PUZZLTHINK

DEV NOTE

Color Link Duel

Color Link AI dev notes

Before an AI that plays, a solver that proves.

Color Link is the second game of The Devil's Plan 3 final. Two players take turns placing coloured stones; every pair of same-coloured stones must always be joinable by its own line of 6 cells or more, and lines may not cross or share a cell. If you think the stones just placed made that impossible, you call it, and the player who placed them must prove otherwise by drawing every line.

This AI starts not from reading moves but from solving the puzzle. This note covers the solver, the strategy on top of it, and how the AI turned out so strong it became the Very Hard level.

Play now

Published · 2026-11-26

The solver comes first

Color Link launched in the early hours of 25 November. In this game even the referee has to be a computer: to judge a call or a proof you need a solver that answers can every colour on this board still be joined? The same solver is the AI’s eyes, and shows "this is how it could have been joined" after a failed proof.

It is a depth-first search that draws one colour at a time, the most cramped first, growing each line toward its target. A lone stone without its partner needs room for a line of exactly 6 cells. Three kinds of pruning keep it from exploding:

  • Shortcuts: a line never needs to touch itself — if the shortcut is still 6 cells or more, it uses fewer cells.
  • Reach and room: each colour still to draw needs both stones in the same open region, big enough for its line, and a region must hold all the colours that can only use it.
  • Dead ends already seen: the same cells taken with the same colours done is never searched twice.

Its work is capped; past the cap it answers "unknown". The AI calls a board impossible only when the solver proves it, and proves its own boards with the solver’s lines. So it never loses a proof it could win and never calls a board that can be saved.

The board as two numbers: a race of space

The solver says what is legal, not where to play. The key is an observation in the code comment: the player to move can always complete two lone colours by placing their partners at the ends of their lines. So there is only one way to get stuck — facing exactly one lone colour with no room left for a new colour’s 6-cell line.

That reduces the board to two numbers: s, the lone colours facing the mover, and f, how many new 6-cell lines the free ground still holds (a greedy packing, corners first). A turn can do one of three things:

Movesf
Complete two lone colourss − 2same
Complete one, start onesamef − 1
Start two new colourss + 2f − 2

That little game can be solved in advance: a table says, for every s up to 15 and f up to 12, whether the mover wins (a winning move sends the opponent to a losing entry). The AI checks every real placement with the solver, then steers toward the side of the table the opponent cannot win from.

What Very Hard does on a turn

  1. STEP 01

    Opening stone

    Anywhere away from the edge, on a cell whose four neighbours are all empty — leaving space for the race.

  2. STEP 02

    Only joinable placements

    Shuffle every placement and keep those after which the solver can still join every colour. New colours are interchangeable, so one stands for all.

  3. STEP 03

    Look for a finish

    If a placement may leave the opponent with one lone colour and no free line, prove it cell by cell, then play it.

  4. STEP 04

    The race table

    Otherwise pick the side of the table the opponent cannot win from, leaving fewer free lines; ties are mixed with a little randomness.

  5. STEP 05

    Deny their finish

    Among the top 12, play the first placement after which the opponent has no finishing move.

If no placement can be joined (the board is already lost), it plays the one the solver struggled with longest — the hardest one to see through — leaving a chance that you miss the call.

So strong it became hell mode

At first the AI thought for 1.8 s; the same morning, with single-round games (first point wins, 1-minute placements, 2-minute proofs), that dropped to 0.9 s. That night the show’s 7×7 board was joined by twelve shaped boards (Four Rooms, Donut, Pillar Forest, Frame, Stairs, H, Zigzag, Arrow, Heart, Diamond, Cross, Hourglass), and the AI difficulty became the board’s difficulty: the same AI everywhere, the board deciding how hard it is. Board tiers came from self-play: a player who never breaks the board but plans nothing won about 30% on big open boards (Four Rooms, Donut) and about 10% on tight ones (Classic, Heart). Maze and Spiral were left out — nearly all one-lane corridors, short forced games.

But this AI was too strong for people. The code comment records that by 26 November people had won 2.7% of 590 games. So on 26 November it became the Very Hard level as it was (hell games deal only hard boards), and new Hard and Normal levels with human-like gaps were added.

LevelTurns it plansMisses a broken boardPlaces without checking
Normal0%50%7%
Hard40%30%0%
Very Hard100%0%0%

On an unplanned turn it plays the first joinable placement in random order. When it "misses", it plays on instead of calling an already broken board. Normal’s unchecked placements may break the board themselves. The code marks these numbers as first guesses, to be retuned from play data.

Real win rates

Signed-in players’ games against the AI as of 2026-11-26, 14:00 KST — about half a day after the new levels.

Level (from 11/26)Human win rateGames
Normal38.8%98
Hard35.1%77
Very Hard20.4%137

The same AI now loses far more often than its earlier 2.7%. By board, Cross stands out at 44.4% (27 games) while Heart was 3.3% (30 games); with so few games it is too early to say how much is the boards themselves. Nine players hold the Very Hard certificate. In all (signed in or not) the game had been played 2,359 times, 1,935 against the AI.

Gaps a human can use

Normal

Blind to half the broken boards

Half the time it does not call a board that can no longer be joined. And on 7% of turns it places without checking — right after its move is a good time to doubt the board.

Hard

Plans four turns in ten

On the other turns it plays any joinable placement. A good moment to set the parity of lone colours so the race comes your way.

Very Hard

Free lines are an estimate

f, the number of new lines the free ground holds, is a greedy approximation. On boards with many narrow passages it can be off, so the race table can mislead it. Finishing moves are proven cell by cell; the guidance before that is approximate.

All

"Unknown" counts as unjoinable

Placements the solver cannot settle in time are never chosen. Drag the board into complexity and the AI’s options shrink.

Where this comes from

This note is written only from the code, the commit history and the aggregate numbers below.

  • `src/lib/colorLinkDuel.ts` — rules and the solver (solve)
  • `src/lib/colorLinkDuelAi.ts` — CLD_LEVELS, the race table (raceWin), freeLines, aiPlace, stuck, opponentFinishes
  • `src/lib/colorLinkDuelBoards.ts` — the 13 boards and their tiers (self-play notes)
  • `scripts/color-link-duel-arena.ts`, `scripts/color-link-duel-boards.ts`, `scripts/color-link-duel-tiers.ts` — self-play
  • Commits 8788eea (11/25 Color Link), 939a7b6 (11/25 single round, 0.9 s), 7a9c4fe (11/25 13 boards), e227318 (11/26 Very Hard, new Normal/Hard)
  • DB aggregates (2026-11-26 14:22 KST): game_results (game = color_link_duel, mode = ai) win rate by level since 11/26 00:24 and Very Hard by board, 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.

  • Russian Janggi AI dev notes

    Even the Very Hard engine that reads to the end must lose to a first-move large cup in the centre — and how that shaped the AI and its win rate.

All dev notes →