aiannacc / Goko-Salvager

Enhance your Dominion Online experience!
13 stars 9 forks source link

Counterfeit-Spoils deck-tracking bug #247

Open aiannacc opened 10 years ago

aiannacc commented 10 years ago

When you Counterfeit a Spoils, the deck-tracking module thinks two Spoils have been returned to the supply. This results in incorrect deck contents and can affect VP totals if Gardens or Fairgrounds is available.

http://forum.dominionstrategy.com/index.php?topic=8163.msg416967#msg416967

aiannacc commented 10 years ago

The fundamental problem is that the log doesn't distinguish between playing Counterfeit on Spoils and playing Counterfeit on nothing followed by two Spoils.

Tracking hand contents addresses many cases (e.g. if the player has only one Spoils in hand). That requires a fair amount of new logic: watching the cards drawn, discarded, and played, plus Masq and Adventurer and double-plays like Procession-Madman, but it would make the post-game log viewer get the Spoils count right more often.

For Salvager's log prettifier and VP counter, the in-game log won't do for hand tracking. It says things like " discards a card" without specifying which card it is. We could rewrite the deck-tracking module to ignore the cards gained/discarded/played and just watch the client-server messages that move cards between the players, supply, and trash.

This bug has the potential to affect VP totals in ~ 0.03% of games. These are games with Counterfeit and (Marauder and/or Bandit Camp) and (Gardens and/or Fairgrounds):

1_2_2*ch(203,7) / ch(206,10) ~= 0.00033

ThaddeusB commented 10 years ago

While you can't be certain, It would be much better to assume the person counterfeited a Spoils than that they played a Counterfeit followed by two normal Spoils. The latter is highly unlikely.

Incidentally, Pillage also gives Spoils.

aiannacc commented 10 years ago

mjb, why did you close this? Was that intentional?

michaeljb commented 10 years ago

It was not intentional...sorry about that. Not sure what happened.

aiannacc commented 10 years ago

While you can't be certain, It would be much better to assume the person counterfeited a Spoils than that they played a Counterfeit followed by two normal Spoils. The latter is highly unlikely.

Agreed. The change goes around here. Gotta track the previous treasure plays to figure out if you might be inside a Counterfeit play or a chain of Counterfeit plays.

Honestly though, anybody who's willing and able to do this could spend their time far more productively on our other issues.

Incidentally, Pillage also gives Spoils.

Good call. So that'd be Counterfeit + (Marauder/BC/Pillage) + (Gardens/FG) + 7 cards:

1 * 3 * 2 * ch(206-3,7) / ch(206, 10) = 0.0005 = 0.05%