# python-computer-vision-game/gesture-tic-tac-toe-algorithm-project architecture

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

- Interactive diagram: https://gitdiagram.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project
- Repository: https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project

## Overview

Gesture Tic-Tac-Toe is a two-player webcam game: the player points or pinches to select a cell, and the game validates moves, resolves rounds, updates scores, and renders results. Its principal flow runs from camera frames through hand tracking and gesture selection into the game engine. The README also documents mouse input, setup, settings, instructions, camera recovery, and audio. The sampled excerpts establish the main calls; some screen and loop details are only partially shown, so undocumented links are omitted.

Main entry points: [`src/game_state.py`](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_state.py) (Game loop and screens), [`src/hand_tracker.py`](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/hand_tracker.py) (Hand tracking), [`src/renderer.py`](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/renderer.py) (Game and menu rendering), [`src/gesture_detector.py`](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py) (Gesture detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input"]
  node_camera["Camera capture<br/>[hand_tracker.py]"]
  node_tracking["Hand tracking<br/>[hand_tracker.py]"]
  node_gesture["Gesture detection"]
  node_selection["Pointer selection"]
  node_mouse["Mouse input"]
  node_mapper["Cell mapping"]
end

subgraph group_gameplay["Game logic"]
  node_game["Game loop and screens<br/>[game_state.py]"]
  node_engine["Game engine<br/>[game_state.py]"]
  node_board["Board state<br/>[board.py]"]
  node_rules["Move and result rules<br/>[game_rules.py]"]
  node_turns["Turn management<br/>[turn_manager.py]"]
  node_scores["Match scores<br/>[score_manager.py]"]
end

subgraph group_presentation["Presentation"]
  node_renderer["Game and menu rendering<br/>[renderer.py]"]
end

subgraph group_support["Runtime support"]
  node_main["Application entry<br/>[main.py]"]
  node_config["Settings and UI text<br/>[config.py]"]
  node_audio["Sound and music<br/>[audio_manager.py]"]
end

node_player(("Player"))
node_webcam["Webcam"]
node_mediapipe["MediaPipe"]
node_soundfiles["Audio assets"]

node_player -->|"starts"| node_main
node_main -->|"runs"| node_game
node_webcam -->|"provides frames"| node_camera
node_camera -->|"captures frames"| node_tracking
node_tracking -->|"detects hands"| node_mediapipe
node_game -->|"reads frames"| node_camera
node_game -->|"processes frames"| node_tracking
node_tracking -->|"supplies landmarks"| node_gesture
node_gesture -->|"produces pointers"| node_selection
node_player -.->|"moves pointer"| node_mouse
node_mouse -.->|"supplies input"| node_game
node_game -->|"updates selection"| node_selection
node_game -->|"maps cells"| node_mapper
node_selection -->|"confirms target"| node_game
node_game -->|"dispatches actions"| node_engine
node_engine -->|"evaluates moves"| node_rules
node_engine -->|"updates board"| node_board
node_engine -->|"tracks turns"| node_turns
node_engine -->|"records results"| node_scores
node_game -->|"draws screens"| node_renderer
node_renderer -->|"reads board"| node_board
node_renderer -->|"uses pointer types"| node_gesture
node_renderer -->|"uses hand connections"| node_tracking
node_game -->|"plays cues"| node_audio
node_audio -->|"loads sounds"| node_soundfiles
node_game -->|"reads settings"| node_config
node_audio -->|"reads paths"| node_config
node_gesture -->|"reads thresholds"| node_config

click node_main "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/main.py"
click node_game "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_state.py"
click node_camera "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/hand_tracker.py"
click node_tracking "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/hand_tracker.py"
click node_gesture "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py"
click node_selection "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py"
click node_mouse "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py"
click node_mapper "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py"
click node_engine "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_state.py"
click node_board "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/board.py"
click node_rules "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_rules.py"
click node_turns "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/turn_manager.py"
click node_scores "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/score_manager.py"
click node_renderer "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/renderer.py"
click node_config "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/config.py"
click node_audio "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/audio_manager.py"
click node_soundfiles "https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/tree/main/assets/sounds"

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_camera,node_tracking,node_gesture,node_selection,node_mouse,node_mapper toneBlue
class node_game,node_engine,node_board,node_rules,node_turns,node_scores toneAmber
class node_renderer,node_mediapipe toneMint
class node_main,node_config,node_audio toneRose
class node_player,node_webcam toneIndigo
class node_soundfiles toneTeal
```

## Components

### Input

- [Camera capture](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/hand_tracker.py): `src/hand_tracker.py`
- [Hand tracking](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/hand_tracker.py): `src/hand_tracker.py`
- [Gesture detection](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py): `src/gesture_detector.py`
- [Pointer selection](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py): `src/gesture_detector.py`
- [Mouse input](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py): `src/gesture_detector.py`
- [Cell mapping](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/gesture_detector.py): `src/gesture_detector.py`

### Game logic

- [Game loop and screens](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_state.py): `src/game_state.py`
- [Game engine](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_state.py): `src/game_state.py`
- [Board state](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/board.py): `src/board.py`
- [Move and result rules](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/game_rules.py): `src/game_rules.py`
- [Turn management](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/turn_manager.py): `src/turn_manager.py`
- [Match scores](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/score_manager.py): `src/score_manager.py`

### Presentation

- [Game and menu rendering](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/renderer.py): `src/renderer.py`

### Runtime support

- [Application entry](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/main.py): `main.py`
- [Settings and UI text](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/config.py): `src/config.py`
- [Sound and music](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/blob/main/src/audio_manager.py): `src/audio_manager.py`

### Other components

- **Player**
- **Webcam**
- **MediaPipe**
- [Audio assets](https://github.com/python-computer-vision-game/gesture-tic-tac-toe-algorithm-project/tree/main/assets/sounds): `assets/sounds`

## Connections

- Player → Application entry: starts (evidence: `README.md`)
- Application entry → Game loop and screens: runs (evidence: `main.py`)
- Webcam → Camera capture: provides frames (evidence: `src/hand_tracker.py`)
- Camera capture → Hand tracking: captures frames (evidence: `src/hand_tracker.py`)
- Hand tracking → MediaPipe: detects hands (evidence: `src/hand_tracker.py`)
- Game loop and screens → Camera capture: reads frames (evidence: `src/game_state.py`)
- Game loop and screens → Hand tracking: processes frames (evidence: `src/game_state.py`)
- Hand tracking → Gesture detection: supplies landmarks (evidence: `src/gesture_detector.py`)
- Gesture detection → Pointer selection: produces pointers (evidence: `src/gesture_detector.py`)
- Player → Mouse input: moves pointer (evidence: `README.md`)
- Mouse input → Game loop and screens: supplies input (evidence: `src/game_state.py`)
- Game loop and screens → Pointer selection: updates selection (evidence: `src/game_state.py`)
- Game loop and screens → Cell mapping: maps cells (evidence: `src/game_state.py`)
- Pointer selection → Game loop and screens: confirms target (evidence: `src/game_state.py`)
- Game loop and screens → Game engine: dispatches actions (evidence: `src/game_state.py`)
- Game engine → Move and result rules: evaluates moves (evidence: `src/game_state.py`)
- Game engine → Board state: updates board (evidence: `src/game_state.py`)
- Game engine → Turn management: tracks turns (evidence: `src/game_state.py`)
- Game engine → Match scores: records results (evidence: `src/game_state.py`)
- Game loop and screens → Game and menu rendering: draws screens (evidence: `src/game_state.py`)
- Game and menu rendering → Board state: reads board (evidence: `src/renderer.py`)
- Game and menu rendering → Gesture detection: uses pointer types (evidence: `src/renderer.py`)
- Game and menu rendering → Hand tracking: uses hand connections (evidence: `src/renderer.py`)
- Game loop and screens → Sound and music: plays cues (evidence: `src/game_state.py`)
- Sound and music → Audio assets: loads sounds (evidence: `src/audio_manager.py`)
- Game loop and screens → Settings and UI text: reads settings (evidence: `src/game_state.py`)
- Sound and music → Settings and UI text: reads paths (evidence: `src/audio_manager.py`)
- Gesture detection → Settings and UI text: reads thresholds (evidence: `src/gesture_detector.py`)
