A templated, optimized implementation of the Minimax algorithm using closed set and a-b pruning. Includes a Othello/Reversi game using it as an opponent.
The Minimax algorithm is included in the 3 header files in the 'minimax' folders. Simply copy these files into your project and include "Minimax.h".
To use the Minimax<T> class you will need to write a class representing your game's state and which implements the interface described in the class documentation of Minimax<T>. The T class must include:
- A std::hash<T> function
- A list<T> getChildren() method
- A int getValue() method
- A Position getLastMove() method
- A bool isFinal() method
The Minimax<T> class also supports depth ramp-up; that is, it can start the first round with a shallower depth and gradually go up to the maximum depth as the game progresses. This is useful for games like Othello where the first rounds have very limited options, so a costly, in-depth calculation doesn't make sesnse. Both standard and custom options are supported for this feature.
The project includes a demo where a player can face off against the computer in a game of Othello. To play the demo, copy the files from both folders in the same directory and execute Game.cpp