# marriam00/traffic_escape architecture

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

- Interactive diagram: https://gitdiagram.com/marriam00/traffic_escape
- Repository: https://github.com/marriam00/traffic_escape

## Overview

Traffic Escape is a playable vehicle-clearance puzzle with search-based solvers and a comparison interface. In the main workflow, a player selects a solver in the GUI; the solver explores game states under the level’s blocking rules and returns a move sequence and statistics, which the GUI plays and displays. A command-line entry point also runs the solvers and prints their results. The excerpts show the solver dispatch and core rules; unsampled GUI code and other implementation details are not inferred.

Main entry points: [`gui.py`](https://github.com/marriam00/traffic_escape/blob/main/gui.py) (Game GUI), [`main.py`](https://github.com/marriam00/traffic_escape/blob/main/main.py) (CLI Runner), [`game.py`](https://github.com/marriam00/traffic_escape/blob/main/game.py) (Game Rules), [`algorithms/best_first.py`](https://github.com/marriam00/traffic_escape/blob/main/algorithms/best_first.py) (Best-First Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interfaces"]
  node_gui["Game GUI<br/>[gui.py]"]
  node_cli["CLI Runner<br/>[main.py]"]
end

subgraph group_domain["Puzzle Domain"]
  node_game["Game Rules<br/>[game.py]"]
  node_level["Level Layout<br/>[level.py]"]
end

subgraph group_search["Search Algorithms"]
  node_dfs["Depth-First Search<br/>[dfs.py]"]
  node_ucs["Uniform-Cost Search<br/>[ucs.py]"]
  node_greedy["Greedy Search<br/>[greedy.py]"]
  node_astar["A-Star Search<br/>[astar.py]"]
  node_genetic["Genetic Search<br/>[genetic.py]"]
end

subgraph group_common["Shared Search"]
  node_best_first["Best-First Engine<br/>[best_first.py]"]
end

node_player(("Player"))

node_player -->|"plays"| node_gui
node_gui -->|"resets and checks"| node_game
node_gui -->|"reads layout"| node_level
node_gui -->|"dispatches"| node_dfs
node_gui -->|"dispatches"| node_ucs
node_gui -->|"dispatches"| node_greedy
node_gui -->|"dispatches"| node_astar
node_gui -->|"dispatches"| node_genetic
node_cli -->|"runs"| node_dfs
node_cli -->|"runs"| node_ucs
node_cli -->|"runs"| node_greedy
node_cli -->|"runs"| node_astar
node_cli -->|"runs"| node_genetic
node_game -->|"loads layout"| node_level
node_dfs -->|"expands states"| node_game
node_ucs -->|"delegates"| node_best_first
node_greedy -->|"delegates"| node_best_first
node_astar -->|"delegates"| node_best_first
node_best_first -->|"expands states"| node_game
node_genetic -->|"simulates moves"| node_game

click node_gui "https://github.com/marriam00/traffic_escape/blob/main/gui.py"
click node_cli "https://github.com/marriam00/traffic_escape/blob/main/main.py"
click node_game "https://github.com/marriam00/traffic_escape/blob/main/game.py"
click node_level "https://github.com/marriam00/traffic_escape/blob/main/level.py"
click node_dfs "https://github.com/marriam00/traffic_escape/blob/main/algorithms/dfs.py"
click node_ucs "https://github.com/marriam00/traffic_escape/blob/main/algorithms/ucs.py"
click node_greedy "https://github.com/marriam00/traffic_escape/blob/main/algorithms/greedy.py"
click node_astar "https://github.com/marriam00/traffic_escape/blob/main/algorithms/astar.py"
click node_genetic "https://github.com/marriam00/traffic_escape/blob/main/algorithms/genetic.py"
click node_best_first "https://github.com/marriam00/traffic_escape/blob/main/algorithms/best_first.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,node_cli toneBlue
class node_game,node_level toneAmber
class node_dfs,node_ucs,node_greedy,node_astar,node_genetic toneMint
class node_best_first toneRose
class node_player toneIndigo
```

## Components

### Interfaces

- [Game GUI](https://github.com/marriam00/traffic_escape/blob/main/gui.py): `gui.py`
- [CLI Runner](https://github.com/marriam00/traffic_escape/blob/main/main.py): `main.py`

### Puzzle Domain

- [Game Rules](https://github.com/marriam00/traffic_escape/blob/main/game.py): `game.py`
- [Level Layout](https://github.com/marriam00/traffic_escape/blob/main/level.py): `level.py`

### Search Algorithms

- [Depth-First Search](https://github.com/marriam00/traffic_escape/blob/main/algorithms/dfs.py): `algorithms/dfs.py`
- [Uniform-Cost Search](https://github.com/marriam00/traffic_escape/blob/main/algorithms/ucs.py): `algorithms/ucs.py`
- [Greedy Search](https://github.com/marriam00/traffic_escape/blob/main/algorithms/greedy.py): `algorithms/greedy.py`
- [A-Star Search](https://github.com/marriam00/traffic_escape/blob/main/algorithms/astar.py): `algorithms/astar.py`
- [Genetic Search](https://github.com/marriam00/traffic_escape/blob/main/algorithms/genetic.py): `algorithms/genetic.py`

### Shared Search

- [Best-First Engine](https://github.com/marriam00/traffic_escape/blob/main/algorithms/best_first.py): `algorithms/best_first.py`

### Other components

- **Player**

## Connections

- Player → Game GUI: plays (evidence: `gui.py`)
- Game GUI → Game Rules: resets and checks (evidence: `gui.py`)
- Game GUI → Level Layout: reads layout (evidence: `gui.py`)
- Game GUI → Depth-First Search: dispatches (evidence: `gui.py`)
- Game GUI → Uniform-Cost Search: dispatches (evidence: `gui.py`)
- Game GUI → Greedy Search: dispatches (evidence: `gui.py`)
- Game GUI → A-Star Search: dispatches (evidence: `gui.py`)
- Game GUI → Genetic Search: dispatches (evidence: `gui.py`)
- CLI Runner → Depth-First Search: runs (evidence: `main.py`)
- CLI Runner → Uniform-Cost Search: runs (evidence: `main.py`)
- CLI Runner → Greedy Search: runs (evidence: `main.py`)
- CLI Runner → A-Star Search: runs (evidence: `main.py`)
- CLI Runner → Genetic Search: runs (evidence: `main.py`)
- Game Rules → Level Layout: loads layout (evidence: `game.py`)
- Depth-First Search → Game Rules: expands states (evidence: `algorithms/dfs.py`)
- Uniform-Cost Search → Best-First Engine: delegates (evidence: `algorithms/ucs.py`)
- Greedy Search → Best-First Engine: delegates (evidence: `algorithms/greedy.py`)
- A-Star Search → Best-First Engine: delegates (evidence: `algorithms/astar.py`)
- Best-First Engine → Game Rules: expands states (evidence: `algorithms/best_first.py`)
- Genetic Search → Game Rules: simulates moves (evidence: `algorithms/genetic.py`)
