Hello everybody! The comments in my last post and some thinking helped me get the inspiration needed to continue my work on developing a minimax AI for a MTG game. The solution I’m current developing is to allow multiple choices inside the same, atomic, “game flow unit”. This allows me to keep my simple declaration syntax for spells and their effects (the whole definition of the spell is a game flow unit, and there can be multiple choices to be made by a player when a spell is played). This is not optimal in the sense that the minimax algorithm has to start back from the beginning of the game flow unit when trying a “new path”. But I think the overhead is going to be minimal because so much spells involve only one choice or no choice at all.
I also discovered transparent proxies in .Net. They allow me to separate the generic minimax algorithm code (for example, the code that tries all the paths) from the specific gameplay code (for example, the code that computes the possible paths at a given point). Without that separation, I would have to repeat a lot of code in all the “interaction” methods (the methods that ask something to a player, like what to do next when given priority, or a target). It also allows me to unit test every part pretty thoroughly and in a very self-contained (unitary!), independent way. Yes, I’m still pretty maniacal about this!
I’m leaving for India for a couple of weeks this Friday, so this is probably my last post for a while.
So, thanks for all your input and see you in a couple of weeks!