# zodys/tictactoe architecture

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

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

## Overview

##### Project type and purpose
- This is a self-contained, console-based Tic-Tac-Toe game written in C#/.NET.
- It lives in a Visual Studio solution (`TicTacToe.sln`) with a single project (`TicTacToe.csproj`).
- The purpose is to run a human vs. human or human vs. AI game loop in the terminal.

##### File structure
- Top-level files:
- README.md (unused)
- TicTacToe.sln (solution container)
- Project folder “TicTacToe”:
- Program.cs – application entry point & console I/O
- Board.cs – internal representation of the 3×3 grid
- CellState.cs – enum defining Empty, X, O
- Player.cs – abstract or base class for Player behavior
- AI.cs – implementation of computer-move algorithm
- TicTacToe.csproj – .NET project definition
- No external services, databases, or web layers—purely local, in-memory logic.

##### README
- The README contains no usable architectural hints (“Don’t read me >:(”).
- All insights must come from file names and typical design patterns for console games.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Solution and Project
    subgraph "Solution Container"
        Solver("TicTacToe.sln"):::container
        CSProj("TicTacToe.csproj"):::container
    end

    Solver -->|"contains"| CSProj

    %% Layers
    subgraph "UI Layer"
        Program["Program\n(Console UI)"]:::ui
    end

    subgraph "Orchestration Layer"
        Game["Game\n(Engine)"]:::logic
    end

    subgraph "Player Components"
        Player["Player\n(Abstract)"]:::abstract
        AIPlayer["AIPlayer\n(Algorithm)"]:::ai
    end

    subgraph "Domain Model"
        Board["Board\n(Grid Model)"]:::data
        CellState["CellState\n(Enum)"]:::data
    end

    %% Connections
    Program -->|"calls Run()"| Game
    Game -->|"invokes GetMove(Board)"| Player
    Player -->|"reads/writes PlaceMark()"| Board
    Game -->|"queries CheckWin()"| Board
    AIPlayer -->|"implements GetMove()"| Player
    AIPlayer -->|"queries Board state"| Board
    Board -->|"uses state"| CellState

    %% Click Events
    click Program "https://github.com/zodys/tictactoe/blob/main/TicTacToe/Program.cs"
    click Game "https://github.com/zodys/tictactoe/blob/main/TicTacToe/Game.cs"
    click Board "https://github.com/zodys/tictactoe/blob/main/TicTacToe/Board.cs"
    click CellState "https://github.com/zodys/tictactoe/blob/main/TicTacToe/CellState.cs"
    click Player "https://github.com/zodys/tictactoe/blob/main/TicTacToe/Player.cs"
    click AIPlayer "https://github.com/zodys/tictactoe/blob/main/TicTacToe/AI.cs"
    click CSProj "https://github.com/zodys/tictactoe/blob/main/TicTacToe/TicTacToe.csproj"
    click Solver "https://github.com/zodys/tictactoe/blob/main/TicTacToe.sln"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#2196F3,stroke-width:2px;
    classDef logic fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px;
    classDef data fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px;
    classDef abstract fill:#F3E5F5,stroke:#9C27B0,stroke-width:2px,stroke-dasharray: 5 5;
    classDef ai fill:#FFEBEE,stroke:#F44336,stroke-width:2px;
    classDef container fill:#ECEFF1,stroke:#607D8B,stroke-width:2px,stroke-dasharray: 2 2;
```
