# kunal0040/text-adventure-game-python architecture

> Architecture diagram of the GitHub repository kunal0040/text-adventure-game-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kunal0040/text-adventure-game-python
- Repository: https://github.com/kunal0040/text-adventure-game-python

## Overview

This is a terminal-based, data-driven noir mystery adventure. The player receives the case, explores locations, questions characters, gathers and inspects evidence, then reaches an ending based on their evidence and choices. The README also documents visited-room fast travel, lock validation, animated pacing, and changing room states; these are represented at the level supported by the excerpts. Source excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`main.py`](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py) (Command dispatch), [`world_map.py`](https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py) (Locations and rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Game engine"]
  node_terminal["Terminal commands<br/>[main.py]"]
  node_dispatch["Command dispatch<br/>[main.py]"]
  node_navigation["Room navigation<br/>[main.py]"]
  node_room_view["Room presentation<br/>[main.py]"]
  node_pacing["Text pacing<br/>[main.py]"]
  node_case_controls["Help and controls<br/>[main.py]"]
end

subgraph group_case["Investigation"]
  node_interrogation["Character dialogue<br/>[main.py]"]
  node_investigation["Room actions<br/>[main.py]"]
  node_evidence["Evidence handling<br/>[main.py]"]
  node_inspection["Clue inspection<br/>[main.py]"]
  node_inventory["Case inventory<br/>[main.py]"]
  node_resolution["Ending evaluation<br/>[main.py]"]
end

subgraph group_story["Story data"]
  node_room_data["Locations and rules<br/>[world_map.py]"]
  node_character_data["Characters and dialogue<br/>[world_map.py]"]
  node_ending_data["Case resolutions<br/>[world_map.py]"]
end

node_player(("Detective player"))

node_player -->|"enters commands"| node_terminal
node_terminal -->|"parses and dispatches"| node_dispatch
node_dispatch -->|"routes movement"| node_navigation
node_dispatch -->|"routes talk"| node_interrogation
node_dispatch -->|"routes actions"| node_investigation
node_dispatch -->|"routes pickup"| node_evidence
node_dispatch -->|"routes inspection"| node_inspection
node_dispatch -->|"routes inventory"| node_inventory
node_dispatch -->|"routes help"| node_case_controls
node_navigation -->|"reads exits and rules"| node_room_data
node_navigation -->|"displays destination"| node_room_view
node_room_view -->|"reads room details"| node_room_data
node_interrogation -->|"reads dialogue and actions"| node_room_data
node_interrogation -->|"dispatches matching action"| node_investigation
node_interrogation -->|"checks case readiness"| node_resolution
node_investigation -->|"reads and changes room state"| node_room_data
node_investigation -->|"collects spawned clues"| node_evidence
node_evidence -->|"reads and removes items"| node_room_data
node_evidence -->|"adds collected clues"| node_inventory
node_evidence -->|"offers inspection"| node_inspection
node_inspection -->|"reads examination text"| node_room_data
node_inspection -->|"checks held clues"| node_inventory
node_resolution -->|"checks evidence"| node_inventory
node_resolution -->|"selects ending"| node_ending_data
node_room_view -->|"prints paced text"| node_pacing
node_case_controls -->|"reads available actions"| node_room_data

click node_terminal "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_dispatch "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_navigation "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_room_view "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_pacing "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_case_controls "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_interrogation "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_investigation "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_evidence "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_inspection "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_inventory "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_resolution "https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py"
click node_room_data "https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py"
click node_character_data "https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py"
click node_ending_data "https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.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_terminal,node_dispatch,node_navigation,node_room_view,node_pacing,node_case_controls toneBlue
class node_interrogation,node_investigation,node_evidence,node_inspection,node_inventory,node_resolution toneAmber
class node_room_data,node_character_data,node_ending_data toneMint
class node_player toneIndigo
```

## Components

### Game engine

- [Terminal commands](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Command dispatch](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Room navigation](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Room presentation](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Text pacing](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Help and controls](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`

### Investigation

- [Character dialogue](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Room actions](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Evidence handling](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Clue inspection](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Case inventory](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`
- [Ending evaluation](https://github.com/kunal0040/text-adventure-game-python/blob/main/main.py): `main.py`

### Story data

- [Locations and rules](https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py): `world_map.py`
- [Characters and dialogue](https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py): `world_map.py`
- [Case resolutions](https://github.com/kunal0040/text-adventure-game-python/blob/main/world_map.py): `world_map.py`

### Other components

- **Detective player**

## Connections

- Detective player → Terminal commands: enters commands
- Terminal commands → Command dispatch: parses and dispatches
- Command dispatch → Room navigation: routes movement
- Command dispatch → Character dialogue: routes talk
- Command dispatch → Room actions: routes actions
- Command dispatch → Evidence handling: routes pickup
- Command dispatch → Clue inspection: routes inspection
- Command dispatch → Case inventory: routes inventory
- Command dispatch → Help and controls: routes help
- Room navigation → Locations and rules: reads exits and rules
- Room navigation → Room presentation: displays destination
- Room presentation → Locations and rules: reads room details
- Character dialogue → Locations and rules: reads dialogue and actions
- Character dialogue → Room actions: dispatches matching action
- Character dialogue → Ending evaluation: checks case readiness
- Room actions → Locations and rules: reads and changes room state
- Room actions → Evidence handling: collects spawned clues
- Evidence handling → Locations and rules: reads and removes items
- Evidence handling → Case inventory: adds collected clues
- Evidence handling → Clue inspection: offers inspection
- Clue inspection → Locations and rules: reads examination text
- Clue inspection → Case inventory: checks held clues
- Ending evaluation → Case inventory: checks evidence
- Ending evaluation → Case resolutions: selects ending
- Room presentation → Text pacing: prints paced text
- Help and controls → Locations and rules: reads available actions
