RufasSok is a minimalistic version of the Sokoban puzzle game with embedded autosolvers for Windows, Mac OS-X and GNU-Linux.
Get full source and binaries in the tar.gz file under releases, or try this link:
https://github.com/fastrgv/RufasSok/releases/download/v2.6.8/rsk15dec25.7z
Type "7z x filename" to extract the archive.
- On OSX, Keka works well for 7Z files. The command-line for Keka is:
- /Applications/Keka.app/Contents/MacOS/Keka --cli 7z x (filename.7z)
GitHub downloaders: Please ignore the "Source code" zip & tar.gz files. (They are auto-generated by GitHub). Click on the large 7z file under releases to download all source & binaries (Windows,Mac & Linux). Then, type "7z x filename" to extract the archive.
alternate download link: https://sourceforge.net/projects/rufassok/files/latest/download
Minimalist Sokoban Game using OpenGL, GLFW3 & OpenAL audio with embedded live solvers & backward mode
ver 2.6.8 -- 15dec2025
- Revised baksok so that the x-key file dump works as input to resume later.
- Added ability to highlight safe-haven cells to assist manual solutions.
- Updated hbox solver.
- Added a utility screen to choose a solution method for hbox.
ver 2.6.7 -- 26nov2025
- Added a countdown during long hbox autosolver waits.
- Added more information to help screens.
- Added b-key display of box-invalid locations.
- Improved user friendliness by skipping problematic levels rather than aborting.
- Increased the puzzle size capacity to 128 boxes and 64 rows & cols.
- In single-file mode there is a new and valuable capability to read an external solution file that will enable a single-step playback.
- Corrected status counters.
See complete revision history at end of file.
This is a minimalistic version of an interactive, OpenGL Sokoban puzzle game platform with 3 external solvers, and 3 embedded auto-solvers designed to help you to learn to solve puzzles on your own. It includes a reverse game option where the boxes must be pulled back from their goals to their original positions.
The forward platform is called "forsok". Its objective is to push all the movable boxes onto their goals. And the embedded solvers can help you a little, or a lot, when you get stuck.
And now, when you think you are ready for it, try solving the various puzzles backward using the new backward mode platform called "baksok".
solver keys [within parentheses]:
-
(.) iplr; for small or dense puzzles
-
(,) ibox; medium
-
(=) hbox [most capable]
-
(m) sets hbox method [see details below]
movement keys:
- i j k l
- w a s d
- (up) (lf) (dn) (rt)
For baksok use (ctrl)-key with a movement key to "PULL" a box.
other common key functions:
-
(+) increase wait timeout (numKeypad)
-
(-) decrease wait timeout (numKeypad)
-
(u) undo
-
(n) next level current file
-
(p) previous level current file
-
(shift)+(n) skip ahead 10 levels in current file
-
(shift)+(p) skip back 10 levels in current file
-
(ctrl)+(n) next file
-
(ctrl)+(p) previous file
-
(z) set a setpoint
-
(r) reset to z-key setpoint (restarts if no setpoint)
-
(ctrl)+(r) restart from beginning
-
(x) dump current puzzle state to a file that can be input later
-
(esc) quit
- runs on Windows, OSX, Linux; New linux binary now runs on many linux distros!
- uses GLFW3;
- uses OpenAL for applause sound;
- all runtime files are in ./data/
- all puzzle files are in ./games/
- includes 3 external autosolvers: iplr3r, ibox3r, hbox
- includes 3 embedded autosolvers that help you to learn.
- no installation
- no dependencies
- simply unzip in your Downloads directory, and run;
- or unzip onto a USB flash drive [w/same file format] and run.
[namechanges due to new backward (puller) game] To start the game type:
on linux: forsok
on osx: forsok_osx
on windows: wforsok.bat
Three autosolvers are now embedded within this application so that pressing the (=)-key or (,)-key or (.)-key at any time initiates an attempt to solve the present state of the current puzzle within a limited amount of time. If successful then you will see an onscreen prompt to continue to press the same key to single-step toward the solution. Otherwise you will see no such prompt. These three embedded solvers are good for small and dense layouts; but not so good at large, sparse puzzles.
The 3rd alternate solver [hbox] is initiated with the (=)-key. It is the most capable embedded solver.
Thus, you can give yourself a headstart toward a correct solution by limited use of this feature. Once you think you can solve it yourself, stop using the solver and proceed manually. This really helps when you cannot see what your next move should be.
Note also that the solvers can tell you when you have gone too far and gotten yourself into a deadlock. If you periodically test to see if a solution is available as you proceed manually, then if you go too far you will suddenly find no solution is available. This means you need to undo (u) until a solution is once again available.
Embedded autosolver failure might imply the present state of the puzzle is impossible to solve, or simply that the autosolver failed due to time constraint, or insufficient capability.
Note: all 3 solvers can fail if the puzzle is too large or difficult. However, be aware thatafter making a few good moves yourself, the autosolvers might then be capable of finding a solution. An extreme example is Xsokoban puzzle #19 of 90. After making a single [correct] move, hbox can solve it in 60 seconds using method 23, yet hbox cannot solve it from the beginning!
The default timeout used by embedded solvers is 10 seconds, but is adjustable using the (+)-key or (-)-key on the number keypad to increment or decrement by 10 seconds per press. This is the time to wait for the internal autosolvers before giving up.
Also, the method used by embedded solver Hbox is now set using the m-key...
There are several hbox solution methods to choose from including 5 basic methods, each of which has several variations, because hbox is currently being used as a research tool. See ~/docs/solmethods.txt for choices available within this RufasSok app. See ~/docs/SolMethodsIndex.txt for an exhaustive listing.
Even more information can be found by studying the documents in: https://sourceforge.net/projects/hbox4/files/latest/download
Remember that there are still three external autosolvers without time constraints. Subject to several limitations, typing: "solver-name puzzle-file-name.sok maxlevels level-number" will attempt to solve a particular puzzle for you, where solver-name is either "iplr3r" or "ibox3r". There are many large or sparse [lishout] puzzles the first two solvers cannot handle, but they are pretty good at sovling the small dense ones. Use the script ccc.sh to compile either solver for your operating system (assuming the presence of an Ada compiler).
To run type: [exeName puzzleFile LevelToSolve]
EG on windows type: external_solvers\iplr3r.exe games\pico_22.sok 3 ...to solve the 3rd level in file pico_22.sok.
EG on Linux type external_solvers/ibox3r_gnu games/pico_22.sok 3
EG on OSX type external_solvers/hbox_osx games/pico_22.sok 3
It uses the Ada programming language and modern OpenGL methods, with textures, shaders and uniforms. Compiles and runs on Windows, OSX, GNU/Linux systems.
Focusing on portability, transparency, and open source freedom, this project relies exclusively on F.O.S.S. tools: a thin GLFW3 binding, a thin OpenGL binding, a PNG reader by Stephen Sanguine & Dimitry Anisimkov, and a GNAT compiler.
The linux-build can run on multiple Linux distros! The Windows build can run on Win10 + Win11.
I have 0 testers ;) and would appreciate any feedback... Open source Ada developers are welcome to help improve or extend this app. Developer or not, send comments, suggestions or questions to: [email protected]
Mac/OSX users see "osx-setup.txt". Windows users see "windows-setup.txt".
Unzip the archive.
-
On Linux & Windows, 7z [www.7-zip.org] works well for this. The proper command to extract the archive and maintain the directory structure is "7z x filename".
-
On OSX, Keka works well for 7Z files. The command-line for Keka is:
- /Applications/Keka.app/Contents/MacOS/Keka --cli 7z x (filename.7z)
After the archive is unzipped...
Users may then open a terminal window, cd to install-directory, then, at the command line, type the executable name to start the game.
In Linux type:
forsok
You can also use the Windows executable under wine, thusly:
- wine cmd < wforsok.bat
- wine binw64/forsok.exe
Windows users type:
wforsok.bat
or:
binw64\forsok.exe
Mac users type:
forsok_osx
The install-directory should contain subdirectories named "data", "libs", "games", "skins", "src", "buildScripts", "binw64", "docs".
Pusher movement is accomplished using the arrow keys or the WASD keys.
rufasok has the following skin options:
- gray bkgd
- star bkgd
- water bkgd
- antique desk skin
- plain and simple ...the (c)-key now cycles thru the skins (c=color)
The (m) key brings up a menu to select a solution Method for the hbox solver.
The (h) key brings up a help menu that looks something like this:
Movement: ijkl, wasd, or arrowKeys(up,lf,dn,rt) (esc) quit (u) undo (m) set hbox method (r) restore-setpt (ctrl)+(r) restart (n) next-level this set (p) previous-level this set (ctrl)+(p) = previous puzzle set (ctrl)+(n) = next puzzle set (z) redefine setPoint Zero (q) Quiet move sound (c) next skin Color (kp+), (kp-) +timeout, -timeout
(.) solver: (iplr) (,) solver: (ibox) (=) solver: (hbox)
(b) show Box-invalid cells (spc) show freeSpace cells (x) dump puzzle to Pdump.sok
- use mouse drag to change size of puzzle window
Linux Note: a "mouse" or "sloppy" window focus policy might allow window focus to slip away while changing puzzles (if the new window no longer includes the pointer). In this case, simply move the cursor back onto the puzzle window. This annoyance does NOT occur with a systemwide "click" policy.
These are old solvers that have significant limitations, including rapid growth of memory usage, for puzzles that are too large or have too many boxes to handle. They seem to still exit gracefully, and when they do, simply use "hbox" using the equal-key. On the other hand, "iplr3r" will generally give the most efficient solutions, when it does work. So it's usually worth trying first.
Note that the file naming conventions must be maintained now that dynamic file loading is done after reading the ./games/ directory. No underscores are permitted except one that precedes the integer that indicates the number of levels in the file. The name format is thus anyname_nnn.sok. Note that there is a standardized format for the online sokoban files themselves that I have attempted to respect and maintain.
A specific sokoban file may be loaded by naming it on the terminal window command line with the following syntax:
forsok sokfilepath maxlevels startlevel
For example you could type
"forsok_osx games/original_50.sok 50 2" (on Mac/OSX)
"forsok games/original_50.sok 50 2" (on linux)
"wforsok.bat games/original_50.sok 50 2" (on Windows)
to tackle level 2 from the original_50 sokoban file. In this single-file mode, you can still use the next-level(n) & previous-level(p) keys, however, the next/previous files (R-shift/L-shift) keys are disabled.
A prior puzzle dump may also be read in and play resumed thusly:
"forsok Pdump.sok 1 1" (forsok in linux)
"baksok Rdump.sok 1 1" (baksok in linux)
If you happen to have an externally generated solution string in a file, along with the puzzle file, (possibly in the same file) then you can load both to single step through the solution using the following commandline syntax:
forsok puzzleFile maxlevels startlevel solutionFile
For example:
"forsok_osx games/original_50.sok 50 2 sol2" (on Mac/OSX)
"forsok games/original_50.sok 50 2 sol2" (on linux)
"wforsok.bat games/original_50.sok 50 2 sol2" (on Windows)
where "sol2" is the name of the solution file [that contains only ONE solution]. It must contain the word "Solution" on the line immediately preceeding the standard solution string.
This new mode is experimental and not user friendly, but I needed it myself to see how to begin solving a difficult puzzle (sasquatch7 #40). So I solved it using "Festival", then watched the playback. By the way, my copies of Takaken74 & Sokolution could not solve this puzzle in 30 minutes!
I included a new Puller-Sokoban app:
- wbaksok.bat (MsWin)
- baksok (linux)
- baksok_osx (Mac/OSX)
Most keys work as before, but to PULL a box next to the puller, press the Ctrl-Key while using the arrow-keys or WASD. You can also use the numeric-keypad-arrows U=kp8, L=kp4, R=kp6, D=kp2 to PULL the boxes (reminder: boxes are no longer pushable).
Hbox, the most capable autosolver, is invoked with the (=)-key. Now, the other 2, less-capable solvers have also been added. The (,)-key invokes ibox3r, while the (.)-key invokes iplr3r. These last two have not been adequately tested yet, but preliminary tests seemed Ok. Just as in the forward game, forsok, these solvers can be invoked and abandoned at any time to help you find the next good move. And just as before, they might fail to find a solution within the time constraints. This often means that you made a bad move that renders the problem unsolvable. If so, you can undo your recent moves with the (u)-key until it IS solvable.
To solve the backward problem, you MUST end up with the puller on the puller-goal-cell, indicated by a magenta color. It is not enough to just get all the boxes on their goals.
In the reversed problem, there is uncertainty about the Initial puller position. So, before you begin, you can cycle thru all of the candidates using the "i"-key. But note that some candidates may be unsolvable, so choose wisely. OTOH, if the autosolver is capable of solving the problem, when invoked, it will automatically move the puller to a valid start position, at which time you can try solving it yourself, or continue to use the autosolver and step towards the solution with each (=)-key press.
These apps can handle up to a maximum of 128 boxes, 64 rows/cols, and 256 box-valid interior cells.
- a recent GNAT Ada compiler from AdaLibre;
- graphics card that supports OpenGL version 3.3 or later;
In the ~/buildScripts/ directory try:
Mac/OSX => obuildall.sh
Linux => lbuildall.sh
msWin64 => setpath64.bat + w64buildall.bat
Of course, the above scripts need to be adjusted to reference your actual compiler installation directory. Please read carefully: ~/docs/gnuAdaOnWindows.txt.
If your linux distribution is old, it might not run, and you will need to recompile.
Note that linux users with wine installed can run with the command:
wine binw64/forsok.exe
If the delivered GNU/Linux binary does not run, try:
-
Use wine and the Windows EXE, as above; or
-
Manually install GNU Ada.
-
Rerun the compile script lbuildall.sh.
The commands to build the external autosolvers:
on Linux: cccgnu.sh ibox3r cccgnu.sh iplr3r cccgnu.sh hbox
and on Windows: ccc64.bat ibox3r ccc64.bat iplr3r ccc64.bat hbox
and on OSX: cccosx.sh ibox3r cccosx.sh iplr3r cccosx.sh hbox
===================================================================
This app is covered by the GNU GPL v3 as indicated in the sources:
Copyright (C) 2025 [email protected]
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You may read the full text of the GNU General Public License at http://www.gnu.org/licenses/.
https://github.com/fastrgv?tab=repositories https://www.indiedb.com/members/fastrgv/games https://fastrgv.itch.io https://sourceforge.net/u/fastrgv/profile/ https://gamejolt.com/@fastrgv/games
It is my intention to use media with copyrights or licenses that are compatible with GPLv3. Please notify me if you believe there is an incompatibility, and it will be removed ASAP, eg a CC-by-NC license is NOT GPL compatible.
...are from freesound.org and are covered by the Creative Commons CC0 license documented in the accompanying file creativeCommonsCC0.txt.
ver 2.6.6 -- 13oct2025
- Updated help screen & README.md.
- Updated hbox solver.
ver 2.6.5 -- 26aug2025
- Improved sizing in single file mode.
- Equal-key now always mapped to [most able] hbox solver.
- Updated hbox solver.
- Added 2 other, less-capable, solvers to baksok, the backward mode game.
- Fixed disappearing puller problem [baksok] when solver fails.
- Corrected baksok win message to read "pulls" not "pushes".
ver 2.6.4 -- 29mar2025
- Repaired window resizing issues. Use mouse to resize.
- Enhanced simplicity & consistency of key-mappings.
ver 2.6.3 -- 25mar2025
- Added a REVERSE Sokoban game using a Puller & single autosolver: hbox.
- Added 3 heuristic monitors in pusher version: #corrals, #blocked-rooms, #blocked-boxes.
ver 2.6.2 -- 3mar2025
- Updated & improved 3 sok-solvers.
ver 2.6.1 -- 01jan2025
- Fixed embedded solver hbox method 3; made other improvements.
- Added "+", "-" number-keypad keys to adjust timeout.
- Improved other two embedded solvers; and fixed memory leak.
ver 2.6.0 -- 16dec2024
- Updated hbox4 to hbox5.
- Updated embedded solver.
- Moved all 9 external solvers into their own sub-directory for less clutter.
ver 2.5.9 -- 24jan2024
- Upgraded hbox4 solvers, embedded & external. Now checks memory available.
- Default method used by embedded hbox4 may now be set interactively.
- Resizing is now done exclusively with mouse drag.
- Fixed problem with the embedded ibox solver not respecting time limit.
- Other code improvements & corrections.
ver 2.5.8 -- 8oct2023
- Revived OSX support, but without a bundle, and built without using Xcode.
ver 2.5.7 -- 23sep2023
- All cc-by-nc-licensed puzzle sets have been removed for complete GPLv3 compatibility.
- Updated splaypq utility.
- Discontiued OSX development.
- Added graceful shutdown in case of exception.
ver 2.5.6 -- 5oct2022
- More clearly identified two cc-by-nc-licensed puzzle sets as not compatible with GPLv3 license: (miniNC_60.sok, magiNC_100.sok).
- Updated shared linux libglfw.
- Updated Windows build to use easy-to-install 64-bit GNU Ada.
- Removed all scripts that reference the now defunct AdaCore compilers.
- Removed 32-bit Windows build to provide maximal memory for solvers.
ver 2.5.5 -- 28oct2021
- Improved adaOpenAL binding code...rufasok is now buildable with [GNU Compiler Collection] GNAT, as well as all AdaCore versions.
- Updated glext.lib.
ver 2.5.4 -- 13oct2021
- Enabled normal window exit.
- Fixed occasional bad sizing at startup.
- Updated libraries.
ver 2.5.3 -- 15apr2021
- Increased box limit to allow more puzzles to function.
- Added option to keep window focus while playing (f-key).
- Added o-key to restore Original puzzle.
- Repaired faulty undo = u-key to store initial Pos.
- Upgraded to glfw v3.3.4.
- Added several more families of puzzles.
ver 2.5.2 -- 4mar2021
- Added 3rd embedded solver accessed by (,)-key.
ver 2.5.1 -- 20feb2021
- Fixed annoying changes of user-set window size/position.
- Upgraded to OpenAL sound.
- Updated autosolvers.
- Added more capable hbox4 autosolver.
- Added visual aid that shows
- possible destinations when a box is clicked.
- possible sources when a goal is clicked.
ver 2.5.0 -- 3nov20
- Greatly simplified build process.
ver 2.4.2 -- 19sep20
- Updated all glfw libs to v3.3.2.
- Removed unused linux libraries.
- Included [yet unused] linux sound library with soundloop capability.
- Added on-screen message when setpoint is saved.
- Added "rufasok64.bat" for Windows users.
- Made direct ALSA sound the default build for linux.
ver 2.4.0 -- 04jan20
- Converted to GLFW3;
- Improved compile scripts;
- Improved key bindings;