rspeer / dominiate

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

Implement Scheme #60

Closed bilts closed 12 years ago

bilts commented 12 years ago

Fixes #37. I implemented Scheme. I've included a sample Scheme-Witch strategy that's competitive with Double Witch.

In the process, I found an issue with the card clean-up code. Card#onCleanup was being called after the card was removed from play, and possibly after other cards had been removed from play. The problem is that some cards being cleaned up need to consider other cards that have been played. In the case of Scheme, it needs to consider itself as well. In theory, this could cause problems with Herbalist, too. I think Herbalist works coincidentally because, with the exception of Black Market, treasure is always played after actions.

I updated the cleanup code so that onCleanup is called first, then cards are removed from play. I didn't see any problems with existing cards, but I'd appreciate someone more familiar with the code taking a look at it.