SokoSave Desktop Documentation

SokoSave
COPYRIGHT

SokoSave is copyright ©1997,2001,2002 by Eric Sunshine.
SokoSave is copyright ©1997 by Paul McCarthy.

SokoSave is freeware. You may use and enjoy this program for free. You may make and distribute unmodified copies of this program for free provided that no fee of any kind is collected.

The latest version of SokoSave can always be found at www.sokosave.org.

THE GAME
Starting a New Game

You start a new game by selecting the New... item from the Game menu. This brings up a panel that lets you select the puzzle you would like to play.

Objective

The object of the game is to use the player to push all of the crates onto the blue goal tiles. The various elements in the game are illustrated below.

SokoPlayer SokoPlayerHex SokoPlayerTriN Player
SokoCrate SokoCrateHex SokoCrateTriN Crate
SokoCrateSelected SokoCrateSelectedHex SokoCrateSelectedTriN Highlighted Crate
SokoEmpty SokoEmptyHex SokoEmptyTriN Empty Tile
SokoEmptySafe SokoEmptySafeHex SokoEmptySafeTriN Empty Goal Tile
SokoWall SokoWallHex SokoWallTriN Wall

SokoSave supports the classic square-tiled Sokoban, hexagon-tiled Hexoban, and triangular-tiled Trioban puzzles.

Moving Around

For square-tiled games, the player can move up, down, left and right. The player can not move diagonally, though diagonal movement can be simulated by moving horizontally and then vertically, or vice versa. For hexagon-tiled games, the player can move left, right, and digaonally. For triangle-tiled games, the player can move left, right, diagonally, and either up or down, depending upon the orientation of the traingular tile.

The player can not move through walls.

There are several mechanisms for moving the player:

  • Point-and-Click. Click on an empty tile with the primary mouse button. If that tile can be reached by the player without pushing any crates or going through walls, then the player is moved there by the shortest path possible.

  • Dragging Player. Click on the player with the primary mouse button and then drag the player to the desired tile with the mouse button still pressed. If the destination tile is reachable, the player will be moved there by the shortest path. If the player is adjacent to a movable crate and is dragged in the direction of the crate, then the crate will be pushed along in front of the player.

  • Movement Buttons. Press the directional movement buttons at the bottom of the puzzle board.

  • Arrow Keys. Press the up, down, left, or right arrows on the keyboard. The 1 through 9 keys on the numeric keypad may also be used. For example, 4 will move the player to the left, and 9 will move the player up and right.

Pushing Crates

The player can only push one crate at a time. If the player is next to a crate and the tile on the far side of the crate is empty, then moving toward the crate will push it along in front of the player.

For triangle-tiled puzzles, pushes are weighted to give the crate a leftward or rightward motion. The weighting is controlled by the overall direction of player movement. For example, if the overall direction of movement of the player is horizontal, then the crate will be pushed in front of the player along a horizontal path. The same rule applies to diagonal movement.

There are several mechanisms for pushing crates:

  • Point-and-Click. This is perhaps the most useful form of automated movement. Click on a crate with the primary mouse button and then release the button. The crate becomes highlighted. Next, click on the tile to which the crate should be moved. The player will automatically push the crate to the destination tile by the shortest path possible, provided that the following three conditions are met. First, the player must be able to reach the crate in order to push it. Second, at least one path must exist from the crate's current location to the destination location. Third, it must be possible for the player to push the crate to every intermediate position along a path.

    If you highlight a crate and then decide not to move that crate, you can unhighlight it using one of the following methods: click on the same crate a second time; click on a different crate; click on a wall; click on an unreachable empty tile; move the player; or press the Escape key on the keyboard.

  • Dragging Crate. Click on a crate with the primary mouse button and then drag the crate to the desired tile with the mouse button still pressed. Moving a crate in this fashion is only allowed when three conditions are met. First, the player must be able to reach the crate in order to push it. Second, at least one path must exist from the crate's current location to the destination location. Third, it must be possible for the player to push the crate to every intermediate position along a path. If these conditions are met, then the player automatically pushes the crate to the destination tile by the shortest path possible.

  • Dragging Player. When dragging the player, if the player is adjacent to a crate, the crate will be pushed in the direction of player movement.

  • Quick Push. The secondary mouse button can be used to quickly push crates long distances in a straight line. To use this mechanism, line up the player behind the crate and click with the secondary mouse button on the tile where you want the crate to end up. If there are no obstacles in the way, the player will push the crate to the destination. If the mouse has only a single button, this type of movement can instead be triggered by holding down a modifier key, such as Shift, Control, or Alternate when pressing the mouse's button.

  • Movement Buttons. When the player is adjacent to a crate, activating the appropriate directional movement button at the bottom of the puzzle board will cause the crate to be pushed along in front of the player as the player moves in that direction.

  • Arrow Keys. When the player is adjacent to a crate, pressing the appropriate arrow on the keyboard will cause the crate to be pushed as the player moves in that direction. The 1 through 9 keys on the numeric keypad may also be used.

Undo, Redo, and Playback

SokoSave provides unlimited undo and redo capabilities. If you make a mistake, you can back up as many moves as you like by pressing the Undo Move button at the bottom of the board. If you take back too many moves, you can use the Redo Move button to "undo the undo". Redo is available until you make a move which differs from the sequence of moves that was undone.

