Awesome
RufasSok
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.5.9/rsok24jan24.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.
RufaSok ...
Minimalist Sokoban
using GLFW3, OpenAL audio
with embedded live solvers
What's new:
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.
See complete revision history at end of file
RufaSok Introduction
This is a minimalistic version of the 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.
Controls
solver keys [within parentheses]:
- (.) hbox4 [most capable];
- (=) bfs#1 [for small puzzles];
- (,) bfs#2 [medium]
- (0..5) sets hbox4 method
movement keys:
- w a s d
- (up) (lf) (dn) (rt)
other keys:
- (u) undo
- (n) next level current set
- (p) previous level current set
- (Lshift) previous set
- (Rshift) next set
- (z) set a setpoint
- (r) reset to z-key setpoint
- (o) restart from beginning
- (esc) quit
Features
- 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, hbox4
- 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.
Embedded Autosolver Function
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 [hbox4] is initiated with the (.)-key. It is the most capable embedded solver.
Note: all 3 solvers can fail if the puzzle is too large (256 or more valid puzzle positions).
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.
Finally, a single command-line argument (decimal float) specifies a persistent timeout interval to wait for the internal autosolver before giving up. The default is 10.0 seconds. A new setting remains in effect until a different setting is specified using a command-line argument.
The default method used by embedded solver Hbox4 [ (.)-key ] can now be reset using the k-key, where k is 0..5.
6 method options for hbox4:
* 0 "quickest"
* 1 more "efficient"
* 2 suppress hungarian estimator (for dense puzzles)
* 3 like 0 but tries to reduce total moves
* 4 like 1 but tries to reduce total moves [default]
* 5 like 2 but tries to reduce total moves
For further details see:
* https://sourceforge.net/projects/hbox4/
External Autosolvers
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 TotalLevels LevelToSolve]
EG on windows type: binw64\iplr3r.exe games\pico_22.sok 22 3 ...to solve the 3rd level in file pico_22.sok.
EG on Linux type hbox4 games/pico_22.sok 22 3
EG on OSX type hbox4_osx games/pico_22.sok 22 3
what is special about this project?
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 is among very few modern OpenGL games where a single pre-built executable can run on multiple Linux distros without 3rd party add-ons!
Setup & Running:
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 "rufasok" OR you may also double click the icon for rufasok in file manager. The command rufasok 20.0 sets the autosolver-wait to 20 seconds...double the default. This might help when using the second method ".", which is hbox, the most powerful of the 3.
You can also use the Windows executable under wine, thusly: * wine cmd < rufasok.bat * wine binw64/rufasok.exe
Windows users type: "rufasok.bat", or to reset solver wait to 10 seconds type binw64\rufasok.exe 10.0
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)
Other Details
The (h) key brings up a help menu that looks like this:
- (f) = grab/keep windows focus toggle (default=off)
- (esc) = exit
- (u) = undo last move
- (r) = reset to setpoint
- (o) = restart Original puzzle
- (n) = next-puzzle in current file
- (p) = previous-puzzle in current file
- (R-shift) = next-file
- (L-shift) = previous-file
- (z) = define setPoint...subsequent presses of (r)-key will restore THIS configuration
- (2,f2) = bigger
- (1,f1) = smaller
- (c) = next skin Color
- (=) = try autosolver #1 (iplr3r)
- (.) = try autosolver #2 (hbox4...most capable)
- (,) = try autosolver #3 (ibox3r)
- box-click: possible destinations [not perfect]
- goal-click: possible sources [not perfect either]
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. But now, the f-key toggles a game policy that forcibly keeps focus, although it is generally considered improper to do this.
Adding Your Own Sokoban Files
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 or rufasok.bat.
For example on linux you could type
"rufasok 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.
Build Requirements:
- a recent GNAT Ada compiler from AdaLibre;
- graphics card that supports OpenGL version 3.3 or later;
Build instructions:
In the ~/buildScripts/ directory try:
Mac/OSX => lbuildall.sh
Linux => mbuildall.sh
msWin64 => setpath64.bat + wbuildall.bat
Note that the above windows built scripts might need to be adjusted. Please read ~/docs/gnuAdaOnWindows.txt.
The distributed linux executable requires glibc v2.14 or newer. That means if your distribution is older than june 2011, it probably will not run, and you will need to recompile.
Note that linux users with wine installed can run with the command:
wine binw64/rufasok.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 command to build the external autosolvers [on linux] is simply: cccgnu.sh ibox3r cccgnu.sh iplr3r cccgnu.sh hbox4
and on Windows: ccc.bat ibox3r ccc.bat iplr3r ccc.bat hbox4
===================================================================
License
RufaSok itself is covered by the GNU GPL v3 as indicated in the sources:
Copyright (C) 2024 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/.
Download Sites for all my games:
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
Media Files
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.
SoundFiles (applause,fanfare,whoosh)
...are from freesound.org and are covered by the Creative Commons CC0 license documented in the accompanying file creativeCommonsCC0.txt.
Revision History:
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 "rufasok.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;