# juliannicholls/flood-cpp architecture

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

- Interactive diagram: https://gitdiagram.com/juliannicholls/flood-cpp
- Repository: https://github.com/juliannicholls/flood-cpp

## Overview

Flood Puzzle is a Raylib implementation of Simon Tatham’s color-flood game. The player clicks a grid color; the game expands the top-left region to that color, animates the change, tracks moves and time, and detects completion. The sampled game code shows the game coordinating grid updates, sound, background imagery, and the exit button. The tree identifies the executable entry point, but its source was not sampled, so entry-point wiring is not shown. Image loading and resource definitions are represented only where sampled code documents their use.

Main entry points: [`game.cpp`](https://github.com/juliannicholls/flood-cpp/blob/main/game.cpp) (Game loop), [`block_grid.cpp`](https://github.com/juliannicholls/flood-cpp/blob/main/block_grid.cpp) (Flood grid), [`animated_block.h`](https://github.com/juliannicholls/flood-cpp/blob/main/animated_block.h) (Animated blocks), [`button.cpp`](https://github.com/juliannicholls/flood-cpp/blob/main/button.cpp) (Exit button)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game flow"]
  node_entry["Flood executable<br/>[flood.cpp]"]
  node_game["Game loop<br/>[game.cpp]"]
end

subgraph group_board["Board logic"]
  node_grid["Flood grid<br/>[block_grid.cpp]"]
  node_animated["Animated blocks<br/>[animated_block.h]"]
  node_resources["Game constants<br/>[resources.h]"]
end

subgraph group_presentation["Presentation"]
  node_button["Exit button<br/>[button.cpp]"]
  node_images["Image loader<br/>[images.cpp]"]
  node_assets["Game assets"]
end

subgraph group_runtime["Runtime services"]
  node_raylib["Raylib"]
end

node_player(("Player"))

node_player -->|"starts game"| node_entry
node_game -->|"updates and draws"| node_grid
node_grid -->|"updates and draws"| node_animated
node_grid -->|"uses dimensions"| node_resources
node_game -->|"updates and draws"| node_button
node_game -->|"constructs loader"| node_images
node_game -->|"loads background and sound"| node_assets
node_images -->|"loads images"| node_assets
node_game -->|"plays sound, draws"| node_raylib
node_grid -->|"reads mouse input"| node_raylib
node_animated -->|"draws blocks"| node_raylib
node_button -->|"reads input, draws"| node_raylib

click node_entry "https://github.com/juliannicholls/flood-cpp/blob/main/flood.cpp"
click node_game "https://github.com/juliannicholls/flood-cpp/blob/main/game.cpp"
click node_grid "https://github.com/juliannicholls/flood-cpp/blob/main/block_grid.cpp"
click node_animated "https://github.com/juliannicholls/flood-cpp/blob/main/animated_block.h"
click node_resources "https://github.com/juliannicholls/flood-cpp/blob/main/resources.h"
click node_button "https://github.com/juliannicholls/flood-cpp/blob/main/button.cpp"
click node_images "https://github.com/juliannicholls/flood-cpp/blob/main/images.cpp"
click node_assets "https://github.com/juliannicholls/flood-cpp/tree/main/assets"

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_entry,node_game toneBlue
class node_grid,node_animated,node_resources toneAmber
class node_button,node_images,node_assets toneMint
class node_raylib toneRose
class node_player toneIndigo
```

## Components

### Game flow

- [Flood executable](https://github.com/juliannicholls/flood-cpp/blob/main/flood.cpp): `flood.cpp`
- [Game loop](https://github.com/juliannicholls/flood-cpp/blob/main/game.cpp): `game.cpp`

### Board logic

- [Flood grid](https://github.com/juliannicholls/flood-cpp/blob/main/block_grid.cpp): `block_grid.cpp`
- [Animated blocks](https://github.com/juliannicholls/flood-cpp/blob/main/animated_block.h): `animated_block.h`
- [Game constants](https://github.com/juliannicholls/flood-cpp/blob/main/resources.h): `resources.h`

### Presentation

- [Exit button](https://github.com/juliannicholls/flood-cpp/blob/main/button.cpp): `button.cpp`
- [Image loader](https://github.com/juliannicholls/flood-cpp/blob/main/images.cpp): `images.cpp`
- [Game assets](https://github.com/juliannicholls/flood-cpp/tree/main/assets): `assets`

### Runtime services

- **Raylib**

### Other components

- **Player**

## Connections

- Player → Flood executable: starts game
- Game loop → Flood grid: updates and draws
- Flood grid → Animated blocks: updates and draws
- Flood grid → Game constants: uses dimensions
- Game loop → Exit button: updates and draws
- Game loop → Image loader: constructs loader
- Game loop → Game assets: loads background and sound
- Image loader → Game assets: loads images
- Game loop → Raylib: plays sound, draws
- Flood grid → Raylib: reads mouse input
- Animated blocks → Raylib: draws blocks
- Exit button → Raylib: reads input, draws
