# pablovgs/project-game-of-life architecture

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

- Interactive diagram: https://gitdiagram.com/pablovgs/project-game-of-life
- Repository: https://github.com/pablovgs/project-game-of-life

## Overview

This C++ Conway’s Game of Life application loads a starting grid, advances generations, and presents the simulation either in an interactive SFML window or as console-generated files. The core stages are grid loading, rule-based state preparation, simultaneous cell updates, and output. The GUI also supports pause/play, stepping, speed changes, reset, and a live-cell count. The graph combines sampled calls and type relationships with capabilities explicitly described in the README; unsampled implementation details are not inferred.

Main entry points: [`core/Game.cpp`](https://github.com/pablovgs/project-game-of-life/blob/main/core/Game.cpp) (Game orchestration), [`core/Grid.cpp`](https://github.com/pablovgs/project-game-of-life/blob/main/core/Grid.cpp) (Grid and neighbors), [`core/main.cpp`](https://github.com/pablovgs/project-game-of-life/blob/main/core/main.cpp) (Mode entry point), [`GUI/GameGraphics.cpp`](https://github.com/pablovgs/project-game-of-life/blob/main/GUI/GameGraphics.cpp) (SFML interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and views"]
  node_main["Mode entry point<br/>[main.cpp]"]
  node_graphics["SFML interface<br/>[GameGraphics.cpp]"]
end

subgraph group_simulation["Simulation core"]
  node_game["Game orchestration<br/>[Game.cpp]"]
  node_grid["Grid and neighbors<br/>[Grid.cpp]"]
  node_rule["Conway rules<br/>[Rule.cpp]"]
end

subgraph group_states["Cell model"]
  node_cell["Cell transitions<br/>[Cell.cpp]"]
  node_cellstate["Cell state base<br/>[CellState.h]"]
  node_alive["Alive state<br/>[AliveState.h]"]
  node_dead["Dead state<br/>[DeadState.h]"]
end

node_user(("User"))
node_input["Initial grid file"]
node_output["Generation files"]

node_user -->|"selects mode"| node_main
node_input -->|"provides grid"| node_grid
node_main -->|"creates game"| node_game
node_main -->|"creates rule"| node_rule
node_main -->|"launches graphics"| node_graphics
node_main -->|"runs console export"| node_game
node_graphics -->|"steps and resets"| node_game
node_graphics -->|"reads for display"| node_grid
node_game -->|"manages grid"| node_grid
node_game -->|"uses strategy"| node_rule
node_game -->|"writes generations"| node_output
node_grid -->|"stores cells"| node_cell
node_grid -->|"sets loaded state"| node_alive
node_grid -->|"sets loaded state"| node_dead
node_cell -->|"holds state"| node_cellstate
node_alive -->|"extends"| node_cellstate
node_dead -->|"extends"| node_cellstate

click node_main "https://github.com/pablovgs/project-game-of-life/blob/main/core/main.cpp"
click node_graphics "https://github.com/pablovgs/project-game-of-life/blob/main/GUI/GameGraphics.cpp"
click node_game "https://github.com/pablovgs/project-game-of-life/blob/main/core/Game.cpp"
click node_grid "https://github.com/pablovgs/project-game-of-life/blob/main/core/Grid.cpp"
click node_rule "https://github.com/pablovgs/project-game-of-life/blob/main/core/Rule.cpp"
click node_cell "https://github.com/pablovgs/project-game-of-life/blob/main/core/Cell.cpp"
click node_cellstate "https://github.com/pablovgs/project-game-of-life/blob/main/core/CellState.h"
click node_alive "https://github.com/pablovgs/project-game-of-life/blob/main/core/AliveState.h"
click node_dead "https://github.com/pablovgs/project-game-of-life/blob/main/core/DeadState.h"

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_graphics,node_user toneBlue
class node_game,node_grid,node_rule toneAmber
class node_cell,node_cellstate,node_alive,node_dead toneMint
class node_input,node_output toneIndigo
```

## Components

### Entry and views

- [Mode entry point](https://github.com/pablovgs/project-game-of-life/blob/main/core/main.cpp): `core/main.cpp`
- [SFML interface](https://github.com/pablovgs/project-game-of-life/blob/main/GUI/GameGraphics.cpp): `GUI/GameGraphics.cpp`

### Simulation core

- [Game orchestration](https://github.com/pablovgs/project-game-of-life/blob/main/core/Game.cpp): `core/Game.cpp`
- [Grid and neighbors](https://github.com/pablovgs/project-game-of-life/blob/main/core/Grid.cpp): `core/Grid.cpp`
- [Conway rules](https://github.com/pablovgs/project-game-of-life/blob/main/core/Rule.cpp): `core/Rule.cpp`

### Cell model

- [Cell transitions](https://github.com/pablovgs/project-game-of-life/blob/main/core/Cell.cpp): `core/Cell.cpp`
- [Cell state base](https://github.com/pablovgs/project-game-of-life/blob/main/core/CellState.h): `core/CellState.h`
- [Alive state](https://github.com/pablovgs/project-game-of-life/blob/main/core/AliveState.h): `core/AliveState.h`
- [Dead state](https://github.com/pablovgs/project-game-of-life/blob/main/core/DeadState.h): `core/DeadState.h`

### Other components

- **User**
- **Initial grid file**
- **Generation files**

## Connections

- User → Mode entry point: selects mode (evidence: `README.md`)
- Initial grid file → Grid and neighbors: provides grid (evidence: `README.md`)
- Mode entry point → Game orchestration: creates game (evidence: `core/main.cpp`)
- Mode entry point → Conway rules: creates rule (evidence: `core/main.cpp`)
- Mode entry point → SFML interface: launches graphics (evidence: `core/main.cpp`)
- Mode entry point → Game orchestration: runs console export (evidence: `core/main.cpp`)
- SFML interface → Game orchestration: steps and resets (evidence: `GUI/GameGraphics.cpp`)
- SFML interface → Grid and neighbors: reads for display (evidence: `GUI/GameGraphics.cpp`)
- Game orchestration → Grid and neighbors: manages grid
- Game orchestration → Conway rules: uses strategy
- Game orchestration → Generation files: writes generations (evidence: `README.md`)
- Grid and neighbors → Cell transitions: stores cells
- Grid and neighbors → Alive state: sets loaded state (evidence: `core/Grid.cpp`)
- Grid and neighbors → Dead state: sets loaded state (evidence: `core/Grid.cpp`)
- Cell transitions → Cell state base: holds state (evidence: `core/Cell.cpp`)
- Alive state → Cell state base: extends (evidence: `core/AliveState.h`)
- Dead state → Cell state base: extends (evidence: `core/DeadState.h`)
