# cauvinferrard-blip/tictactoe02 architecture

> Architecture diagram of the GitHub repository cauvinferrard-blip/tictactoe02, 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/cauvinferrard-blip/tictactoe02
- Repository: https://github.com/cauvinferrard-blip/tictactoe02

## Overview

This is a console Tic-Tac-Toe game. The player enters moves or save/load/quit commands; the game loop validates moves, updates and displays the board, checks for a win or draw, and can persist the current board and player turn. The runtime is centered in the main source file, while board operations and save/load serialization are separate modules. The README documents save/load capability; the sampled code shows those operations using savegame.txt. The graph reflects only relationships visible in the excerpts or README.

Main entry points: [`tictactoeo2_main.cpp`](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp) (Game loop), [`board.cpp`](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/board.cpp) (Board operations), [`file_utils.cpp`](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.cpp) (Save and load), [`savegame.txt`](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/savegame.txt) (savegame.txt)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game_loop["Game loop"]
  node_move_input["Move input"]
  node_game_rules["Move and outcome rules"]
end

subgraph group_board["Board model"]
  node_board_state["Board operations<br/>[board.cpp]"]
  node_board_api["Board interface<br/>[board.h]"]
end

subgraph group_persistence["Save and load"]
  node_save_load["Save and load<br/>[file_utils.cpp]"]
  node_save_format["Game-state format<br/>[file_utils.cpp]"]
  node_file_api["Persistence interface<br/>[file_utils.h]"]
  node_save_file["savegame.txt<br/>[savegame.txt]"]
end

node_player(("Player"))

node_player -->|"plays"| node_game_loop
node_game_loop -->|"reads commands"| node_move_input
node_game_loop -->|"checks and applies"| node_game_rules
node_game_rules -->|"reads and updates"| node_board_state
node_game_loop -->|"prints board"| node_board_state
node_game_loop -->|"dispatches save/load"| node_save_load
node_save_load -->|"reads and writes"| node_save_file
node_save_format -->|"serializes board"| node_board_state

click node_game_loop "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp"
click node_move_input "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp"
click node_game_rules "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp"
click node_board_state "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/board.cpp"
click node_board_api "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/board.h"
click node_save_load "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.cpp"
click node_save_format "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.cpp"
click node_file_api "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.h"
click node_save_file "https://github.com/cauvinferrard-blip/tictactoe02/blob/main/savegame.txt"

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_loop,node_move_input,node_game_rules toneBlue
class node_board_state,node_board_api toneAmber
class node_save_load,node_save_format,node_file_api,node_save_file toneMint
class node_player toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp): `tictactoeo2_main.cpp`
- [Move input](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp): `tictactoeo2_main.cpp`
- [Move and outcome rules](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/tictactoeo2_main.cpp): `tictactoeo2_main.cpp`

### Board model

- [Board operations](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/board.cpp): `board.cpp`
- [Board interface](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/board.h): `board.h`

### Save and load

- [Save and load](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.cpp): `file_utils.cpp`
- [Game-state format](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.cpp): `file_utils.cpp`
- [Persistence interface](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/file_utils.h): `file_utils.h`
- [savegame.txt](https://github.com/cauvinferrard-blip/tictactoe02/blob/main/savegame.txt): `savegame.txt`

### Other components

- **Player**

## Connections

- Player → Game loop: plays (evidence: `README.md`)
- Game loop → Move input: reads commands (evidence: `tictactoeo2_main.cpp`)
- Game loop → Move and outcome rules: checks and applies (evidence: `tictactoeo2_main.cpp`)
- Move and outcome rules → Board operations: reads and updates (evidence: `tictactoeo2_main.cpp`)
- Game loop → Board operations: prints board (evidence: `tictactoeo2_main.cpp`)
- Game loop → Save and load: dispatches save/load (evidence: `tictactoeo2_main.cpp`)
- Save and load → savegame.txt: reads and writes (evidence: `file_utils.cpp`)
- Game-state format → Board operations: serializes board (evidence: `file_utils.cpp`)
