Skip to content
One Quick Try

Traffic Jam Puzzle

Slide the cars and trucks along their lanes until the red car can drive out.

Type
Logic
Takes
about 2-6 min
Result in
moves

Traffic Jam

~2-6 min

  1. Cars and trucks fill the lot. Each slides only forwards or backwards.
  2. Drag them to clear a path for the red car to the exit on the right.
  3. 12 levels, from 4 to 38 moves at best. Your moves are compared with the fewest possible.
Level

Keyboard: Tab to a vehicle, then use the arrow keys.

Your result: — moves

How it's measured
  • Sliding Puzzle

    Slide the tiles back into order.~2-5 min
  • Maze

    Find the way out of a new maze every game.~1-3 min
  • Tower of Hanoi

    Move every disk in the fewest moves.~1-5 min
  • Box Pushing

    Push every box onto a target.~2-10 min
  • Lights Out

    Turn off every light. Each press flips its neighbors.~1-3 min
  • Chess Puzzles

    Find the best move in five real positions.~3-5 min

How does the traffic jam puzzle work?

Cars and trucks are packed into a 6×6 parking lot. Each one can only slide forwards or backwards along its own direction, never sideways and never through another vehicle. Drag them to clear a path for the red car to the exit on the right of its row. With a keyboard, Tab to a vehicle and slide it with the arrow keys.

How is your Traffic Jam Puzzle result calculated?

A move is one vehicle sliding, however far it goes. Moving the same vehicle again straight after counts as the same move, because it could have gone there in one slide. Your result is your number of moves, compared with the fewest possible for that level, and your time from your first move.

How do you know the fewest moves?

By trying everything. A computer can list every position a lot can reach and find the shortest way out with a breadth-first search: first every position one move away, then two, and so on until the red car escapes. There are 12 levels here, needing 4 moves at best for the first and 38 for the last, and the site's tests run that search on every level each time the site is built.

The puzzle was invented by Nob Yoshigahara and has been sold since 1996 as the board game Rush Hour. In a 2018 search of every 6×6 position, Michael Fogleman found that the hardest needs 51 moves, counting a move the way this page does: one vehicle sliding any distance. Some searches count every square a vehicle travels as a separate step, which gives larger figures. Sébastien Collette, Jean-François Raskin and Frédéric Servais had already sorted every starting position by its shortest solution in 2007.

Search only works this well because the lot is small. Gary Flake and Eric Baum proved in 2002 that on lots of any size the puzzle is PSPACE-complete, a class of problems for which no quick general method is known: as the lot grows, the number of positions to search grows out of reach.

How do you solve traffic jam puzzles?

  • Work backwards from the red car. Note which vehicles stand in its way, then what is blocking each of those, and so on. That chain is your plan.
  • Trucks are the hard part. A truck across the exit row usually has to go all the way up or down, so check early whether there is room for it.
  • Make space before you need it. Moves that look useless, like pushing a car into a corner, often open the lane you need three moves later.

For another puzzle about sliding pieces, try the Sliding Puzzle; for a puzzle about getting everyone across, the River Crossing Puzzle.

What can affect your Traffic Jam Puzzle result?

Only moves count towards the rating, not time, and a move is one vehicle sliding any distance: moving the same vehicle again straight away still counts as one. So there's no penalty for nudging a car into place. On a phone, dragging a short car can be fiddly; on a keyboard, Tab picks a vehicle and the arrow keys slide it one square at a time.

Questions

What counts as one move?
One vehicle sliding any distance. Sliding the same vehicle again straight after is counted as part of the same move.
Is this the same as Rush Hour?
It is the same kind of puzzle, with levels made for this site. Rush Hour is the board game, invented by Nob Yoshigahara and sold since 1996.
What is the hardest traffic jam puzzle?
A 2018 computer search of every 6×6 position found that the hardest needs 51 moves, where a move is one vehicle sliding any distance, as here. The last level here needs 38.
How are the fewest moves worked out?
By a breadth-first search through every position the lot can reach, which finds the shortest way out. The site's tests repeat it for every level.
Can vehicles turn or move sideways?
No. Each car or truck only slides forwards and backwards along the direction it faces.
Is there a traffic jam puzzle solver?
The site has one behind the scenes: a search that tries every move, used to find the fewest moves for each level, which your result is compared with. The game doesn't show solutions, so the puzzle stays yours to solve.