Spielerando

A full number-merging board is not always lost, and where the new tile goes

Ending the game the moment the board is full is wrong, and so is letting a new tile appear on top of an old one. This entry gives the exact end test, the choice of the empty spot, and the odds of a bigger tile, all repeatable from the numbers you pass in.

Why this works

The game is over when no move is left, and a full board can still have moves. So test for any move rather than for a full board, and draw the new tile from the empty cells only, with a roll that is passed in.

When not to use it

If new tiles should not be random, such as in a puzzle with a fixed order or one shared by all players on a day, the roll must come from a plan, not from chance. Then the same sequence has to be stored and replayed.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 29 lines of example code with 5 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "A full number-merging board is not always lost, and where the new tile goes" (read_entry number-merge-game-over-and-spawn) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP