PUZZLES · 3 min read

Sliding Puzzle Guide: Solve Any Board Row by Row

The classic way to solve a sliding puzzle is to complete one row at a time, then finish the last two rows together. The same planning idea applies to the 3×3, 4×4 and 5×5 boards here; the examples below show specific legal sequences.

Try it now →

The idea behind the method

You cannot solve the whole board at once, so you build it from one corner and never disturb what is already finished. Each completed row or column makes the remaining puzzle smaller, until only a tiny corner is left. The only difficult moment is placing the last tile of a row, and there is a simple trick for that.

Solve the top row first

Work towards the top-left corner, leaving room to arrange the final two tiles of a row together. Do not lock the next-to-last tile into place if that leaves no way to bring the last tile beside it.

For a 3×3 example, suppose the first two rows read 1, blank, 2 / 4, 5, 3. Click tile 2 to move it left, then tile 3 to move it up. The top row becomes 1, 2, 3. The blank moves into the second row, where you can continue without touching the solved row. Reaching that setup from another board requires additional moves.

Then the left column

After the first row is done, treat the remaining board as a smaller puzzle. Solve the left column of that smaller puzzle using the same technique, turned ninety degrees. Alternate rows and columns until a two-by-two area remains.

12345913Green: solved first. Grey: the smaller puzzle left.
After the first row and column are solved, only a smaller puzzle remains.

Finish the last two by two

Once every tile outside the final 2×2 corner is correctly placed, rotate its three tiles around the blank until they match their targets. In a solvable board, with the rest correctly fixed, those tiles have the compatible cyclic order.

If you believe the final tiles cannot rotate into place, check the supposedly solved rows and columns first. PlayDapple generates boards by legal moves from the solution, so it does not introduce an unsolvable permutation.

Why some boards cannot be solved

Exactly half of all arrangements of a sliding puzzle can be solved. A solvability test counts inversions, the number of pairs where a larger tile precedes a smaller one, and combines that with the blank square’s row on boards of even width. PlayDapple creates its boards through legal moves from the solved state, so every starting board has a solution.

Efficiency tips

Think in cycles. Moving the blank around a two-by-three block rotates the tiles in a loop, which can reposition a tile without disturbing those already placed. Plan the whole loop before you start, and use undo if you lose track.

Larger boards mostly take longer, not harder, because the method is the same. The first rows of a 5×5 board go quickly, and the real work is in the last few.

A worked example on a 3×3 board

Start with rows 1, 2, 3 / 7, 4, 6 / blank, 5, 8. Click tiles 7, 4, 5, 8, in that order. Each clicked tile is next to the blank, and none of these moves touches the solved top row.

The intermediate rows are: after 7, 1, 2, 3 / blank, 4, 6 / 7, 5, 8; after 4, 1, 2, 3 / 4, blank, 6 / 7, 5, 8; after 5, 1, 2, 3 / 4, 5, 6 / 7, blank, 8. Clicking 8 then finishes. This is a specific endgame example, not a move sequence that solves every shuffled board.

12374658
Click 7, 4, 5, then 8. All four moves are legal and preserve the top row.

Common mistakes

The most common mistake is placing the last tile of a row directly, which pushes the tile you already placed out of position. Always set up the last two tiles together. Another is trying to fix one stubborn tile by disturbing the solved rows, which usually undoes more than it gains.

Moves and efficiency

Solving by the row method is not the shortest path, but it is reliable. Expert players use their knowledge of which tiles are close to their positions to take shortcuts, but even they use the row method as a fallback. If you want to reduce your move count, look for moves that place two tiles at once.

Play it now →

Related guides

← All guides