- Source Code
Jason Townsend, Pascal Developer
JSokoban Source Code
Editorial Note by Bill Catambay
Jason has graciously released the source code to his JSokoban freeware game. The source code is released under the Perl Artistic License. The source code and project files have been tested under CW Pro 4 and CW Pro 5.
Note: The CW environments were altered, so you may have troubles compiling this with CW Pascal straight "out-of-the-box". I have not been able to get the project to compile due to unexplainable and bogus CW compiler errors. If anyone has better success, please send me an e-mail, as I would love to update my environment as well as include running applications with the JSokoban source code.
By Jason Townsend
I am releasing JSokoban under the Perl Artistic License.
Notice that there are two CodeWarrior projects. One is for CW Pro 4, and the other is for CW Pro 5.
In order to get my full install of CW Pro 5 to compile Pascal, I copied the Pascal Compilers, Preference Panels, Libraries, and Interfaces from their places in the CW Pro 4 distribution to the equivalent places in the Pro 5 distribution. I also threw away the Data folder and let it rebuild from scratch.
Please send me any bug fixes or new features you come up with.
Download Source Code (111K)
How to play
ýSokobanţ is Japanese for ýwarehouse keeperţ. The object of the game is to rearrange the money bags to their destination positions on each level. Winning the game involves solving all the levels.
The man responds to the mouse or keyboard. Keyboard movement uses the arrow keys, the numeric keypad, or i-j-k-l. K, comma, spacebar, 5, 2, and 0 all move the man down. Clicking with the mouse in a neighbor square has the same effect as pressing keys. Each move must be either vertical or horizontal; no diagonal moves are allowed.
Holding down shift while pressing one of the directional keys or clicking in the same row or column as the man will make the man move in that direction as far as he can. Holding down control will make the man move as far as he can without pushing any bags.
The man can move the money bags by pushing them in front of himself, one at a time. If you push a bag into a corner, it is stuck. When you mess up (which will happen more than you think) you can restart the level, or undo the last push. Undo is supported for every push on the current level. To get an idea of the general strategy, try out the level 1 demo (under the File menu). You can speed up the demo by holding down the option key, or stop it by pressing command-period.
If you click the mouse somewhere more than one square away, the man will move to where you clicked if there is a path. When you click somewhere you canÝt go, JSokoban will play the ýbonkţ sound. You can drag the man around, too.
Pressing the diagonal keys (7, 9, 1, and 3 or U, O, M, and period) is equivalent to clicking on the analogous square immediately diagonal from the man.
The original Sokoban won a Japanese computer game contest in the early 80Ýs. It became a commercial game on NEC computers. (Info from Takeshi Miyazaki.)
Much later, a version for Unix (Curses) materialized (author unknown). The 40 ýExtraţ levels are from xsokoban, by Andrew Myers (firstname.lastname@example.org). The 50 Default levels are the same over all Sokoban versions. (Info from Ingemar Ragnemalm, Scott Lindhurst.)
There are two other Sokobans for the Mac, MacSokoban by Ingemar Ragnemalm and Sokoban by Scott Lindhurst.
JSokoban runs under System 7 or later in color, grayscale or B&W. For best display of the graphics, use 8-bit color or better. Sound Manager 3.0 or System 7.5 or later is required for multi-channel sound. Some features such as movable modal dialogs and the command-shift-Z shortcut for Redo require Appearance Manager, or Mac OS 8 or later. My goal is to make JSokoban support as many setups as possible, so if it doesnÝt work on your Mac, let me know!
JSokoban is freeware. As a starving computer science student/Mac programmer, I understand tight software budgets. :) So send me mail instead of money. Any distribution of JSokoban must include this doc file, the Extra file, and the Bug Report file. Although JSokoban is freeware, the game (minus the included levels) is ©1994-99 Jason Townsend.
JSokoban may be included on a commercial CD as long as I get a free copy. JSokoban may not be distributed commercially on floppies. (This means you, Educorp!)
You can always check my web page <http://homepage.mac.com/townsend/programs/> for the latest version of JSokoban.
Several people have contributed to the development of this game. Charles Turner explained many Mac Pascal concepts to me, including type-casting. Both Charles and Ryan Schmidt had good suggestions for new features or better ways of doing old things. (And bug reports too!)
Jason Best created the awesome graphics that replaced my clunky originals.
I would also like to thank my beta testers Ryan Schmidt, Jason Best, Ben Judson, Charles Turner, Alex Kac, John Fenton, Scott Lindhurst, and Florian Keller.
And thanks to everyone who sent me positive feedback about JSokoban 1.0. You have made this a truly rewarding experience!
JSokoban was written in CodeWarrior Pascal on a Power Macintosh G3/233.
How to Contact Me
Please send me any comments, suggestions, or (heaven forbid) bug reports. I can be reached at the following addresses: