rspeer / dominiate

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

getVP of some cards return wrong values (e.g. Gardens) #28

Closed xat closed 13 years ago

xat commented 13 years ago

It seems that when "state.current" is called inside of a cards getVP()-method 'current' always points to the first bot (the bot that finishes the game first). This happens when getVP is called from within getFinalStatus().

The result is that wrong Points are given for example if the second Player uses gardens since state.current.getDeck().length will return the amount of cards of the first bot instead of the second bot.

I guess this affects all cards which use state.current inside the getVP method.

michaeljb commented 13 years ago

I think this should be fixable by passing getVP the owner instead of the state and changing "state.current" to "owner" within the code. So for example, Gardens would have getVP: (owner) -> Math.floor(owner.getDeck().size / 10)

michaeljb commented 13 years ago

I verified getVP was working incorrectly by making two bots that would only buy 4 Gardens and 4 Estates. One bot would then do nothing, the other would empty the Coppers.

The simulator concluded that the do-nothing bot was the dominant strategy after it won 24 of 31 games--obviously counting the Gardens scores wrong.

After my fix, the Copper bot wins 100% of the time :)