Yükleniyor · Loading

Fish Jigsaw

How the bot plays the jigsaw

The jigsaw from the fish chest is the most mathematical part of DeepCast. The board below is a real demo — the bot’s decision logic runs live in your browser.

📜

The rules

  • You click the chest and one of 6 piece types arrives at random. The board is 6×4 = 24 cells.
  • Pieces do NOT rotate. You must fit them exactly as they arrive.
  • The fewer draws you need to fill the board, the better the reward: 10 or fewer = Large chest, 11–24 = Medium, 25+ = Small.
💡

The catch: sometimes discarding is the right move

Intuition says “I already paid for it, so place it.” The exact solution proves otherwise: a bad placement opens an isolated hole that only the single-cell piece can fill, and that hole costs about 6 draws on average. Sacrificing one draw is usually cheaper. Measured: always-place 20.8 draws, optimal 16.4.

Live demo

How the bot plays the jigsaw

The board the bot sees, the piece it draws and the decision it makes. You can also click the board and try it yourself.

Draws
0
Filled
0/24
Current reward
Large Chest
Bot average
16,4
Speed

Piece in hand

Try it yourself

Pause and click the board to place the piece yourself. The bot’s suggestion is outlined in green — pick a different spot and watch the average get worse.

Note: to run in a browser this demo uses lookahead instead of the exact table (16.5 draws over 500 games; the bot itself gets 16.4). A single game can go lucky or unlucky — the difference shows in the average, so watch a few rounds.

How does the bot do it?

How does the bot do it?

👁️

Reads the board from the screen

No calibration needed: it finds the grid from its edge lines and reads each cell’s state from colour saturation.

🧠

Identifies the piece in hand

The game shows a ghost of the piece under the cursor. The bot hovers over an empty area and works out the shape from the colour difference.

📐

Looks up the optimal move

The expected number of draws is precomputed for all 16,777,216 board states. Choosing a move then takes microseconds.

Verifies before committing

Just before clicking it checks the ghost lands exactly on the planned cells; if not, it does not click.

Benchmark: 5000 simulated games

Benchmark: 5000 simulated games

The same game played with four decision policies. Average draws per chest and the resulting reward split:

PolicyAvg. drawsLarge (≤10)Medium (11–24)Small (25+)
First fit (naive)32.8%1,3%30,3%68,4
Heuristic25.3%4,7%51,8%43,5
2-move lookahead23.5%6,3%55,3%38,4
★ Exact table (DeepCast)16.4%12,7%77,8%9,6