# tadrosmaged/tictactoe_game architecture

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

- Interactive diagram: https://gitdiagram.com/tadrosmaged/tictactoe_game
- Repository: https://github.com/tadrosmaged/tictactoe_game

## Overview

##### Project type and purpose
- This is a desktop GUI application built with Qt 6.7, implementing a Tic-Tac-Toe game (“TicTacBoom”) with single-player (minimax + alpha-beta pruning) and two-player modes.
- It also includes user management (login, signup, user profiles, statistics) backed by a local SQLite database.

##### File structure
- Top level: Qt_2/ contains all source code, .ui files, the .pro qmake project, and TicTacBoom.db (SQLite file).
- Subdirectories:
- build/ & Qt_2/build/ – auto-generated build artifacts (object files, Makefiles, UI headers).
- Qt_2/test/ – unit/integration tests invoking the same widgets and logic.
- Key source files:
- main.cpp, App.cpp/h – application entry point, QCoreApplication/QApplication setup.
- *.ui & generated ui_*.h – UI definitions for windows/widgets.
- *.cpp/h – controller classes (loginpage, signupform, gamemodewindow, gameplaywindow, statisticswindow, userprofile, etc.).
- tictactoewidget.cpp/h – custom game board widget.
- Database file: TicTacBoom.db stored alongside sources for persistent user & game history.
- build scripts: TicTacBoom.pro drives qmake → make.

##### README for insights
- Confirms use of Qt on Windows, features, and algorithmic focus (minimax & pruning) in game logic.
- No external services – all local; no web/backend.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        style UI fill:#D0E8FF,stroke:#0275d8
        MW["MainWindow"]:::ui
        GM["GameModeWindow"]:::ui
        GPW["GamePlayWindow"]:::ui
        LP["LoginPage"]:::ui
        SU["SignUpForm"]:::ui
        SW["StatisticsWindow"]:::ui
        UP["UserProfile"]:::ui
        PS["PlayerSelection"]:::ui
        CD["ChooseDifficulty"]:::ui
        GH["GameHistoryWindow"]:::ui
        TTW["TicTacToeWidget"]:::ui
    end

    %% Logic Layer
    subgraph "Application Logic Layer"
        style LOGIC fill:#D5FFD0,stroke:#5cb85c
        APP["App (QApplication)"]:::logic
        GC["GameChoices"]:::logic
        GHLogic["GameHistory Logic"]:::logic
    end

    %% Data Layer
    subgraph "Data Layer"
        style DATA fill:#FFF3B0,stroke:#f0ad4e
        DB1["TicTacBoom.db"]:::data
        DB2["TicTacToe.db"]:::data
    end

    %% Build and Test
    subgraph "Build & Test"
        style BT fill:#E0E0E0,stroke:#6c757d
        PRO["TicTacBoom.pro"]:::build
        TOPBUILD["build/"]:::build
        QT2BUILD["Qt_2/build/"]:::build
        TSTPRO["test/test.pro"]:::build
        TSTCPP["tst_test1.cpp"]:::build
        TSTBUILD["test/build/"]:::build
    end

    %% Connections: UI → Logic
    MW -->|signals| APP
    GM -->|signals| GC
    GPW -->|signals| GC
    LP -->|auth events| APP
    SU -->|auth events| APP
    SW -->|stats requests| GHLogic
    UP -->|profile requests| APP
    PS -->|selection events| GC
    CD -->|difficulty choice| GC
    GH -->|history requests| GHLogic
    TTW -->|user moves| GC

    %% Logic → Data
    GHLogic -->|read/write history| DB1
    APP -->|user persistence| DB1
    GC -->|game results| DB1
    GC -->|optional fallback| DB2

    %% Logic → UI
    APP -->|update UI| MW
    GC -->|update UI| GPW
    GHLogic -->|update UI| SW
    GHLogic -->|update UI| GH

    %% Build/Test dependencies
    PRO -->|generates| TOPBUILD
    PRO -->|uses| QT2BUILD
    TSTPRO -->|generates| TSTBUILD
    TSTPRO -->|runs| TSTCPP

    %% Click Events UI
    click MW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/mainwindow.ui"
    click MW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/mainwindow.cpp"
    click MW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/mainwindow.h"
    click GM "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamemodewindow.ui"
    click GM "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamemodewindow.cpp"
    click GM "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamemodewindow.h"
    click GPW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gameplaywindow.ui"
    click GPW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gameplaywindow.cpp"
    click GPW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gameplaywindow.h"
    click LP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/loginpage.ui"
    click LP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/loginpage.cpp"
    click LP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/loginpage.h"
    click SU "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/signupform.ui"
    click SU "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/signupform.cpp"
    click SU "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/signupform.h"
    click SW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/statisticswindow.ui"
    click SW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/statisticswindow.cpp"
    click SW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/statisticswindow.h"
    click UP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/userprofile.ui"
    click UP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/userprofile.cpp"
    click UP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/userprofile.h"
    click PS "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/playerselection.ui"
    click PS "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/playerselection.cpp"
    click PS "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/playerselection.h"
    click CD "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/choosedifficulty.ui"
    click CD "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/choosedifficulty.cpp"
    click CD "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/choosedifficulty.h"
    click GH "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamehistory.ui"
    click GH "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamehistory.cpp"
    click GH "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamehistory.h"
    click TTW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/tictactoewidget.cpp"
    click TTW "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/tictactoewidget.h"

    %% Click Events Logic
    click APP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/main.cpp"
    click APP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/App.h"
    click APP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/App.cpp"
    click GC "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gameChoices.h"
    click GC "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gameChoices.cpp"
    click GHLogic "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamehistory.h"
    click GHLogic "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/gamehistory.cpp"

    %% Click Events Data
    click DB1 "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/TicTacBoom.db"
    click DB2 "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/TicTacToe.db"

    %% Click Events Build/Test
    click PRO "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/TicTacBoom.pro"
    click TOPBUILD "https://github.com/tadrosmaged/tictactoe_game/tree/main/build/"
    click QT2BUILD "https://github.com/tadrosmaged/tictactoe_game/tree/main/Qt_2/build/"
    click TSTPRO "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/test/test.pro"
    click TSTCPP "https://github.com/tadrosmaged/tictactoe_game/blob/main/Qt_2/test/tst_test1.cpp"
    click TSTBUILD "https://github.com/tadrosmaged/tictactoe_game/tree/main/Qt_2/test/build/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0275d8
    classDef logic fill:#D5FFD0,stroke:#5cb85c
    classDef data fill:#FFF3B0,stroke:#f0ad4e
    classDef build fill:#E0E0E0,stroke:#6c757d
```
