A simple terminal-based Sokoban engine written in C++, using the ncurses library.
- Install the ncurses development library
- Clone the git repository and navigate into its directory
git clone https://github.com/JosCla/SimpleSoko && cd SimpleSoko
- Build the program
make
- Run the program
./soks [path to level file]
The goal of Sokoban is to push all of the boxes in a level onto the level's target squares. The boxes can only be pushed if there is no wall in their path, and two boxes in a row cannot be pushed at the same time.
Controls:
Arrow keys - Move
Z - Undo previous move
Q - Quit game
The first three numbers in the file represent the height of the level, the width of the level, and the number of metadata entries to read.
The next few rows (number of rows specified by the level height) represent the level itself. Here is what each character represents:
[#] - Wall
[ ] - Floor
[.] - Target
[@] - Player
[+] - Player on Target
[$] - Box
[*] - Box on Target
The final few rows (number of rows specified by the number of metadata entries) represent the metadata, with the text before the colon being the name of the entry, and the text after the colon being the value of the entry.
A sample level file (found at levels/sample.soks
) follows:
4 6 3
######
#@ $.#
# *#
######
Title:Sample
Author:J
Description:Sample level to demonstrate the file format
In order to play a level, find the path of the level relative to the root directory of the program.
Then, use the following to play the level:
./soks [path to level file]
For example, if your level file was located at levels/sample.soks
, you would use:
./soks levels/sample.soks
A few sample levels have been provided with the program, and they can be found in the levels
directory. Take a look in there if you want to try some of them out!