pip install -r requirements.txt
Create a data
folder from the root of this project. Create two folders, one for logs
and one for weights
inside rl_chess
.
Download the appropriate Stockfish binaries inside the data
folder:
wget https://github.com/official-stockfish/Stockfish/releases/latest/download/stockfish-ubuntu-x86-64-avx2.tar
tar -xvf stockfish-ubuntu-x86-64-avx2.tar
wget https://github.com/official-stockfish/Stockfish/releases/latest/download/stockfish-macos-m1-apple-silicon.tar
Download the puzzles from https://database.lichess.org/lichess_db_puzzle.csv.zst
From the data
folder:
wget https://database.lichess.org/lichess_db_puzzle.csv.zst
Specify the path to the puzzle file in build_puzzles.py
and then run python build_puzzles.py
To train an RL agent to play by playing against itself, run python main.py self
To train an RL agent to play from puzzle scenarios, run python main.py puzzle
To train an RL agent to play from full games against the Stockfish engine, run python main.py engine
- Self-Play
- Engine
- Puzzle
- Self-Play + Puzzle
- Engine + Puzzle
- Puzzle + Self-Play
- Puzzle + Engine