How to play Sokoban
From Sokoban Wiki
This article explains how to play Sokoban. There are also simple strategies explained.
First let's have a look at the rules of the game:
The object of Sokoban is to take some objects (usually boxes) to designated locations by pushing them.
To do this the user moves a man who we call Sokoban. Sokoban can move up, down, left and right. He can't pass through walls or boxes. He can push only one box at a time (never pull). At any time a square can only be occupied by one of a wall, box or man.
A level contains these elements:
Walls: # Boxes: $ Goals: . Free squares: ' ' The Sokoban / the player: @
Boxes and the Sokoban can also be located on a goal.
Boxes on goals: * The Sokoban on a goal: +
In the following the Sokoban is called "the player" to indicate that this is the object the user can move.
Movements:
Nearly all Sokoban games can be played using the arrow keys. Nowadays many programs also support playing with the mouse.
All moves of the Sokoban need only to be done for pushing a box.
Level 1 ######### #@ $ .# #########
Using the arrow keys one has to press the "right arrow" 5 times. Using the mouse you have to mark the box for pushing (by clicking on it) and then clicking at the position the box is to be pushed to.
Level 2 ######## # ### #@$ ### #### ### ## ### ## ## # ##. # # # ##### # ########
Here the difference between playing with keyboard and playing with mouse is demonstrated. Using the mouse is as simple as in Level 1. Using the arrow keys needs a lot of key presses for pushing the box to the goal. Hence, it's always recommended to use the mouse for playing. The advantages compared to keyboard playing are:
- With two clicks a box can be pushed to every possible square
- Most programs automatically calculates the best moves for the player. Hence the user doesn't have to think about how to move the player by keys.
- Some programs even show the squares a box can be pushed to. In this way it's easy to see if a box can be pushed to the selected position.
- The user can concentrate on pushes only instead of moves and pushes
Levels containing only one box are very simple to solve using the mouse: One just has to mark the box for pushing and then to choose the goal square as target.
Usually Sokoban levels are a lot more complicated.
Let's increase the difficulty step by step:
Level 3 ######## # # # $ .# #@ $ .# # $ .# # # ########
Here the level contains 3 boxes. Nevertheless the level can easily be solved. Although every box can be pushed to each goal it doesn't matter which box is pushed to which goal. The boxes can just be pushed one after the other to any goal.
Level 4 ######## # #. # # $# # # # @## # # $## # .## ########
This level is more complicated. The box under the player is close to a goal. Nevertheless it can't be pushed to the goal - this would result in a deadlock. This level shows some problems one has to solve before it's possible to finish the level:
- Not every box can be pushed to every goal
- Boxes can't just be pushed to the nearest goal in every case
- Box pushes can create a deadlock
Level 5 ######### ## # # #.$. $ # # # ## # # @$.$. # #########
To solve this level the boxes have to be pushed to their goals in a specific order. Moreover one box has to be pushed away from its goal before it can be pushed to it.
Level 6 ######### # # .# #@$ $ # # $ ##..# # ##### #########
This level is another example of the need to push a box away from its goal before the level can be solved. Additionally one box has to be "parked" until some other boxes have reached their goals. A situation where a box must be pushed but can't be pushed immediately to its goal occurs very often in Sokoban levels. Some of them are "parking" situations. "Parking" means:
- a box must be pushed away from its goal
- after the box is pushed to its parking position another box has to be pushed
- parking the box at a specific position is required to solve the level