Tiltak is an AI for the board game Tak. The project can be used as an analysis tool, or connect as a playable bot to the playtak.com server.
It is most likely the strongest bot available. In a 2000-game match against Taktician, which was previously regarded as the strongest, it won 1276 games and lost 684.
The core engine is built using Monte Carlo Tree Search, but without full simulation rollouts. This is similar to the implementation in AlphaZero or Leela Zero.
It prunes the search tree very aggressively while searching, and will quickly reach depths of 10+ moves in the longest lines. On the other hand, it may also miss 2-move winning sequences, even with significant thinking time.
The project consists of 5 different binaries, that use the core engine in various ways:
- main Various commands, mostly for debugging and experimentation.
- playtak Connect to the
playtak.com
server, and seek games as a bot. - tei Run the engine through Tak Engine Interface, a uci-like text interface.
- tune Automatically tune the engine's parameters.
- bootstrap Engine worker for running on AWS Lambda.
The first 3 binaries will be built by default, while tune
and bootstrap
require specific commands, see their sections.
Five experimental commands entered through stdin:
- play: Play against the engine through the command line.
- aimatch: Watch the engine play against a very simple minmax implementation.
- analyze : Analyze a given position, provided from a PTN or a simple move list.
- tps : Analyze a given position, provided from a tps string.
- game : Analyze a whole game, provided from a PTN or a simple move list.
Connect to the playtak.com server, and seek games as a bot. If no username/password is provided, the bot will login as guest.
At the time of writing, three bots based on this project are running on Playtak. They are configured as follows:
playtak -s 6 --tc 1200+30 --target-move-time 20 --policy-noise high --seek-color black --allow-choosing-color -u Tiltak_Bot -p <password> -l tiltak.log
playtak -s 6 --tc 600+20 --target-move-time 5 --komi 2 --rollout-depth 200 --rollout-noise low --allow-choosing-color -u SlateBot -p <password> -l slate.log
playtak -s 5 --tc 900+30 --fixed-nodes 100 --policy-noise medium --rollout-depth 200 --rollout-noise low -u CobbleBot -p <password> -l cobble.log
Configuration options
This list is not exhaustive, see the --help
menu for more
CLI flag | Environment variable | Default value | Description |
---|---|---|---|
--username | PLAYTAK_USERNAME | Playtak username. Connect as Guest if value is missing. | |
--password | PLAYTAK_PASSWORD | Playtak password. | |
--size | SIZE | 5 | Board size. |
--tc | TC | Time control in seconds, with optional increment. Example: --tc "300+10" for 5 minutes with 10 second increment. |
|
--playtak-base-url | PLAYTAK_BASE_URL | playtak.com | URL for playtak. Useful to override for local development. |
--playtak-port | PLAYTAK_PORT | 10000 | Network port for playtak. Useful to override for local development. |
--komi | KOMI | 0.0 | Seek with komi. Defaults to 0. |
--play-bot | PLAY_BOT | Instead of seeking any game, accept any seek from the specified bot. |
Docker image
Pre-built Docker images for the playtak
binary are available in docker.io/mortenlohne/tiltak-playtak
. To run and seek as guest, run docker run -e TC="300+10" docker.io/mortenlohne/tiltak-playtak:0.1.0
.
Run the engine through Tak Engine Interface, a uci-like text interface.
Only a small subset of uci works. To analyze a position for 1 second, run the tei binary and enter:
tei
teinewgame 5
position startpos moves e1 a1
go movetime 1000
To build and run this binary:
cargo build --release --features "constant-tuning" --bin tune
cargo run --release --features "constant-tuning" --bin tune
Automatically tune the engine's parameters through several subcommands.
The engine's static evaluation (value parameters) and move evaluation (policy parameters) are tuned from a .ptn
file, using gradient descent. The search exploration parameters are tuned using SPSA.
This is otherwise not well documented, try tune --help
for more.
To build this binary:
cargo build --release --target x86_64-unknown-linux-musl --bin bootstrap --features aws-lambda-runtime
This is otherwise undocumented.
Building the project from source requires the Rust compiler and Cargo (Rust's package manager) installed, both included in the Rust downloads.
The minimum required Rust version is 1.51, released March 25th 2021.
To build and run:
cargo build --release
cargo run --release
This command will automatically fetch and build dependencies. The resulting binaries are written to tiltak/target/release
.
To build and run a specific command, run cargo run --release --bin playtak
or similar.
Use cargo test
to run tests, cargo test --release
to run without debugging checks (recommended).
This project is licensed under the GPLv3 (or any later version at your option). See the LICENSE file for the full license text.
[reference]: https://en.wikipedia.org/wiki/Universal_Chess_Interface)[uci] -like