This Github repository contains the code necessary to train and play an expert level AI player in Othello.
Our goal is to create a CNN model to play the game of Othello at an expert level. Based on previous research in this field, Convolutional Neural Networks can achieve strong performance because Othello can be interpreted as an image-like matrix and CNN's are skilled at computer vision tasks. This problem can be motivated as a multi-class classification problem in which our model must choose 60 different moves for a current Othello board state. We use a Kaggle Othello dataset of games played by expert Othello players to construct a dataset of over 8 million board states and moves to train our player model. For our best model, we achieve an accuracy of 55.91%, a top-3 accuracy of 87.47%, and top-5 accuracy of 96.25%, making it a difficult Othello player to beat. We also perform qualitative analysis of our Othello AI player model by playing against it, in which it easily wins the majority of the games.
You just need to have Python 3.7+ installed (3.10+ for the simplified typehinting).
-
Create a Python virtual environment
python3 -m venv env
-
Start the virtual environment
source env/bin/activate
-
Install dependencies
pip install -U pip pip install -r requirements.txt
-
Run the game
python game.py
View our presentation.
You play first as the black player. Scores are viewable in the top left of the game board. Every move inference time is printed to the console. The game closes automatically 7 seconds after a player wins.