# htx296/niu-repo architecture

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

- Interactive diagram: https://gitdiagram.com/htx296/niu-repo
- Repository: https://github.com/htx296/niu-repo

## Overview

This repository’s documented product is a JavaFX Tetris game. The user opens the menu, starts a game, controls falling pieces with the keyboard, and sees board, score, and game-state updates; the game handles collisions, locking, line clears, scoring, level changes, and game over. The graph also preserves the separate task-list demonstration found in the tree and the game’s high-score and sound capabilities. Relationships reflect the README and source-index references; unsampled wiring is not inferred beyond those references.

Main entry points: [`sourcecode/oop/tetris/controller/GameController.java`](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/controller/GameController.java) (Game Controller), [`sourcecode/oop/tetris/view/GameWindow.java`](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GameWindow.java) (Game Window), [`sourcecode/oop/tetris/view/GamePanel.java`](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GamePanel.java) (Game Panel), [`sourcecode/oop/tetris/model/Board.java`](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/Board.java) (Board Rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry_ui["Entry and UI"]
  node_main["JavaFX Entry<br/>[Main.java]"]
  node_window["Game Window<br/>[GameWindow.java]"]
  node_menu["Main Menu<br/>[MainMenu.java]"]
  node_panel["Game Panel<br/>[GamePanel.java]"]
end

subgraph group_gameplay["Gameplay Control"]
  node_input["Keyboard Input<br/>[InputHandler.java]"]
  node_controller["Game Controller"]
end

subgraph group_game_domain["Game Domain"]
  node_board["Board Rules<br/>[Board.java]"]
  node_state["Game State<br/>[GameState.java]"]
  node_tetromino["Falling Piece<br/>[Tetromino.java]"]
  node_factory["Piece Factory"]
  node_shapes["Piece Shapes"]
  node_strategy["Scoring Strategy"]
  node_classic["Classic Scoring"]
end

subgraph group_services["Game Services"]
  node_events["Game Events"]
  node_scores["High Score Manager<br/>[ScoreManager.java]"]
  node_scorefile[("Bundled High Score<br/>[highscore.txt]")]
  node_sound["Sound Manager<br/>[SoundManager.java]"]
  node_fonts["Font Loader<br/>[FontManager.java]"]
end

subgraph group_task_demo["Task Demo"]
  node_taskmanager["Task Manager<br/>[TaskManager.java]"]
  node_task["Task Record<br/>[Task.java]"]
end

node_player(("Player"))
node_taskuser(("Task-list User"))

node_main -->|"opens"| node_window
node_main -->|"loads fonts"| node_fonts
node_player -.->|"chooses game"| node_menu
node_window -->|"loads screen"| node_menu
node_window -->|"creates"| node_panel
node_window -->|"creates"| node_controller
node_window -->|"creates"| node_board
node_window -->|"registers"| node_input
node_window -->|"plays music"| node_sound
node_menu -->|"starts game"| node_window
node_player -.->|"presses keys"| node_input
node_input -->|"dispatches actions"| node_controller
node_controller -->|"checks and updates"| node_board
node_controller -->|"updates state"| node_state
node_controller -->|"creates pieces"| node_factory
node_controller -->|"calculates score"| node_strategy
node_controller -->|"checks record"| node_scores
node_controller -->|"plays effects"| node_sound
node_controller -->|"notifies"| node_events
node_board -->|"checks piece"| node_tetromino
node_factory -->|"returns piece"| node_tetromino
node_factory -->|"selects shape"| node_shapes
node_classic -->|"implements"| node_strategy
node_panel -->|"renders game state"| node_controller
node_panel -->|"reads grid"| node_board
node_panel -->|"handles events"| node_events
node_panel -->|"controls music"| node_sound
node_scores -->|"loads fallback"| node_scorefile
node_taskuser -->|"adds or views"| node_taskmanager
node_taskmanager -->|"creates and reads"| node_task

click node_main "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/main/Main.java"
click node_window "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GameWindow.java"
click node_menu "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/MainMenu.java"
click node_panel "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GamePanel.java"
click node_input "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/controller/InputHandler.java"
click node_controller "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/controller/GameController.java"
click node_board "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/Board.java"
click node_state "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/GameState.java"
click node_tetromino "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/Tetromino.java"
click node_factory "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/TetrominoFactory.java"
click node_shapes "https://github.com/htx296/niu-repo/tree/main/sourcecode/oop/tetris/model/shapes"
click node_strategy "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/ScoringStrategy.java"
click node_classic "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/ClassicScoring.java"
click node_events "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/GameEventListener.java"
click node_scores "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/ScoreManager.java"
click node_scorefile "https://github.com/htx296/niu-repo/blob/main/sourcecode/resources/data/highscore.txt"
click node_sound "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/SoundManager.java"
click node_fonts "https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/FontManager.java"
click node_taskmanager "https://github.com/htx296/niu-repo/blob/main/ReleaseFlowDemonstration/TaskManager.java"
click node_task "https://github.com/htx296/niu-repo/blob/main/ReleaseFlowDemonstration/Task.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_window,node_menu,node_panel toneBlue
class node_input,node_controller toneAmber
class node_board,node_state,node_tetromino,node_factory,node_shapes,node_strategy,node_classic toneMint
class node_events,node_scores,node_scorefile,node_sound,node_fonts,node_taskuser toneRose
class node_taskmanager,node_task,node_player toneIndigo
```

## Components

### Entry and UI

- [JavaFX Entry](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/main/Main.java): `sourcecode/oop/tetris/main/Main.java`
- [Game Window](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GameWindow.java): `sourcecode/oop/tetris/view/GameWindow.java`
- [Main Menu](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/MainMenu.java): `sourcecode/oop/tetris/view/MainMenu.java`
- [Game Panel](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/view/GamePanel.java): `sourcecode/oop/tetris/view/GamePanel.java`

### Gameplay Control

- [Keyboard Input](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/controller/InputHandler.java): `sourcecode/oop/tetris/controller/InputHandler.java`
- [Game Controller](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/controller/GameController.java): `sourcecode/oop/tetris/controller/GameController.java`

### Game Domain

- [Board Rules](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/Board.java): `sourcecode/oop/tetris/model/Board.java`
- [Game State](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/GameState.java): `sourcecode/oop/tetris/model/GameState.java`
- [Falling Piece](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/Tetromino.java): `sourcecode/oop/tetris/model/Tetromino.java`
- [Piece Factory](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/TetrominoFactory.java): `sourcecode/oop/tetris/model/TetrominoFactory.java`
- [Piece Shapes](https://github.com/htx296/niu-repo/tree/main/sourcecode/oop/tetris/model/shapes): `sourcecode/oop/tetris/model/shapes`
- [Scoring Strategy](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/ScoringStrategy.java): `sourcecode/oop/tetris/model/ScoringStrategy.java`
- [Classic Scoring](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/model/ClassicScoring.java): `sourcecode/oop/tetris/model/ClassicScoring.java`

### Game Services

- [Game Events](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/GameEventListener.java): `sourcecode/oop/tetris/util/GameEventListener.java`
- [High Score Manager](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/ScoreManager.java): `sourcecode/oop/tetris/util/ScoreManager.java`
- [Bundled High Score](https://github.com/htx296/niu-repo/blob/main/sourcecode/resources/data/highscore.txt): `sourcecode/resources/data/highscore.txt`
- [Sound Manager](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/SoundManager.java): `sourcecode/oop/tetris/util/SoundManager.java`
- [Font Loader](https://github.com/htx296/niu-repo/blob/main/sourcecode/oop/tetris/util/FontManager.java): `sourcecode/oop/tetris/util/FontManager.java`

### Task Demo

- [Task Manager](https://github.com/htx296/niu-repo/blob/main/ReleaseFlowDemonstration/TaskManager.java): `ReleaseFlowDemonstration/TaskManager.java`
- [Task Record](https://github.com/htx296/niu-repo/blob/main/ReleaseFlowDemonstration/Task.java): `ReleaseFlowDemonstration/Task.java`

### Other components

- **Player**
- **Task-list User**

## Connections

- JavaFX Entry → Game Window: opens (evidence: `sourcecode/oop/tetris/main/Main.java`)
- JavaFX Entry → Font Loader: loads fonts (evidence: `sourcecode/oop/tetris/main/Main.java`)
- Player → Main Menu: chooses game
- Game Window → Main Menu: loads screen (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Game Window → Game Panel: creates (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Game Window → Game Controller: creates (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Game Window → Board Rules: creates (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Game Window → Keyboard Input: registers (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Game Window → Sound Manager: plays music (evidence: `sourcecode/oop/tetris/view/GameWindow.java`)
- Main Menu → Game Window: starts game (evidence: `sourcecode/oop/tetris/view/MainMenu.java`)
- Player → Keyboard Input: presses keys
- Keyboard Input → Game Controller: dispatches actions (evidence: `sourcecode/oop/tetris/controller/InputHandler.java`)
- Game Controller → Board Rules: checks and updates (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → Game State: updates state (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → Piece Factory: creates pieces (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → Scoring Strategy: calculates score (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → High Score Manager: checks record (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → Sound Manager: plays effects (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Game Controller → Game Events: notifies (evidence: `sourcecode/oop/tetris/controller/GameController.java`)
- Board Rules → Falling Piece: checks piece (evidence: `sourcecode/oop/tetris/model/Board.java`)
- Piece Factory → Falling Piece: returns piece (evidence: `sourcecode/oop/tetris/model/TetrominoFactory.java`)
- Piece Factory → Piece Shapes: selects shape (evidence: `sourcecode/oop/tetris/model/TetrominoFactory.java`)
- Classic Scoring → Scoring Strategy: implements (evidence: `sourcecode/oop/tetris/model/ClassicScoring.java`)
- Game Panel → Game Controller: renders game state (evidence: `sourcecode/oop/tetris/view/GamePanel.java`)
- Game Panel → Board Rules: reads grid (evidence: `sourcecode/oop/tetris/view/GamePanel.java`)
- Game Panel → Game Events: handles events (evidence: `sourcecode/oop/tetris/view/GamePanel.java`)
- Game Panel → Sound Manager: controls music (evidence: `sourcecode/oop/tetris/view/GamePanel.java`)
- High Score Manager → Bundled High Score: loads fallback (evidence: `sourcecode/oop/tetris/util/ScoreManager.java`)
- Task-list User → Task Manager: adds or views (evidence: `ReleaseFlowDemonstration/TaskManager.java`)
- Task Manager → Task Record: creates and reads (evidence: `ReleaseFlowDemonstration/TaskManager.java`)
