# mihneafeitan/picnic-cuvant architecture

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

- Interactive diagram: https://gitdiagram.com/mihneafeitan/picnic-cuvant
- Repository: https://github.com/mihneafeitan/picnic-cuvant

## Overview

Picnic Cuvant is a Romanian-language word game: a player selects letters to find each level’s target words, earns points, advances through levels, and resumes or saves progress. The runtime separates SFML interaction from game rules; level loading creates classic, timed, difficult, and bonus variants. Completing the game updates a persistent high-score table. The graph follows documented and indexed references; unsampled save, ranking, and game internals are represented by their exact implementation paths, with only evidenced relationships shown.

Main entry points: [`src/Joc.cpp`](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Joc.cpp) (Game orchestration), [`src/InterfataJoc.cpp`](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/InterfataJoc.cpp) (SFML interface), [`src/IncarcatorNivele.cpp`](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/IncarcatorNivele.cpp) (Level loader), [`src/Nivel.cpp`](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Nivel.cpp) (Level rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game["Game orchestration<br/>[Joc.cpp]"]
  node_ui["SFML interface<br/>[InterfataJoc.cpp]"]
end

subgraph group_levels["Levels and rules"]
  node_level["Level rules<br/>[Nivel.cpp]"]
  node_classic["Classic level<br/>[NivelClasic.cpp]"]
  node_timed["Timed level"]
  node_difficult["Difficult level<br/>[NivelDificil.cpp]"]
  node_bonus["Bonus level<br/>[NivelBonus.cpp]"]
  node_loader["Level loader"]
end

subgraph group_persistence["Progress and records"]
  node_save["Save manager"]
  node_ranking[("High scores<br/>[Clasament.cpp]")]
end

subgraph group_domain["Game domain"]
  node_player["Player<br/>[Jucator.cpp]"]
  node_word["Target words<br/>[Cuvant.cpp]"]
  node_letter["Letters<br/>[Litera.cpp]"]
  node_errors["Game exceptions<br/>[Exceptii.cpp]"]
end

node_actor(("Player"))
node_leveldata["Level JSON files"]
node_savefile["Progress save file"]
node_rankingfile["Ranking file"]

node_actor -.->|"plays through"| node_ui
node_ui -->|"sends selections"| node_game
node_ui -->|"advances levels"| node_game
node_game -->|"delegates gameplay"| node_level
node_game -.->|"updates score"| node_player
node_loader -->|"reads JSON"| node_leveldata
node_loader -->|"creates variant"| node_classic
node_loader -->|"creates variant"| node_timed
node_loader -->|"creates variant"| node_difficult
node_loader -->|"creates variant"| node_bonus
node_game -->|"loads levels"| node_loader
node_game -->|"restores progress"| node_save
node_save -->|"reads and writes"| node_savefile
node_game -->|"persists progress"| node_save
node_ui -->|"records final score"| node_ranking
node_ranking -.->|"reads and writes"| node_rankingfile
node_ui -->|"checks timer"| node_timed
node_ui -->|"shows bonus"| node_bonus
node_ui -->|"shows failure state"| node_difficult
node_level -.->|"validates words"| node_word
node_level -.->|"uses letters"| node_letter
node_loader -->|"throws on invalid data"| node_errors
node_game -->|"throws on missing level"| node_errors

click node_player "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Jucator.cpp"
click node_word "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Cuvant.cpp"
click node_letter "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Litera.cpp"
click node_level "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Nivel.cpp"
click node_classic "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelClasic.cpp"
click node_timed "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelCronometrat.cpp"
click node_difficult "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelDificil.cpp"
click node_bonus "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelBonus.cpp"
click node_loader "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/IncarcatorNivele.cpp"
click node_game "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Joc.cpp"
click node_ui "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/InterfataJoc.cpp"
click node_save "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/GestionarSalvari.cpp"
click node_ranking "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Clasament.cpp"
click node_errors "https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Exceptii.cpp"
click node_leveldata "https://github.com/mihneafeitan/picnic-cuvant/tree/sfml3/data/nivele"

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_game,node_ui toneBlue
class node_level,node_classic,node_timed,node_difficult,node_bonus,node_loader toneAmber
class node_save,node_ranking toneMint
class node_player,node_word,node_letter,node_errors toneRose
class node_actor,node_savefile,node_rankingfile toneIndigo
class node_leveldata toneTeal
```

## Components

### Game runtime

- [Game orchestration](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Joc.cpp): `src/Joc.cpp`
- [SFML interface](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/InterfataJoc.cpp): `src/InterfataJoc.cpp`

### Levels and rules

- [Level rules](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Nivel.cpp): `src/Nivel.cpp`
- [Classic level](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelClasic.cpp): `src/NivelClasic.cpp`
- [Timed level](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelCronometrat.cpp): `src/NivelCronometrat.cpp`
- [Difficult level](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelDificil.cpp): `src/NivelDificil.cpp`
- [Bonus level](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/NivelBonus.cpp): `src/NivelBonus.cpp`
- [Level loader](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/IncarcatorNivele.cpp): `src/IncarcatorNivele.cpp`

### Progress and records

- [Save manager](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/GestionarSalvari.cpp): `src/GestionarSalvari.cpp`
- [High scores](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Clasament.cpp): `src/Clasament.cpp`

### Game domain

- [Player](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Jucator.cpp): `src/Jucator.cpp`
- [Target words](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Cuvant.cpp): `src/Cuvant.cpp`
- [Letters](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Litera.cpp): `src/Litera.cpp`
- [Game exceptions](https://github.com/mihneafeitan/picnic-cuvant/blob/sfml3/src/Exceptii.cpp): `src/Exceptii.cpp`

### Other components

- **Player**
- [Level JSON files](https://github.com/mihneafeitan/picnic-cuvant/tree/sfml3/data/nivele): `data/nivele`
- **Progress save file**
- **Ranking file**

## Connections

- Player → SFML interface: plays through (evidence: `README.md`)
- SFML interface → Game orchestration: sends selections
- SFML interface → Game orchestration: advances levels (evidence: `src/InterfataJoc.cpp`)
- Game orchestration → Level rules: delegates gameplay
- Game orchestration → Player: updates score
- Level loader → Level JSON files: reads JSON (evidence: `src/IncarcatorNivele.cpp`)
- Level loader → Classic level: creates variant (evidence: `src/IncarcatorNivele.cpp`)
- Level loader → Timed level: creates variant (evidence: `src/IncarcatorNivele.cpp`)
- Level loader → Difficult level: creates variant (evidence: `src/IncarcatorNivele.cpp`)
- Level loader → Bonus level: creates variant (evidence: `src/IncarcatorNivele.cpp`)
- Game orchestration → Level loader: loads levels
- Game orchestration → Save manager: restores progress
- Save manager → Progress save file: reads and writes
- Game orchestration → Save manager: persists progress
- SFML interface → High scores: records final score (evidence: `src/InterfataJoc.cpp`)
- High scores → Ranking file: reads and writes
- SFML interface → Timed level: checks timer (evidence: `src/InterfataJoc.cpp`)
- SFML interface → Bonus level: shows bonus (evidence: `src/InterfataJoc.cpp`)
- SFML interface → Difficult level: shows failure state (evidence: `src/InterfataJoc.cpp`)
- Level rules → Target words: validates words
- Level rules → Letters: uses letters
- Level loader → Game exceptions: throws on invalid data (evidence: `src/IncarcatorNivele.cpp`)
- Game orchestration → Game exceptions: throws on missing level (evidence: `src/Joc.cpp`)
