Skip to main content

hexbot

A Python framework for building AI bots for Hexagonal Tic-Tac-Toe (Connect-6 on an infinite hex grid). Fast C game engine, multiple neural network architectures, AlphaZero training pipeline, and a live training dashboard.

Home of the Orca bot.

PyPI Wiki

Full guides, learning path, and feature reference live on the Wiki. Start with Quickstart or Concepts. Try it now in Colab (free T4 GPU, ~5 minutes).

Built a great bot with this? Open an issue or get in touch, and I'll feature it here.

Model Zoo

Share bots with the community. Download by name, upload your trained checkpoints. Built-in metadata (architecture, ELO, author, description) keeps everything interoperable.

from orca.zoo import Zoo

# See what others have shared
Zoo.list()

# Try someone else's bot
bot = Zoo.download('orca-v3')

# Share yours
Zoo.package('hex_checkpoint_500.pt',
            name='my-bot-v1', author='You', elo=1450,
            description='Trained 500 iterations with hex-masked')
Zoo.upload('my-bot-v1.pt', name='my-bot-v1')

Trained something interesting? Publish it and the next person can pull it with one line. See the Evaluation and Sharing wiki page for the full lifecycle (Arena, Leaderboard, Zoo).

Featured Community Bots

No community bots rated yet. Train one, then Leaderboard().rate(bot, name='my-bot-v1') to land here. See Evaluation and Sharing.

This table is regenerated from leaderboard.json by scripts/update_featured_bots.py (runs in CI on every push to main).

Installation

pip install hexbot

Or from source (for development):

git clone https://github.com/Saiki77/hexbot-building-framework.git
cd hexbot-building-framework
pip install -e .               # core (game engine + torch)
pip install -e '.[dashboard]'  # + dashboard UI
pip install -e '.[all]'        # everything

The C engine auto-compiles on first import (cc/gcc/clang required).

Quick Start

from hexbot import HexGame, Bot, Arena

game = HexGame()
game.place(0, 0)         # P0: 1 stone first turn
game.place(1, 0)         # P1: first of 2
game.place(1, -1)        # P1: second stone

# Any function is a bot
def my_bot(game):
    return game.legal_moves()[0]

result = Arena(my_bot, Bot.heuristic(), num_games=20).play()

Orca Bot

Pre-trained AlphaZero-style bot. The included checkpoint is early-stage (65 iterations) - gets significantly stronger with more training.

from hexbot import Bot
orca = Bot.orca()
move = orca.best_move(game)

Train

# From game collections (fast bootstrap)
python -m orca.scrape --games 5000 --output games.jsonl
python -m orca.sft --data games.jsonl --then-selfplay 50

# Pure self-play
python -m orca.train --iterations 100

# With web dashboard
python train_dashboard.py

Network Architectures

Config Params Description
fast 656K Quick experiments
standard 3.9M Default Orca (128 filters, 12 ResBlocks)
hex-masked 3.9M Hex-neighbor masked CNN (recommended for hex)
large 14.5M Maximum strength (256 filters)
orca-transformer 4.4M CNN + transformer attention
hex-gnn 432K Graph neural network on hex topology
multiscale 1.1M Local CNN + global attention two-tower
python -m orca.train --config hex-gnn --iterations 50

Features

Feature Description
SFT Pipeline Train from game collections (JSONL/CSV/text), chain with self-play
Endgame Solver Deep alpha-beta with transposition cache, integrates with MCTS
Opening Book Trie-based lookup from winning games, blends with MCTS policy
6 Architectures CNN, transformer, GNN, multiscale, hybrid, fast
Mixed Precision FP16 on CUDA for 2x training speed
Distributed Multi-GPU (DDP) and multi-machine (Ray)
Skill Curriculum 6-level auto-progression: basics through endgame
Ensemble Average N checkpoints with uncertainty estimation
Model Zoo Share and download community models
Leaderboard Rate bots against references, compare head-to-head
Plugin System Register custom bots and network architectures
Dashboard REST + WebSocket API, live game replay, charts
30+ API Functions NN eval, MCTS search, threats, solver, augmentation

Bot Approaches

# Approach Complexity
1 Hand-tuned evaluation Low
2 Evolutionary weights Low
3 Minimax with alpha-beta Medium
4 Monte Carlo playouts Medium
5 Neural network (AlphaZero) High
6 Hybrid strategies High

Architecture

