# mtinggaard/adventure architecture

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

- Interactive diagram: https://gitdiagram.com/mtinggaard/adventure
- Repository: https://github.com/mtinggaard/adventure

## Overview

This is a Java text-adventure game. The player enters commands in the console; the interface routes movement and item actions through Adventure, which coordinates the player and a room map, and the interface displays the resulting room, inventory, health, or command outcome. The domain includes traversable rooms, collectible items, consumables and weapons, plus room-position diagrams. The excerpts show weapon equipping but no completed attack behavior. Relationships below are limited to calls and references shown in excerpts or the source index; several domain classes were not excerpted.

Main entry points: [`src/AdventureGame/Map.java`](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Map.java) (Room map), [`src/AdventureGame/Player.java`](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Player.java) (Player state), [`src/AdventureGame/UserInterface.java`](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/UserInterface.java) (Command interface), [`src/AdventureGame/Position.java`](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Position.java) (Position selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Console interaction"]
  node_main["Game launcher<br/>[Main.java]"]
  node_ui["Command interface<br/>[UserInterface.java]"]
end

subgraph group_world["World and navigation"]
  node_adventure["Game coordinator<br/>[Adventure.java]"]
  node_map["Room map<br/>[Map.java]"]
  node_room["Room<br/>[Room.java]"]
end

subgraph group_player["Player actions"]
  node_player_state["Player state<br/>[Player.java]"]
end

subgraph group_items["Items and outcomes"]
  node_item["Base item<br/>[Item.java]"]
  node_consumable["Consumable<br/>[Consumable.java]"]
  node_food["Food<br/>[Food.java]"]
  node_liquid["Liquid<br/>[Liquid.java]"]
  node_weapon["Weapon base<br/>[Weapon.java]"]
  node_melee["Melee weapon<br/>[MeleeWeapon.java]"]
  node_ranged["Ranged weapon<br/>[RangedWeapon.java]"]
  node_outcome["Consume outcome"]
  node_result["Consume result<br/>[ConsumeResult.java]"]
end

subgraph group_display["Map display"]
  node_position["Position selector<br/>[Position.java]"]
  node_visual["Room diagrams<br/>[Visual.java]"]
end

node_user(("Player"))

node_user -->|"enters commands"| node_ui
node_main -->|"starts interface"| node_ui
node_ui -->|"routes actions"| node_adventure
node_ui -->|"requests map view"| node_position
node_adventure -->|"builds and queries"| node_map
node_adventure -->|"delegates actions"| node_player_state
node_map -->|"creates rooms"| node_room
node_map -->|"populates rooms"| node_item
node_map -->|"places items"| node_food
node_map -->|"places items"| node_liquid
node_map -->|"places weapons"| node_melee
node_map -->|"places weapons"| node_ranged
node_player_state -->|"moves and transfers items"| node_room
node_player_state -->|"manages inventory"| node_item
node_player_state -->|"applies health points"| node_consumable
node_player_state -->|"equips weapon"| node_weapon
node_player_state -->|"returns consume outcome"| node_outcome
node_ui -->|"displays consume result"| node_outcome
node_consumable -->|"extends"| node_item
node_food -->|"extends"| node_consumable
node_liquid -->|"extends"| node_consumable
node_weapon -->|"extends"| node_item
node_melee -->|"extends"| node_weapon
node_ranged -->|"extends"| node_weapon
node_outcome -->|"contains status"| node_result
node_position -->|"reads game state"| node_adventure
node_position -->|"checks current room"| node_player_state
node_position -->|"selects room diagram"| node_visual

click node_main "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Main.java"
click node_ui "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/UserInterface.java"
click node_adventure "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Adventure.java"
click node_map "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Map.java"
click node_room "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Room.java"
click node_position "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Position.java"
click node_visual "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Visual.java"
click node_player_state "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Player.java"
click node_item "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Item.java"
click node_consumable "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Consumable.java"
click node_food "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Food.java"
click node_liquid "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Liquid.java"
click node_weapon "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Weapon.java"
click node_melee "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/MeleeWeapon.java"
click node_ranged "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/RangedWeapon.java"
click node_outcome "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/ConsumeOutcome.java"
click node_result "https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/ConsumeResult.java"

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_main,node_ui toneBlue
class node_adventure,node_map,node_room toneAmber
class node_player_state toneMint
class node_item,node_consumable,node_food,node_liquid,node_weapon,node_melee,node_ranged,node_outcome,node_result toneRose
class node_position,node_visual,node_user toneIndigo
```

## Components

### Console interaction

- [Game launcher](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Main.java): `src/AdventureGame/Main.java`
- [Command interface](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/UserInterface.java): `src/AdventureGame/UserInterface.java`

### World and navigation

- [Game coordinator](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Adventure.java): `src/AdventureGame/Adventure.java`
- [Room map](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Map.java): `src/AdventureGame/Map.java`
- [Room](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Room.java): `src/AdventureGame/Room.java`

### Player actions

- [Player state](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Player.java): `src/AdventureGame/Player.java`

### Items and outcomes

- [Base item](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Item.java): `src/AdventureGame/Item.java`
- [Consumable](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Consumable.java): `src/AdventureGame/Consumable.java`
- [Food](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Food.java): `src/AdventureGame/Food.java`
- [Liquid](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Liquid.java): `src/AdventureGame/Liquid.java`
- [Weapon base](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Weapon.java): `src/AdventureGame/Weapon.java`
- [Melee weapon](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/MeleeWeapon.java): `src/AdventureGame/MeleeWeapon.java`
- [Ranged weapon](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/RangedWeapon.java): `src/AdventureGame/RangedWeapon.java`
- [Consume outcome](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/ConsumeOutcome.java): `src/AdventureGame/ConsumeOutcome.java`
- [Consume result](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/ConsumeResult.java): `src/AdventureGame/ConsumeResult.java`

### Map display

- [Position selector](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Position.java): `src/AdventureGame/Position.java`
- [Room diagrams](https://github.com/mtinggaard/adventure/blob/main/src/AdventureGame/Visual.java): `src/AdventureGame/Visual.java`

### Other components

- **Player**

## Connections

- Player → Command interface: enters commands (evidence: `src/AdventureGame/UserInterface.java`)
- Game launcher → Command interface: starts interface (evidence: `src/AdventureGame/Main.java`)
- Command interface → Game coordinator: routes actions (evidence: `src/AdventureGame/UserInterface.java`)
- Command interface → Position selector: requests map view (evidence: `src/AdventureGame/UserInterface.java`)
- Game coordinator → Room map: builds and queries (evidence: `src/AdventureGame/Adventure.java`)
- Game coordinator → Player state: delegates actions (evidence: `src/AdventureGame/Adventure.java`)
- Room map → Room: creates rooms (evidence: `src/AdventureGame/Map.java`)
- Room map → Base item: populates rooms (evidence: `src/AdventureGame/Map.java`)
- Room map → Food: places items (evidence: `src/AdventureGame/Map.java`)
- Room map → Liquid: places items (evidence: `src/AdventureGame/Map.java`)
- Room map → Melee weapon: places weapons (evidence: `src/AdventureGame/Map.java`)
- Room map → Ranged weapon: places weapons (evidence: `src/AdventureGame/Map.java`)
- Player state → Room: moves and transfers items (evidence: `src/AdventureGame/Player.java`)
- Player state → Base item: manages inventory (evidence: `src/AdventureGame/Player.java`)
- Player state → Consumable: applies health points (evidence: `src/AdventureGame/Player.java`)
- Player state → Weapon base: equips weapon (evidence: `src/AdventureGame/Player.java`)
- Player state → Consume outcome: returns consume outcome (evidence: `src/AdventureGame/Player.java`)
- Command interface → Consume outcome: displays consume result (evidence: `src/AdventureGame/UserInterface.java`)
- Consumable → Base item: extends (evidence: `src/AdventureGame/Consumable.java`)
- Food → Consumable: extends (evidence: `src/AdventureGame/Food.java`)
- Liquid → Consumable: extends (evidence: `src/AdventureGame/Liquid.java`)
- Weapon base → Base item: extends (evidence: `src/AdventureGame/Weapon.java`)
- Melee weapon → Weapon base: extends (evidence: `src/AdventureGame/MeleeWeapon.java`)
- Ranged weapon → Weapon base: extends (evidence: `src/AdventureGame/RangedWeapon.java`)
- Consume outcome → Consume result: contains status (evidence: `src/AdventureGame/ConsumeOutcome.java`)
- Position selector → Game coordinator: reads game state (evidence: `src/AdventureGame/Position.java`)
- Position selector → Player state: checks current room (evidence: `src/AdventureGame/Position.java`)
- Position selector → Room diagrams: selects room diagram (evidence: `src/AdventureGame/Position.java`)
