# aarende/mini-chess architecture

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

- Interactive diagram: https://gitdiagram.com/aarende/mini-chess
- Repository: https://github.com/aarende/mini-chess

## Overview

MiniChess is a standalone Qt desktop chess game. Players choose a standard or custom setup, make moves on the board, and can pause, save, resume, or review a game. The documented workflow includes setup editing and validation, rule-checked play, and end-of-game results; setup and game files preserve different data. The excerpts show the main window coordinating the engine, board view, timers, and file dialogs. Save/load paths are visible, but unsampled handlers and UI wiring limit confidence about some details.

Main entry points: [`mainwindow.cpp`](https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp) (Main window), [`chessgame.cpp`](https://github.com/aarende/mini-chess/blob/main/chessgame.cpp) (Game state and rules), [`chessboardview.cpp`](https://github.com/aarende/mini-chess/blob/main/chessboardview.cpp) (Board view), [`mainwindow.ui`](https://github.com/aarende/mini-chess/blob/main/mainwindow.ui) (Game interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Game coordination"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_window["Main window<br/>[mainwindow.cpp]"]
end

subgraph group_rules["Chess rules"]
  node_game["Game state and rules<br/>[chessgame.cpp]"]
  node_data["Piece model<br/>[chessdata.h]"]
end

subgraph group_presentation["Board and interface"]
  node_board["Board view<br/>[chessboardview.cpp]"]
  node_interface["Game interface<br/>[mainwindow.ui]"]
end

subgraph group_persistence["Saved games"]
  node_setupfiles["Setup files<br/>[mainwindow.cpp]"]
  node_gamefiles["Game files<br/>[mainwindow.cpp]"]
end

node_player(("Player"))
node_filesystem[("Local files")]

node_player -->|"uses"| node_interface
node_entry -->|"creates"| node_window
node_window -->|"controls"| node_interface
node_window -->|"updates"| node_board
node_board -->|"emits clicks"| node_window
node_window -->|"requests moves"| node_game
node_window -->|"executes moves"| node_game
node_window -->|"checks results"| node_game
node_game -->|"uses pieces"| node_data
node_window -->|"writes or reads"| node_setupfiles
node_window -->|"writes or reads"| node_gamefiles
node_setupfiles -->|"stored in"| node_filesystem
node_gamefiles -->|"stored in"| node_filesystem

click node_entry "https://github.com/aarende/mini-chess/blob/main/main.cpp"
click node_window "https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp"
click node_game "https://github.com/aarende/mini-chess/blob/main/chessgame.cpp"
click node_data "https://github.com/aarende/mini-chess/blob/main/chessdata.h"
click node_board "https://github.com/aarende/mini-chess/blob/main/chessboardview.cpp"
click node_interface "https://github.com/aarende/mini-chess/blob/main/mainwindow.ui"
click node_setupfiles "https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp"
click node_gamefiles "https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp"

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_entry,node_window toneBlue
class node_game,node_data,node_filesystem toneAmber
class node_board,node_interface toneMint
class node_setupfiles,node_gamefiles toneRose
class node_player toneIndigo
```

## Components

### Game coordination

- [Application entry](https://github.com/aarende/mini-chess/blob/main/main.cpp): `main.cpp`
- [Main window](https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp): `mainwindow.cpp`

### Chess rules

- [Game state and rules](https://github.com/aarende/mini-chess/blob/main/chessgame.cpp): `chessgame.cpp`
- [Piece model](https://github.com/aarende/mini-chess/blob/main/chessdata.h): `chessdata.h`

### Board and interface

- [Board view](https://github.com/aarende/mini-chess/blob/main/chessboardview.cpp): `chessboardview.cpp`
- [Game interface](https://github.com/aarende/mini-chess/blob/main/mainwindow.ui): `mainwindow.ui`

### Saved games

- [Setup files](https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp): `mainwindow.cpp`
- [Game files](https://github.com/aarende/mini-chess/blob/main/mainwindow.cpp): `mainwindow.cpp`

### Other components

- **Player**
- **Local files**

## Connections

- Player → Game interface: uses
- Application entry → Main window: creates
- Main window → Game interface: controls
- Main window → Board view: updates
- Board view → Main window: emits clicks
- Main window → Game state and rules: requests moves
- Main window → Game state and rules: executes moves
- Main window → Game state and rules: checks results
- Game state and rules → Piece model: uses pieces
- Main window → Setup files: writes or reads
- Main window → Game files: writes or reads
- Setup files → Local files: stored in
- Game files → Local files: stored in
