Bug - Fixed Modifier maximizer wants to put one weapon in mainhand/offhand simulaneously

slyz

Developer
But if your are spending time on things like this, your next hack will always be quicker and better!
 

heeheehee

Developer
Staff member
I can also sympathize with wanting to do things the best possible way :)

I get in trouble sometimes for spending too much time on things at work when they only need a quick hack though :(

except... the "best" way isn't really optimal in this case! (constants are larger than dataset, etc.) It's like how matrix multiplication in faster than ~n^2.8 is just not practical, ever.

edit: okay, it'd be optimal if the maximizer takes into account the effect of the fake hand (unlikely, IMO) and someone with a bunch of fake hands (probably a few thousand, at least) in inventory decides to run "maximize -weapon damage" or whatever. Then you'd want to consider an O(n) algorithm over an O(n^2) one.
 
Last edited:

roippi

Developer
Contrary to popular belief, I don't develop mafia because of all the babes that are drawn to my position of authority. I do it because I enjoy it, and little didactic tangents like this one are a part of that. :)
 

Catch-22

Active member
Sometimes the "best possible way" might save 5 seconds at execution time, but take an extra hour to implement. In my workplace, if we're only running that piece of code once per week, it would take my company 14 years to justify the extra hour I spent :)

In roippi's case, when working with a small amount of data, I would suggest going with the most readable/easily maintained solution (Occam's razor and all that).
 

Theraze

Active member
Sometimes the "best possible way" might save 5 seconds at execution time, but take an extra hour to implement. In my workplace, if we're only running that piece of code once per week, it would take my company 14 years to justify the extra hour I spent :)

In roippi's case, when working with a small amount of data, I would suggest going with the most readable/easily maintained solution (Occam's razor and all that).

However, working out the best possible way might save you 3 hours of optimization in a later project... :) It's the perpetual decision... how long do you keep working on something before it's a waste of time?

Anyways, off-topic. :D
 

roippi

Developer
Hm, before I address this bug, looks like I need to fix another one:

Code:
[COLOR=olive]> equip[/COLOR]

Hat: Hodgman's porkpie hat
Weapon: scratch 'n' sniff sword
Off-hand: Glass Balls of the Goblin King
Shirt: sea salt scrubs
Pants: sugar shorts
Container: paperclip cape

Acc. 1: glacial clock
Acc. 2: (none)
Acc. 3: Oscus's pelt

Pet: Baby Bugged Bugbear (35 lbs)
Item: bugged balaclava

[COLOR=olive]> equip 2 glacial clock[/COLOR]

Taking off glacial clock...
Equipment changed.
Putting on glacial clock...
Equipment changed.

[COLOR=olive]> equip[/COLOR]

Hat: Hodgman's porkpie hat
Weapon: scratch 'n' sniff sword
Off-hand: Glass Balls of the Goblin King
Shirt: sea salt scrubs
Pants: sugar shorts
Container: paperclip cape

Acc. 1: (none)
Acc. 2: glacial clock
Acc. 3: Oscus's pelt

Pet: Baby Bugged Bugbear (35 lbs)
Item: bugged balaclava
 

Veracity

Developer
Staff member
I assume that is a bug because you had another glacial clock available and wanted a glacial clock in both acc1 and acc2.
If you only had one available - and it was in acc1 - you told it you wanted your glacial clock in slot acc2 and it obliged.

Or is there some other bug that your gCLI log doesn't show?
 
Forgive my ignorance (and you can ignore this, I'm just trying to learn more about kolmafia), but what's the bug? Did you have 2 glacial clocks, and thus were expecting 2 to be equipped vs. the clock to be moved to the 2nd acc slot? My cursory reading of the code says it's doing what it's supposed to do, hence my question. :)

Edit: yup, ignore this... :) Should have hit refresh.
 

Orbrisa

Member
Problems when maximizer wants to put the same piece of equipment in main and offhands

