A self-learning chess AI that trains itself by playing against itself, then plays against you.
1. Make sure you have Python installed Python 3.9 or higher. Check with:
python --version
2. Install the required libraries Open a terminal, go into the project folder, and run:
cd chess_ai_project
pip install -r requirements.txt
The AI starts knowing nothing. Run this to teach it by having it play games against itself:
python main.py train --cycles 5 --games 20
This takes a few minutes. You'll see it playing games and updating itself. Run it again any time you want it to get stronger — it picks up where it left off.
python main.py server
You should see:
Uvicorn running on http://0.0.0.0:8000
Go to:
http://127.0.0.1:8000
The chess board will load and you can play.
- Pick White or Black using the buttons above the board
- Drag and drop pieces to make your move
- The AI responds automatically
- Hit New Game to start over at any time
Just run the training command again. More cycles = stronger AI:
python main.py train --cycles 20 --games 50
The AI also learns a little from every game you play against it automatically.
Nothing shows up at localhost:8000
Make sure you're running the server from inside the chess_ai_project folder, not from outside it.
Please note that Training is slow That's normal on a regular laptop. Fewer games per cycle = faster but weaker. More games = slower but stronger.
Developed and Maintained by Atul / Lisk