# sharpp08/table-hockey architecture

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

- Interactive diagram: https://gitdiagram.com/sharpp08/table-hockey
- Repository: https://github.com/sharpp08/table-hockey

## Overview

Table Hockey is a Pygame arcade air-hockey game. The player launches a match from the menu, controls a paddle while the opponent AI responds, and plays through goals and win conditions to the end screen; pause, settings, and score persistence support that flow. The main loop coordinates match updates and drawing. Source excerpts establish the core calls, but gaps leave some event routing and match internals unverified, so those links are omitted.

Main entry points: [`TABLE_HOCKEY/main.py`](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/main.py) (Game loop), [`TABLE_HOCKEY/match.py`](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/match.py) (Match lifecycle), [`TABLE_HOCKEY/config.py`](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/config.py) (Game constants), [`TABLE_HOCKEY/states.py`](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/states.py) (Screen states)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Game loop<br/>[main.py]"]
  node_states["Screen states<br/>[states.py]"]
end

subgraph group_game["Match simulation"]
  node_match["Match lifecycle<br/>[match.py]"]
  node_physics["Puck physics<br/>[physics.py]"]
  node_ai["Opponent AI<br/>[ai.py]"]
  node_paddle["Paddle entity<br/>[paddle.py]"]
  node_puck["Puck entity<br/>[puck.py]"]
  node_player_entity["Player score<br/>[player.py]"]
end

subgraph group_presentation["Screens and rendering"]
  node_effects["Match effects<br/>[effects.py]"]
  node_renderer["Table renderer<br/>[ui.py]"]
  node_menu_widgets["Menu widgets<br/>[menu_ui.py]"]
end

subgraph group_support["Configuration and feedback"]
  node_settings["Settings and layout<br/>[settings.py]"]
  node_config["Game constants<br/>[config.py]"]
  node_audio["Synth audio<br/>[audio.py]"]
end

node_player(("Player"))

node_player -->|"plays"| node_main
node_main -->|"creates manager"| node_states
node_main -->|"builds match"| node_match
node_main -->|"uses settings"| node_settings
node_main -->|"draws table"| node_renderer
node_main -->|"controls audio"| node_audio
node_states -->|"uses widgets"| node_menu_widgets
node_states -->|"resets and resumes"| node_match
node_states -.->|"saves preferences"| node_settings
node_match -->|"requests movement"| node_ai
node_match -->|"updates collisions"| node_physics
node_match -->|"updates paddles"| node_paddle
node_match -->|"simulates puck"| node_puck
node_match -->|"tracks scores"| node_player_entity
node_match -->|"triggers effects"| node_effects
node_match -->|"plays match sounds"| node_audio
node_main -->|"draws paddles"| node_paddle
node_main -->|"draws puck"| node_puck
node_main -->|"draws effects"| node_effects
node_main -->|"reads constants"| node_config
node_match -->|"uses tuning"| node_config
node_settings -->|"validates defaults"| node_config
node_ai -->|"uses difficulty"| node_config
node_physics -->|"uses physics values"| node_config
node_effects -->|"uses colors"| node_config
node_renderer -->|"uses palette"| node_config

click node_main "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/main.py"
click node_states "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/states.py"
click node_settings "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/settings.py"
click node_config "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/config.py"
click node_match "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/match.py"
click node_physics "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/physics.py"
click node_ai "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/ai.py"
click node_paddle "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/paddle.py"
click node_puck "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/puck.py"
click node_player_entity "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/player.py"
click node_effects "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/effects.py"
click node_renderer "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/ui.py"
click node_menu_widgets "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/menu_ui.py"
click node_audio "https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/audio.py"

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_states toneBlue
class node_match,node_physics,node_ai,node_paddle,node_puck,node_player_entity toneAmber
class node_effects,node_renderer,node_menu_widgets toneMint
class node_settings,node_config,node_audio toneRose
class node_player toneIndigo
```

## Components

### Application

- [Game loop](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/main.py): `TABLE_HOCKEY/main.py`
- [Screen states](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/states.py): `TABLE_HOCKEY/states.py`

### Match simulation

- [Match lifecycle](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/match.py): `TABLE_HOCKEY/match.py`
- [Puck physics](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/physics.py): `TABLE_HOCKEY/physics.py`
- [Opponent AI](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/ai.py): `TABLE_HOCKEY/ai.py`
- [Paddle entity](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/paddle.py): `TABLE_HOCKEY/paddle.py`
- [Puck entity](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/puck.py): `TABLE_HOCKEY/puck.py`
- [Player score](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/player.py): `TABLE_HOCKEY/player.py`

### Screens and rendering

- [Match effects](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/effects.py): `TABLE_HOCKEY/effects.py`
- [Table renderer](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/ui.py): `TABLE_HOCKEY/ui.py`
- [Menu widgets](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/menu_ui.py): `TABLE_HOCKEY/menu_ui.py`

### Configuration and feedback

- [Settings and layout](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/settings.py): `TABLE_HOCKEY/settings.py`
- [Game constants](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/config.py): `TABLE_HOCKEY/config.py`
- [Synth audio](https://github.com/sharpp08/table-hockey/blob/main/TABLE_HOCKEY/audio.py): `TABLE_HOCKEY/audio.py`

### Other components

- **Player**

## Connections

- Player → Game loop: plays (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Screen states: creates manager (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Match lifecycle: builds match (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Settings and layout: uses settings (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Table renderer: draws table (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Synth audio: controls audio (evidence: `TABLE_HOCKEY/main.py`)
- Screen states → Menu widgets: uses widgets (evidence: `TABLE_HOCKEY/states.py`)
- Screen states → Match lifecycle: resets and resumes (evidence: `TABLE_HOCKEY/states.py`)
- Screen states → Settings and layout: saves preferences
- Match lifecycle → Opponent AI: requests movement (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Puck physics: updates collisions (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Paddle entity: updates paddles (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Puck entity: simulates puck (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Player score: tracks scores (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Match effects: triggers effects (evidence: `TABLE_HOCKEY/match.py`)
- Match lifecycle → Synth audio: plays match sounds (evidence: `TABLE_HOCKEY/match.py`)
- Game loop → Paddle entity: draws paddles (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Puck entity: draws puck (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Match effects: draws effects (evidence: `TABLE_HOCKEY/main.py`)
- Game loop → Game constants: reads constants (evidence: `TABLE_HOCKEY/main.py`)
- Match lifecycle → Game constants: uses tuning (evidence: `TABLE_HOCKEY/match.py`)
- Settings and layout → Game constants: validates defaults (evidence: `TABLE_HOCKEY/settings.py`)
- Opponent AI → Game constants: uses difficulty (evidence: `TABLE_HOCKEY/ai.py`)
- Puck physics → Game constants: uses physics values (evidence: `TABLE_HOCKEY/physics.py`)
- Match effects → Game constants: uses colors (evidence: `TABLE_HOCKEY/effects.py`)
- Table renderer → Game constants: uses palette (evidence: `TABLE_HOCKEY/ui.py`)
