rspeer / dominiate

A simulator for Dominion card game strategies
http://rspeer.github.com/dominiate
MIT License
121 stars 43 forks source link

Problems with state.supply[card] #13

Closed michaeljb closed 13 years ago

michaeljb commented 13 years ago

Turns out adding (state.supply[card] ? 0) > 0 into upgradeChoices, instead of my current if not card2.isPrize band-aid will work. It looks like when the card object is created, it is added to state.supply--there are 10 of each of the prizes in the supply, and 30 of Diadem (since it is derived from Silver which is set to start at 30 in the supply), so anything that checks the supply will always find cards there (like the proposed fix for upgradeChoices). This problem also affects Ambassador; the Ambassador player can return a Prize (or ostensibly a card gained from the Black Market) and cause the other players to gain it.

For example: Set a DoubleAmbassador player against a TournamentPlayer, have them each want to gain exactly 1 Remodel. Have the Ambassador player want to gain a Prize, like Bag of Gold, but not want to gain any Tournaments. Put "Bag of Gold,0" at the top of ambassadorPriority and make sure Ambassador is higher in actionPriority than Bag of Gold. With those settings, you will see DoubleAmbassador Remodeling Coppers and Estates into Bag of Gold, and returning Bag of Gold when possible. TournamentPlayer will Remodel Coppers and Estates into Followers.

I'm working on it when I can. In practice it looks like the greatest danger will be a Tournament player using upgrading type cards--Tournament/Ambassador players probably won't be wanting to return Prizes anyway.

michaeljb commented 13 years ago

After a bit more tweaking and testing, I think I found the real problem--all the Prizes derived from action, which has startingSupply() = 10, except for Diadem which is derived from Silver and has startingSupply() = 30.

So pretty much I think I misinterpreted the original problem, which turned out to be Prizes being set to a non-zero startingSupply.

However, I think there may still be problems for Black Market, since at the moment it looks like every card is in the supply, so for if for some reason you wanted to Ambassador away a card gained from the Black Market it would work even though it shouldn't.

PS if any of this isn't making sense or anything it's probably because I should be sleeping instead of doing this.