# naitik0shah/othellogame architecture

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

- Interactive diagram: https://gitdiagram.com/naitik0shah/othellogame
- Repository: https://github.com/naitik0shah/othellogame

## Overview

This is a C17 terminal Othello game. A player interacts through terminal input; the application updates a game, renders the screen, and supports session commands. The main internal layers are CLI/application handling, Othello rules and state, persistence, and statistics. The README gives little feature detail, so documented command capabilities in the sampled UI and the shared API help identify the runtime branches. Some command-dispatch wiring is unsampled and is not asserted here.

Main entry points: [`src/misc.c`](https://github.com/naitik0shah/othellogame/blob/master/src/misc.c) (Event handling), [`src/main.c`](https://github.com/naitik0shah/othellogame/blob/master/src/main.c) (Session loop), [`src/storage.c`](https://github.com/naitik0shah/othellogame/blob/master/src/storage.c) (Save and load), [`src/ui_cli_platform.c`](https://github.com/naitik0shah/othellogame/blob/master/src/ui_cli_platform.c) (CLI and rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Terminal application"]
  node_main["Session loop<br/>[main.c]"]
  node_terminal["Terminal I/O<br/>[ui_cli_platform.c]"]
  node_cli["CLI and rendering<br/>[ui_cli_platform.c]"]
  node_app_events["Event handling<br/>[misc.c]"]
  node_new_game["New-game prompts<br/>[misc.c]"]
end

subgraph group_game["Game domain"]
  node_utilities["Shared utilities<br/>[common.c]"]
  node_rules["Move rules"]
  node_state["Game state"]
end

subgraph group_data["Game data"]
  node_storage["Save and load<br/>[storage.c]"]
  node_save_files["Save files"]
  node_stats["Game statistics<br/>[stats.c]"]
end

node_player(("Player"))

node_player -->|"provides input"| node_terminal
node_main -->|"reads events"| node_terminal
node_main -->|"renders screen"| node_cli
node_main -->|"dispatches events"| node_app_events
node_app_events -->|"validates and plays"| node_rules
node_app_events -->|"opens command prompt"| node_cli
node_app_events -->|"requests player names"| node_new_game
node_new_game -->|"edits prompt line"| node_cli
node_rules -->|"uses board helpers"| node_utilities
node_storage -->|"reads and writes"| node_save_files
node_storage -->|"rebuilds loaded state"| node_state
node_stats -->|"loads games"| node_storage
node_stats -->|"checks results"| node_state

click node_main "https://github.com/naitik0shah/othellogame/blob/master/src/main.c"
click node_terminal "https://github.com/naitik0shah/othellogame/blob/master/src/ui_cli_platform.c"
click node_cli "https://github.com/naitik0shah/othellogame/blob/master/src/ui_cli_platform.c"
click node_app_events "https://github.com/naitik0shah/othellogame/blob/master/src/misc.c"
click node_new_game "https://github.com/naitik0shah/othellogame/blob/master/src/misc.c"
click node_utilities "https://github.com/naitik0shah/othellogame/blob/master/src/common.c"
click node_rules "https://github.com/naitik0shah/othellogame/blob/master/src/validation_capture.c"
click node_state "https://github.com/naitik0shah/othellogame/blob/master/src/validation_capture.c"
click node_storage "https://github.com/naitik0shah/othellogame/blob/master/src/storage.c"
click node_stats "https://github.com/naitik0shah/othellogame/blob/master/src/stats.c"

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_terminal,node_cli,node_app_events,node_new_game toneBlue
class node_utilities,node_rules,node_state toneAmber
class node_storage,node_save_files,node_stats toneMint
class node_player toneIndigo
```

## Components

### Terminal application

- [Session loop](https://github.com/naitik0shah/othellogame/blob/master/src/main.c): `src/main.c`
- [Terminal I/O](https://github.com/naitik0shah/othellogame/blob/master/src/ui_cli_platform.c): `src/ui_cli_platform.c`
- [CLI and rendering](https://github.com/naitik0shah/othellogame/blob/master/src/ui_cli_platform.c): `src/ui_cli_platform.c`
- [Event handling](https://github.com/naitik0shah/othellogame/blob/master/src/misc.c): `src/misc.c`
- [New-game prompts](https://github.com/naitik0shah/othellogame/blob/master/src/misc.c): `src/misc.c`

### Game domain

- [Shared utilities](https://github.com/naitik0shah/othellogame/blob/master/src/common.c): `src/common.c`
- [Move rules](https://github.com/naitik0shah/othellogame/blob/master/src/validation_capture.c): `src/validation_capture.c`
- [Game state](https://github.com/naitik0shah/othellogame/blob/master/src/validation_capture.c): `src/validation_capture.c`

### Game data

- [Save and load](https://github.com/naitik0shah/othellogame/blob/master/src/storage.c): `src/storage.c`
- **Save files**
- [Game statistics](https://github.com/naitik0shah/othellogame/blob/master/src/stats.c): `src/stats.c`

### Other components

- **Player**

## Connections

- Player → Terminal I/O: provides input
- Session loop → Terminal I/O: reads events (evidence: `src/main.c`)
- Session loop → CLI and rendering: renders screen (evidence: `src/main.c`)
- Session loop → Event handling: dispatches events (evidence: `src/main.c`)
- Event handling → Move rules: validates and plays (evidence: `src/misc.c`)
- Event handling → CLI and rendering: opens command prompt (evidence: `src/misc.c`)
- Event handling → New-game prompts: requests player names (evidence: `src/misc.c`)
- New-game prompts → CLI and rendering: edits prompt line (evidence: `src/misc.c`)
- Move rules → Shared utilities: uses board helpers (evidence: `src/validation_capture.c`)
- Save and load → Save files: reads and writes (evidence: `src/storage.c`)
- Save and load → Game state: rebuilds loaded state (evidence: `src/storage.c`)
- Game statistics → Save and load: loads games (evidence: `src/stats.c`)
- Game statistics → Game state: checks results (evidence: `src/stats.c`)
