# mohitt10/hanoi-towers architecture

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

- Interactive diagram: https://gitdiagram.com/mohitt10/hanoi-towers
- Repository: https://github.com/mohitt10/hanoi-towers

## Overview

1. This repository is a small Java application centered on a Tower of Hanoi game. The codebase is organized around a single `game` package plus a top-level `Main.java` entrypoint.

2. `Main.java` is the application bootstrap. It likely wires together the game logic and the interface layer, so it is the top of the runtime call graph.

3. The core domain model lives in `game/Game.java` and `game/GameState.java`. These are the likely center of the architecture:
   - `GameState` appears to hold the current tower/disc configuration and other mutable state.
   - `Game` likely implements the rules and operations for moving discs, validating legal moves, and advancing the game.

4. `game/TowerInterfaceGUI.java` is the presentation layer. The name suggests a graphical user interface for interacting with the Tower of Hanoi game, probably reading user actions and invoking game operations rather than containing game rules itself.

5. The main data flow is probably: user input in the GUI → `Game` logic validates/applies the move → `GameState` is updated → GUI refreshes to reflect the new state. That separation suggests a basic model/view/controller-style structure, even if not formally implemented that way.

6. The architecture boundary is between presentation and game rules. The GUI should depend on the game classes, but the game classes should not depend on GUI concerns. That is the key dependency line for a diagram.

7. `Makefile` provides project-level build/run automation. Since this is a Java repo, it likely encapsulates compilation and execution commands rather than introducing application runtime components.

8. `plan.md` appears to be a design or development notes document rather than a runtime subsystem. It may describe intended features or implementation steps, but it does not affect the execution architecture directly.

9. There are no visible signs of external services, persistence, networking, or concurrency in the repository layout. The application appears self-contained, with all state managed in memory.

10. For an architecture diagram, the main boxes should be:
    - Application entrypoint (`Main`)
    - Game domain/rules (`Game`)
    - Game state model (`GameState`)
    - GUI presentation (`TowerInterfaceGUI`)
    - Build/tooling (`Makefile`)

Main entry points: [`game/TowerInterfaceGUI.java`](https://github.com/mohitt10/hanoi-towers/blob/main/game/TowerInterfaceGUI.java) (Tower UI), [`Main.java`](https://github.com/mohitt10/hanoi-towers/blob/main/Main.java) (Main), [`game/Game.java`](https://github.com/mohitt10/hanoi-towers/blob/main/game/Game.java) (Game), [`game/GameState.java`](https://github.com/mohitt10/hanoi-towers/blob/main/game/GameState.java) (GameState)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main(("Main<br/>entrypoint<br/>[Main.java]"))
  node_gui["Tower UI<br/>gui"]
  node_game["Game<br/>rules<br/>[Game.java]"]
  node_state[("GameState<br/>model<br/>[GameState.java]")]
end

subgraph group_tooling["Tooling"]
  node_makefile["Makefile<br/>build"]
end

node_main -->|"starts"| node_gui
node_main -->|"initializes"| node_game
node_gui -->|"invokes"| node_game
node_gui -->|"renders"| node_state
node_game -->|"updates"| node_state
node_makefile -.->|"builds"| node_main

click node_main "https://github.com/mohitt10/hanoi-towers/blob/main/Main.java"
click node_gui "https://github.com/mohitt10/hanoi-towers/blob/main/game/TowerInterfaceGUI.java"
click node_game "https://github.com/mohitt10/hanoi-towers/blob/main/game/Game.java"
click node_state "https://github.com/mohitt10/hanoi-towers/blob/main/game/GameState.java"
click node_makefile "https://github.com/mohitt10/hanoi-towers/tree/main/Makefile"

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_gui,node_game,node_state toneBlue
class node_makefile toneAmber
```

## Components

### Runtime

Application entrypoint, game logic, and UI

- [Main](https://github.com/mohitt10/hanoi-towers/blob/main/Main.java): entrypoint · Bootstraps the application and wires the game to the interface · `Main.java`
- [Tower UI](https://github.com/mohitt10/hanoi-towers/blob/main/game/TowerInterfaceGUI.java): gui · Graphical interface for player interaction and state display · `game/TowerInterfaceGUI.java`
- [Game](https://github.com/mohitt10/hanoi-towers/blob/main/game/Game.java): rules · Implements Tower of Hanoi move validation and game progression · `game/Game.java`
- [GameState](https://github.com/mohitt10/hanoi-towers/blob/main/game/GameState.java): model · Holds the current tower and disc configuration · `game/GameState.java`

### Tooling

Build and run automation

- [Makefile](https://github.com/mohitt10/hanoi-towers/tree/main/Makefile): build · Project build and execution automation · `Makefile`

## Connections

- Main → Tower UI: starts · Launches the user interface
- Main → Game: initializes · Creates or configures the game logic
- Tower UI → Game: invokes · Sends user actions to the rules engine
- Tower UI → GameState: renders · Reads current state to update the display
- Game → GameState: updates · Applies legal moves to the mutable game state
- Makefile → Main: builds · Compiles and runs the application entrypoint
