# niral-bit/terminal-dungeons architecture

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

- Interactive diagram: https://gitdiagram.com/niral-bit/terminal-dungeons
- Repository: https://github.com/niral-bit/terminal-dungeons

## Overview

Terminal Dungeons is a small command-line, turn-based RPG. Running game.py starts a single combat loop: the player chooses attack or heal, the game updates health and reports whether the player or monster wins. The README documents these actions; the implementation combines input, combat arithmetic, and outcome handling in one function. There are no separate storage or integration layers.

Main entry points: [`game.py`](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py) (Combat loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_combat["Combat runtime"]
  node_start["Game entry<br/>[game.py]"]
  node_combat_loop["Combat loop<br/>[game.py]"]
  node_action["Action input<br/>[game.py]"]
  node_attack["Attack damage<br/>[game.py]"]
  node_heal["Healing<br/>[game.py]"]
  node_enemy["Enemy turn<br/>[game.py]"]
  node_outcome["Combat outcome<br/>[game.py]"]
end

node_player(("Player"))
node_random["Random number generator"]

node_player -->|"launches"| node_start
node_start -->|"starts"| node_combat_loop
node_combat_loop -->|"prompts"| node_action
node_player -->|"chooses"| node_action
node_action -->|"dispatches"| node_attack
node_action -->|"dispatches"| node_heal
node_attack -->|"draws damage"| node_random
node_heal -->|"updates HP"| node_combat_loop
node_attack -->|"updates enemy HP"| node_combat_loop
node_combat_loop -->|"runs enemy turn"| node_enemy
node_enemy -->|"draws damage"| node_random
node_enemy -->|"updates player HP"| node_combat_loop
node_combat_loop -->|"selects result"| node_outcome

click node_start "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_combat_loop "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_action "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_attack "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_heal "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_enemy "https://github.com/niral-bit/terminal-dungeons/blob/main/game.py"
click node_outcome "https://github.com/niral-bit/terminal-dungeons/blob/main/game.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_start,node_combat_loop,node_action,node_attack,node_heal,node_enemy,node_outcome toneBlue
class node_player,node_random toneIndigo
```

## Components

### Combat runtime

- [Game entry](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Combat loop](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Action input](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Attack damage](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Healing](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Enemy turn](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`
- [Combat outcome](https://github.com/niral-bit/terminal-dungeons/blob/main/game.py): `game.py`

### Other components

- **Player**
- **Random number generator**

## Connections

- Player → Game entry: launches (evidence: `README.md`)
- Game entry → Combat loop: starts (evidence: `game.py`)
- Combat loop → Action input: prompts (evidence: `game.py`)
- Player → Action input: chooses (evidence: `README.md`)
- Action input → Attack damage: dispatches (evidence: `game.py`)
- Action input → Healing: dispatches (evidence: `game.py`)
- Attack damage → Random number generator: draws damage (evidence: `game.py`)
- Healing → Combat loop: updates HP (evidence: `game.py`)
- Attack damage → Combat loop: updates enemy HP (evidence: `game.py`)
- Combat loop → Enemy turn: runs enemy turn (evidence: `game.py`)
- Enemy turn → Random number generator: draws damage (evidence: `game.py`)
- Enemy turn → Combat loop: updates player HP (evidence: `game.py`)
- Combat loop → Combat outcome: selects result (evidence: `game.py`)
