# jarrydstringy/sokoban-solver architecture

> Architecture diagram of the GitHub repository jarrydstringy/sokoban-solver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jarrydstringy/sokoban-solver
- Repository: https://github.com/jarrydstringy/sokoban-solver

## Overview

This repository is a weighted Sokoban solver with a Tkinter interface. A user loads a warehouse, can move the worker manually or request a plan, and can step through the returned action sequence. The solver models puzzle states and legal moves, then delegates search to a generic search module. The README only identifies the project; the GUI and solver excerpts establish the user workflow and solver stages. Warehouse files are sample puzzle inputs; unsampled GUI and solver behavior is not inferred beyond documented calls.

Main entry points: [`mySokobanSolver.py`](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py) (Weighted solver), [`gui_sokoban.py`](https://github.com/jarrydstringy/sokoban-solver/blob/main/gui_sokoban.py) (Sokoban GUI), [`sokoban.py`](https://github.com/jarrydstringy/sokoban-solver/blob/main/sokoban.py) (Warehouse state), [`search.py`](https://github.com/jarrydstringy/sokoban-solver/blob/main/search.py) (Search algorithms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gui["Sokoban GUI<br/>[gui_sokoban.py]"]
end

subgraph group_puzzle["Puzzle model"]
  node_warehouse["Warehouse state<br/>[sokoban.py]"]
  node_levels["Warehouse levels"]
end

subgraph group_solver["Solver"]
  node_taboo["Taboo analysis<br/>[mySokobanSolver.py]"]
  node_move_rules["Move validation<br/>[mySokobanSolver.py]"]
  node_puzzle_problem["Search problem<br/>[mySokobanSolver.py]"]
  node_weighted_solver["Weighted solver<br/>[mySokobanSolver.py]"]
  node_path_trace["Solution path<br/>[mySokobanSolver.py]"]
end

subgraph group_search["Search engine"]
  node_search_api["Search algorithms<br/>[search.py]"]
end

node_user(("Player"))

node_user -->|"operates"| node_gui
node_gui -->|"loads and updates"| node_warehouse
node_gui -->|"loads level"| node_levels
node_gui -->|"requests plan"| node_weighted_solver
node_weighted_solver -->|"models puzzle"| node_puzzle_problem
node_puzzle_problem -->|"reads configuration"| node_warehouse
node_puzzle_problem -->|"subclasses Problem"| node_search_api
node_weighted_solver -->|"runs search"| node_search_api
node_weighted_solver -.->|"uses taboo cells"| node_taboo
node_puzzle_problem -.->|"checks moves"| node_move_rules
node_weighted_solver -->|"traces result"| node_path_trace
node_weighted_solver -->|"returns actions"| node_gui

click node_gui "https://github.com/jarrydstringy/sokoban-solver/blob/main/gui_sokoban.py"
click node_warehouse "https://github.com/jarrydstringy/sokoban-solver/blob/main/sokoban.py"
click node_levels "https://github.com/jarrydstringy/sokoban-solver/tree/main/warehouses"
click node_taboo "https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py"
click node_move_rules "https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py"
click node_puzzle_problem "https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py"
click node_weighted_solver "https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py"
click node_path_trace "https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py"
click node_search_api "https://github.com/jarrydstringy/sokoban-solver/blob/main/search.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui toneBlue
class node_warehouse,node_levels toneAmber
class node_taboo,node_move_rules,node_puzzle_problem,node_weighted_solver,node_path_trace toneMint
class node_search_api toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Sokoban GUI](https://github.com/jarrydstringy/sokoban-solver/blob/main/gui_sokoban.py): `gui_sokoban.py`

### Puzzle model

- [Warehouse state](https://github.com/jarrydstringy/sokoban-solver/blob/main/sokoban.py): `sokoban.py`
- [Warehouse levels](https://github.com/jarrydstringy/sokoban-solver/tree/main/warehouses): `warehouses`

### Solver

- [Taboo analysis](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py): `mySokobanSolver.py`
- [Move validation](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py): `mySokobanSolver.py`
- [Search problem](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py): `mySokobanSolver.py`
- [Weighted solver](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py): `mySokobanSolver.py`
- [Solution path](https://github.com/jarrydstringy/sokoban-solver/blob/main/mySokobanSolver.py): `mySokobanSolver.py`

### Search engine

- [Search algorithms](https://github.com/jarrydstringy/sokoban-solver/blob/main/search.py): `search.py`

### Other components

- **Player**

## Connections

- Player → Sokoban GUI: operates (evidence: `gui_sokoban.py`)
- Sokoban GUI → Warehouse state: loads and updates (evidence: `gui_sokoban.py`)
- Sokoban GUI → Warehouse levels: loads level (evidence: `gui_sokoban.py`)
- Sokoban GUI → Weighted solver: requests plan (evidence: `gui_sokoban.py`)
- Weighted solver → Search problem: models puzzle (evidence: `mySokobanSolver.py`)
- Search problem → Warehouse state: reads configuration (evidence: `mySokobanSolver.py`)
- Search problem → Search algorithms: subclasses Problem (evidence: `mySokobanSolver.py`)
- Weighted solver → Search algorithms: runs search (evidence: `mySokobanSolver.py`)
- Weighted solver → Taboo analysis: uses taboo cells (evidence: `mySokobanSolver.py`)
- Search problem → Move validation: checks moves (evidence: `mySokobanSolver.py`)
- Weighted solver → Solution path: traces result (evidence: `mySokobanSolver.py`)
- Weighted solver → Sokoban GUI: returns actions (evidence: `gui_sokoban.py`)
