Mission progress
0 / 10
Lesson 28.4Bonus Chapter 28Lesson 28.5
Bonus Chapter 28 · Puzzle Studio 5

Swap Tiles through a Single Empty Space

Move only a tile that shares a side with the blank. Track the blank, avoid repeated states, and discover whether the worked example’s 17-move route is merely successful—or truly shortest.

2 × 3 sliding boardstate-space searchundo and replayshortest-path proof
Progress saves in this browser.

One blank controls every move

At any moment, only tiles directly above, below, left, or right of the empty cell may slide. The blank then moves into the tile’s old position.

legal move = slide one side-adjacent tile into □
original goal: tile 1 and tile 2 exchange their starting positions

original puzzle at a glance

The worked example starts with the board 5 □ 1 / 4 3 2. It asks only that tiles 1 and 2 exchange places; the final positions of 3, 4, and 5 do not matter.

Important distinction: a route proves that the swap is possible. To prove it is shortest, every route with fewer moves must also be ruled out.
1
Read the goal precisely

Separate fixed targets from “anywhere” tiles

Not complete
Starting board
Goal condition

Four original rules

5 tilesNumbered 1 through 5.
1 blankThe only destination of a move.
Side-adjacentNo diagonal slide.
Only 1 and 2 fixedTiles 3, 4, 5 may finish elsewhere.

Checkpoint

2
Make legal slides

Move the blank by sliding a neighbor

Not complete

Click a numbered tile. Only side-neighbors of the blank can move.

Live move audit

Moves made0
Legal choices now3
Blank positiontop middle
Last move
Start by choosing tile 1, 3, or 5.

Checkpoint

How many legal first moves are available from the worked example starting board?

3
Follow the worked example opening

Track the first five moves

Not complete

original opening sequence

After these five moves, the blank reaches the top-left corner. The board has become □ 1 2 / 5 4 3.
Step0 / 5
Tile 1top right
Tile 2bottom right
Blanktop middle

Checkpoint

4
Worked example 5

Replay the complete 17-move construction

Not complete

Move-by-move route

Current step0 / 17
Tile 1 targetnot yet
Tile 2 targetnot yet
Goal reached?no
StepMoved tileBoard state
original result: the printed route ends at 5 4 2 / 3 □ 1. That swaps 1 and 2. The worked example page demonstrates possibility; Mission 7 adds a complete shortest-path audit.

Checkpoint

5
Solve it yourself

Use undo, avoid loops, and reach the swap

Not complete

Goal: tile 2 at top right and tile 1 at bottom right. Other pieces may finish anywhere.

Your route

Moves0
Distinct boards in current route1
Repeated a board in current route?no
Fewest additional moves from here17
Choose a side-adjacent tile.
Tile 1 and tile 2 are both still away from their target cells.

Validate your construction

Undo removes a move from the current route and its repeat count; Redo restores it. The remaining-distance display counts additional moves from the current board, not moves already spent. Your route may differ from the worked example and may use more than 17 moves. It succeeds when the two target tiles have exchanged their starting positions.

6
Count legal choices from the current position before planning a route.

Follow the blank and recognize a loop

Not complete

Reason it through

A corner blank has two side-neighbors. A middle blank has three. Sliding a tile into the blank and straight back uses two moves but returns to the same board. Keep the first useful state and revise the branch instead of repeating that loop.

All written arrangements

The board holds six objects: tiles 1–5 and the blank. If we ignore legal-move reachability, they can be arranged in:

6! = 6 × 5 × 4 × 3 × 2 × 1 = 720

The complete search below visits 360 boards reachable from this start—half of the 720 written arrangements:

720 ÷ 2 = 360
The notation 6! means six choices for the first cell, then five for the next, and so on. Listing written arrangements does not show which ones legal slides can reach. The search checks reachability by following every legal next slide.

Distance from the starting board

A state is one arrangement of the tiles and blank. A distance layer groups all boards whose shortest route from the starting board takes exactly that many moves. Layer 0 contains just the starting board. Layer 1 contains its three immediate neighbors. A board reached again by a longer route is still counted only in its shortest-distance layer.

Distance0
Boards at this exact distance1
Boards up to this distance1
Farthest layer21

Checkpoint

7
Use a construction and a lower bound together.

Distinguish a working route from a shortest route

Not complete

Reason it through

A working 17-move route proves that 17 is enough. To prove it is shortest, every route with 0 through 16 moves must fail. Just one shorter successful route would disprove the claim. The optional search below checks all boards at distance 0, then 1, then 2, and so on. Each distance is the fewest moves needed to reach that board from the start. Use this after finding a route to understand why a shorter one cannot work.

Check boards in order of shortest distance

Layer revealed0
States in this layer1
Goal states in layer0
States checked through layer1
At distance 0, only the starting board has been checked.

The two first-arriving goal states

Why this is a proof: every reachable board at distances 0 through 16 is examined, and none has the required swap. Goal states first appear at distance 17.
For the final board reached by the printed route, the shortest distance is also 17, and its shortest route is unique: the worked example sequence.

Checkpoint

8
Your current move count changes when you undo; the two target tiles still define the goal.

Track your route while revising a plan

Not complete

Reason it through

After six slides, undoing the last one leaves five moves in the current route. Only tiles 1 and 2 have fixed targets in this puzzle. The other three tiles may move temporarily or finish elsewhere. The optional experiment below starts a new puzzle when you choose a different pair of tiles to exchange. Its minimum and route counts belong to that selected pair. Your original construction still asks you to exchange tiles 1 and 2.

Choose two tiles to exchange

Minimum moves17
Nearest goal states2
Shortest routes2
Route step0 / 17
The worked example route and one alternate route both complete the 1 ↔ 2 swap in 17 moves.

Checkpoint

9
Independent practice

Sliding-puzzle workshop

Not complete
10
Exit ticket

Explain what makes the route valid and optimal

Not complete