#sokoban #algorithm #level #position #box #structures #deadlock

soukoban

A library provides the implementation of some algorithms and data structures related to Sokoban

2 releases

0.1.1 Jan 11, 2025
0.1.0 Feb 28, 2024

#567 in Algorithms

Download history 12/week @ 2024-10-02 2/week @ 2024-12-04 11/week @ 2024-12-11 128/week @ 2025-01-08 15/week @ 2025-01-15

143 downloads per month

MIT/Apache

785KB
2K SLoC

soukoban

docs.rs Test status Code coverage

A library provides the implementation of algorithms and data structures related to Sokoban.

Features

  • Level
    • Zero-allocation lazy parsing: Parses levels lazily from an in-memory string without memory allocations except for level creation.
    • Lazy stream parsing: Parses levels lazily from a stream.
    • Map reconstruction: Reconstructs the map from the solution.
    • Normalization: Removes elements from the map that are not relevant to the solution.
    • RLE support: Enables loading of levels encoded in Run-Length Encoding (RLE) format.
  • Solution
    • Reversal move handling: Automatically interprets reversal moves as undo actions.
    • Metrics calculation: Computes metrics such as box_lines, box_changes, pushing_sessions, and player_lines.
  • Pathfinding: Finds the optimal player path to push a box to a position.
  • Deadlock detection: Detects static deadlocks and freeze deadlocks.

License

Licensed under either of

at your option.

The level files in the assets directory are licensed solely under their respective licenses, available in the LICENSE file in the directory.

Dependencies

~4MB
~84K SLoC