and the equipment is in the closet

Code:
> maximize familiar weight -tie

Maximizing     (1st time may take a while)...
3072 combinations checked, best score     68.00
Putting on crumpled felt fedora...
Equipment changed.
Removing     items from closet...
You acquire an item: gnawed-up dog bone
Wielding     gnawed-up dog bone...
Equipment changed.
Taking off gnawed-up dog     bone...
Equipment changed.
Holding gnawed-up dog bone...
Why     bother putting a weapon into your offhand if you don't have anything in     your on-hand? "On-hand?" Whatever.
Unable     to meet all requirements via equipment changes.
See the Modifier     Maximizer for further suggestions.

The same thing happens if you have, say, 2 bar whips and no gnawed-up dog bones. Mafia only takes one out of the closet, then sequentially puts it in the main hand and offhand. Presumably only if you can dual wield weapons? FWIW, old-school flying disk (an offhand item) is functionally equivalent to the gnawed-up dog bone; they both add 5 pounds. (Probably this is not relevant, but I figured I'd mention it just in case.)
 

xKiv

Active member
Maximizer fails (aborts) when it needs two of the same item, and has to pull(?) them

Here's what I did, for CLI:
Code:
> maximize mp

Maximizing (1st time may take a while)...
30962 combinations checked, best score 3,260.00, best since last = 3,260.00
67340 combinations checked, best score 3,260.00, best since last = 3,260.00
Pulling items from storage...
Putting on Hairpiece On Fire...
Equipment changed.
Pulling items from storage...
Wielding Hand that Rocks the Ladle...
Equipment changed.
Taking off Hand that Rocks the Ladle...
Equipment changed.
Holding Hand that Rocks the Ladle...
Why bother putting a weapon into your offhand if you don't have anything in your on-hand? "On-hand?" Whatever.
Unable to meet all requirements via equipment changes.
See the Modifier Maximizer for further suggestions.

> acquire 2 hand rock

Pulling items from storage...

Instead of pulling 2 hands that rock the ladles, only one was pullled - and trying to equip it in offhand took it from mainhand.
This used to work and, I guess, was probably "broken" (or, rather, exposed?) when "pull $number something" stopped being equivalent to "pull * something".

This might be two separate issues:
- maximizer should know how many of an item it will want, and acquire all of it (but I thought this was already fixed?)
- trying to equip a 1-handed weapon in offhand when the only source for that weapon is taking it from mainhand should probably stop even *before* the unequipping step. Somehow.

(ETA: r16122)
 
Maximizer failure when creating two identical weapons

Basically, the bug goes something like this:

You ask maximizer to maximize (for example, Muscle as a Seal Clubber). It suggests creating / equipping 2 of the same weapon, since you have Double-Fisted Skull Smashing and can hold 2 1-handed weapons (say, a pair of Meat Tenderizers are Murder, since you have the ingredients on hand to make 2, your maximizer is set to suggest creating equipment if needed, and you do NOT have any on hand). It creates the 1st weapon and equips it. It then, for reasons I cannot fathom, tries to equip the weapon it just created in your off-hand slot instead of the main hand. This fails, since you can't hold a weapon in your off-hand without also having a main hand weapon; furthermore, the entire maximization execution gets aborted as well.

What SHOULD happen: Maximizer should go create BOTH weapons if it needs 2, then equip them.

Tested in KoLmafia r16228 (latest version as of this post).
 

Crowther

Active member
We're going to need a sticky for this bug. I went looking for the original and only found another duplicated. sigh

Hopefully Bale can find it and merge them.
 

Darzil

Developer
I think there are a few more threads missed, as this code has been changed several times, we now have loads of fixed bugs lumped in with current ones. Will ignore all the earlier part of this thread.

Looking at this now.
 
I suggest as a fix for this, to give the maximizer execution portion 2 phases: 1st, acquire any resources needed and perform any creation requested. 2nd, equipping / using items.
 
Top