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/2.6.4/sok29mar25.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
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.
See complete revision history at end of file.
This is a minimalistic version of an interactive, OpenGL Sokoban puzzle game with 3 external solvers, and 3 embedded auto-solvers designed to help you to learn to solve puzzles on your own.
The objective is to push all the movable objects onto their targets. And the embedded solvers can help you a little, or a lot, when you get stuck.
solver keys [within parentheses]:
-
(.) hbox [most capable];
-
(=) bfs#1 [iplr; for small puzzles];
-
(,) bfs#2 [ibox; medium]
-
(0..9) sets hbox method [see details below]
movement keys:
- w a s d
- (up) (lf) (dn) (rt)
other keys:
-
(+) increase wait timeout (numKeypad)
-
(-) decrease wait timeout (numKeypad)
-
(u) undo
-
(n) next level current file
-
(p) previous level current file
-
(ctrl)+(n) next file
-
(ctrl)+(p) previous file
-
(z) set a setpoint
-
(r) reset to z-key setpoint (restart is no setpoint)
-
(ctrl)+(r) restart from beginning
-
(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.
Note: all 3 solvers can fail if the puzzle is too large or difficult.
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.
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 default method used by embedded solver Hbox [ (.)-key ] can now be set using the k-key, where k is 0..5.
- 0 "pull-efficient"
- 1 "move-efficient"
- 2 suppress hungarian estimator (for dense puzzles)
- 3 like 0 but single-step
- 4 like 0 but using only 5-heuristics
- 5 like 0 but using 1-heuristic (meth10)
- 6 like 1 but using 1-heuristic (meth11)
- 7 like 2 but using 1-heuristic (meth12)
- 8 like 3 but using 1-heuristic (meth13)
- 9 like 4 but using 1-heuristic (meth14)
For further details see:
* https://sourceforge.net/projects/hbox4/
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 am short of 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: fastrgv@gmail.com
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 (h) key brings up a help menu that looks like this:
- (esc) = exit
- (u) = undo last move
- (n) = next-puzzle in current file
- (p) = previous-puzzle in current file
- (ctrl)+(n) = next-file
- (ctrl)+(p) = previous-file
- (z) = define setPoint...subsequent presses of (r)-key will restore THIS configuration
- (r) = reset to setpoint
- (ctrl)+(r) = restart Original puzzle
- (c) = next skin Color
- (=) = try autosolver #1 (iplr3r)
- (.) = try autosolver #2 (hbox...most capable)
- (,) = try autosolver #3 (ibox3r)
- use mouse drag to change size of puzzle window
- (0..9) set solution method for hbox, where :
- 0 "quickest" using 6 heuristics+inertia
- 1 "move-efficient" +inertia
- 2 suppress hungarian estimator (for dense puzzles)
- 3 like 0 but single-step
- 4 like 0 but using only 5-heuristics
- 5 like 0 but using 1-heuristic (meth10)
- 6 like 1 but using 1-heuristic (meth11)
- 7 like 2 but using 1-heuristic (meth12)
- 8 like 3 but using 1-heuristic (meth13)
- 9 like 4 but using 1-heuristic (meth14)
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, 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 period-key. On the other hand, the "puller" will generally give the most efficient solutions, when it does work.
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.
Note also that a specific sokoban file may be tested by naming it on the terminal window command line with the following syntax:
rufasok sokfilepath maxlevels startlevel
where rufasok can be
rufasok_gnu, rufasok_osx, or rufasok64.bat
For example on linux you could type
"rufasok_gnu games/original_50.sok 50 2"
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.
I included a new "beta-test" Puller-Sokoban app that may still have some bugs:
- 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 (which are no longer pushable).
There is only one autosolver, and it is invoked with the (=)-key.
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, 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.
- 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.bat ibox3r cccosx.bat iplr3r cccosx.bat hbox
===================================================================
This app is covered by the GNU GPL v3 as indicated in the sources:
Copyright (C) 2025 fastrgv@gmail.com
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.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;