This Python-based project is a game engine of the classic domino , allowing players to challenge a sophisticated AI opponent. The AI comes equipped with four distinct strategies:
- Rule-Based
- Monte Carlo Tree Search (MCTS)
- Blind
- Alpha-Beta Pruning(:warning: not implemented yet)
Users can customize the parameters of each algorithm to modify the AI’s behavior and tailor the difficulty or strategic depth of the game. The project supports both casual and analytical gameplay, you can let AI compete with another AI.
First install requirements. Not much, numpy and colorama mainly. You can reproduce same results using environment.yml file.
conda env create -f environment.ymlor
pip install numpy colorama pyyaml python-dotenvactivate generated environment (in case using conda env create)
conda activate Domino_ai
change working directory to /src
cd ./srcNow run the package
python -m domino_ai❌ Don't change terminal size after running the script, it might corrupt view.
You can configure game through src/config.yaml file, or you can over-write it using arg parser
Example:
python -m domino_ai --score 151 --strategy mctsYou can control algorithms hyper-parameters through src/domino_ai/ai/hyper_parameters.yaml file
MCTS: sophisticated algorithm balancing between exploraion and exploitation, through the parameter C. This implementation differes alot from the original one, due to the nature of uncertaininty in domino
:warning: current implementation emphsizes only lowering the value of computer hand.
:x: it's not supported in AI-to-AI matches. it's hard-coded to evaluate second-player hand in each state.
RULE-BASED: Classic algorithm, giving score to each placible tile based on some criterias( pips count, double, blocking potential ... ).
You can control how aggressive or defencive the algorithm is by modifing src/domino_ai/ai/hyper_parameters.yaml file
BLIND: nothing smart about it, just choose random possibe tile.
LLMs: Large Language Models are tested to play domino, The task of playing domino relies mainly on reasoning,so. The better the model is in reasoning, the better it is in playing domino. Notebooks are provided to test LLMs, either through google genai api or ollama if local development.
:warning: using LLMs to play domino is an insane idea, the cost will be massive, so didn't bother add this feature, alghough it's quite easy.
Alpha-Beta prunning: ⭕ Not implemented yet

- GUI
- alpha-beta pruning
- reverse play feature
- multiplayer

