DEV NOTE
Russian JanggiRussian Janggi AI dev notes
Once the AI could read to the end, an unbeatable opening showed up.
Russian Janggi is 3×3 tic-tac-toe with cups that cover each other. Each side has two small, two medium and two large cups; you place one on an empty cell or over a smaller cup, or lift one of your cups on the board and move it. Lifting can reveal a line underneath — if it is the opponent’s colour, they win.
With so few pieces on so small a board, a computer can read the game to the end. That led to something unusual: the strongest AI became the hell-mode AI that loses most often. Here is why, from the code and the records.
Published · 2026-11-26
Night one: from placing to moving
Russian Janggi launched at 11 pm on 16 November. The first version only let you place cups, and the AI ran an iterative-deepening alpha-beta search within 0.7 s. Twenty-four minutes later came moving your own cups on the board — and with it, lines revealed by lifting a cup, and an 80-ply draw limit, since cups can be shuffled forever. The AI learned to search moves as well.
The Easy–Hard evaluation is classic tic-tac-toe AI. For each of the eight lines with none of the opponent’s cups showing, add the square of my cups in it × 3 plus 2 per large cup of mine there (and subtract the same for the opponent). The centre on top is worth 4, a large cup still in hand 3 and a medium cup 1 — a large cup can never be covered, so holding it makes it a final blow. Cells are searched centre first, then corners, then edges.
Normal and Hard became the same AI
At the first record check on 20 November, Russian Janggi was too hard: people won 18% against Normal and 11% against Hard (targets 50% and 25%). The search was made shallower and noisier; Normal sometimes played "any move that does not lose at once", and Hard came down to roughly the old Normal.
On 26 November another look showed that both now read two moves and were effectively the same AI. The numbers kept in the code comment: 27% against Normal and 40% against Hard — Hard was the easier one — and for people who had played both, 34% and 33%. The levels are now split like this:
| Level | Choosing a move |
|---|---|
| Easy | Plays a winning move with 75% probability. Otherwise, 55% of the time a random move that survives a 2-ply search, else any move. |
| Normal | Four turns in ten, a random move that does not lose at once. Otherwise a 2-ply search (0.12 s) plus big noise (14). |
| Hard | 3-ply search (0.3 s) plus small noise (7). No noise on moves whose result is decided. |
| Very Hard | Iterative deepening up to 60 plies (1.5 s desktop, 1 s phone). Details below. |
Very Hard: no dice, no hidden cups
Very Hard arrived on 24 November in the same commit as 12 Janggi’s. The first comment in its file sums the game up: full information, no dice and no hidden cups — nothing to average over, so the search reads exact outcomes. It shares 12 Janggi’s structure (PVS, transposition table, killer and history ordering) on a 27-slot "cell × size" array.
- Revealed lines, exactly: a lift that uncovers the opponent’s line is scored as a loss and removed from the candidates.
- Win at once: before searching it checks for a move that ends the game now.
- Repetition is a draw: it remembers the last 120 positions, so when ahead it presses on instead of going back.
- Mix near-equal moves: it picks at random among moves within 8 points of the best.
Its evaluation is new: 34 for a line showing two of my cups and none of theirs (a threat), 5 for one, 22 more for two or more threats at once (a fork). Each top cup earns a place score proportional to the lines through its cell (centre 4, corner 3, edge 2), covering an enemy cup is worth 7, a large cup in hand 16, a medium one 5, and the side to move gets 8.
The first player’s large cup in the centre
What the engine revealed once it could read to the end.
The code comment says it plainly: a large cup in the centre as the first move is a theoretical win for the first player. A large cup can never be covered, so it holds four lines for good. From there, even a perfect AI cannot beat a perfect human.
So Very Hard got two defences. First, a one-position opening book: when the opponent opens with a large centre cup, it answers in a corner without searching. Offline searches of 3 s per answer showed the corner leaves the fewest winning replies — 16 of 28 with a large cup, 18 of 31 with a small one, against 19–23 for other answers. Second, how it plays a lost position: rather than just dragging the game out, it picks the move after which the smallest share of the opponent’s sensible replies still win, and none wins on the spot. You have to find the exact moves to win.
It shows in the records
As of 2026-11-26, 14:00 KST, signed-in players had 110 Very Hard wins with a saved replay. In all 110 the human moved first, and in 107 the first move was a large cup in the centre. Not one of those wins came with the AI moving first. Overall people won 25.0% of 517 Very Hard games — the highest of the six hell-mode games — and 22 players hold its hell certificate, also the most.
Real win rates
Signed-in players’ games against the AI as of 2026-11-26, 14:00 KST.
| Level | Human win rate | Games |
|---|---|---|
| Easy | 85.0% | 20 |
| Normal | 27.2% | 947 |
| Hard | 39.0% | 1,102 |
| Very Hard | 25.0% | 517 |
Normal is lower than Hard because most of these games come from the period when both read two moves; few games have been played since the 26 November retune. Counting everyone, Russian Janggi had been played 9,636 times — the most of any board game on the site — 8,554 of them against the AI.
Gaps a human can use
Move first, large cup in the centre
A theoretical win. But the AI answers in a corner and, when lost, picks the move with the fewest winning replies — you still have to play exactly.
A fork on the fourth ply
Hard reads three plies. A fork (two lines threatened at once) that appears after your move → its reply → your move is not prevented.
Careless four times in ten
On some turns it plays any move that does not lose immediately. Set up a threat that completes a line one move later and it is often missed.
It hoards large cups
Easy to Hard score large cups in hand, so they keep them. Take the strong cells with your own large cups first and the AI’s have nowhere good to go.
Where this comes from
This note is written only from the code, the commit history and the aggregate numbers below.
- `src/lib/russianJanggi.ts` — rules and the Easy/Normal/Hard AI (sEval, sNegamax, rootScores, chooseAiAction)
- `src/lib/russianJanggiHell.ts`, `src/lib/russianJanggiHellClient.ts`, `src/lib/russianJanggiHell.worker.ts` — Very Hard, the opening book, trickiest
- `src/components/russianJanggi/RJGame.tsx` — choosing who starts, recording results
- Commits 73fef3a (11/16 Russian Janggi), 1769c8e (11/16 moving cups, 80-ply draw), 1fe2d84 (11/20 retune: Normal 18%, Hard 11%), eb8f15e (11/24 Very Hard, self-play), e227318 (11/26 retune)
- DB aggregates (2026-11-26 14:22 KST): game_results (game = russian_janggi, mode = ai) win rate by level; first player and first move among Very Hard wins with a saved replay; hell_clears count; game_plays_daily totals
Read next
- How the Wallgo AI plays
From a reach-first territory estimate to alpha-beta with a transposition table: what each Wallgo AI level computes, and where it is weak.
- 12 Janggi AI dev notes
Why a 7-ply Hard was almost unbeatable and went down to 5, the no-third-repetition ban, and a Very Hard that reads 13–19 plies.
- Blind Gomoku AI dev notes
AIs that remember only the last 3, 8 or 36 moves, and a Very Hard one with full memory and VCF/VCT threat search — and how forgotten stones become a weakness.