# tharana-dev/rabbit-hunter-game architecture

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

- Interactive diagram: https://gitdiagram.com/tharana-dev/rabbit-hunter-game
- Repository: https://github.com/tharana-dev/rabbit-hunter-game

## Overview

Rabbit Hunter is a single-process Turtle arcade game with Pygame audio. The player starts or resumes play through keyboard controls; the game loop moves the rabbit, resolves carrot, trap, kit, and hunter interactions, updates score and health, and ends the session when required. High scores persist in a text file, while a separate image helper generates and registers scaled rabbit sprites. The loop and collision branches are partly unsampled, so edges for those features rely on the README; the source excerpts show initialization, image generation, persistence, and selected game-loop behavior.

Main entry points: [`game.py`](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py) (Game loop), [`image_maker.py`](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/image_maker.py) (Scaled sprites), [`highscore.txt`](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/highscore.txt) (High score file)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Gameplay"]
  node_player["Player controls<br/>[game.py]"]
  node_loop["Game loop<br/>[game.py]"]
  node_carrots["Carrot scoring<br/>[game.py]"]
  node_traps["Trap damage<br/>[game.py]"]
  node_kits["Health kits<br/>[game.py]"]
  node_hunter["Hunter encounter<br/>[game.py]"]
  node_health["Health system<br/>[game.py]"]
  node_score["Score display<br/>[game.py]"]
end

subgraph group_assets["Assets and audio"]
  node_spritegen["Scaled sprites<br/>[image_maker.py]"]
  node_sound["Sound effects<br/>[game.py]"]
  node_music["Background music<br/>[game.py]"]
end

subgraph group_state["Session and persistence"]
  node_session["Start and pause<br/>[game.py]"]
  node_highscore[("High score<br/>[game.py]")]
  node_ending["Game over<br/>[game.py]"]
end

node_rabbit(("Player"))
node_keyboard(("Keyboard"))
node_scorefile["High score file<br/>[highscore.txt]"]

node_keyboard -.->|"controls"| node_player
node_player -.->|"starts or pauses"| node_session
node_session -.->|"runs"| node_loop
node_loop -.->|"moves"| node_player
node_loop -.->|"checks collisions"| node_carrots
node_loop -.->|"checks collisions"| node_traps
node_loop -.->|"checks collisions"| node_kits
node_loop -.->|"updates encounter"| node_hunter
node_traps -.->|"reduces"| node_health
node_kits -.->|"restores"| node_health
node_carrots -.->|"updates"| node_score
node_hunter -.->|"can trigger"| node_ending
node_health -.->|"can trigger"| node_ending
node_loop -->|"ends on bounds"| node_ending
node_loop -->|"saves new record"| node_highscore
node_highscore -->|"reads and writes"| node_scorefile
node_player -->|"loads images"| node_spritegen
node_spritegen -->|"registers sprites"| node_rabbit
node_loop -.->|"plays effects"| node_sound
node_session -.->|"starts playback"| node_music

click node_player "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_loop "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_carrots "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_traps "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_kits "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_hunter "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_health "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_score "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_session "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_highscore "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_ending "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_spritegen "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/image_maker.py"
click node_sound "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_music "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py"
click node_scorefile "https://github.com/tharana-dev/rabbit-hunter-game/blob/main/highscore.txt"

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_player,node_loop,node_carrots,node_traps,node_kits,node_hunter,node_health,node_score toneBlue
class node_spritegen,node_sound,node_music toneAmber
class node_session,node_highscore,node_ending toneMint
class node_rabbit,node_keyboard toneIndigo
class node_scorefile toneTeal
```

## Components

### Gameplay

- [Player controls](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Game loop](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Carrot scoring](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Trap damage](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Health kits](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Hunter encounter](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Health system](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Score display](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`

### Assets and audio

- [Scaled sprites](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/image_maker.py): `image_maker.py`
- [Sound effects](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Background music](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`

### Session and persistence

- [Start and pause](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [High score](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`
- [Game over](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/game.py): `game.py`

### Other components

- **Player**
- **Keyboard**
- [High score file](https://github.com/tharana-dev/rabbit-hunter-game/blob/main/highscore.txt): `highscore.txt`

## Connections

- Keyboard → Player controls: controls (evidence: `readme.md`)
- Player controls → Start and pause: starts or pauses (evidence: `readme.md`)
- Start and pause → Game loop: runs (evidence: `readme.md`)
- Game loop → Player controls: moves (evidence: `readme.md`)
- Game loop → Carrot scoring: checks collisions (evidence: `readme.md`)
- Game loop → Trap damage: checks collisions (evidence: `readme.md`)
- Game loop → Health kits: checks collisions (evidence: `readme.md`)
- Game loop → Hunter encounter: updates encounter (evidence: `readme.md`)
- Trap damage → Health system: reduces (evidence: `readme.md`)
- Health kits → Health system: restores (evidence: `readme.md`)
- Carrot scoring → Score display: updates (evidence: `readme.md`)
- Hunter encounter → Game over: can trigger (evidence: `readme.md`)
- Health system → Game over: can trigger (evidence: `readme.md`)
- Game loop → Game over: ends on bounds (evidence: `game.py`)
- Game loop → High score: saves new record (evidence: `game.py`)
- High score → High score file: reads and writes (evidence: `game.py`)
- Player controls → Scaled sprites: loads images (evidence: `game.py`)
- Scaled sprites → Player: registers sprites (evidence: `image_maker.py`)
- Game loop → Sound effects: plays effects (evidence: `readme.md`)
- Start and pause → Background music: starts playback (evidence: `readme.md`)
