Sokoban: Rules, History, Why Pushing Is Hard

Updated

Sokoban is a puzzle in which you play a warehouse keeper who pushes boxes onto marked squares, and the one rule that makes it hard is that you can push a box but never pull it. It was created in Japan in the early 1980s and its name means warehouse keeper. This page gives the rules, a short history, a worked example of a mistake you cannot undo and the ways box pushing lives on in other games.

The rules in three lines

A Sokoban level is a small room drawn on a grid. It has walls, a number of boxes, the same number of marked goal squares and a worker. The aim is to get every box onto a goal square. The whole game is three rules:

  1. You move one square at a time, up, down, left or right, onto any empty floor square.
  2. You can push a box by walking into it, but only one box at a time, and only if the square behind it is empty. A box pushed against a wall or another box does not move.
  3. You can never pull a box. Once it is in a corner, it stays in that corner.

Nothing else is in the game: no timer, no enemies, no points. A level is solved when the last box lands on a goal, and the score, if there is one, is how few moves or pushes you needed.

Where it comes from

Sokoban was created by Hiroyuki Imabayashi in 1981 as a hobby project for a Japanese home computer, the NEC PC-8001. He founded a company called Thinking Rabbit to sell it, and the first commercial release came in Japan in 1982. The Japanese name, sōko-ban, means warehouse keeper, and the setting explains the game at once: boxes, a floor and someone who has to tidy up.

A few details are worth stating carefully. Sources disagree slightly on the exact year of the first commercial release, with 1982 the most often given, and the game was later sold and ported to many other computers and phones. Today there are thousands of fan-made levels. The rules were never changed, which is one reason a level from forty years ago is still playable.

Why pushing without pulling is so hard

The difficulty comes from one fact: most moves cannot be taken back. In most puzzles a wrong move wastes time. In Sokoban a wrong push can make the level unsolvable, and you may not notice for ten moves. Three situations cause nearly all the trouble.

The corner trap

A box pushed into a corner can never leave it, because to move it you would need to stand on the far side, and the walls are there. Unless that corner is a goal square, the level is dead. The simplest habit is to check, before every push, whether the box would end up in a corner that is not a goal.

The wall trap

A box against a wall can slide along it, but never away from it. If no goal lies on that wall, the box is lost. Two boxes side by side against a wall block each other in the same way.

The order problem

Often the goals have to be filled in a particular order: the far one first, then the near one. If you put a box on the near goal first, it can block the path to the far one. Experienced players plan backwards, starting from the last box and asking how it gets there.

MistakeWhat happensHow to avoid it
Box in a non-goal cornerIt can never move againLook at each corner before you push
Two boxes stacked in a line against a wallNeither can be pushed awayKeep one box free
Filling the near goal firstIt can block the way to the far goalPlan the order from the last box backwards
Pushing without checking your own way outYou trap yourself behind a boxLeave a path for the worker
The four ways a Sokoban level is most often spoiled.

A small worked example

Imagine a room three squares wide and four tall, one box in the middle and a goal at the top left. You stand below the box. The obvious move is to push it up, to the top row, which puts it against the top wall. Now the goal is to its left, and you can push it left only if you stand to its right, which is a square inside the room, so that works. The same idea fails if the goal is at the top right and you push it up into the left column instead: the box then sits against the left wall, with no goal on that wall.

The lesson is to ask where a box can go next before you move it. The question that wins Sokoban levels is always the same: from this square, which pushes are still possible?

How box pushing lives on

Sokoban's idea of pushing objects in a small space is now part of many puzzle games. Some keep the grid and the no-pull rule and add new elements, such as ice that slides or switches that open doors. Others turn it into action: instead of a quiet room, the boxes arrive in real time. That second route is where games like Night Shift sit.

In Night Shift you are also a worker in a warehouse. The crates are pushed by walking into them, one at a time for cardboard, and you cannot pull them. But a crane keeps dropping new crates, so you do not have time to plan a whole level; you plan the next three moves. The kinds of crate add rules of their own: steel needs the strength upgrade to be pushed, glass breaks, and ice slides until something stops it. The crates guide lists every one, and how to play has the rules on a single page.

Eight crate pictures along the floor: cardboard, steel, glass, dynamite, ice, valuable cargo, then the helmet and magnet pickups.
The crates of Night Shift: each one changes what a push does.

If you want to compare the two honestly, see games like Sokoban. Night Shift has no connection to the original game; it is a different puzzle that borrows an old idea.

Questions people ask

Why can you not pull boxes in Sokoban?

Because the rule creates the puzzle. If you could pull, every mistake could be undone and there would be little to plan.

Can a Sokoban level become impossible to finish?

Yes. A box in a corner that is not a goal can never be moved again, so most levels have mistakes that cannot be repaired. Many versions give an undo button for that reason.

What is a good way to start a hard level?

Find the boxes that are already near their goals and the boxes that are in danger of getting stuck, and deal with the risky ones first.