Create 2D perfect information board games, and play them with machine learning systems.
Project description
Perfect Information Game
Creating 2D perfect information board games, and playing them with machine learning systems.
What's in this repo?
- Implementations for a bunch of board games including Chess, Checkers, Connect 4, Othello (Reversi), and The Game of the Amazons
- Implementations of various algorithms for selecting moves including Minimax (with alpha-beta pruning), Monte Carlo tree search using randomized rollouts, iterative deepening, and policy-value driven Monte Carlo tree search
- Code for generating endgame tablebases for Chess using retrograde analysis
- Code for training neural networks from scratch using self-play reinforcement learning
- Over 4500 lines of Python code and counting
- Some cool chess puzzles that I discovered along the way
Play Against Live Models on my Website
Getting Started
- Ensure Python is installed
- Install requirements:
pip install -r requirements.txt
- Play a game of Connect 4 against the ai:
python src/scripts/play_vs_ai.py
- View games files that were generated during training:
python src/scripts/view_game_file.py
- Switch the active game by uncommenting the corresponding line in
src/utils/active_game.py
- For games with multiple versions, select the desired version by opening the corresponding file under
src/games/
and uncommenting the corresponding line that starts withCONFIG =
How I Trained the Models
Resources I Used
- How to Keep Improving When You're Better Than Any Teacher - Iterated Distillation and Amplification
- Multiple Policy Value Monte Carlo Tree Search
- Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm
- Introduction to Reinforcement Learning (course by David Silver)
- Parallel Monte-Carlo Tree Search
- A Lock-free Multithreaded Monte-Carlo Tree Search Algorithm
- Time Management for Monte Carlo Tree Search
- Lessons From Alpha Zero (part 5): Performance Optimization
- How much training data do you need?
- Working with Numpy in Cython
- Chess Piece Images
- Chess test cases and more chess test cases
- Chess Position Encoding Scheme
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file perfect-information-game-0.0.5.tar.gz
.
File metadata
- Download URL: perfect-information-game-0.0.5.tar.gz
- Upload date:
- Size: 80.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c87c4fb03fb19682550a044664dd5d53efe062112443c86dc7f4379cab6775e |
|
MD5 | 1e7801b33c8718f6dff5bd23afa059b3 |
|
BLAKE2b-256 | e97b9ca6db0007afda1886463941fcae6168f31cf875be36e13b0b48321b8054 |
File details
Details for the file perfect_information_game-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: perfect_information_game-0.0.5-py3-none-any.whl
- Upload date:
- Size: 140.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3497965019dd5aef4535468c8b0008c6d772714ed9707627e5e73b0a830c9755 |
|
MD5 | 72c865636a416530ff607ffff879169d |
|
BLAKE2b-256 | 089ba40cdeb0e022f3107b290544e19f341ac389ad65a2e0f478a56635678c21 |