# codevix26/codevix-tic-tac-toe architecture

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

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

## Overview

Codevix Tic-Tac-Toe is an interactive terminal game. A player starts a session and enters moves; the CLI controller coordinates board state, asks the heuristic bot for its turn, and renders each frame and the outcome. The board handles move availability and win/draw checks, while input validation and terminal rendering are separate UI responsibilities. The README documents replay and graceful interruption; those behaviors are part of the controller and input flow. Relationships shown are supported by the README or sampled source; no unsampled modules are assumed.

Main entry points: [`src/index.ts`](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/index.ts) (Game Loop), [`src/core/Board.ts`](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/core/Board.ts) (Board State), [`src/ui/input.ts`](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/ui/input.ts) (Move Input), [`src/utils/helpers.ts`](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/utils/helpers.ts) (Bot Delay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_controller["Game Control"]
  node_cli["Game Loop<br/>[index.ts]"]
  node_delay["Bot Delay<br/>[helpers.ts]"]
end

subgraph group_logic["Game Logic"]
  node_board["Board State<br/>[Board.ts]"]
  node_bot["Bot Strategy<br/>[Bot.ts]"]
end

subgraph group_terminal["Terminal UI"]
  node_input["Move Input<br/>[input.ts]"]
  node_render["Board Renderer<br/>[render.ts]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_cli
node_cli -->|"creates and updates"| node_board
node_cli -->|"checks outcome"| node_board
node_cli -->|"renders state"| node_render
node_cli -->|"requests move"| node_input
node_player -->|"enters move"| node_input
node_cli -->|"chooses move"| node_bot
node_cli -->|"waits before turn"| node_delay

click node_cli "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/index.ts"
click node_board "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/core/Board.ts"
click node_bot "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/core/Bot.ts"
click node_input "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/ui/input.ts"
click node_render "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/ui/render.ts"
click node_delay "https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/utils/helpers.ts"

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_cli,node_delay toneBlue
class node_board,node_bot toneAmber
class node_input,node_render toneMint
class node_player toneIndigo
```

## Components

### Game Control

- [Game Loop](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/index.ts): `src/index.ts`
- [Bot Delay](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/utils/helpers.ts): `src/utils/helpers.ts`

### Game Logic

- [Board State](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/core/Board.ts): `src/core/Board.ts`
- [Bot Strategy](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/core/Bot.ts): `src/core/Bot.ts`

### Terminal UI

- [Move Input](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/ui/input.ts): `src/ui/input.ts`
- [Board Renderer](https://github.com/codevix26/codevix-tic-tac-toe/blob/main/src/ui/render.ts): `src/ui/render.ts`

### Other components

- **Player**

## Connections

- Player → Game Loop: starts game (evidence: `README.md`)
- Game Loop → Board State: creates and updates (evidence: `src/index.ts`)
- Game Loop → Board State: checks outcome (evidence: `src/index.ts`)
- Game Loop → Board Renderer: renders state (evidence: `src/index.ts`)
- Game Loop → Move Input: requests move (evidence: `src/index.ts`)
- Player → Move Input: enters move (evidence: `src/ui/input.ts`)
- Game Loop → Bot Strategy: chooses move (evidence: `src/index.ts`)
- Game Loop → Bot Delay: waits before turn (evidence: `src/index.ts`)
