# jordan73737/chess-game architecture

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

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

## Overview

This repository is a desktop chess game: a player interacts with the WPF interface, which uses game state and chess rules to display and apply moves, then presents promotion, pause, and game-over choices. The logic covers board setup, piece move generation, special moves, legality, and game outcomes; state-string support is also present. The README gives no further capability detail. Some connections below rely on the SOURCE INDEX for read-but-unsampled files, so they are limited to relationships that file references support.

Main entry points: [`Chess/ChessLogic/GameState.cs`](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/GameState.cs) (Game lifecycle), [`Chess/ChessLogic/Board.cs`](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Board.cs) (Board state), [`Chess/ChessUI/MainWindow.xaml.cs`](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/MainWindow.xaml.cs) (Chess window), [`Chess/ChessLogic/Pieces`](https://github.com/jordan73737/chess-game/tree/main/Chess/ChessLogic/Pieces) (Piece move rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_main["Chess window<br/>[MainWindow.xaml.cs]"]
  node_images["Piece images<br/>[Images.cs]"]
  node_promotion_ui["Promotion menu"]
  node_pause_ui["Pause menu<br/>[PauseMenu.xaml.cs]"]
  node_over_ui["Game-over menu"]
end

subgraph group_state["Game state"]
  node_game["Game lifecycle<br/>[GameState.cs]"]
  node_result["Game result<br/>[Result.cs]"]
  node_state_string["State serialization<br/>[StateString.cs]"]
  node_end_reason["End reasons<br/>[EndReason.cs]"]
end

subgraph group_rules["Chess rules"]
  node_board["Board state<br/>[Board.cs]"]
  node_moves["Move execution"]
  node_position["Board positions<br/>[Position.cs]"]
  node_direction["Directions<br/>[Direction.cs]"]
  node_move_type["Move types<br/>[MoveType.cs]"]
  node_counting["Material counting<br/>[Counting.cs]"]
end

subgraph group_pieces["Piece behavior"]
  node_piece_type["Piece types<br/>[PieceType.cs]"]
  node_piece_base["Piece base rules<br/>[Piece.cs]"]
  node_piece_moves["Piece move rules"]
end

node_player(("Player"))

node_player -->|"plays through"| node_main
node_main -->|"uses game state"| node_game
node_main -->|"loads images"| node_images
node_main -->|"uses piece rules"| node_piece_moves
node_promotion_ui -->|"uses images"| node_images
node_pause_ui -.->|"returns options"| node_main
node_over_ui -->|"reads game state"| node_game
node_over_ui -->|"reads result"| node_result
node_game -->|"uses board"| node_board
node_game -->|"uses moves"| node_moves
node_game -->|"sets result"| node_result
node_game -->|"uses serialization"| node_state_string
node_game -->|"uses pieces"| node_piece_base
node_game -->|"uses positions"| node_position
node_board -->|"queries pieces"| node_piece_moves
node_board -->|"counts material"| node_counting
node_board -->|"checks en passant"| node_moves
node_piece_moves -->|"extends base rules"| node_piece_base
node_piece_moves -->|"creates moves"| node_moves
node_piece_moves -->|"uses positions"| node_position
node_moves -->|"updates board"| node_board
node_moves -->|"uses move types"| node_move_type
node_state_string -->|"reads board"| node_board
node_piece_base -->|"uses piece types"| node_piece_type
node_piece_base -->|"uses positions"| node_position
node_result -->|"uses end reasons"| node_end_reason

click node_main "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/MainWindow.xaml.cs"
click node_images "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/Images.cs"
click node_promotion_ui "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/PromotionMenu.xaml.cs"
click node_pause_ui "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/PauseMenu.xaml.cs"
click node_over_ui "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/GameOverMenu.xaml.cs"
click node_game "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/GameState.cs"
click node_result "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Result.cs"
click node_state_string "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/StateString.cs"
click node_board "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Board.cs"
click node_moves "https://github.com/jordan73737/chess-game/tree/main/Chess/ChessLogic/Moves"
click node_position "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Position.cs"
click node_direction "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Direction.cs"
click node_move_type "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/MoveType.cs"
click node_piece_type "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/PieceType.cs"
click node_piece_base "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Pieces/Piece.cs"
click node_piece_moves "https://github.com/jordan73737/chess-game/tree/main/Chess/ChessLogic/Pieces"
click node_counting "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Counting.cs"
click node_end_reason "https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/EndReason.cs"

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_main,node_images,node_promotion_ui,node_pause_ui,node_over_ui toneBlue
class node_game,node_result,node_state_string,node_end_reason toneAmber
class node_board,node_moves,node_position,node_direction,node_move_type,node_counting toneMint
class node_piece_type,node_piece_base,node_piece_moves toneRose
class node_player toneIndigo
```

## Components

### Desktop interface

- [Chess window](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/MainWindow.xaml.cs): `Chess/ChessUI/MainWindow.xaml.cs`
- [Piece images](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/Images.cs): `Chess/ChessUI/Images.cs`
- [Promotion menu](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/PromotionMenu.xaml.cs): `Chess/ChessUI/PromotionMenu.xaml.cs`
- [Pause menu](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/PauseMenu.xaml.cs): `Chess/ChessUI/PauseMenu.xaml.cs`
- [Game-over menu](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessUI/GameOverMenu.xaml.cs): `Chess/ChessUI/GameOverMenu.xaml.cs`

### Game state

- [Game lifecycle](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/GameState.cs): `Chess/ChessLogic/GameState.cs`
- [Game result](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Result.cs): `Chess/ChessLogic/Result.cs`
- [State serialization](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/StateString.cs): `Chess/ChessLogic/StateString.cs`
- [End reasons](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/EndReason.cs): `Chess/ChessLogic/EndReason.cs`

### Chess rules

- [Board state](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Board.cs): `Chess/ChessLogic/Board.cs`
- [Move execution](https://github.com/jordan73737/chess-game/tree/main/Chess/ChessLogic/Moves): `Chess/ChessLogic/Moves`
- [Board positions](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Position.cs): `Chess/ChessLogic/Position.cs`
- [Directions](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Direction.cs): `Chess/ChessLogic/Direction.cs`
- [Move types](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/MoveType.cs): `Chess/ChessLogic/MoveType.cs`
- [Material counting](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Counting.cs): `Chess/ChessLogic/Counting.cs`

### Piece behavior

- [Piece types](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/PieceType.cs): `Chess/ChessLogic/PieceType.cs`
- [Piece base rules](https://github.com/jordan73737/chess-game/blob/main/Chess/ChessLogic/Pieces/Piece.cs): `Chess/ChessLogic/Pieces/Piece.cs`
- [Piece move rules](https://github.com/jordan73737/chess-game/tree/main/Chess/ChessLogic/Pieces): `Chess/ChessLogic/Pieces`

### Other components

- **Player**

## Connections

- Player → Chess window: plays through (evidence: `Chess/ChessUI/MainWindow.xaml.cs`)
- Chess window → Game lifecycle: uses game state (evidence: `Chess/ChessUI/MainWindow.xaml.cs`)
- Chess window → Piece images: loads images (evidence: `Chess/ChessUI/MainWindow.xaml.cs`)
- Chess window → Piece move rules: uses piece rules (evidence: `Chess/ChessUI/MainWindow.xaml.cs`)
- Promotion menu → Piece images: uses images (evidence: `Chess/ChessUI/PromotionMenu.xaml.cs`)
- Pause menu → Chess window: returns options
- Game-over menu → Game lifecycle: reads game state (evidence: `Chess/ChessUI/GameOverMenu.xaml.cs`)
- Game-over menu → Game result: reads result (evidence: `Chess/ChessUI/GameOverMenu.xaml.cs`)
- Game lifecycle → Board state: uses board (evidence: `Chess/ChessLogic/GameState.cs`)
- Game lifecycle → Move execution: uses moves (evidence: `Chess/ChessLogic/GameState.cs`)
- Game lifecycle → Game result: sets result (evidence: `Chess/ChessLogic/GameState.cs`)
- Game lifecycle → State serialization: uses serialization (evidence: `Chess/ChessLogic/GameState.cs`)
- Game lifecycle → Piece base rules: uses pieces (evidence: `Chess/ChessLogic/GameState.cs`)
- Game lifecycle → Board positions: uses positions (evidence: `Chess/ChessLogic/GameState.cs`)
- Board state → Piece move rules: queries pieces (evidence: `Chess/ChessLogic/Board.cs`)
- Board state → Material counting: counts material (evidence: `Chess/ChessLogic/Board.cs`)
- Board state → Move execution: checks en passant (evidence: `Chess/ChessLogic/Board.cs`)
- Piece move rules → Piece base rules: extends base rules (evidence: `Chess/ChessLogic/Pieces/Pawn.cs`)
- Piece move rules → Move execution: creates moves (evidence: `Chess/ChessLogic/Pieces/Pawn.cs`)
- Piece move rules → Board positions: uses positions (evidence: `Chess/ChessLogic/Pieces/Pawn.cs`)
- Move execution → Board state: updates board (evidence: `Chess/ChessLogic/Moves/NormalMove.cs`)
- Move execution → Move types: uses move types (evidence: `Chess/ChessLogic/Moves/Move.cs`)
- State serialization → Board state: reads board (evidence: `Chess/ChessLogic/StateString.cs`)
- Piece base rules → Piece types: uses piece types (evidence: `Chess/ChessLogic/Pieces/Piece.cs`)
- Piece base rules → Board positions: uses positions (evidence: `Chess/ChessLogic/Pieces/Piece.cs`)
- Game result → End reasons: uses end reasons (evidence: `Chess/ChessLogic/Result.cs`)
