# adrienlabayle/sokoban architecture

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

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

## Overview

This is a small Qt desktop Sokoban game. The workflow starts with the application opening its main window, which loads a level; arrow-key events move the player and push boxes in the map model, and repainting sends the updated map through the game renderer to the screen. The map loader parses text levels, while the model holds terrain and entity positions. Relationships are limited to those visible in the excerpts; the README is empty, and no unsampled capabilities are inferred.

Main entry points: [`mainwindow.cpp`](https://github.com/adrienlabayle/sokoban/blob/main/mainwindow.cpp) (Main window), [`map.cpp`](https://github.com/adrienlabayle/sokoban/blob/main/map.cpp) (Map state and movement), [`game.cpp`](https://github.com/adrienlabayle/sokoban/blob/main/game.cpp) (Game facade), [`display.cpp`](https://github.com/adrienlabayle/sokoban/blob/main/display.cpp) (Map renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Qt interface"]
  node_app["Qt application<br/>[main.cpp]"]
  node_window["Main window<br/>[mainwindow.cpp]"]
end

subgraph group_gameplay["Gameplay"]
  node_game["Game facade<br/>[game.cpp]"]
  node_map["Map state and movement<br/>[map.cpp]"]
  node_renderer["Map renderer<br/>[display.cpp]"]
end

subgraph group_levels["Level loading"]
  node_loader["Level parser<br/>[Load.cpp]"]
end

node_player(("Player"))

node_app -->|"creates"| node_window
node_player -->|"presses keys"| node_window
node_window -->|"loads level"| node_loader
node_loader -->|"populates"| node_map
node_window -->|"moves player"| node_map
node_window -->|"requests drawing"| node_game
node_game -->|"delegates drawing"| node_renderer
node_renderer -->|"reads cells"| node_map

click node_app "https://github.com/adrienlabayle/sokoban/blob/main/main.cpp"
click node_window "https://github.com/adrienlabayle/sokoban/blob/main/mainwindow.cpp"
click node_game "https://github.com/adrienlabayle/sokoban/blob/main/game.cpp"
click node_map "https://github.com/adrienlabayle/sokoban/blob/main/map.cpp"
click node_renderer "https://github.com/adrienlabayle/sokoban/blob/main/display.cpp"
click node_loader "https://github.com/adrienlabayle/sokoban/blob/main/Load.cpp"

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_app,node_window toneBlue
class node_game,node_map,node_renderer toneAmber
class node_loader toneMint
class node_player toneIndigo
```

## Components

### Qt interface

- [Qt application](https://github.com/adrienlabayle/sokoban/blob/main/main.cpp): `main.cpp`
- [Main window](https://github.com/adrienlabayle/sokoban/blob/main/mainwindow.cpp): `mainwindow.cpp`

### Gameplay

- [Game facade](https://github.com/adrienlabayle/sokoban/blob/main/game.cpp): `game.cpp`
- [Map state and movement](https://github.com/adrienlabayle/sokoban/blob/main/map.cpp): `map.cpp`
- [Map renderer](https://github.com/adrienlabayle/sokoban/blob/main/display.cpp): `display.cpp`

### Level loading

- [Level parser](https://github.com/adrienlabayle/sokoban/blob/main/Load.cpp): `Load.cpp`

### Other components

- **Player**

## Connections

- Qt application → Main window: creates (evidence: `main.cpp`)
- Player → Main window: presses keys (evidence: `mainwindow.cpp`)
- Main window → Level parser: loads level (evidence: `mainwindow.cpp`)
- Level parser → Map state and movement: populates (evidence: `Load.cpp`)
- Main window → Map state and movement: moves player (evidence: `mainwindow.cpp`)
- Main window → Game facade: requests drawing (evidence: `mainwindow.cpp`)
- Game facade → Map renderer: delegates drawing (evidence: `game.cpp`)
- Map renderer → Map state and movement: reads cells (evidence: `display.cpp`)
