An extremely easy Sokoban level.

So as to provide some background information on Sokoban for my other articles about the puzzle game, I’m writing this quick little description.

There are a few different variations of the game. Here I’m only concerned with the classic game, in which the player gets one pusher with which to push “boxes” around on a square grid.

The general idea

A level in 倉庫番(そうこばん, sōkoban), literally “warehouse keeper,” is kind of like a maze. But instead of trying to find your way into or out of something, the point of the game is to put things in their right place.

Like most good puzzle games, the rules are quite simple. You get a player token on the board, which is a square grid. You can move the player token up, down, left or right, provided there isn’t an obstacle in the way. The most obvious obstacle is a wall brick.

There are boxes and there are goals. One or more of the boxes might already be in the goals, but at least one box isn’t. The point of the game is to get all of the boxes into the goals.

You do that by pushing the boxes around. You use your player token to push a box in a particular direction, by coming at the box from the opposite direction. But the space you want to move the box to must be empty. If there’s a wall brick, or another box, you can’t push.

In the example level shown below, the player token (looks like a blue marble) can move in any direction, except to the right, because that would be pushing the box (looks like a red marble), but another box is blocking the way.

Initial state of a simple Sokoban level with four boxes and four goals.
Initial state of a simple Sokoban level with four boxes and four goals.

This is with the “Heavy Metal” “skin” in Sokoban YASC; other “skins” have boxier looking boxes.

In this example, moving down would be inadvisable, because that would push a box against the wall.

That’s not necessarily a bad thing, except that in this particular level, it would then become impossible to get that box to a goal without backtracking (which some implementations of the game may not allow) or restarting from the beginning (which I believe all implementations do allow).

In this level, you do want to push the boxes against the opposite wall, taking care not to push them any of them into a corner without a goal.

Sokoban level in which the player is pushing a box towards a goal.
Sokoban level in which the player is pushing a box towards a goal.

If you happen to push a box into a corner without a goal (as can happen from holding an arrow key down for just a tad too long), see if the implementation allows you to undo the last move (this would probably count against your time, if it’s keeping track of that). If not, you might have to completely restart the level (which ought to reset your time to zero).

I like how the Heavy Metal skin renders boxes when they’re in a goal. The player token looks good, too.

Sokoban level in which the player has successfully moved a box into a goal.
Sokoban level in which the player has successfully moved a box into a goal.

Once all the boxes have been moved into goals, the level is complete and you may move on to the next level.

I don’t know if there’s a standard scoring scheme, but there are two metrics for measuring how well one played that seem quite obvious: moves and pushes.

However, some implementations count moves a little differently. A push is of course a move that pushes a box one space in any given direction. But some implementations don’t count pushes as “moves.”

For example, if you solve a level with five non-push moves and two pushes, some implementations count that as “5 moves and 2 pushes” and some as “7 moves and 2 pushes.”

This is consequential for determining whether a given solution is “move-optimal” or “push-optimal.”

Sometimes you’ll figure out the best solution for a level, the one with the fewest moves and the fewest pushes. Other times, you might discover two distinct solutions and not be able to say one’s better than the other.

Let’s say your first solution uses very few non-push moves, at the expense of a lot of pushes. That’s a move-optimal solution. And let’s say your second solutions economizes pushes, at the cost of a lot more non-push moves. That’s a push-optimal solution.

How to play on your computer

I first played Sokoban many years ago on an iMac running Mac OS 9. I don’t remember if it showed any game metrics.

On the Windows 10 side, there’s no shortage of choices. I first downloaded Sokoban YASC (Yet Another Sokoban Clone) from SourceForge. But I was hesitant to install it because the publisher is unknown to the operating system and does not have a digital certificate.

I then downloaded and installed Sokoban 3.0 by Ben Ruyl from Download.com. It’s a good implementation, but, as far as I can tell, it has no level editing capabilities. Kind of important if you want to create your own levels.

YASC has a level editor. Don’t use it to cheat on levels, though. YASC offers a lot of help for solving a level without editing it: in addition to single-move backtracking and level restart, YASC has some fairly sophisticated deadlock detection.

By default, YASC will prevent you from the more obvious boneheaded mistakes, like pushing a box into a corner without a goal. But it can also detect much subtler deadlocks, like this one I got myself into with David W. Skinner’s Sasquatch 3 level:

A deadlock situation in David W. Skinner’s Sasquatch 3 level.

Actually, it was even subtler than that. I understood that the upper row of four goals had to be filled before the lower row of four. But I didn’t at first understand that I needed some empty goals on that bottom row to fill the upper goal of the pair above.

David W. Skinner’s levels are difficult but usually very interesting. I don’t think I’ll ever be able to solve one of his without having to restart at least twice.

I’ll have more about designing Sokoban levels in another article.

How to play online

Now I’ve been playing online, at Game-Sokoban.com.

is a composer and photographer from Detroit, Michigan. He has been working on a Java program to display certain mathematical diagrams.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store