# demoner21/tictactoe architecture

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

- Interactive diagram: https://gitdiagram.com/demoner21/tictactoe
- Repository: https://github.com/demoner21/tictactoe

## Overview

This repository contains two independent Tic-Tac-Toe implementations: a terminal game and a Tkinter GUI. In both, a player enters a move, the game updates its board, checks for a win or tie, and reports the result. The terminal version prompts and prints; the GUI version uses button callbacks and status labels. Source excerpts show the key calls within each implementation; no README documents additional capabilities.

Main entry points: [`tictac.py`](https://github.com/demoner21/tictactoe/blob/master/tictac.py) (Game loop), [`tictoe.py`](https://github.com/demoner21/tictactoe/blob/master/tictoe.py) (GUI game)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terminal["Terminal game"]
  node_cli_game["Game loop<br/>[tictac.py]"]
  node_cli_moves["Move input<br/>[tictac.py]"]
  node_cli_board["Board output<br/>[tictac.py]"]
  node_cli_rules["Win check<br/>[tictac.py]"]
end

subgraph group_gui["Tkinter game"]
  node_gui_game["GUI game<br/>[tictoe.py]"]
  node_gui_buttons["Board buttons<br/>[tictoe.py]"]
  node_gui_rules["Win check<br/>[tictoe.py]"]
  node_gui_status["Status display<br/>[tictoe.py]"]
end

node_terminal_player(("Player"))
node_cli_terminal["Terminal"]
node_gui_player(("Player"))
node_gui_tk["Tkinter"]

node_terminal_player -->|"enters move"| node_cli_moves
node_cli_game -->|"requests moves"| node_cli_moves
node_cli_moves -->|"updates board"| node_cli_game
node_cli_game -->|"prints board"| node_cli_board
node_cli_game -->|"checks win"| node_cli_rules
node_cli_game -->|"prints prompts"| node_cli_terminal
node_gui_player -->|"clicks cell"| node_gui_buttons
node_gui_buttons -->|"calls move"| node_gui_game
node_gui_game -->|"checks win"| node_gui_rules
node_gui_game -->|"updates status"| node_gui_status
node_gui_game -->|"updates cells"| node_gui_buttons
node_gui_game -->|"creates widgets"| node_gui_tk

click node_cli_game "https://github.com/demoner21/tictactoe/blob/master/tictac.py"
click node_cli_moves "https://github.com/demoner21/tictactoe/blob/master/tictac.py"
click node_cli_board "https://github.com/demoner21/tictactoe/blob/master/tictac.py"
click node_cli_rules "https://github.com/demoner21/tictactoe/blob/master/tictac.py"
click node_gui_game "https://github.com/demoner21/tictactoe/blob/master/tictoe.py"
click node_gui_buttons "https://github.com/demoner21/tictactoe/blob/master/tictoe.py"
click node_gui_rules "https://github.com/demoner21/tictactoe/blob/master/tictoe.py"
click node_gui_status "https://github.com/demoner21/tictactoe/blob/master/tictoe.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_cli_game,node_cli_moves,node_cli_board,node_cli_rules toneBlue
class node_gui_game,node_gui_buttons,node_gui_rules,node_gui_status toneAmber
class node_terminal_player,node_cli_terminal,node_gui_player,node_gui_tk toneIndigo
```

## Components

### Terminal game

- [Game loop](https://github.com/demoner21/tictactoe/blob/master/tictac.py): `tictac.py`
- [Move input](https://github.com/demoner21/tictactoe/blob/master/tictac.py): `tictac.py`
- [Board output](https://github.com/demoner21/tictactoe/blob/master/tictac.py): `tictac.py`
- [Win check](https://github.com/demoner21/tictactoe/blob/master/tictac.py): `tictac.py`

### Tkinter game

- [GUI game](https://github.com/demoner21/tictactoe/blob/master/tictoe.py): `tictoe.py`
- [Board buttons](https://github.com/demoner21/tictactoe/blob/master/tictoe.py): `tictoe.py`
- [Win check](https://github.com/demoner21/tictactoe/blob/master/tictoe.py): `tictoe.py`
- [Status display](https://github.com/demoner21/tictactoe/blob/master/tictoe.py): `tictoe.py`

### Other components

- **Player**
- **Terminal**
- **Player**
- **Tkinter**

## Connections

- Player → Move input: enters move (evidence: `tictac.py`)
- Game loop → Move input: requests moves (evidence: `tictac.py`)
- Move input → Game loop: updates board (evidence: `tictac.py`)
- Game loop → Board output: prints board (evidence: `tictac.py`)
- Game loop → Win check: checks win (evidence: `tictac.py`)
- Game loop → Terminal: prints prompts (evidence: `tictac.py`)
- Player → Board buttons: clicks cell (evidence: `tictoe.py`)
- Board buttons → GUI game: calls move (evidence: `tictoe.py`)
- GUI game → Win check: checks win (evidence: `tictoe.py`)
- GUI game → Status display: updates status (evidence: `tictoe.py`)
- GUI game → Board buttons: updates cells (evidence: `tictoe.py`)
- GUI game → Tkinter: creates widgets (evidence: `tictoe.py`)
