Zensu AI
An AlphaZero-style AI that taught itself the board game Zensu through self-play, going from random moves to beating a rule-based bot in every benchmark game.
Built with Python, PyTorch, Pygame, pytest

What it is
A rules engine for the board game Zensu, plus an AI that learns to play it with no human examples, only games against itself. I built it to learn how AlphaZero-style reinforcement learning works in practice. It’s a personal research project: Zensu belongs to its publisher, so the code stays private and there’s no public build to play.
Results
The AI is rated with Elo against a simple rule-based Greedy player fixed at 1000.
- The untrained network started at about 49 Elo.
- After 18 training iterations it reached about 2,760 Elo.
- From iteration 5 onward it won 20 out of 20 benchmark games against Greedy.
How it works
Each training iteration:
- Self-play: the current best network plays 256 games against itself, using Monte Carlo tree search with 160 simulations per move. Games are spread over several worker processes sharing one GPU.
- Training: a candidate network (a ResNet with a policy head and a win/draw/loss head) learns from the last 400k positions to predict the search’s move choices and each game’s final result.
- Arena: the candidate plays 40 games against the current best and replaces it only if it wins at least 55% of the decisive games.
Design decisions
- Draws are penalised almost as heavily as losses. The search scores positions as
P(win) − P(loss) − 0.9 · P(draw), so the AI takes risks to win rather than shuffling pieces. Self-play games over 300 moves also count as penalised draws. - Tools to see what it learned. A training dashboard tracks Elo, arena results and losses per iteration. A replay viewer steps through recorded self-play games, showing which moves the AI considered and how it rated the position.
- The rules engine is tested separately with pytest, so a rules bug can’t quietly teach the AI the wrong game.