# etturo/fly-in architecture

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

- Interactive diagram: https://gitdiagram.com/etturo/fly-in
- Repository: https://github.com/etturo/fly-in

## Overview

Fly-in is an interactive Pygame drone-routing simulator. The user launches the application, browses difficulty folders and selects a text map; the application parses it into a graph, solves routes, then advances and renders drone traffic with playback and undo controls. The graph model captures zone types and capacities, while the pathfinder and simulator handle flow allocation and turn-by-turn movement. README capabilities include restricted-zone meta-zones, snapshot history, viewport scaling and end-of-run statistics. Some links rely on README or source-index references; unsampled implementation details are not asserted.

Main entry points: [`src/application.py`](https://github.com/etturo/fly-in/blob/main/src/application.py) (Application loop), [`src/simulator.py`](https://github.com/etturo/fly-in/blob/main/src/simulator.py) (Traffic simulator), [`src/graph.py`](https://github.com/etturo/fly-in/blob/main/src/graph.py) (Topology graph), [`src/parser.py`](https://github.com/etturo/fly-in/blob/main/src/parser.py) (Map parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interactive application"]
  node_app["Application loop<br/>[application.py]"]
  node_entry["Launch entry<br/>[__main__.py]"]
  node_buttons["UI controls<br/>[buttons.py]"]
end

subgraph group_topology["Map and graph"]
  node_maps["Map collection"]
  node_parser["Map parser<br/>[parser.py]"]
  node_graph["Topology graph<br/>[graph.py]"]
  node_zone["Zones<br/>[zone.py]"]
  node_connection["Links<br/>[connection.py]"]
end

subgraph group_routing["Routing and simulation"]
  node_pathfinder["Pathfinder<br/>[pathfinder.py]"]
  node_simulator["Traffic simulator<br/>[simulator.py]"]
  node_drone["Drone state<br/>[drone.py]"]
end

subgraph group_presentation["Visualization"]
  node_renderer["Pygame renderer<br/>[renderer.py]"]
  node_utilities["Modes and colors<br/>[utils.py]"]
end

node_user(("Player"))

node_user -->|"operates"| node_app
node_entry -->|"starts"| node_app
node_app -->|"browses and loads"| node_maps
node_app -->|"parses maps"| node_parser
node_parser -->|"builds"| node_graph
node_parser -->|"creates"| node_zone
node_parser -->|"creates"| node_connection
node_graph -->|"stores"| node_zone
node_graph -->|"stores"| node_connection
node_app -->|"sets graph and solves"| node_simulator
node_simulator -->|"finds routes"| node_pathfinder
node_pathfinder -->|"reads topology"| node_graph
node_pathfinder -->|"evaluates costs"| node_zone
node_simulator -->|"creates and advances"| node_drone
node_simulator -->|"uses capacities"| node_graph
node_app -->|"updates and renders"| node_renderer
node_renderer -->|"draws topology"| node_graph
node_renderer -->|"draws movement"| node_drone
node_app -->|"handles controls"| node_buttons
node_app -->|"uses application modes"| node_utilities
node_renderer -->|"uses colors"| node_utilities
node_user -->|"clicks"| node_buttons
node_app -->|"steps or reverses"| node_simulator
node_simulator -->|"records movement history"| node_drone

click node_app "https://github.com/etturo/fly-in/blob/main/src/application.py"
click node_entry "https://github.com/etturo/fly-in/blob/main/src/__main__.py"
click node_buttons "https://github.com/etturo/fly-in/blob/main/src/buttons.py"
click node_maps "https://github.com/etturo/fly-in/tree/main/resources/maps"
click node_parser "https://github.com/etturo/fly-in/blob/main/src/parser.py"
click node_graph "https://github.com/etturo/fly-in/blob/main/src/graph.py"
click node_zone "https://github.com/etturo/fly-in/blob/main/src/zone.py"
click node_connection "https://github.com/etturo/fly-in/blob/main/src/connection.py"
click node_pathfinder "https://github.com/etturo/fly-in/blob/main/src/pathfinder.py"
click node_simulator "https://github.com/etturo/fly-in/blob/main/src/simulator.py"
click node_drone "https://github.com/etturo/fly-in/blob/main/src/drone.py"
click node_renderer "https://github.com/etturo/fly-in/blob/main/src/renderer.py"
click node_utilities "https://github.com/etturo/fly-in/blob/main/src/utils.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_app,node_entry,node_buttons toneBlue
class node_maps,node_parser,node_graph,node_zone,node_connection toneAmber
class node_pathfinder,node_simulator,node_drone toneMint
class node_renderer,node_utilities toneRose
class node_user toneIndigo
```

## Components

### Interactive application

- [Application loop](https://github.com/etturo/fly-in/blob/main/src/application.py): `src/application.py`
- [Launch entry](https://github.com/etturo/fly-in/blob/main/src/__main__.py): `src/__main__.py`
- [UI controls](https://github.com/etturo/fly-in/blob/main/src/buttons.py): `src/buttons.py`

### Map and graph

- [Map collection](https://github.com/etturo/fly-in/tree/main/resources/maps): `resources/maps`
- [Map parser](https://github.com/etturo/fly-in/blob/main/src/parser.py): `src/parser.py`
- [Topology graph](https://github.com/etturo/fly-in/blob/main/src/graph.py): `src/graph.py`
- [Zones](https://github.com/etturo/fly-in/blob/main/src/zone.py): `src/zone.py`
- [Links](https://github.com/etturo/fly-in/blob/main/src/connection.py): `src/connection.py`

### Routing and simulation

- [Pathfinder](https://github.com/etturo/fly-in/blob/main/src/pathfinder.py): `src/pathfinder.py`
- [Traffic simulator](https://github.com/etturo/fly-in/blob/main/src/simulator.py): `src/simulator.py`
- [Drone state](https://github.com/etturo/fly-in/blob/main/src/drone.py): `src/drone.py`

### Visualization

- [Pygame renderer](https://github.com/etturo/fly-in/blob/main/src/renderer.py): `src/renderer.py`
- [Modes and colors](https://github.com/etturo/fly-in/blob/main/src/utils.py): `src/utils.py`

### Other components

- **Player**

## Connections

- Player → Application loop: operates (evidence: `README.md`)
- Launch entry → Application loop: starts (evidence: `src/__main__.py`)
- Application loop → Map collection: browses and loads (evidence: `README.md`)
- Application loop → Map parser: parses maps (evidence: `src/application.py`)
- Map parser → Topology graph: builds (evidence: `src/parser.py`)
- Map parser → Zones: creates (evidence: `src/parser.py`)
- Map parser → Links: creates (evidence: `src/parser.py`)
- Topology graph → Zones: stores (evidence: `src/graph.py`)
- Topology graph → Links: stores (evidence: `src/graph.py`)
- Application loop → Traffic simulator: sets graph and solves (evidence: `src/application.py`)
- Traffic simulator → Pathfinder: finds routes (evidence: `src/simulator.py`)
- Pathfinder → Topology graph: reads topology (evidence: `src/pathfinder.py`)
- Pathfinder → Zones: evaluates costs (evidence: `src/pathfinder.py`)
- Traffic simulator → Drone state: creates and advances (evidence: `src/simulator.py`)
- Traffic simulator → Topology graph: uses capacities (evidence: `src/simulator.py`)
- Application loop → Pygame renderer: updates and renders (evidence: `src/application.py`)
- Pygame renderer → Topology graph: draws topology (evidence: `src/renderer.py`)
- Pygame renderer → Drone state: draws movement (evidence: `src/renderer.py`)
- Application loop → UI controls: handles controls (evidence: `src/application.py`)
- Application loop → Modes and colors: uses application modes (evidence: `src/application.py`)
- Pygame renderer → Modes and colors: uses colors (evidence: `src/renderer.py`)
- Player → UI controls: clicks (evidence: `README.md`)
- Application loop → Traffic simulator: steps or reverses (evidence: `README.md`)
- Traffic simulator → Drone state: records movement history (evidence: `README.md`)
