# annmascrene/tic-tac-toe architecture

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

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

## Overview

This repository contains a small, two-player Tic-Tac-Toe game implemented as a Python console program. Its principal workflow is: initialize a board, display it, prompt the active player for a valid move, update the board, then check for a win or draw before continuing or ending. The sampled Python source supports these runtime relationships; the tree also lists index.html, but no contents were provided, so its role is unclear and it is omitted.

Main entry points: [`tictactoe.py`](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py) (Game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_player(("Human player"))
node_loop["Game loop<br/>[tictactoe.py]"]
node_board["Board state<br/>[tictactoe.py]"]
node_create["Create board<br/>[tictactoe.py]"]
node_display["Display board<br/>[tictactoe.py]"]
node_move["Validate move<br/>[tictactoe.py]"]
node_winner["Check winner<br/>[tictactoe.py]"]
node_draw["Check draw<br/>[tictactoe.py]"]
node_console["Console"]

node_loop -->|"calls"| node_create
node_create -->|"creates"| node_board
node_loop -->|"calls"| node_display
node_display -->|"reads"| node_board
node_display -->|"prints"| node_console
node_loop -->|"calls"| node_move
node_move -->|"checks"| node_board
node_move -->|"prompts"| node_console
node_player -->|"enters move"| node_move
node_loop -->|"updates"| node_board
node_loop -->|"calls"| node_winner
node_winner -->|"checks"| node_board
node_loop -->|"calls"| node_draw
node_draw -->|"checks"| node_board
node_loop -->|"prints result"| node_console

click node_loop "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_board "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_create "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_display "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_move "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_winner "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"
click node_draw "https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py"

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_player,node_console toneIndigo
class node_loop,node_board,node_create,node_display,node_move,node_winner,node_draw toneTeal
```

## Components

### Other components

- **Human player**
- [Game loop](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Board state](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Create board](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Display board](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Validate move](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Check winner](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- [Check draw](https://github.com/annmascrene/tic-tac-toe/blob/main/tictactoe.py): `tictactoe.py`
- **Console**

## Connections

- Game loop → Create board: calls
- Create board → Board state: creates
- Game loop → Display board: calls
- Display board → Board state: reads
- Display board → Console: prints
- Game loop → Validate move: calls
- Validate move → Board state: checks
- Validate move → Console: prompts
- Human player → Validate move: enters move
- Game loop → Board state: updates
- Game loop → Check winner: calls
- Check winner → Board state: checks
- Game loop → Check draw: calls
- Check draw → Board state: checks
- Game loop → Console: prints result
