# limiajayi/java-space-game architecture

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

- Interactive diagram: https://gitdiagram.com/limiajayi/java-space-game
- Repository: https://github.com/limiajayi/java-space-game

## Overview

Informative Space Game is a command-line exploration game: the player navigates a planetary map, enters locations, gathers materials and learns space facts, then returns for an outcome and score. The main interaction loop and planet-specific behavior are implemented together in Game.java; supporting classes hold player state, map and room data, inventory, and scoring. The excerpts show these relationships, but do not expose the full command loop, so the graph does not infer finer-grained control flow within it.

Main entry points: [`Game.java`](https://github.com/limiajayi/java-space-game/blob/main/Game.java) (Game loop), [`Player.java`](https://github.com/limiajayi/java-space-game/blob/main/Player.java) (Player state), [`Map.java`](https://github.com/limiajayi/java-space-game/blob/main/Map.java) (Space map), [`Position.java`](https://github.com/limiajayi/java-space-game/blob/main/Position.java) (Coordinates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Game interaction"]
  node_game["Game loop<br/>[Game.java]"]
  node_planet_actions["Planet exploration<br/>[Game.java]"]
end

subgraph group_world["World model"]
  node_map["Space map<br/>[Map.java]"]
  node_room["Planet rooms<br/>[Room.java]"]
  node_position["Coordinates<br/>[Position.java]"]
end

subgraph group_state["Player state"]
  node_player_state["Player state<br/>[Player.java]"]
  node_inventory["Inventory<br/>[Inventory.java]"]
  node_score["Score<br/>[Score.java]"]
end

node_player_actor(("Player"))

node_player_actor -->|"enters commands"| node_game
node_game -->|"dispatches actions"| node_planet_actions
node_game -->|"creates and displays"| node_map
node_game -->|"creates and describes"| node_room
node_game -->|"moves player"| node_player_state
node_game -->|"updates items"| node_inventory
node_game -->|"updates score"| node_score
node_planet_actions -->|"collects materials"| node_inventory
node_planet_actions -->|"solves puzzles"| node_score
node_player_state -->|"moves on"| node_map
node_player_state -->|"holds items"| node_inventory
node_player_state -->|"stores position"| node_position
node_map -->|"places rooms at"| node_position
node_room -->|"stores location"| node_position

click node_game "https://github.com/limiajayi/java-space-game/blob/main/Game.java"
click node_planet_actions "https://github.com/limiajayi/java-space-game/blob/main/Game.java"
click node_map "https://github.com/limiajayi/java-space-game/blob/main/Map.java"
click node_room "https://github.com/limiajayi/java-space-game/blob/main/Room.java"
click node_position "https://github.com/limiajayi/java-space-game/blob/main/Position.java"
click node_player_state "https://github.com/limiajayi/java-space-game/blob/main/Player.java"
click node_inventory "https://github.com/limiajayi/java-space-game/blob/main/Inventory.java"
click node_score "https://github.com/limiajayi/java-space-game/blob/main/Score.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_game,node_planet_actions toneBlue
class node_map,node_room,node_position toneAmber
class node_player_state,node_inventory,node_score toneMint
class node_player_actor toneIndigo
```

## Components

### Game interaction

- [Game loop](https://github.com/limiajayi/java-space-game/blob/main/Game.java): `Game.java`
- [Planet exploration](https://github.com/limiajayi/java-space-game/blob/main/Game.java): `Game.java`

### World model

- [Space map](https://github.com/limiajayi/java-space-game/blob/main/Map.java): `Map.java`
- [Planet rooms](https://github.com/limiajayi/java-space-game/blob/main/Room.java): `Room.java`
- [Coordinates](https://github.com/limiajayi/java-space-game/blob/main/Position.java): `Position.java`

### Player state

- [Player state](https://github.com/limiajayi/java-space-game/blob/main/Player.java): `Player.java`
- [Inventory](https://github.com/limiajayi/java-space-game/blob/main/Inventory.java): `Inventory.java`
- [Score](https://github.com/limiajayi/java-space-game/blob/main/Score.java): `Score.java`

### Other components

- **Player**

## Connections

- Player → Game loop: enters commands (evidence: `README.md`)
- Game loop → Planet exploration: dispatches actions (evidence: `Game.java`)
- Game loop → Space map: creates and displays (evidence: `Game.java`)
- Game loop → Planet rooms: creates and describes (evidence: `Game.java`)
- Game loop → Player state: moves player (evidence: `Game.java`)
- Game loop → Inventory: updates items (evidence: `Game.java`)
- Game loop → Score: updates score (evidence: `Game.java`)
- Planet exploration → Inventory: collects materials (evidence: `Game.java`)
- Planet exploration → Score: solves puzzles (evidence: `Game.java`)
- Player state → Space map: moves on (evidence: `Player.java`)
- Player state → Inventory: holds items (evidence: `Player.java`)
- Player state → Coordinates: stores position (evidence: `Player.java`)
- Space map → Coordinates: places rooms at (evidence: `Map.java`)
- Planet rooms → Coordinates: stores location (evidence: `Room.java`)
