-1

I want to code an AI for the Warlight Game. I read about the MiniMax algorithm for the TicTacToe game but I suppose this situation is different.

enter image description here

For the TicTacToe game we have states in the nodes. But I can't imagine how to store a state of the Warlight game in a node. I have precomputed probability values which is created by using the theory here. https://stats.stackexchange.com/questions/91814/probability-enemy-territory-captured-in-x-turns

Could you help me to understand what the most reasonable way to use MiniMax search in Warlight AI game is?

Notes: I'm using Java codebase but it is different than the actual Warlight AI competition. This is not for competition.

This is not complete but here is an example usage of precomputed probabilities just to give an idea;

aRes = FightAttackersResults.loadFromFile(new File("FightSimulation-Attackers-A200-D200.obj"));
dRes = FightDefendersResults.loadFromFile(new File("FightSimulation-Defenders-A200-D200.obj"));

for (int a = defenders; a <= attackers; ++a) {
            double chance = aRes.getAttackersWinChance(a, defenders);
            if (chance >= winProbability) {
                return a;
            }
        }
Community
  • 1
  • 1

1 Answers1

2

This game has chance nodes (attacks involve randomized outcomes decided by the game controller, not the AI) and so you'll want to start with the minimax variant called ExpectiMax. The main difference between these is that expect max assigns a likelihood to each node of the outcome, and the value for the node is a weighted combination of ending up in any of the possible states beyond that branch.

In the real game, all players move at the same time whereas it looks like it's just one after another for the competition. Regardless, you have to be able to calculate all possible moves which is an enormous task (all conceivable combinations of attacks). Since the game is so huge, it's intractable and as such, you'll have to find a way to cut off search before reaching the leaf nodes. At the point where you cut off the search, you'll run an evaluation function which is something you have to craft by hand. You can get crazy, but a simple example might be something like calculating the % of your territories which you can capture neighboring territories on your next turn minus the number of your territories that can be captured on the next turn. The quality of your gameplay will be almost entirely reliant on this evaluation function since you probably won't get more than 4 or 5 levels deep in the expected max evaluation.

For the first phase of the game, I wouldn't worry about trying to use any kind of minimax, just pre-assign a static strategy unless you know some information about the players you'll be against beforehand.

Nick Larsen
  • 18,631
  • 6
  • 67
  • 96