Deterministic board mechanism

How Mahjong Turtle Boards Are Generated

Mahjong Turtle does not scatter faces independently onto a shape. It assigns a supported matching-pair pool to layout positions while simulating legal removals with a seeded pseudorandom number generator.

That process creates a valid path for the generated initial board. It does not make every player-created state solvable, and the Shuffle control does not preserve the original path.

Layout coordinates become tile slots

Each layout is an ordered list of positions with horizontal x, vertical y, and layer z coordinates. The coordinate grid uses half-tile units, allowing the Turtle head, tail, and centered cap to overlap rows without changing the free-tile rule.

A position is a slot, not a face. The Turtle supplies 144 slots; the other seven layouts supply smaller even counts. The generator later assigns one face to every slot in the selected layout.

The supported pair pool

The full pool contains 72 pairs. Each of the 34 standard faces contributes two identical pairs, representing four copies of that face. The four flowers form two flower-category pairs, and the four seasons form two season-category pairs.

Before assignment, the seeded generator shuffles a copy of that pool. A smaller layout consumes only the number of pairs needed for its slot count, which is why smaller boards contain deterministic subsets rather than the complete 144-tile collection.

The initial-generation pipeline

This simplified diagram follows the implemented flow in layout.ts and tiles.ts without publishing an assignment or removal answer.

  1. 1 · Select layoutLoad the layout's x, y, z slots and mark every slot present in a simulation.
  2. 2 · Seed the generatorCreate the deterministic pseudorandom sequence from the supported numeric seed.
  3. 3 · Shuffle pair poolSeed-shuffle the 72-pair pool, then consume only as many pairs as the layout needs.
  4. 4 · Find free slotsApply the real rule: no overlapping position above and at least one horizontal side open.
  5. 5 · Assign and simulateChoose two current free slots, assign one matching pair, and remove those slots from the simulation.
  6. 6 · Return assignmentRepeat until no slots remain; the completed face-to-slot assignment becomes the initial board.
The simulation proves one legal removal path existed during assignment. The site returns the board assignment, not a public solution sequence.

What happens if a simulated path closes

During construction, the generator repeatedly asks for at least two currently free slots. If a trial reaches remaining slots with fewer than two free positions, that trial is abandoned and assignment is attempted again, up to the implemented retry limit.

A successful return therefore has a construction path. This is a property of the initial face assignment, not a claim that every conceivable assignment or every later state is solvable.

Deterministic seed and date replay

The same supported layout and numeric seed reproduce the same initial assignment. Replay Same Board passes the current seed back through generation, restoring the starting positions and faces while resetting play history and counters.

For the Daily Challenge, the visitor's local calendar date is formatted as a date string and hashed into the numeric seed. The same supported date input and Turtle layout therefore restore the same initial Daily board. This article intentionally does not publish a current Daily seed, tile assignment, or removal sequence.

Initial validity versus player-created states

The generator's simulated sequence establishes that at least one valid route existed before play. A player can choose another legal pair, use a needed duplicate, or leave matching faces behind positions that later remain blocked. The resulting state can have no moves even though the initial board had a valid path.

Undo restores a recorded removed pair and can return toward an earlier branch. It should be understood as move-history recovery, not proof that any arbitrary position can be repaired.

What Shuffle changes

Shuffle keeps the positions still present and collects the faces currently assigned to them. It then uses a derived seeded shuffle to reassign those remaining faces among those same positions.

Because this operation does not rerun the legal-removal construction pipeline, it does not guarantee a complete solution for the shuffled state or every state that follows. It may expose a current move, but it has left the original construction path.

A result records play, not the answer

The Daily result view is useful evidence of what the product stores after completion. It displays outcome statistics and replay controls without exposing the board assignment or solution path.

Completed Mahjong Turtle Daily Challenge dialog showing elapsed time, moves, hints, undos, access-change counts, and Replay Same Board
The completion view reports local play statistics. It does not include the seed, slot-to-face assignment, tile identifiers, or the simulated removal sequence used during generation.

Technical boundaries

The seeded pseudorandom generator is used for reproducibility, not cryptographic security. Its purpose here is to make the same supported input reproducible.

The guarantee is deliberately narrow: successful initial generation provides one valid construction path for that layout and seed. It does not cover every layout state, arbitrary manual assignments, or states created after player decisions and Shuffle.

Related learning