SokoArrowLeft Undo Move
SokoArrowRight Redo Move

SokoSave also features smart undo and redo for pushes. Rather than applying to only a single move, the Undo Push and Redo Push buttons undo and redo an entire series of logically related actions. When Undo Push is used, if the last action was a push, then that push is undone along with all other pushes in the same direction. If the last action was a move, then that move is undone along with all other moves until a push is reached. Redo Push works in a complementary fashion.

SokoArrowLeftLeft Undo Push
SokoArrowRightRight Redo Push

You can also use the playback slider to back up to any point in the game. If the Animate switch is checked, then the moves and pushes are animated during replay. If this switch is not checked, then the game returns instantaneously to the selected point of play without any animation. If an animated playback becomes too lengthy, you can abort the playback by pressing the Stop button; by pressing the Escape key on the keyboard; by clicking in the puzzle area with the mouse; or by switching to a different window.

SokoSave's undo and redo mechanisms are intelligent. If you make moves which SokoSave considers to be opposite of your most recent moves, then undo or redo actions are invoked automatically on your behalf. For instance, if you move the player left three times and up once without pushing a crate, and then immediately move down once and right three times, SokoSave sees this as four moves followed by four undo actions.

Scoring

SokoSave computes several scores as you play.

  • Moves. Number of player moves.

  • Pushes. Number of crate moves.

  • Runs. Number of straight lines in which crates have been pushed. Looked at another way, this is the number of times crates have changed direction while being pushed.

  • Focus. Number of times the player's attention has shifted between crates. A high focus count typically indicates a puzzle with a complex solution that requires repeated shuffling of crates.

Puzzle maniacs should try to find solutions with the minimum number of moves, pushes, runs, or focus changes. These are different goals. For example, sometimes you can reduce the number of moves at the cost of added pushes and vice versa. As an illustration of these potentially conflicting goals, consider the following puzzle.

SokoExample1

As illustrated below, one can minimize the number of pushes (represented by the dark line), but at the expense of the number of moves (represented by the light line). In this case, getting the crate to the goal required only 6 pushes, but 28 moves.

SokoExample2

Conversely, minimizing the number of moves often results in a greater number of pushes, as illustrated below. In this instance, getting the crate to the goal required 14 pushes (8 more than the previous example), but only 18 moves (10 fewer than the previous example).

SokoExample3

The effect of the automated movement mechanisms on scoring may impact your choice of which mechanisms to employ or in what manner to employ them.

When the player is moved via either dragging or point-and-click, the computer always chooses the path to the destination tile which requires the fewest number of moves.

When the secondary mouse button is used to push a crate in a straight line, both the number of moves and the number of pushes needed to reach the destination tile are minimized.

When a crate is moved via either dragging or point-and-click, the chosen path minimizes the number of pushes required to deposit the crate at the destination tile. As a secondary objective, the chosen path also minimizes the overall number of moves needed to satisfy the primary objective of minimizing the number of pushes. If your goal is to minimize the overall number of moves in a game, then use caution when employing automated crate movement, since minimizing moves is only a secondary goal of this mechanism.

Saving and Restoring Games

You can save your current position by selecting the Save or Save As... item from the Game menu. Save uses the current save-file-name associated with the board. This name is displayed in the window's title bar. Each time you use Save it replaces the last saved position with the current position. Using Save As... lets you specify a different name for the saved game, thus allowing you to keep any number of different positions per puzzle. To restore a saved game, use the Open... item from the Game menu.

CONCLUSION
Credits

Paul McCarthy wrote the original version of SokoSave for NextStep.

Eric Sunshine added many new features, including several powerful automated movement mechanisms for ease of game play; added support for hexagonal Hexoban puzzles and triangular Trioban puzzles; generalized the core SokoSave game logic and extracted it into a portable and reusable library; and ported SokoSave to Microsoft Windows using C++Builder, and to MacOS/X, MacOS/X Server 1.0 (Rhapsody/YellowBox) for Mach and Windows, and OpenStep for Mach and Windows.

Classic puzzles 1 through 50 were published by Hiroyuki Imabayashi when he invented Sokoban in 1982. Joseph L. Traub collected another 40 levels for XSokoban.

David W. Skinner invented the hexagonal-style Hexoban puzzle layout, created the "dws" Hexoban puzzles, and the "dwstri" Trioban puzzles. François Marques invented the triangular-style Trioban puzzle layout, created the Hexoban-style Heloban and Heroban puzzle sets, and the Trioban-style Tryoban puzzle set. Aymeric Du Peloux created the Hexocet Hexoban puzzle collection, as well as the "adptri" Trioban puzzles. J. Kenneth Riviere created the "jkr" Hexoban puzzles. David Holland created the "dh" Hexoban puzzles. Gerald Holler created the "gh" Hexoban puzzle.

Feedback

When sending feedback to the authors, please mention the SokoSave release and build numbers, as well as the operating system type and version information with your correspondence.

Send comments to:
Eric Sunshine <sunshine@sunshineco.com>
Paul McCarthy <zarnuk@high-speed-software.com>