# charliebrej/bombe architecture

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

- Interactive diagram: https://gitdiagram.com/charliebrej/bombe
- Repository: https://github.com/charliebrej/bombe

## Overview

Bombe is a C++ deduction-puzzle game, accompanied by a grid generator and a score/level server. The main workflow is player input through the game client, puzzle-state updates and solver reasoning, then rendered feedback and saved progress. The README documents level/score services, Steam authentication, and an optional local control socket. Sampled source is partial, so some client-to-server and generator data wiring is not shown.

Main entry points: [`main.cpp`](https://github.com/charliebrej/bombe/blob/main/main.cpp) (Game Entry), [`GameState.cpp`](https://github.com/charliebrej/bombe/blob/main/GameState.cpp) (Game State), [`ControlSocket.cpp`](https://github.com/charliebrej/bombe/blob/main/ControlSocket.cpp) (Control Socket), [`Grid.cpp`](https://github.com/charliebrej/bombe/blob/main/Grid.cpp) (Grid Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game Client"]
  node_main["Game Entry<br/>[main.cpp]"]
  node_state["Game State<br/>[GameState.cpp]"]
  node_render["SDL Rendering<br/>[GameState.cpp]"]
  node_control["Control Socket<br/>[ControlSocket.cpp]"]
  node_control_client["BombeControl<br/>[BombeControl.cpp]"]
end

subgraph group_puzzle["Puzzle Logic"]
  node_grid["Grid Model<br/>[Grid.cpp]"]
  node_solver["Constraint Solver<br/>[Grid.cpp]"]
  node_levels["Level Sets<br/>[LevelSet.cpp]"]
  node_generator["Grid Generator<br/>[grid_generator.cpp]"]
end

subgraph group_services["Services"]
  node_save["Save Codec<br/>[SaveState.cpp]"]
  node_compression["Compression<br/>[Compress.cpp]"]
  node_server["Score Level Server<br/>[BombeServer.cpp]"]
  node_steam["Steam Services<br/>[main.cpp]"]
end

subgraph group_data["Runtime Data"]
  node_save_files[("Save Files")]
  node_level_data["Level Data<br/>[levels.data]"]
  node_assets["Game Assets"]
end

node_player(("Player"))
node_steam_api["Steam API"]

node_player -->|"starts game"| node_main
node_main -->|"creates state"| node_state
node_state -->|"updates puzzle"| node_grid
node_grid -->|"checks constraints"| node_solver
node_state -->|"renders feedback"| node_render
node_state -->|"loads levels"| node_levels
node_main -->|"serializes progress"| node_save
node_main -->|"compresses saves"| node_compression
node_main -->|"reads and writes"| node_save_files
node_main -->|"loads data"| node_level_data
node_state -->|"uses media"| node_assets
node_main -.->|"enables optionally"| node_control
node_control_client -.->|"sends commands"| node_control
node_control -.->|"dispatches requests"| node_state
node_generator -->|"builds grids"| node_grid
node_generator -->|"uses level sets"| node_levels
node_state -.->|"fetches scores"| node_server
node_server -.->|"authenticates tickets"| node_steam_api
node_main -.->|"updates achievements"| node_steam
node_steam -.->|"uses callbacks"| node_steam_api

click node_main "https://github.com/charliebrej/bombe/blob/main/main.cpp"
click node_state "https://github.com/charliebrej/bombe/blob/main/GameState.cpp"
click node_render "https://github.com/charliebrej/bombe/blob/main/GameState.cpp"
click node_control "https://github.com/charliebrej/bombe/blob/main/ControlSocket.cpp"
click node_control_client "https://github.com/charliebrej/bombe/blob/main/BombeControl.cpp"
click node_grid "https://github.com/charliebrej/bombe/blob/main/Grid.cpp"
click node_solver "https://github.com/charliebrej/bombe/blob/main/Grid.cpp"
click node_levels "https://github.com/charliebrej/bombe/blob/main/LevelSet.cpp"
click node_generator "https://github.com/charliebrej/bombe/blob/main/grid_generator.cpp"
click node_save "https://github.com/charliebrej/bombe/blob/main/SaveState.cpp"
click node_compression "https://github.com/charliebrej/bombe/blob/main/Compress.cpp"
click node_server "https://github.com/charliebrej/bombe/blob/main/BombeServer.cpp"
click node_steam "https://github.com/charliebrej/bombe/blob/main/main.cpp"
click node_level_data "https://github.com/charliebrej/bombe/blob/main/levels.data"
click node_assets "https://github.com/charliebrej/bombe/tree/main/snd"

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_state,node_render,node_control,node_control_client toneBlue
class node_grid,node_solver,node_levels,node_generator toneAmber
class node_save,node_compression,node_server,node_steam,node_steam_api toneMint
class node_save_files,node_level_data,node_assets toneRose
class node_player toneIndigo
```

## Components

### Game Client

- [Game Entry](https://github.com/charliebrej/bombe/blob/main/main.cpp): `main.cpp`
- [Game State](https://github.com/charliebrej/bombe/blob/main/GameState.cpp): `GameState.cpp`
- [SDL Rendering](https://github.com/charliebrej/bombe/blob/main/GameState.cpp): `GameState.cpp`
- [Control Socket](https://github.com/charliebrej/bombe/blob/main/ControlSocket.cpp): `ControlSocket.cpp`
- [BombeControl](https://github.com/charliebrej/bombe/blob/main/BombeControl.cpp): `BombeControl.cpp`

### Puzzle Logic

- [Grid Model](https://github.com/charliebrej/bombe/blob/main/Grid.cpp): `Grid.cpp`
- [Constraint Solver](https://github.com/charliebrej/bombe/blob/main/Grid.cpp): `Grid.cpp`
- [Level Sets](https://github.com/charliebrej/bombe/blob/main/LevelSet.cpp): `LevelSet.cpp`
- [Grid Generator](https://github.com/charliebrej/bombe/blob/main/grid_generator.cpp): `grid_generator.cpp`

### Services

- [Save Codec](https://github.com/charliebrej/bombe/blob/main/SaveState.cpp): `SaveState.cpp`
- [Compression](https://github.com/charliebrej/bombe/blob/main/Compress.cpp): `Compress.cpp`
- [Score Level Server](https://github.com/charliebrej/bombe/blob/main/BombeServer.cpp): `BombeServer.cpp`
- [Steam Services](https://github.com/charliebrej/bombe/blob/main/main.cpp): `main.cpp`

### Runtime Data

- **Save Files**
- [Level Data](https://github.com/charliebrej/bombe/blob/main/levels.data): `levels.data`
- [Game Assets](https://github.com/charliebrej/bombe/tree/main/snd): `snd`

### Other components

- **Player**
- **Steam API**

## Connections

- Player → Game Entry: starts game
- Game Entry → Game State: creates state
- Game State → Grid Model: updates puzzle
- Grid Model → Constraint Solver: checks constraints
- Game State → SDL Rendering: renders feedback
- Game State → Level Sets: loads levels
- Game Entry → Save Codec: serializes progress
- Game Entry → Compression: compresses saves
- Game Entry → Save Files: reads and writes
- Game Entry → Level Data: loads data
- Game State → Game Assets: uses media
- Game Entry → Control Socket: enables optionally
- BombeControl → Control Socket: sends commands
- Control Socket → Game State: dispatches requests
- Grid Generator → Grid Model: builds grids
- Grid Generator → Level Sets: uses level sets
- Game State → Score Level Server: fetches scores
- Score Level Server → Steam API: authenticates tickets
- Game Entry → Steam Services: updates achievements
- Steam Services → Steam API: uses callbacks
