# ondrejpupik/chess architecture

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

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

## Overview

This is a single-file SFML chess game. The player holds and moves pieces in the window; the game loop handles play and invokes chess-rule checks, while piece movement and promotion update the board. The excerpt shows legality, king-safety and checkmate logic, plus promotion selection. Components share chess.cpp because the repository has no separate runtime modules; unsampled details are omitted rather than inferred.

Main entry points: [`chess.cpp`](https://github.com/ondrejpupik/chess/blob/main/chess.cpp) (Game Loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game Interaction"]
  node_loop["Game Loop<br/>[chess.cpp]"]
  node_promotion["Promotion Choice<br/>[chess.cpp]"]
end

subgraph group_rules["Chess Rules"]
  node_ruleset["Move And Check Rules<br/>[chess.cpp]"]
end

subgraph group_state["Game State"]
  node_board[("Board And Pieces<br/>[chess.cpp]")]
end

node_player(("Player"))
node_sfml["SFML Window"]

node_player -->|"moves pieces"| node_loop
node_loop -->|"checks moves"| node_ruleset
node_loop -->|"opens choice"| node_promotion
node_loop -->|"draws window"| node_sfml
node_ruleset -->|"reads position"| node_board

click node_loop "https://github.com/ondrejpupik/chess/blob/main/chess.cpp"
click node_promotion "https://github.com/ondrejpupik/chess/blob/main/chess.cpp"
click node_ruleset "https://github.com/ondrejpupik/chess/blob/main/chess.cpp"
click node_board "https://github.com/ondrejpupik/chess/blob/main/chess.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_loop,node_promotion toneBlue
class node_ruleset toneAmber
class node_board toneMint
class node_player,node_sfml toneIndigo
```

## Components

### Game Interaction

- [Game Loop](https://github.com/ondrejpupik/chess/blob/main/chess.cpp): `chess.cpp`
- [Promotion Choice](https://github.com/ondrejpupik/chess/blob/main/chess.cpp): `chess.cpp`

### Chess Rules

- [Move And Check Rules](https://github.com/ondrejpupik/chess/blob/main/chess.cpp): `chess.cpp`

### Game State

- [Board And Pieces](https://github.com/ondrejpupik/chess/blob/main/chess.cpp): `chess.cpp`

### Other components

- **Player**
- **SFML Window**

## Connections

- Player → Game Loop: moves pieces (evidence: `README.md`)
- Game Loop → Move And Check Rules: checks moves (evidence: `chess.cpp`)
- Game Loop → Promotion Choice: opens choice (evidence: `chess.cpp`)
- Game Loop → SFML Window: draws window (evidence: `chess.cpp`)
- Move And Check Rules → Board And Pieces: reads position (evidence: `chess.cpp`)
