# geras1mleo/chess architecture

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

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

## Overview

Gera Chess is a .NET chess-logic library: callers create or load a board, generate and validate moves, execute and navigate them, and inspect notation, events, and game outcomes. Its documented formats include FEN, PGN, and SAN; its optional endgame rules include insufficient material, the fifty-move rule, and repetition. The graph includes these product branches and the board’s supporting domain types. Relationships rely on README statements and the supplied source index; unsampled implementation details are not inferred.

Main entry points: [`ChessLibrary/ChessBoard/ChessBoard.cs`](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessBoard.cs) (ChessBoard API), [`ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs) (Endgame provider), [`ChessLibrary/Builders/FenBoardBuilder.cs`](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/FenBoardBuilder.cs) (FEN builder), [`ChessLibrary/Builders/SanBuilder.cs`](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/SanBuilder.cs) (SAN builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_board["Chessboard runtime"]
  node_board_api["ChessBoard API<br/>[ChessBoard.cs]"]
  node_move_generation["Move generation"]
  node_move_validation["Move validation"]
  node_board_events["Board events<br/>[ChessEvents.cs]"]
end

subgraph group_notation["Notation and loading"]
  node_fen_api["FEN conversion<br/>[Fen.cs]"]
  node_fen_builder["FEN builder<br/>[FenBoardBuilder.cs]"]
  node_pgn_api["PGN conversion<br/>[Pgn.cs]"]
  node_pgn_builder["PGN builder<br/>[PgnBuilder.cs]"]
  node_san_api["SAN conversion<br/>[San.cs]"]
  node_san_builder["SAN builder<br/>[SanBuilder.cs]"]
end

subgraph group_outcomes["Game outcomes"]
  node_endgame_provider["Endgame provider<br/>[EndGameProvider.cs]"]
  node_endgame_info["Endgame result<br/>[EndGameInfo.cs]"]
  node_endgame_rule["Rule base<br/>[EndGameRule.cs]"]
  node_fifty_rule["Fifty-move rule<br/>[FiftyMoveRule.cs]"]
  node_material_rule["Material rule"]
  node_repetition_rule["Repetition rule<br/>[RepetitionRule.cs]"]
end

subgraph group_domain["Chess domain"]
  node_move_model["Move model<br/>[Move.cs]"]
  node_piece_model["Piece model<br/>[Piece.cs]"]
  node_position_model["Position model<br/>[Position.cs]"]
  node_regexes["Notation patterns<br/>[Regexes.cs]"]
end

node_caller(("Chess app"))

node_caller -->|"uses"| node_board_api
node_board_api -->|"loads FEN"| node_fen_builder
node_board_api -->|"checks outcomes"| node_endgame_provider
node_board_api -->|"sets result"| node_endgame_info
node_board_api -->|"parses SAN"| node_san_builder
node_board_api -->|"generates moves"| node_move_generation
node_board_api -->|"validates moves"| node_move_validation
node_board_api -->|"raises events"| node_board_events
node_fen_api -->|"uses builder"| node_fen_builder
node_pgn_api -->|"uses builder"| node_pgn_builder
node_pgn_builder -->|"loads position"| node_fen_builder
node_pgn_builder -->|"parses moves"| node_san_builder
node_san_api -->|"delegates parsing"| node_san_builder
node_endgame_provider -->|"uses rule base"| node_endgame_rule
node_endgame_provider -->|"checks rule"| node_fifty_rule
node_endgame_provider -->|"checks rule"| node_material_rule
node_endgame_provider -->|"checks rule"| node_repetition_rule
node_san_builder -->|"matches patterns"| node_regexes
node_fen_builder -->|"matches patterns"| node_regexes
node_move_model -->|"stores positions"| node_position_model
node_move_model -->|"stores pieces"| node_piece_model
node_piece_model -->|"validates notation"| node_regexes

click node_board_api "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessBoard.cs"
click node_move_generation "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessGenerations.cs"
click node_move_validation "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessValidations.cs"
click node_board_events "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessEvents.cs"
click node_fen_api "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/Fen.cs"
click node_fen_builder "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/FenBoardBuilder.cs"
click node_pgn_api "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/Pgn.cs"
click node_pgn_builder "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/PgnBuilder.cs"
click node_san_api "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/San.cs"
click node_san_builder "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/SanBuilder.cs"
click node_endgame_provider "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs"
click node_endgame_info "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameInfo.cs"
click node_endgame_rule "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameRule.cs"
click node_fifty_rule "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/FiftyMoveRule.cs"
click node_material_rule "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/InsufficientMaterialRule.cs"
click node_repetition_rule "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/RepetitionRule.cs"
click node_move_model "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Move.cs"
click node_piece_model "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Piece.cs"
click node_position_model "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Position.cs"
click node_regexes "https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Regexes.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_board_api,node_move_generation,node_move_validation,node_board_events toneBlue
class node_fen_api,node_fen_builder,node_pgn_api,node_pgn_builder,node_san_api,node_san_builder toneAmber
class node_endgame_provider,node_endgame_info,node_endgame_rule,node_fifty_rule,node_material_rule,node_repetition_rule toneMint
class node_move_model,node_piece_model,node_position_model,node_regexes toneRose
class node_caller toneIndigo
```

## Components

### Chessboard runtime

- [ChessBoard API](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessBoard.cs): `ChessLibrary/ChessBoard/ChessBoard.cs`
- [Move generation](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessGenerations.cs): `ChessLibrary/ChessBoard/ChessGenerations.cs`
- [Move validation](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessValidations.cs): `ChessLibrary/ChessBoard/ChessValidations.cs`
- [Board events](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/ChessEvents.cs): `ChessLibrary/ChessBoard/ChessEvents.cs`

### Notation and loading

- [FEN conversion](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/Fen.cs): `ChessLibrary/Conversions/Fen.cs`
- [FEN builder](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/FenBoardBuilder.cs): `ChessLibrary/Builders/FenBoardBuilder.cs`
- [PGN conversion](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/Pgn.cs): `ChessLibrary/Conversions/Pgn.cs`
- [PGN builder](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/PgnBuilder.cs): `ChessLibrary/Builders/PgnBuilder.cs`
- [SAN conversion](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Conversions/San.cs): `ChessLibrary/Conversions/San.cs`
- [SAN builder](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Builders/SanBuilder.cs): `ChessLibrary/Builders/SanBuilder.cs`

### Game outcomes

- [Endgame provider](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs): `ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`
- [Endgame result](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameInfo.cs): `ChessLibrary/ChessBoard/EndGameTypes/EndGameInfo.cs`
- [Rule base](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/EndGameRule.cs): `ChessLibrary/ChessBoard/EndGameTypes/EndGameRule.cs`
- [Fifty-move rule](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/FiftyMoveRule.cs): `ChessLibrary/ChessBoard/EndGameTypes/FiftyMoveRule.cs`
- [Material rule](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/InsufficientMaterialRule.cs): `ChessLibrary/ChessBoard/EndGameTypes/InsufficientMaterialRule.cs`
- [Repetition rule](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/ChessBoard/EndGameTypes/RepetitionRule.cs): `ChessLibrary/ChessBoard/EndGameTypes/RepetitionRule.cs`

### Chess domain

- [Move model](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Move.cs): `ChessLibrary/Types/Move.cs`
- [Piece model](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Piece.cs): `ChessLibrary/Types/Piece.cs`
- [Position model](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Position.cs): `ChessLibrary/Types/Position.cs`
- [Notation patterns](https://github.com/geras1mleo/chess/blob/master/ChessLibrary/Types/Regexes.cs): `ChessLibrary/Types/Regexes.cs`

### Other components

- **Chess app**

## Connections

- Chess app → ChessBoard API: uses (evidence: `README.md`)
- ChessBoard API → FEN builder: loads FEN (evidence: `ChessLibrary/ChessBoard/ChessBoard.cs`)
- ChessBoard API → Endgame provider: checks outcomes (evidence: `ChessLibrary/ChessBoard/ChessBoard.cs`)
- ChessBoard API → Endgame result: sets result (evidence: `ChessLibrary/ChessBoard/ChessBoard.cs`)
- ChessBoard API → SAN builder: parses SAN (evidence: `ChessLibrary/ChessBoard/ChessBoard.cs`)
- ChessBoard API → Move generation: generates moves (evidence: `README.md`)
- ChessBoard API → Move validation: validates moves (evidence: `README.md`)
- ChessBoard API → Board events: raises events (evidence: `ChessLibrary/ChessBoard/ChessEvents.cs`)
- FEN conversion → FEN builder: uses builder (evidence: `ChessLibrary/Conversions/Fen.cs`)
- PGN conversion → PGN builder: uses builder (evidence: `ChessLibrary/Conversions/Pgn.cs`)
- PGN builder → FEN builder: loads position (evidence: `ChessLibrary/Builders/PgnBuilder.cs`)
- PGN builder → SAN builder: parses moves (evidence: `ChessLibrary/Builders/PgnBuilder.cs`)
- SAN conversion → SAN builder: delegates parsing (evidence: `ChessLibrary/Conversions/San.cs`)
- Endgame provider → Rule base: uses rule base (evidence: `ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`)
- Endgame provider → Fifty-move rule: checks rule (evidence: `ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`)
- Endgame provider → Material rule: checks rule (evidence: `ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`)
- Endgame provider → Repetition rule: checks rule (evidence: `ChessLibrary/ChessBoard/EndGameTypes/EndGameProvider.cs`)
- SAN builder → Notation patterns: matches patterns (evidence: `ChessLibrary/Builders/SanBuilder.cs`)
- FEN builder → Notation patterns: matches patterns (evidence: `ChessLibrary/Builders/FenBoardBuilder.cs`)
- Move model → Position model: stores positions (evidence: `ChessLibrary/Types/Move.cs`)
- Move model → Piece model: stores pieces (evidence: `ChessLibrary/Types/Move.cs`)
- Piece model → Notation patterns: validates notation (evidence: `ChessLibrary/Types/Piece.cs`)
