# redmvv/tic-tac-toe architecture

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

- Interactive diagram: https://gitdiagram.com/redmvv/tic-tac-toe
- Repository: https://github.com/redmvv/tic-tac-toe

## Overview

This is a Windows console game offering two local, two-player modes: Fill (best-of-three tic-tac-toe) and Slide (players move pieces as play continues). The user selects a mode, enters player names and a mark, then plays through numbered board cells until a win or match result is displayed. The graph separates mode setup, turn handling, win checks, shared player state, and console UI. Source excerpts establish the main runtime calls; no README capability description is available.

Main entry points: [`fill.cpp`](https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp) (Fill rounds), [`slide.cpp`](https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp) (Slide turns), [`main.cpp`](https://github.com/redmvv/tic-tac-toe/blob/main/main.cpp) (Program menu), [`player.hpp`](https://github.com/redmvv/tic-tac-toe/blob/main/player.hpp) (Player state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["Program menu<br/>[main.cpp]"]
end

subgraph group_fill["Fill mode"]
  node_fill_setup["Fill setup<br/>[fill.cpp]"]
  node_fill_rounds["Fill rounds<br/>[fill.cpp]"]
  node_fill_input["Fill move input<br/>[fill.cpp]"]
  node_fill_winner["Fill win check<br/>[fill.cpp]"]
end

subgraph group_slide["Slide mode"]
  node_slide_setup["Slide setup<br/>[slide.cpp]"]
  node_slide_turns["Slide turns<br/>[slide.cpp]"]
  node_slide_input["Slide move input<br/>[slide.cpp]"]
  node_slide_winner["Slide win check<br/>[slide.cpp]"]
end

subgraph group_shared["Shared game support"]
  node_menu["Menu UI<br/>[ui.cpp]"]
  node_player_state["Player state<br/>[player.hpp]"]
  node_board_render["Board renderer<br/>[ui.cpp]"]
  node_board_reset["Board reset<br/>[ui.cpp]"]
  node_console_ui["Console helpers<br/>[ui.cpp]"]
end

node_user(("Player"))

node_user -->|"chooses mode"| node_main
node_main -->|"starts Fill"| node_fill_setup
node_main -->|"starts Slide"| node_slide_setup
node_main -->|"invalid input"| node_menu
node_menu -->|"starts Fill"| node_fill_setup
node_menu -->|"starts Slide"| node_slide_setup
node_fill_setup -->|"starts rounds"| node_fill_rounds
node_fill_rounds -->|"gets move"| node_fill_input
node_fill_rounds -->|"checks win"| node_fill_winner
node_fill_setup -->|"sets players"| node_player_state
node_fill_rounds -->|"updates state"| node_player_state
node_fill_input -->|"redraws board"| node_board_render
node_fill_rounds -->|"renders board"| node_board_render
node_fill_rounds -->|"resets board"| node_board_reset
node_fill_setup -->|"formats display"| node_console_ui
node_slide_setup -->|"starts play"| node_slide_turns
node_slide_turns -->|"gets move"| node_slide_input
node_slide_turns -->|"checks win"| node_slide_winner
node_slide_setup -->|"sets players"| node_player_state
node_slide_turns -->|"updates state"| node_player_state
node_slide_input -->|"redraws board"| node_board_render
node_slide_turns -->|"renders board"| node_board_render
node_slide_setup -->|"formats display"| node_console_ui
node_user -->|"enters moves"| node_fill_input
node_user -->|"enters moves"| node_slide_input

click node_main "https://github.com/redmvv/tic-tac-toe/blob/main/main.cpp"
click node_menu "https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp"
click node_fill_setup "https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp"
click node_fill_rounds "https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp"
click node_fill_input "https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp"
click node_fill_winner "https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp"
click node_slide_setup "https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp"
click node_slide_turns "https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp"
click node_slide_input "https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp"
click node_slide_winner "https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp"
click node_player_state "https://github.com/redmvv/tic-tac-toe/blob/main/player.hpp"
click node_board_render "https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp"
click node_board_reset "https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp"
click node_console_ui "https://github.com/redmvv/tic-tac-toe/blob/main/ui.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_main toneBlue
class node_fill_setup,node_fill_rounds,node_fill_input,node_fill_winner toneAmber
class node_slide_setup,node_slide_turns,node_slide_input,node_slide_winner toneMint
class node_menu,node_player_state,node_board_render,node_board_reset,node_console_ui toneRose
class node_user toneIndigo
```

## Components

### Application entry

- [Program menu](https://github.com/redmvv/tic-tac-toe/blob/main/main.cpp): `main.cpp`

### Fill mode

- [Fill setup](https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp): `fill.cpp`
- [Fill rounds](https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp): `fill.cpp`
- [Fill move input](https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp): `fill.cpp`
- [Fill win check](https://github.com/redmvv/tic-tac-toe/blob/main/fill.cpp): `fill.cpp`

### Slide mode

- [Slide setup](https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp): `slide.cpp`
- [Slide turns](https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp): `slide.cpp`
- [Slide move input](https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp): `slide.cpp`
- [Slide win check](https://github.com/redmvv/tic-tac-toe/blob/main/slide.cpp): `slide.cpp`

### Shared game support

- [Menu UI](https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp): `ui.cpp`
- [Player state](https://github.com/redmvv/tic-tac-toe/blob/main/player.hpp): `player.hpp`
- [Board renderer](https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp): `ui.cpp`
- [Board reset](https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp): `ui.cpp`
- [Console helpers](https://github.com/redmvv/tic-tac-toe/blob/main/ui.cpp): `ui.cpp`

### Other components

- **Player**

## Connections

- Player → Program menu: chooses mode (evidence: `main.cpp`)
- Program menu → Fill setup: starts Fill (evidence: `main.cpp`)
- Program menu → Slide setup: starts Slide (evidence: `main.cpp`)
- Program menu → Menu UI: invalid input (evidence: `main.cpp`)
- Menu UI → Fill setup: starts Fill (evidence: `ui.cpp`)
- Menu UI → Slide setup: starts Slide (evidence: `ui.cpp`)
- Fill setup → Fill rounds: starts rounds (evidence: `fill.cpp`)
- Fill rounds → Fill move input: gets move (evidence: `fill.cpp`)
- Fill rounds → Fill win check: checks win (evidence: `fill.cpp`)
- Fill setup → Player state: sets players (evidence: `fill.cpp`)
- Fill rounds → Player state: updates state (evidence: `fill.cpp`)
- Fill move input → Board renderer: redraws board (evidence: `fill.cpp`)
- Fill rounds → Board renderer: renders board (evidence: `fill.cpp`)
- Fill rounds → Board reset: resets board (evidence: `fill.cpp`)
- Fill setup → Console helpers: formats display (evidence: `fill.cpp`)
- Slide setup → Slide turns: starts play (evidence: `slide.cpp`)
- Slide turns → Slide move input: gets move (evidence: `slide.cpp`)
- Slide turns → Slide win check: checks win (evidence: `slide.cpp`)
- Slide setup → Player state: sets players (evidence: `slide.cpp`)
- Slide turns → Player state: updates state (evidence: `slide.cpp`)
- Slide move input → Board renderer: redraws board (evidence: `slide.cpp`)
- Slide turns → Board renderer: renders board (evidence: `slide.cpp`)
- Slide setup → Console helpers: formats display (evidence: `slide.cpp`)
- Player → Fill move input: enters moves (evidence: `fill.cpp`)
- Player → Slide move input: enters moves (evidence: `slide.cpp`)
