# casalta-lester/tic-toc-toe architecture

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

- Interactive diagram: https://gitdiagram.com/casalta-lester/tic-toc-toe
- Repository: https://github.com/casalta-lester/tic-toc-toe

## Overview

This is a raylib-based Tic-Tac-Toe desktop game. A player uses the GUI to log in or register, selects a mode, plays rounds, and sees match results; account credentials and computer-mode win counts persist in JSON. The principal game stages—easy AI, Minimax AI, and local two-player play—are documented, but their complete implementation is not shown in the excerpts. The sampled code shows the GUI and game logic concentrated in main.cpp, which also opens the account file and includes the JSON library. Edges use README evidence where source details were not sampled.

Main entry points: [`Tic-Toc-Toe/src/main.cpp`](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp) (Board play), [`Tic-Toc-Toe/src/UserInfo.JSON`](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/UserInfo.JSON) (User records), [`Tic-Toc-Toe/src/json.hpp`](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/json.hpp) (JSON library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Game application"]
  node_game_app["Game screens<br/>[main.cpp]"]
  node_raylib["raylib GUI"]
end

subgraph group_accounts["Accounts and state"]
  node_account_flow["Account flow<br/>[main.cpp]"]
  node_json_lib["JSON library<br/>[json.hpp]"]
  node_account_store[("User records<br/>[UserInfo.JSON]")]
end

subgraph group_play["Match gameplay"]
  node_mode_select["Mode selection<br/>[main.cpp]"]
  node_board["Board play<br/>[main.cpp]"]
  node_easy_ai["Easy computer<br/>[main.cpp]"]
  node_hard_ai["Minimax computer<br/>[main.cpp]"]
  node_local_players["Two players<br/>[main.cpp]"]
  node_rounds["Five-round match<br/>[main.cpp]"]
  node_results["Match results<br/>[main.cpp]"]
end

node_player(("Player"))

node_player -->|"uses"| node_game_app
node_game_app -->|"draws GUI"| node_raylib
node_game_app -->|"routes screens"| node_account_flow
node_account_flow -->|"uses"| node_json_lib
node_account_flow -->|"reads and writes"| node_account_store
node_game_app -->|"offers modes"| node_mode_select
node_mode_select -.->|"starts play"| node_board
node_board -->|"dispatches"| node_easy_ai
node_board -->|"dispatches"| node_hard_ai
node_board -->|"supports turns"| node_local_players
node_board -->|"plays rounds"| node_rounds
node_rounds -->|"declares outcome"| node_results
node_results -->|"saves win counts"| node_account_store

click node_game_app "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_account_flow "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_json_lib "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/json.hpp"
click node_account_store "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/UserInfo.JSON"
click node_mode_select "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_board "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_easy_ai "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_hard_ai "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_local_players "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_rounds "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"
click node_results "https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp"

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_app,node_raylib toneBlue
class node_account_flow,node_json_lib,node_account_store toneAmber
class node_mode_select,node_board,node_easy_ai,node_hard_ai,node_local_players,node_rounds,node_results toneMint
class node_player toneIndigo
```

## Components

### Game application

- [Game screens](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- **raylib GUI**

### Accounts and state

- [Account flow](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [JSON library](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/json.hpp): `Tic-Toc-Toe/src/json.hpp`
- [User records](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/UserInfo.JSON): `Tic-Toc-Toe/src/UserInfo.JSON`

### Match gameplay

- [Mode selection](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Board play](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Easy computer](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Minimax computer](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Two players](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Five-round match](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`
- [Match results](https://github.com/casalta-lester/tic-toc-toe/blob/main/Tic-Toc-Toe/src/main.cpp): `Tic-Toc-Toe/src/main.cpp`

### Other components

- **Player**

## Connections

- Player → Game screens: uses (evidence: `README.md`)
- Game screens → raylib GUI: draws GUI (evidence: `Tic-Toc-Toe/src/main.cpp`)
- Game screens → Account flow: routes screens (evidence: `Tic-Toc-Toe/src/main.cpp`)
- Account flow → JSON library: uses (evidence: `Tic-Toc-Toe/src/main.cpp`)
- Account flow → User records: reads and writes (evidence: `README.md`)
- Game screens → Mode selection: offers modes (evidence: `README.md`)
- Mode selection → Board play: starts play (evidence: `Tic-Toc-Toe/src/main.cpp`)
- Board play → Easy computer: dispatches (evidence: `README.md`)
- Board play → Minimax computer: dispatches (evidence: `README.md`)
- Board play → Two players: supports turns (evidence: `README.md`)
- Board play → Five-round match: plays rounds (evidence: `README.md`)
- Five-round match → Match results: declares outcome (evidence: `README.md`)
- Match results → User records: saves win counts (evidence: `README.md`)
