Skip to content

mezpusz/sokohard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

sokohard

sokohard is a Sokoban map generator that creates relatively hard-to-solve maps. Solving Sokoban levels is shown to be PSPACE-complete and the task of automatically generating hard but still solvable levels can be challenging.

Sokohard uses a procedural approach that takes certain patterns of size 3x3 to create maps of arbitrary size then places the goal fields and use backtracking to find a good start position far away from them. "Far away" can be measured by a lot of metrics, such as moves, box pushes, etc. Sokohard currently uses a mix of moves and box pushes.

The output level is written to a .sok file that uses the format described here. A possible solution is also outputted to a file postfixed _solution.sok.

Requirements

  • CMake
  • clang

Building locally

After cloning the repository open up a terminal and hit

$ cmake .
$ make

in the root folder.

This will create the output files with the standalone executable sokohard in the out folder.

You can also open it in Xcode or any editor that CMake supports.

$ cmake . -G Xcode
$ open sokohard.xcodeproj

in the root folder.

Usage

Running without parameters generates a 2x2 (i.e. 6x6 with the pattern size) map with 2 boxes and outputs it to the out.sok file.

$ ./sokohard

Parameters are the following:

  • -w - Width of the map (not including pattern width) - defaults to 2
  • -h - Height of the map (not including pattern height) - defaults to 2
  • -b - Boxes to be placed on the map - defaults to 2
  • -o - Output file name - defaults to out
  • -s - Seed (32-bit integer) for the random generator. - default is current UNIX-epoch timestamp
  • --box-changes - The box changes (pushes) metric is used instead of the default player moves metric.

About

Hard sokoban map generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published