Open bilts opened 12 years ago
I know this has been open forever and the repo is abandoned. But I am currently working on a port to pure JS for a pet AI project of mine while cleaning up the code in the meantime.
I find that the implementation of State.allowDiscard is really poor.
It is only used in discard for benefit scenarios (Cellar, Hamlet, Vault and Secret Chamber) but it is asking the same choice from the AI that a militia attack would cause.
The ai has no context on why it is being asked for a card to discard and chooses to discard coppers whenever possible.
As an example I modified DoubleWitch in the simulator to require Cellar and buy a single cellar if it has none.
On a hand of Cellar, 3 x Copper, Silver, (turn 3) the ai plays Cellar, discards the 3 coppers, draws 2 Estates and a Copper, missing the opportunity to buy Witch.
This happens because discard value of Copper is 0, the discard value of null is 0 and the discard value of Silver is -3.
So it chooses to discard the highest value until it reaches null (Copper, then Copper, then Copper, then null).
This also raises the performance question of why are we asking the ai to choose its discards one at a time without context.
I'll try to address these issues in my port and report back if I make any progress.
I was playing around with Vault today and noticed two poor choices. The following scenarios demonstrate the problem:
Scenario 1: I have a Vault, two Golds, a Silver, and an Estate in my hand I should not play Vault because it likely won't help me, but it may help my opponent
Scenario 2: I have five Coppers in my hand I have no Gold in my deck and perhaps no actions My opponent plays Vault I should choose not to discard 2 cards, because it's unlikely whatever I draw will make up for the loss of $2
The AI makes the wrong choice in both of these scenarios. The first one is probably Vault-specific. The second one likely applies to other cards as well.