Tigers and Sheep documentation
These pages explain how the game is built and how its computer players think. The top-level README covers the rules and how to play; start here when you want to change the code.
| Page | What it covers |
|---|---|
| Building | Toolchain, dependencies and what each is for, Cargo profiles and features, the Nix flake, CI |
| Architecture | The modules, how a game runs from main to the TUI loop, and how the pieces talk to each other |
| The board | The bitboard representation, move generation, the rules as implemented, symmetries and repetitions |
| Players | The Player and MinimaxPlayer traits, and the players that implement them |
| The minimax search | Alpha-beta, iterative deepening, the transposition table, move ordering, repetitions |
| The neural network and training | The network, backprop and Adam, and the self-play training loop with TD(λ) targets |
| Benchmarking and profiling | The bench command, search counters, perf/samply, and pitfalls when timing |
| Adding a player | Step by step: a simple player, a minimax player, and wiring either into the command line |
Conventions used throughout
- Scores favour tigers. Every score in the code, from
evaluateto the network's output, is positive when it's good for the tigers and negative when it's good for the sheep. Tigers maximise, sheep minimise. - Coordinates. A point is
Pos = (x, y), withxandyin0..5.y = 0is drawn at the top. In notation, filesa–earex0–4 and ranks are5 - y, so(0, 0)isa5. - Move notation.
sc3places a sheep on c3,sc3c2moves a sheep,ta5b4is a tiger step andta5xc3a tiger jump (which kills the sheep on b4). - Turns. Sheep move first.
Turnis the side about to move, and most functions take it alongside the board, since the same board can come up with either side to move.
