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 changing the import in the corresponding script
- 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.11.tar.gz
.
File metadata
- Download URL: perfect-information-game-0.0.11.tar.gz
- Upload date:
- Size: 81.3 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 | be6e5d6a9e0dcb0adc6152db53f73e990845b45835ddbad4b8fe21c252410171 |
|
MD5 | 7cbafba1f55b0a531c5bfdaaaa647e68 |
|
BLAKE2b-256 | a0d61d5f8a6a87f634f7012ec2bd415e302c8b7247f623f0ad572cb95bf3b158 |
File details
Details for the file perfect_information_game-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: perfect_information_game-0.0.11-py3-none-any.whl
- Upload date:
- Size: 170.3 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 | dcceb2839e6f1b72d328113cfcf9f658171a98dfc4be38a40c25b1b2d86352ef |
|
MD5 | f4000df87170ffa3714c64abee852f76 |
|
BLAKE2b-256 | 34fe45f751575f8ffb99b80badd52b653d440dd036aa743950f0df8041aeaefb |