# djkamma420/fot25-2_lf12.6 architecture

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

- Interactive diagram: https://gitdiagram.com/djkamma420/fot25-2_lf12.6
- Repository: https://github.com/djkamma420/fot25-2_lf12.6

## Overview

Rechentrainer is a browser-based arithmetic practice game. The user selects Endless or Practice, receives generated tasks, submits answers, and gets feedback and results; Endless runs update streak-based scoring and can be saved to the browser high-score list. The graph separates session orchestration, task generation and selection, answer/scoring logic, and browser presentation and persistence. README describes the rules/info view and installable offline experience; those capabilities are represented, though the precise wiring of the unsampled page and PWA components is not shown.

Main entry points: [`src/practice_session.cpp`](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/practice_session.cpp) (Practice session), [`web/browser.cpp`](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/browser.cpp) (Browser game UI), [`web/index.html`](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/index.html) (Game page), [`src/task_generator.cpp`](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task_generator.cpp) (Task generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game sessions"]
  node_practice_session["Practice session"]
end

subgraph group_arithmetic["Task and scoring"]
  node_task_model["Task model<br/>[task.hpp]"]
  node_task_selection["Task selection<br/>[task_selection.cpp]"]
  node_task_generation["Task generation<br/>[task_generator.cpp]"]
  node_answer_check["Answer checking<br/>[answer_check.cpp]"]
  node_scoring["Scoring and stats<br/>[score.cpp]"]
end

subgraph group_browser["Browser experience"]
  node_browser_ui["Browser game UI<br/>[browser.cpp]"]
  node_page["Game page<br/>[index.html]"]
  node_local_storage[("Browser storage")]
  node_pwa["PWA setup<br/>[pwa.js]"]
  node_service_worker["Offline worker<br/>[service-worker.js]"]
end

node_player(("Player"))
node_browser(("Web browser"))

node_player -->|"uses"| node_page
node_page -.->|"presents"| node_browser_ui
node_browser_ui -->|"starts and submits"| node_practice_session
node_practice_session -->|"selects task rules"| node_task_selection
node_practice_session -->|"generates tasks"| node_task_generation
node_practice_session -->|"checks answers"| node_answer_check
node_practice_session -->|"records outcomes"| node_scoring
node_task_generation -->|"uses difficulty rules"| node_task_selection
node_browser_ui -->|"reads and writes runs"| node_local_storage
node_browser_ui -->|"stores preferences"| node_local_storage
node_browser_ui -->|"updates display"| node_page
node_browser -->|"opens"| node_page
node_browser -.->|"installs app"| node_pwa
node_service_worker -.->|"supports offline use"| node_page

click node_browser_ui "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/browser.cpp"
click node_page "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/index.html"
click node_practice_session "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/practice_session.cpp"
click node_task_model "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task.hpp"
click node_task_selection "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task_selection.cpp"
click node_task_generation "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task_generator.cpp"
click node_answer_check "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/answer_check.cpp"
click node_scoring "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/score.cpp"
click node_pwa "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/pwa.js"
click node_service_worker "https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/service-worker.js"

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_practice_session,node_browser toneBlue
class node_task_model,node_task_selection,node_task_generation,node_answer_check,node_scoring toneAmber
class node_browser_ui,node_page,node_local_storage,node_pwa,node_service_worker toneMint
class node_player toneIndigo
```

## Components

### Game sessions

- [Practice session](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/practice_session.cpp): `src/practice_session.cpp`

### Task and scoring

- [Task model](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task.hpp): `src/task.hpp`
- [Task selection](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task_selection.cpp): `src/task_selection.cpp`
- [Task generation](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/task_generator.cpp): `src/task_generator.cpp`
- [Answer checking](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/answer_check.cpp): `src/answer_check.cpp`
- [Scoring and stats](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/src/score.cpp): `src/score.cpp`

### Browser experience

- [Browser game UI](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/browser.cpp): `web/browser.cpp`
- [Game page](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/index.html): `web/index.html`
- **Browser storage**
- [PWA setup](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/pwa.js): `web/pwa.js`
- [Offline worker](https://github.com/djkamma420/fot25-2_lf12.6/blob/main/web/service-worker.js): `web/service-worker.js`

### Other components

- **Player**
- **Web browser**

## Connections

- Player → Game page: uses (evidence: `README.md`)
- Game page → Browser game UI: presents
- Browser game UI → Practice session: starts and submits (evidence: `web/browser.cpp`)
- Practice session → Task selection: selects task rules (evidence: `src/practice_session.cpp`)
- Practice session → Task generation: generates tasks (evidence: `src/practice_session.cpp`)
- Practice session → Answer checking: checks answers (evidence: `src/practice_session.cpp`)
- Practice session → Scoring and stats: records outcomes (evidence: `src/practice_session.cpp`)
- Task generation → Task selection: uses difficulty rules (evidence: `src/task_generator.cpp`)
- Browser game UI → Browser storage: reads and writes runs (evidence: `web/browser.cpp`)
- Browser game UI → Browser storage: stores preferences (evidence: `web/browser.cpp`)
- Browser game UI → Game page: updates display (evidence: `web/browser.cpp`)
- Web browser → Game page: opens (evidence: `README.md`)
- Web browser → PWA setup: installs app
- Offline worker → Game page: supports offline use