hexbot.py              Framework API (Bot, Arena, 30+ analysis functions)
hexgame.py             Game engine (wraps C engine via ctypes)
engine.c               2,300 lines optimized C (bitboard win detection)
bot.py                 Neural networks, MCTS, training pipeline
dashboard.py           Dashboard API (REST + WebSocket)
train_dashboard.py     Training dashboard with web UI
pyproject.toml         pip install config
orca/
  __init__.py          Orca bot loader
  config.py            All tunable parameters
  train.py             Training pipeline (CLI + library)
  sft.py               Supervised fine-tuning from games
  scrape.py            Game downloader
  solver.py            Endgame solver
  openings.py          Opening book
  curriculum.py        Skill-based curriculum
  ensemble.py          Multi-checkpoint ensemble
  distributed.py       Multi-GPU / Ray training
  zoo.py               Model zoo
  leaderboard.py       Bot rating system
  transformer_net.py   Transformer architecture
  hex_gnn.py           Graph neural network
  multiscale_net.py    Multi-scale architecture
  benchmark.py         Platform benchmark (compare Mac/CUDA/CPU)
  checkpoint.pt        Pre-trained weights
docs/                  Detailed documentation
examples/              Example bot scripts

Benchmark

Compare performance across platforms:

python -m orca.benchmark --quick    # ~30 seconds

Measures: C engine speed, NN inference, MCTS search, self-play, training steps, augmentation.

Device Support

Priority Device Platform
1 CUDA NVIDIA GPU (Linux/Windows)
2 MPS Apple Silicon (macOS)
3 CPU Any platform

Documentation

Full docs live on the Wiki (16 pages organized by Learn / Build / Train / Evaluate / Reference).

Good starting points:

Page What it covers
Quickstart 5 minutes from pip install to a bot playing
Game Rules Hex Connect-6 rules in 60 seconds
Concepts MCTS, AlphaZero, policy/value, ELO explained
Bot Approaches Six complete bot designs with full code
Training Guide Self-play, SFT, curriculum, distributed
Playing Online Run your bot on hexo.did.science
API Reference All public functions and classes
FAQ Common pitfalls and questions

Contributing

Built for the Hexagonal Tic-Tac-Toe community. Contributions welcome.

License

MIT

Release files for hexbot 4.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexbot 4.2.1
File Size Uploaded
hexbot-4.2.1.tar.gz 256.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for hexbot 4.2.1
File
hexbot-4.2.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
hexbot-4.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
hexbot-4.2.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
hexbot-4.2.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
hexbot-4.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
hexbot-4.2.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
hexbot-4.2.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
hexbot-4.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
hexbot-4.2.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
hexbot-4.2.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
hexbot-4.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
hexbot-4.2.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
hexbot-4.2.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
hexbot-4.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
hexbot-4.2.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 3.8 MB

Release files / hexbot-4.2.1.tar.gz

Download URL hexbot-4.2.1.tar.gz
Size 256.7 kB
Tags Source
SHA-256 checksum
How to use checksums
66d108a194aa1699c3193f1f16f5500fdad2eae96d2f23f75f2e008b077a145e
BLAKE2b-256 checksum
How to use checksums
f49a7d4ebbdd238d7c12843b8cb6a844c094f062364317edc970045828640d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp313-cp313-win_amd64.whl

Download URL hexbot-4.2.1-cp313-cp313-win_amd64.whl
Size 190.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
1d1e0cf331aba6cb85d5cf80d8b30047ab2c8838615a1e5956b52c4aa5e514da
BLAKE2b-256 checksum
How to use checksums
ac6472a2f530aa829a0597c495376fb709e442a357b0e460021bec5c87c0b9ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL hexbot-4.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 299.2 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e9179a88898cc086a9c4e470a6dd51107cd98296de124f54cde04a74cce3d7ec
BLAKE2b-256 checksum
How to use checksums
d25b1948de81a85dbf6cee4f89bf061584d866b3ab26f86bd608ad04fb655552
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL hexbot-4.2.1-cp313-cp313-macosx_11_0_arm64.whl
Size 220.6 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8c190aef0b433c1a46ebd1b5ee6dd7cee62ad8ebabf22e3af200cebbbecacb95
BLAKE2b-256 checksum
How to use checksums
84e4ab6e3639b67fbe09f81543a21280e6b47e39e655696aeec9053d10300719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp312-cp312-win_amd64.whl

