# dtschust/javapacman architecture

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

- Interactive diagram: https://gitdiagram.com/dtschust/javapacman
- Repository: https://github.com/dtschust/javapacman

## Overview

This is a desktop Pac-Man game: a player starts or watches the game, controls Pac-Man with the arrow keys, and plays through pellet collection, ghost encounters, and win/loss states. Pacman.java owns the window, input handling, and timed frame progression; Board.java contains most game state, movement, and drawing, while GameSounds.java handles effects. Board.java also reads and writes the high-score file. The excerpts show these main responsibilities, but do not expose every Board-to-sound call or the use of image assets, so those links are omitted.

Main entry points: [`Pacman.java`](https://github.com/dtschust/javapacman/blob/master/Pacman.java) (Window and controls), [`Board.java`](https://github.com/dtschust/javapacman/blob/master/Board.java) (Board and rendering), [`highScores.txt`](https://github.com/dtschust/javapacman/blob/master/highScores.txt) (High-score file), [`GameSounds.java`](https://github.com/dtschust/javapacman/blob/master/GameSounds.java) (Sound effects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Game interface"]
  node_pacman["Window and controls<br/>[Pacman.java]"]
end

subgraph group_simulation["Game simulation"]
  node_board["Board and rendering<br/>[Board.java]"]
  node_movers["Player and ghosts<br/>[Board.java]"]
end

subgraph group_persistence["Game records"]
  node_highscores[("High-score file<br/>[highScores.txt]")]
end

subgraph group_audio["Sound effects"]
  node_sounds["Sound effects<br/>[GameSounds.java]"]
end

node_player(("Player"))

node_player -->|"starts and controls"| node_pacman
node_pacman -->|"advances frames"| node_board
node_pacman -->|"moves and resets"| node_movers
node_pacman -->|"stops demo audio"| node_sounds
node_board -->|"reads and writes"| node_highscores

click node_pacman "https://github.com/dtschust/javapacman/blob/master/Pacman.java"
click node_board "https://github.com/dtschust/javapacman/blob/master/Board.java"
click node_movers "https://github.com/dtschust/javapacman/blob/master/Board.java"
click node_highscores "https://github.com/dtschust/javapacman/blob/master/highScores.txt"
click node_sounds "https://github.com/dtschust/javapacman/blob/master/GameSounds.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_pacman toneBlue
class node_board,node_movers toneAmber
class node_highscores toneMint
class node_sounds toneRose
class node_player toneIndigo
```

## Components

### Game interface

- [Window and controls](https://github.com/dtschust/javapacman/blob/master/Pacman.java): `Pacman.java`

### Game simulation

- [Board and rendering](https://github.com/dtschust/javapacman/blob/master/Board.java): `Board.java`
- [Player and ghosts](https://github.com/dtschust/javapacman/blob/master/Board.java): `Board.java`

### Game records

- [High-score file](https://github.com/dtschust/javapacman/blob/master/highScores.txt): `highScores.txt`

### Sound effects

- [Sound effects](https://github.com/dtschust/javapacman/blob/master/GameSounds.java): `GameSounds.java`

### Other components

- **Player**

## Connections

- Player → Window and controls: starts and controls (evidence: `Pacman.java`)
- Window and controls → Board and rendering: advances frames (evidence: `Pacman.java`)
- Window and controls → Player and ghosts: moves and resets (evidence: `Pacman.java`)
- Window and controls → Sound effects: stops demo audio (evidence: `Pacman.java`)
- Board and rendering → High-score file: reads and writes (evidence: `Board.java`)
