An implementation of Minimax, Alpha-Beta and Monte Carlo Tree Search to play Connect 4
You can install all the libraries needed using pip:
pip install -r requirements.txt
To play the game, run the src/graphics.py
file.
You can choose to play against another human or against one of the AI.
python -m src.graphics
Here is the layout of this project:
Connect4AI │ ├── src │ ├── AIs │ │ ├── alphaBeta.py │ │ ├── mcts.py │ │ ├── Q_learning.py │ │ └── minmax.py │ │ │ ├── Statistics │ │ ├── backup.py │ │ ├── scoring_selection.py │ │ ├── statistics.py │ │ └── statistics_alphabeta.py │ │ │ ├── score.py │ ├── Game.py │ ├── Player.py │ └── graphics.py │ └── tests └── test_score_calculation.py
To train the Q Learning IA with 1 000 000 games, run the src/AIs/Q_learning.py
file.
python -m src.AIs.Q_learning
To run the tests for Connect4AI, navigate to the project directory and run the following commands:
python -m tests.test_score_calculation
This project is licensed under the terms of the GPL-3.0 license.