Download URL hexbot-4.2.1-cp312-cp312-win_amd64.whl
Size 190.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
57d75fb23108e4d2d8d4a53455ded0d0d25b4989782c5156003c9f3377303fa7
BLAKE2b-256 checksum
How to use checksums
c021fe80a6241894c72f136d7c5f2e87546230451c1c6ea9a8d2acbb36899ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL hexbot-4.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 299.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9347d760ff81158b4d81fdf3c6bf3e51f740ded7025e62c874386045a7231e23
BLAKE2b-256 checksum
How to use checksums
a6b5422cedf3a0692fd8b22942c5a6fddb47b9b5f3fa8a54ab1ce692a417ceed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL hexbot-4.2.1-cp312-cp312-macosx_11_0_arm64.whl
Size 220.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1680ac00b1991e9652e27caeba0a1d51c1cc0709be21b80263c129fd44aed505
BLAKE2b-256 checksum
How to use checksums
89e12ae0ad6809fea4fefaf62a380ef01be8388565e93582d8d28048116f3612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp311-cp311-win_amd64.whl

Download URL hexbot-4.2.1-cp311-cp311-win_amd64.whl
Size 190.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
ffa24ffb40418f540d171c8a89bf782a2a5047099c6ed07ede414e98228c63f1
BLAKE2b-256 checksum
How to use checksums
5a6b288d532184653f53b9f39c2084e1f60b74635d69b539fe114bda82a1dc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL hexbot-4.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 299.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f4e74e5bfb6c11f8691146599ded5b0d2e2a219c1670df540b04e7989e2ee00f
BLAKE2b-256 checksum
How to use checksums
3e6cabf81de5457a32ba694d7b2c271c3df54796414396a41ff7f14cafe4fc08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL hexbot-4.2.1-cp311-cp311-macosx_11_0_arm64.whl
Size 220.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6c12427edf620f5a297bb0d77291f5f12fd0c241d284fc85b620676432bcf502
BLAKE2b-256 checksum
How to use checksums
b4267a9e5528876521df1674c8d15cde0c277fbe0963df5fbae4dd5b3b89f8cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp310-cp310-win_amd64.whl

Download URL hexbot-4.2.1-cp310-cp310-win_amd64.whl
Size 190.0 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
f0ba000349feb753b74796dcad420ccc3584793373f8bf37a3cfb46fd82c2984
BLAKE2b-256 checksum
How to use checksums
91b3365b5264fe332574cc1c9f7c1da0c3ecaf2be2f436d4d5423bc46ccbe0b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL hexbot-4.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 299.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
816874b3c4691dabfab0291ef2741c2ecc180a6af50ecfc66e15802fa27aa993
BLAKE2b-256 checksum
How to use checksums
81e577d5556b64f0174c66bc56ade83e69710afb63d9406b9b802898674ed6f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL hexbot-4.2.1-cp310-cp310-macosx_11_0_arm64.whl
Size 220.6 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2380576a6b8778eb434b86eb5cc2a5f0250a2a41667a4318f7939afaf6e4e3f0
BLAKE2b-256 checksum
How to use checksums
d4dc687764938da197ef15ae8b1f1fdb1b1265f6d9cd9c006e5c782a5efca82f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp39-cp39-win_amd64.whl

Download URL hexbot-4.2.1-cp39-cp39-win_amd64.whl
Size 190.0 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
0857d7d6114a6c6d005729ebbba4b9c3a7b7fcdc0da25300d57b4e540de5e6e8
BLAKE2b-256 checksum
How to use checksums
519377b2b58def71676bef399805e6d8ac0058c80d48ee3945e9c4057025bcff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL hexbot-4.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 299.2 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3a135afd2bd79f6c3aba893eb66f531edabf14cc012973e6ad5ea3187e2f0cfe
BLAKE2b-256 checksum
How to use checksums
a6759f7a51f78ee23a2bdc7bfefe05dcbe5cb2f7e2e2950fbfbdeeeaa48b0784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / hexbot-4.2.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL hexbot-4.2.1-cp39-cp39-macosx_11_0_arm64.whl
Size 220.6 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a5290089fa7bc9538cecf9c4bcef6bd7e607a60015ba0641a6dfed2ad9b0dd8e
BLAKE2b-256 checksum
How to use checksums
1b4c6d6c44787e114a2af274430fa14a6889260bc22997e3ceae984c4cfdbd86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

4.2.1 This release

16 release files

4.1.4

16 release files

4.1.2

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page