I started working again this weekend on one of the two “elephant in the room” problems: minmax driving of multichoice parts (that’s a mouthful)! Tonight, I committed what I think is a robust solution, with a ton of new unit tests to make sure those new limit cases are taken care of forever.
Recap: About a month ago (or has it been two already?), I discovered two major flaws in the mechanism that drives AI in Mox: what I call the “min-max” driver. This piece of software is responsible for trying the choices available and evaluating the game state’s value every now and then. It’s basically the centerpiece of the minmax AI module.
Both flaws are related to multichoice parts. Parts are the individual (atomic) game flow pieces that make up the whole game. The driver works on the part level, meaning that when confronted with a choice, it has to retry that last part. A part can contain 0..N choices, meaning that it can contain more than one choice to be decided by the AI module. For example, playing a spell might require to choose a target AND tap a card. This is what I call multichoice parts.
The first flaw involves the state of the game when retrying multi-choice parts. I realized that when the AI was trying out the possibilities for a multi-choice part, there was a possibility that the game state was not quite the same as when the choice has to be made originally. This is not due to a problem in the transactional object model, so the solution is not straightforward. Although I have some ideas in mind for this problem, I chose to attack the second problem first.
The second flaw was that I realized, when investigating for a solution to the first problem, that the minmax driver was plain broken for multichoice parts! Basically, it would spew out random results on the second decisions of a part and later decisions (first decision was ok). Turns out this bug didn’t really appear in the game because most parts are not multichoice parts. This is the bug I fixed this week.
I can now get working on the first bug! Hopefully I can get back to doing funnier things (like adding cards) soon.
See you around!