How it learned
Wure was given the rules and nothing else. No openings, no master games, no tips. Everything it knows comes from thousands of games against itself, played on a laptop CPU.
Two parts that help each other
A good Oware player does two things: they feel that a move is promising, then they check it by reading ahead. Wure does the same with two parts.
The network is the intuition. Give it a position (the 12 pits, both scores, the move count) and it returns two things: a policy, one probability for each of the 6 moves, and a value, a number from −1 (I lose) to +1 (I win). It is a small dense network with three hidden layers of 128 units: – parameters, 200 KB.
The search is the reading ahead. It is MCTS (Monte Carlo Tree Search): it grows a tree of moves, one simulation at a time. Each simulation walks down the tree, picking at every node the move that maximises:
Q + c · P · √N ⁄ (1 + n)
Q is the average value found under that move so far, P is the network’s intuition for it, N is how often the parent node was visited and n how often this move was. At first P dominates, so the search explores what the network likes. The more a move is visited, the more that exploration term shrinks, and Q, the result of the reading, takes over.
When a simulation reaches a position it has never seen, it asks the network for a policy and a value, then carries that value back to the root, flipping its sign at every level: what is good for me is bad for you. The move finally played is the most visited one, not the one with the best Q, because visit counts are a steadier vote.
The original MCTS judged a position by playing random moves to the end. Here the network’s value replaces those random games. That pure MCTS still appears below, as a reference opponent.
Learning by playing itself
The loop is AlphaZero’s, in miniature. It ran – times:
- The current network plays 400 games against itself, with 200 simulations per move. To vary the games, the first 20 moves are sampled in proportion to the visits, and a little Dirichlet noise is added to the root intuitions.
- Every position played becomes an example: the input, the visit distribution (the policy target) and the final result, seen from the player to move (the value target).
- The network trains on the examples from the last 8 iterations: 1,500 gradient steps, cross-entropy for the policy, squared error for the value.
- The new weights replace the old ones, and it starts again.
The whole idea fits in one sentence: the search plays better than the network alone, so the network learns to imitate a version of itself that thought harder. Next round, the search starts from a better intuition and plays better still. Nobody tells it which move is good; only game results decide.
The games are played by a Rust program (rules, search and network in one binary, on 6 threads). Training runs in PyTorch. In total: – on a laptop CPU.
Measuring it: Elo
One generation was kept every 5 iterations. Each played its neighbours and five opponents that never learn:
- random;
- greedy, which takes as many seeds as it can right now;
- two classic alpha-beta searches that read 4 and 8 moves ahead and count seeds, with a transposition table (positions are keyed by a Zobrist hash);
- pure MCTS, 1,000 simulations per move, each finished with random moves.
Games come in pairs: the same 4 random opening moves, sides swapped. Elo comes from a Bradley-Terry model fitted on every result, with random fixed at 0. A 200-point gap means the stronger side scores about 76 %.
The network alone
Take the search away and play the network’s favourite move directly, with no reading ahead. This is how that bare network scores against greedy, generation by generation.
Generations playing each other
Real games from the evaluation. Watch generation 0 hand out seeds without a thought, then the last one set up captures several moves ahead.
What it is not
- It is not a champion. Awari, a very close variant, was fully solved in 2002 by John Romein and Henri Bal with retrograde analysis on a cluster: with perfect play the game is a draw. Wure is nowhere near that.
- The Elo is relative. It only means something inside this small pool of players. It does not compare with chess Elo or with human strength.
- The samples are small. 40 games per pairing, 100 for the last generation: expect a few dozen points of uncertainty on each Elo.
- The estimate bar is not a probability. It is the tree’s average value mapped to 0–100 %.
- One rule is ours. To stop endless games, play ends after 300 moves and each side keeps the seeds on its row.
- It is a small run. A few CPU hours and a small network. More games and more simulations would very likely make it stronger.
Under the hood
The engine (rules, Zobrist hashing, search) is written in Rust and compiled twice: natively for training, and to WebAssembly (57 KB) for this page. Property tests play hundreds of random games and check after every move that all 48 seeds are still there, that the incrementally updated hash equals a hash computed from scratch, and that the moves offered follow the rules.
The network is exported to ONNX and runs in your browser with onnxruntime-web. While that library loads (about 3 MB compressed), the same weights are evaluated by the Rust code: both give the same numbers to within 10−7, which is checked at every export. Nothing goes to a server: the page is static and everything is computed on your device.