Generic Minimax algorithm for 2 player games of Perfect Information. These are the games that are currently implemented:
- Konane (Mount & Blade II: Bannerlord board game)
- MuTorere (Mount & Blade II: Bannerlord board game)
- BaghChal (Mount & Blade II: Bannerlord board game)
- Tic-tac-toe
- Connect Four
I am using C++17 so your g++
version should be at least 7.0!
- Install
g++
:
sudo apt-get install g++
- Install
make
:
sudo apt-get install make
make
make run
- Install
g++
(MinGW): http://www.mingw.org/ - Open your Command Prompt and run this to ensure that
g++
is properly installed:
g++ --version
- Run
build.bat
.
- Run
run.bat
.
- On Windows Subsystem for Linux (WSL) the AI will play as soon as possible.
- Don't run it on Windows if you want to have colorful prints!
- Works for any 2 player games implemented as a derived class from Game<StateType, MoveType>.
- Works for games with cycles.
- Works for games that can tie.
- Takes the shortest path for the win, but the longest path for the loss.
- The AI takes at least
TIMEOUT
milliseconds to play. - It currently does not work for games with imperfect information or chance elements (dice/card games). I'll probably code that in another project.