Building a Dou Shou Qi Engine
I built MistyJungle, a classical Rust engine for Dou Shou Qi, the 7×9 board game usually called Jungle or Animal Chess. It uses alpha-beta search, a handcrafted evaluation, repetition handling, and no neural network in the playing version.
The result is narrow but real. Against the strongest open-source engine I could run, it scored W11-L2-D187 over 200 games, about +16 Elo in a drawish game, and its four-piece endgame play matched exact tablebases with no win/draw/loss mistakes. The two upgrades I expected to help, a learned eval and a tablebase at the search leaf, did not. Classical search did the work.
What I built
A standalone Rust engine with a small UCI-style protocol, usable from the command line or from Python via PyO3. Strength is a node budget, not a clock, so the same position returns the same move on any machine.
The stack is conventional: negamax alpha-beta with iterative deepening, a Zobrist transposition table, quiescence on captures and den-entries, and killer/history move ordering with PVS and late-move reductions, over a handcrafted evaluation that scores material, den races, traps, water, and mobility. That ordering-and-pruning polish was worth a measured +49 Elo at a fixed node budget.
The eval has to be exact before a learned correction can add anything. Dou Shou Qi is material-heavy but full of sharp exceptions: a rat stops an elephant, a trapped piece loses its rank, one step into the den ends the game.
Specs
Each side has eight animals on a 7×9 board, and you win by stepping into the opponent’s den or capturing every piece. The rules vary by region, so the exact set matters. I used the Mistboard/Wikipedia rules as of June 2026, where dog outranks wolf (some sources swap them).
Capture order, strongest to weakest

Elephant
Lion
Tiger
Leopard
Wolf
Dog
Cat
RatEach animal captures to the right. The rat also captures the elephant. A piece in the opponent's trap counts as rank zero.
Beyond plain capture-by-rank, three rules give the game its tactics:
- Rat beats elephant, but only on land. The weakest piece captures the strongest. Captures can’t cross the bank, though, so a rat that swims into the water is safe from everything except another rat.
- Lions and tigers jump the rivers. Only the rat may enter the water. The big cats instead leap a whole river to the far bank, the lion sideways or lengthwise, the tiger lengthwise only, unless a rat sits in the water and blocks the jump.
- A trapped piece loses its rank. The three squares around each den are traps. An enemy piece standing on one drops to rank zero, so anything, even a rat, can capture it.
Full rules with a playable board: mistboard.com/rules/jungle.
Results
A small edge in a game where strong engines draw most of their games:
| Test | Result |
|---|---|
| Open-source benchmark, 200 games | W11-L2-D187, about +16 Elo |
| Search polish (ordering, PVS, LMR) | +49 Elo, paired self-play, p = 0.008 |
| Four-piece tablebase check | 779/800 matched, 0 WDL contradictions |
| Five and six pieces | >99% vs an 8x deeper search (proxy, not proof) |
| Tablebase at the search leaf | W37-L40-D3, about -13 Elo |
| Residual neural eval | best about -70 Elo |
The +49 was the hard one to measure. Two even Jungle engines draw too much for a win-rate gate, so I used paired, color-swapped self-play (every opening played both ways, new search against old) and a sign test on the decisive games.
Data
Endgames and the state of the solve
Small endgames yield to retrograde analysis, and they make excellent judges. Van Rijn and Vis solved four pieces at Leiden in 2013 and Bohrweg reached seven in 2016 (under the Leiden convention, which swaps dog and wolf). My engine matched exact four-piece play on 779 of 800 positions with no WDL contradictions, and tracked an 8x deeper search above 99% at five and six pieces.
That seven-piece database is the frontier, and the wall past it is storage, not solving technique. The board is the problem: 63 squares against the 16 of Flip Jungle, so each added piece has some 60 empty squares to stand on instead of a dozen, and the level sizes grow about five times faster. Five Flip Jungle pieces fit in 2.8 GB on my laptop; five Dou Shou Qi pieces run to roughly 7 TB. Eight pieces and up, half the starting material, is out of reach as a database, and nobody has a forward proof of the full sixteen-piece game either. Dou Shou Qi is solved to seven pieces and open above it, and likely to stay that way.
A tablebase loaded at the search leaf also added nothing to playing strength (about -13 Elo): search already finds the answer at the sizes that fit, and the sizes where it would help don’t ship. One caveat from the Flip Jungle build, where the same experiment first read as null and later turned out to be hiding a bug: those tables stored win/draw/loss with no distance, and a WDL-only leaf lets the engine hold a won endgame forever without finishing it, since every winning move grades the same. Adding distance-to-mate to the tables fixed the finishing there. My Jungle leaf probe was WDL-only too, so some of that -13 may be the same effect rather than tablebases being useless at the leaf. Untested; the classical engine ships without the probe either way.
Learned eval
This stalled on data, not architecture. A residual net (the handcrafted score plus a bounded correction) climbed from -470 to about -70 Elo as I fixed the labels, but never beat the hand eval. The labels were weakest exactly where the net needed help: draw-heavy self-play underrepresents material swings, exact tablebase labels only cover small endgames, and search-score labels mostly teach the net to imitate the search it already has.
AlphaZero
Still open work. I did not run a full Jungle AZ climb. The adjacent Banqi AZ de-risk failed its gate, but that is a different game and does not falsify AZ for Jungle, which is friendlier ground: deterministic and perfect-information, with no chance-node reveal. I parked it because the cheap rung was negative and the classical engine already beat the benchmark.
Example games
The match was mostly draws, but the decisive games show the shape of the edge: den pressure first, material second. These replays start near the conversion, so scrub left for the opening. Tab to a board, then use the left and right arrow keys to step through it.
MistyJungle (black) builds a material lead and finishes with a lion in red’s den:
Another black win, a shorter squeeze where the last piece reaches d1 after exchanges around the trap:
A red win that shows why you can’t just count material: MistyJungle loses material but wins the den race:
The longest saved win, red grinding through 283 plies before reaching the den:
The engine against itself at 8M nodes a move, about five seconds each: a long even fight where red nurses a one-piece edge for forty moves, then converts and walks a lion into black’s den:
More dramatic still, also a mirror game at 8M nodes: red lets black keep the elephant, lion, and tiger, falls sixteen points behind in material, and wins anyway by racing a rat into the den before that material can matter. The clearest statement of what the engine is actually optimizing:
Conclusion
MistyJungle is a classical search engine with a narrow, measured edge over the strongest open-source engine I could run. The work that moved strength was unglamorous: correct rules, fixed-budget measurement, color-swapped tests, search polish, and endgame validation. Tablebases judged well but did not help at the leaf, the first neural rung lost to the hand eval, and a real AlphaZero climb is still open work.
Resources:
- misty-jungle: the engine, in Rust.
- Layheng-Hok/Jungle-Chess: the open-source engine I used as the fixed benchmark.
- Bagheera: Leiden’s closed-source engine and the endgame tablebases I graded against.
- More in the engine series: Building a Banqi Engine, the same measurement discipline on Chinese Dark Chess.