# ihac-er/tictactoe-bot architecture

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

- Interactive diagram: https://gitdiagram.com/ihac-er/tictactoe-bot
- Repository: https://github.com/ihac-er/tictactoe-bot

## Overview

Tic-Tac-Toe Bot is a small game application with CLI and Tkinter interfaces, a shared rules engine, and a Minimax bot. The main workflow is user input through the selected interface, game-state updates, and bot move selection when applicable. The source excerpts show the CLI and GUI call paths; the README documents interface selection and the GUI’s delegation. The graph omits unshown details beyond those sources.

Main entry points: [`TicTacToeGUI.py`](https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToeGUI.py) (Tkinter GUI), [`main.py`](https://github.com/ihac-er/tictactoe-bot/blob/main/main.py) (CLI game), [`bot.py`](https://github.com/ihac-er/tictactoe-bot/blob/main/bot.py) (Bot moves), [`TicTacToe.py`](https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToe.py) (Game engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and interfaces"]
  node_main["Entry point<br/>[main.py]"]
  node_cli["CLI game<br/>[main.py]"]
  node_gui["Tkinter GUI<br/>[TicTacToeGUI.py]"]
end

subgraph group_rules["Game rules"]
  node_engine["Game engine<br/>[TicTacToe.py]"]
end

subgraph group_bot["Bot strategy"]
  node_bot["Bot moves<br/>[bot.py]"]
  node_minimax["Minimax search<br/>[bot.py]"]
end

node_user(("Player"))
node_tk["Tkinter"]

node_user -->|"starts game"| node_main
node_main -->|"selects CLI"| node_cli
node_main -->|"launches GUI"| node_gui
node_user -->|"enters moves"| node_cli
node_user -->|"clicks cells"| node_gui
node_gui -->|"uses toolkit"| node_tk
node_cli -->|"plays moves"| node_engine
node_cli -->|"requests move"| node_bot
node_gui -->|"plays moves"| node_engine
node_gui -->|"requests move"| node_bot
node_cli -->|"syncs board"| node_bot
node_gui -->|"syncs board"| node_bot
node_bot -->|"evaluates moves"| node_minimax

click node_main "https://github.com/ihac-er/tictactoe-bot/blob/main/main.py"
click node_cli "https://github.com/ihac-er/tictactoe-bot/blob/main/main.py"
click node_gui "https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToeGUI.py"
click node_engine "https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToe.py"
click node_bot "https://github.com/ihac-er/tictactoe-bot/blob/main/bot.py"
click node_minimax "https://github.com/ihac-er/tictactoe-bot/blob/main/bot.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_main,node_cli,node_gui toneBlue
class node_engine toneAmber
class node_bot,node_minimax toneMint
class node_user,node_tk toneIndigo
```

## Components

### Entry and interfaces

- [Entry point](https://github.com/ihac-er/tictactoe-bot/blob/main/main.py): `main.py`
- [CLI game](https://github.com/ihac-er/tictactoe-bot/blob/main/main.py): `main.py`
- [Tkinter GUI](https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToeGUI.py): `TicTacToeGUI.py`

### Game rules

- [Game engine](https://github.com/ihac-er/tictactoe-bot/blob/main/TicTacToe.py): `TicTacToe.py`

### Bot strategy

- [Bot moves](https://github.com/ihac-er/tictactoe-bot/blob/main/bot.py): `bot.py`
- [Minimax search](https://github.com/ihac-er/tictactoe-bot/blob/main/bot.py): `bot.py`

### Other components

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

## Connections

- Player → Entry point: starts game (evidence: `README.md`)
- Entry point → CLI game: selects CLI (evidence: `main.py`)
- Entry point → Tkinter GUI: launches GUI (evidence: `main.py`)
- Player → CLI game: enters moves (evidence: `main.py`)
- Player → Tkinter GUI: clicks cells (evidence: `TicTacToeGUI.py`)
- Tkinter GUI → Tkinter: uses toolkit (evidence: `TicTacToeGUI.py`)
- CLI game → Game engine: plays moves (evidence: `main.py`)
- CLI game → Bot moves: requests move (evidence: `main.py`)
- Tkinter GUI → Game engine: plays moves (evidence: `TicTacToeGUI.py`)
- Tkinter GUI → Bot moves: requests move (evidence: `TicTacToeGUI.py`)
- CLI game → Bot moves: syncs board (evidence: `main.py`)
- Tkinter GUI → Bot moves: syncs board (evidence: `TicTacToeGUI.py`)
- Bot moves → Minimax search: evaluates moves (evidence: `bot.py`)
