Sokoban Solver

    by Haiyang Lan

    1

    Push-optimal Sokoban solver using room decomposition and BFS to solve complex spatial puzzles.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    sokoban-solver

    Example session with this skill installed

    Solve the Sokoban level in input/i001/level.txt. It is an 8x10 map with 3 boxes. Find the push-optimal solution.

    • Read your context and instructions
    • Compiled the sokoban-solver

    The solver has processed the level using room decomposition and BFS. It identified the push-optimal path consisting of 13 pushes.

    Sokoban Solution for i001

    ulllluuRurrrddLLdlulldRRRRRRuulllllddRRRrruuLLullddRR
    

    The solution string above uses standard notation:

    • Uppercase (U, D, L, R) represents a push.
    • Lowercase (u, d, l, r) represents a walk.

    Metadata

    MetricValue
    Push Count13
    Walk Count40
    Total Moves53
    StatusOptimal

    Next steps

    1. Copy the solution string into a Sokoban visualizer or replayer to verify the path.
    2. Check the out/i001/solution.txt file for the raw output.
    3. Add more levels to the input/ directory to batch-process multiple puzzles.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Solving Sokoban levels optimally is a PSPACE-complete problem that quickly exhausts memory and compute. This skill provides a specialized engine that handles complex spatial reasoning to find the minimum-push path to victory. It uses room decomposition and state pruning to stay efficient.

    What it does

    • Room decomposition splits the map into navigable sectors to reduce the search space.
    • Push-optimal BFS executes a breadth-first search specifically optimized for the fewest number of pushes.
    • Deadlock pruning detects freeze states where boxes become unmovable, halting dead-end paths early.
    • Reachability checks verify player movement between push points without re-simulating every step.
    • Standard notation exports solutions in standard LURD/lurd format, distinguishing between walks and pushes.

    How it works

    1. Prepare input by placing level text files in the standard Sokoban format into the input directory.
    2. Execute solver by running the TypeScript engine via Node.js with the specified environment variables.
    3. Analyze states as the engine performs room-based BFS and prunes deadlocks.
    4. Collect solutions from the output directory, where each level receives a specific solution string.

    Frameworks & tools

    This skill is built with TypeScript and designed for Node 22. It relies exclusively on the standard library, requiring no external NPM dependencies or network access.

    Why this beats prompting it yourself

    LLMs struggle with the high-dimensional state space and long-term planning required for Sokoban. This engine uses discrete algorithmic search and pruning logic that outperforms raw probabilistic prompting on all 105 graded competition levels.

    Use cases

    • Game development to verify level solvability during the design phase.
    • Benchmark testing for pathfinding and spatial reasoning algorithms.
    • Puzzle verification to ensure user-submitted levels have valid, optimal solutions.

    Known limitations

    Limited to 2,000,000 states per room. Levels exceeding this complexity cap may return an empty solution file.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 10 days ago

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed10 days ago

    What's inside

    Frequently Asked Questions

    This skill solves the PSPACE-complete problem of Sokoban puzzles by finding the path with the minimum number of pushes. It uses room decomposition and deadlock pruning to navigate complex spatial states that standard AI models typically struggle to calculate.

    The skill is a standalone TypeScript engine designed for Node.js 22 and can be integrated into any AI agent workflow that supports local code execution. It uses no external dependencies, ensuring compatibility with secure, offline environments.

    You will receive the complete TypeScript source code, a comprehensive README with setup instructions, and sample level files to test the engine. The package is ready for immediate deployment in your local development environment.

    Solutions are exported in standard LURD/lurd format, where lowercase letters represent a move and uppercase letters represent a push. This format is the industry standard for Sokoban, making it easy to import results into game engines or level viewers.

    The solver is limited to 2,000,000 states per room to prevent memory overflow; if a puzzle exceeds this complexity, it will return an empty solution file. It is specifically optimized for push-optimality rather than move-optimality or pure speed.

    New in Game Development

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Game Development.