Table of Contents


xsokoban - Pushing objects around...


xsokoban [{ -nn | -s[level] | -r | -u <username> -c[scorefile-text]} -C -display <disp> {-w | -walls} {-rv | -reverse} {-f | -font} <fn> {-b | -bitdir} <path> {-fg | -foreground} <color> {-bg | -background} <color> {-bd | -border} <color> {-pr | -pointer} <color> -xrm <arg> ]


xsokoban is an implementation of the game sokoban, written on top of X(1).

The goal of xsokoban is to push all the round objects into the score area of each level using the mouse or the arrow keys. The arrow keys move the player in the corresponding direction, pushing an object if it is in the way and there is a clear space on the other side. The mouse buttons each have a distinct function.

If the left mouse button is pressed on a clear square, the player will move to that location via the optimal path if such a path exists; otherwise, the game will beep.

If the middle button is pressed on an object that is adjacent to the player, the object will be pushed one step. If the middle mouse button is pressed on an empty space, the player will move the closest object that is on a straight line with the destination, such that the object can be pushed in that direction, and the player is not directly between the destination and the object. Before pushing the object, the player is moved optimally to start the push.

Either the left or middle mouse buttons may be used to "drag" an object from an initial to a final position. If a straightforward way exists for the player to push the object without moving any other objects, the player will execute appropriate moves and pushes to get the object to the desired destination.

The right button mouse undoes the last user action, and may be used any number of times.

The rest of the functions are bound to the keyboard:

? Display the help screen.

q Quit the current level.

h,j,k,l Move the man just like the arrow keys, as in vi(1).

s Save and quit.

u Undo the last action. Same as right mouse button.

U Restart a level.

c Snapshot the current position

^U Restore to the last snapshot

^R Redraw the screen.

S View the score file.

The score file can be viewed at any time during the playing of the game. The scores are also displayed whenever a level is completed. Scores of the current user are initially highlighted. While viewing scores, the following keys may be used to control the listing:

q Quit the game

Return Return to the game and continue with the current level; or, if the current level is completed, begin the next level.

<left> The left mouse button may be used to select a different user to highlight. It also controls the scroll bar at the right side of the screen.

The middle mouse button selects a new level to play if a level is not already in progress.

Scores are saved in the score file if they are of high enough rank. A score is ranked according to how many scores are better than it; there are no scores superior to a rank 1 score, only one score superior to a rank 2 score, and so on. If two scores are identical, the first one entered is ranked higher.

It is possible for other users to have the same username as you, and thus collide in the score file. One symptom of this problem is that when you first play the game, you are not started at level 1. To avoid this prob lem, set your "xsokoban.username" X resource to the desired unique user name.


-nn Start at level nn, provided that levels below it are completed.

-s [level]
Print the scores on standard output. The optional level will res trict the printout to scores on just that level.

-r Restore a saved game.

-u <username>
Set the name of the user playing the game. By default, the user's login name is used.

-c [scorefile-text]
Create a new score file (can be ran only by the owner of the game). If the argument "scorefile-text" is supplied, the file of that name is assumed to contain the textual output compatible with the output of "xsokoban -s -D". The scorefile is initialized to contain the scores described in that text file. If no argument is supplied, the score file is initialized to be empty.

-C Create a new X colormap for display purposes. Ordinarily xsokoban creates a new colormap automatically if the default colormap does not contain enough free slots to allow it to run properly.

-display <display>
Run the game on the named display.

{-w | -walls}
Use fancy walls. (This is the default unless an option bitmap set is used)

{-rv | -reverse}
Use reverse video.

{-f | -font} <fontname>
Use the named font instead of the default 9x15 font.

{-b | -bitdir} <path>
Use the bitmaps found in <path> instead of the defaults.

{-fg | -foreground} <color>
Use the named color as the foreground color. (default is Black Pixel())

{-bg | -background} <color>
Use the named color as the background color. (default is Whi tePixel())

{-bd | -border} <color>
Use the named color as the border color. (default is foreground color)

{-pr | -pointer} <color>
Use the named color as the mouse pointer foreground. (default is foreground)

-xrm <arg>
<arg> is an X Resource specification.

Other Information

There is more information about xsokoban in the WWW, at


A global score file is also located there.


Unknown Hacker - Original curses(3) implementation.

Joseph L. Traub - X windows interface.

Kevin Solie - simultaneously developed X implementation (merged in).

Mark Linderman, Christos Zoulas - Mouse code (added to Solie's version).

Andrew Myers(http://www.cs.cornell.edu/andru) - Improved mouse UI, score ranking, color and WWW support.

Code has also been donated by many xsokoban users. Thanks for all your con tributions and suggestions!


xsokoban understands the following resources.

username : string
The name you would like to use when playing xsokoban. It defaults to your real username. If you are playing in WWW mode, some domain information is appended to your real username to disambiguate from other users with the same name. This domain information is not appended to the username if specified through the resource.

fancyWalls : boolean
Use fancy walls.

fontName : font
Use named font.

reverseVideo : boolean
Reverse foreground and background pixels.

foreground : color
Use color as foreground color.

background : color
Use color as background color.

borderColor : color
Use color as border color.

pointerColor : color
Use color as pointer color.

bitmapDir : string
Look for bitmaps in path specified by string.

border.color: color
Color of borders in the score display

text.font: font
Font of text in the score display

text.color: color
Color of text in the score display

text.highlight: color
Color of highlighted text in the score display

text.indent: int
Indenting of text in the score display

scrollbar.width: int
Width of the scrollbar in the score display

scrollbar.background: color
Color of the scrollbar background

scrollbar.thumb.height: int, scrollbar.thumb.width: int
Size of the scrollbar thumb

scrollbar.thumb.color: color
Color of the scrollbar thumb

panel.height: int
Height of the help panel in the score display

panel.font: font
Font of the help panel in the score display

Width of the Motif-like bevels

sep.color: color
Color of the lines separating different score levels

Special Bitmaps

In order to define your own bitmaps for xsokoban you only need to know the names of which files it is looking for. The standard bitmap files are:

man.xbm -- The player bitmap.

-- The goal area bitmap.

-- The standard wall bitmap.

-- The object that gets pushed.

-- The bitmap for the object when it is on the goal.

-- The bitmap for the player when it is on the goal.

To use the fancy walls option, you need the following additional files.

-- a wall with connections on no sides.

-- a wall with only northern connections

-- a wall with only southern connections

-- a wall with only western connections

-- a wall with only eastern connections

-- a wall with northern and eastern connections

-- a wall with southern and eastern connections

-- a wall with northern and western connections

-- a wall with southern and western connections

-- a wall with connections on all BUT northern side

-- a wall with connections on all BUT southern side

-- a wall with connections on all BUT eastern side

-- a wall with connections on all BUT western side

-- A wall will connections on all four sides.


Auto bitmap resizing code doesn't take into account font sizes. Feedback on user error is poor (only beeps).

HTML generated by man2html on Fri Nov 17 17:41:47 1995 .