So you’ve tried a few of the built-in strategies and let them battle each other. That’s cool and all, but the real fun starts when you create your own strategies or modify an existing one so it performs better. I’m going to show you now how to turn a weak bot into a fine tuned monster. Just follow my lead:
First find a strategy you want to fine tune. Select the Chancellor/Stash (under type Combo) for player 1 and Envoy for player 2 and let them battle each other (Accurate Simulation).
The combo of Chancellor and Stash apparantly can’t even beat a single Envoy. We’re going to try to fine tune the Chancellor bot so it beats Envoy. Click the Edit/Create button next to the Chancellor bot.
The first time you open the editor you might get a little disoriented, but it’s all very straightforward really. Let’s simplify things a little. Click the Toggle view of buy conditions. What you see now is a list of all the cards this bot “might” buy during a game.
All the likely candidates are present: Chancellor, Stash, Silver and Province. The simulator will use this buy list during a game to determine when to buy stuff. If a card is higher up in the buy list, it will be considered first as a possible purchase. What might be confusing at first is that a card like Estate is higher up than Gold. Does this mean the simulator will buy Estates over Gold even if it has $6 to spend? Yes! … And No! To see when exactly the bot will start to buy Estates over Golds you have to click the Toggle view of buy conditions button again.
The buy conditions have become visible again and you can see the simulator will start to buy Estates over Golds once the game is very close to over (when there are 2 or less Provinces left in the supply). Some cards don’t have any buy conditions (like Gold), but that doesn’t mean they will always be bought. There are some hidding buy conditions that I’ve programmed so you don’t have to:
- do I have enough money to buy this card
- is the card still in the supply
- won’t buying the card cause me to lose the game (also because of 3 empty piles)
- others (like preventing a Grand Market buy when you have played Coppers)
Changing the buy rules
Now you understand how the buy rules work, get to work modifying them! The best way to start is seeing how a bot actaully plays the game and finding flaws in its decisions. You do this by clicking the Sample Game button which will show a log of a random game played by the simulator. Here’s an example of one game that ended poorly for our bot:
Looking over the log the simulator quickly had $6 and bought a Gold and never really had $5 after that to buy Stashes. It wasn’t actually playing the combo, but just a Big Money strategy with 1 random Chancellor and it lost to the far superior Envoy. How can we ensure that our bot actually plays the combo?
Save the strategy by clicking Save strategy as button and fire up the simulator again (Accurate). The result of this match should be even (46%-46%). Now we’re going to improve the bot further by playing around with the buy conditions.
Modifying Buy conditions
Let’s make the simulator buy more than 1 Chancellor. Open the editor again and find the buy rule for Chancellor and change it like this:
if count in deck(Chancellor) < 3
Save and simulate again…. This will improve the results a little for our bot, but not by as much as we expected. Let’s look into a Sample game:
So the bot opens Chancellor/Chancellor while we would probably rather see it open Chancellor/Silver to prevent the terminal actions from clashing in the early game. There are several ways to enforce this behavior in the editor. Let’s try it like this:
Use the Duplicate button and arrow buttons to create the new buy rules and move them into the correct position in the buy rule list (you can also use the Add a Buy rule button, but I find it more cumbersome). To add the buy conditions click the small “+” button. If you’ve made a mistake you can always delete lines by clicking the red cross or the rubbish bin.
Done? Ok, save your work and simulate again. Your bot will now always open Chancellor/Silver with a $4/$3 and beat Envoy around 50-41. Success!!!
You can tune your bot further using the multitude of buy conditions. Here’s my best performing Chancellor/Stash bot. Copy the following code and use the Copy/Paste button:
<player name="COMBO - Chancellor/Stash improved"> <buy name="Province"/> <buy name="Duchy"> <condition> <left type="countCardsInSupply" attribute="Province"/> <operator type="smallerOrEqualThan" /> <right type="constant" attribute="5.0"/> </condition> </buy> <buy name="Estate"> <condition> <left type="countCardsInSupply" attribute="Province"/> <operator type="smallerOrEqualThan" /> <right type="constant" attribute="2.0"/> </condition> </buy> <buy name="Stash"> <condition> <left type="countCardsInDeck" attribute="Stash"/> <operator type="smallerThan" /> <right type="constant" attribute="4.0"/> </condition> </buy> <buy name="Chancellor"> <condition> <left type="countCardsInDeck" attribute="Chancellor"/> <operator type="equalTo" /> <right type="constant" attribute="0.0"/> </condition> </buy> <buy name="Silver"> <condition> <left type="countCardsInDeck" attribute="Silver"/> <operator type="equalTo" /> <right type="constant" attribute="0.0"/> </condition> </buy> <buy name="Chancellor"> <condition> <left type="countCardsInDeck" attribute="Chancellor"/> <operator type="smallerOrEqualThan" /> <right type="countCardsInDeck" attribute="Stash"/> </condition> </buy> <buy name="Silver"/> </player>
This one beats Envoy 55-38. I just let the simulator buy Chancellor only if it has less Chancellors in the deck than Stashes and won’t let him buy more than 4 Stashes.
Do it yourself
Now you should be able to create and fine tune your own bots. Good luck and have fun!