# leuzthiam/chessgame architecture

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

- Interactive diagram: https://gitdiagram.com/leuzthiam/chessgame
- Repository: https://github.com/leuzthiam/chessgame

## Overview

ChessGame is a .NET chess application with a cross-platform MAUI interface, chess rules and match management in Core, and EF Core persistence in Infrastructure. The main workflow is a player interacting with the board UI, which delegates game actions to the match service; the service applies rules to the chess state and can save or load games. The graph also shows move history, AI, and user services. Some relationships are supported only by the README or source index; unsampled implementation details are not inferred.

Main entry points: [`ChessGame.Core/Core/Application/Services/ServicePartie.cs`](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ServicePartie.cs) (Match service), [`ChessGame.Core/Core/Domain/Models/Echiquier.cs`](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Domain/Models/Echiquier.cs) (Chessboard state), [`ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs`](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs) (EF Core context), [`ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs`](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["MAUI interface"]
  node_boardview["Board view"]
  node_gameinfo["Game info viewmodel"]
end

subgraph group_game["Chess gameplay"]
  node_match["Match service<br/>[ServicePartie.cs]"]
  node_validator["Move validator<br/>[ValidateurCoup.cs]"]
  node_rules["Game rules<br/>[ReglesJeu.cs]"]
  node_generator["Move generator<br/>[GenerateurCoups.cs]"]
  node_board["Chessboard state<br/>[Echiquier.cs]"]
  node_pieces["Chess pieces<br/>[Pieces]"]
  node_matchstate["Match state<br/>[EtatPartie.cs]"]
  node_movehistory["Move history"]
end

subgraph group_ai["Move assistance"]
  node_minimax["Minimax engine<br/>[MoteurMinimax.cs]"]
  node_evaluation["Position evaluation"]
  node_simpleai["Simple AI<br/>[SimpleAi.cs]"]
end

subgraph group_storage["Persistence and users"]
  node_repository["Match repository"]
  node_saver["Game save/load<br/>[Sauvegardeur.cs]"]
  node_dbcontext["EF Core context<br/>[ChessDbContext.cs]"]
  node_entities["Persistence entities<br/>[Entities]"]
  node_database[("Database")]
  node_userservice["User service"]
  node_users["User records"]
end

node_player(("Player"))

node_player -->|"plays through"| node_boardview
node_boardview -->|"requests game actions"| node_match
node_gameinfo -->|"uses match service"| node_match
node_match -->|"validates moves"| node_validator
node_match -->|"checks rules"| node_rules
node_match -->|"requests possible moves"| node_generator
node_match -->|"updates game state"| node_board
node_board -->|"tracks pieces"| node_pieces
node_board -->|"holds match state"| node_matchstate
node_match -->|"manages state"| node_matchstate
node_match -->|"updates history"| node_movehistory
node_match -->|"saves or loads"| node_saver
node_match -->|"uses repository"| node_repository
node_minimax -.->|"evaluates positions"| node_evaluation
node_simpleai -.->|"may delegate"| node_minimax
node_repository -->|"queries and persists"| node_dbcontext
node_saver -->|"serializes game state"| node_board
node_dbcontext -->|"maps entities"| node_entities
node_dbcontext -.->|"stores records"| node_database
node_userservice -->|"uses context"| node_dbcontext
node_userservice -->|"manages users"| node_users

click node_boardview "https://github.com/leuzthiam/chessgame/blob/main/ChessGameMAUI/Presentation/Views/EchiquierView.xaml.cs"
click node_gameinfo "https://github.com/leuzthiam/chessgame/blob/main/ChessGameMAUI/Presentation/ViewModels/InfoPartieViewModel.cs"
click node_match "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ServicePartie.cs"
click node_validator "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ValidateurCoup.cs"
click node_rules "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ReglesJeu.cs"
click node_generator "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/GenerateurCoups.cs"
click node_board "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Domain/Models/Echiquier.cs"
click node_pieces "https://github.com/leuzthiam/chessgame/tree/main/ChessGame.Core/Core/Domain/Models/Pieces"
click node_matchstate "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Domain/Models/EtatPartie.cs"
click node_movehistory "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/HistoriquesCoups.cs"
click node_minimax "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/MoteurMinimax.cs"
click node_evaluation "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/EvaluationPosition.cs"
click node_simpleai "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/SimpleAi.cs"
click node_repository "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Repositories/PartieRepository.cs"
click node_saver "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Sauvegardeur.cs"
click node_dbcontext "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs"
click node_entities "https://github.com/leuzthiam/chessgame/tree/main/ChessGame.Infrastructure/Infrastructure/Persistence/Entities"
click node_userservice "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs"
click node_users "https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Entities/UtilisateurEntity.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_boardview,node_gameinfo toneBlue
class node_match,node_validator,node_rules,node_generator,node_board,node_pieces,node_matchstate,node_movehistory toneAmber
class node_minimax,node_evaluation,node_simpleai toneMint
class node_repository,node_saver,node_dbcontext,node_entities,node_database,node_userservice,node_users toneRose
class node_player toneIndigo
```

## Components

### MAUI interface

- [Board view](https://github.com/leuzthiam/chessgame/blob/main/ChessGameMAUI/Presentation/Views/EchiquierView.xaml.cs): `ChessGameMAUI/Presentation/Views/EchiquierView.xaml.cs`
- [Game info viewmodel](https://github.com/leuzthiam/chessgame/blob/main/ChessGameMAUI/Presentation/ViewModels/InfoPartieViewModel.cs): `ChessGameMAUI/Presentation/ViewModels/InfoPartieViewModel.cs`

### Chess gameplay

- [Match service](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ServicePartie.cs): `ChessGame.Core/Core/Application/Services/ServicePartie.cs`
- [Move validator](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ValidateurCoup.cs): `ChessGame.Core/Core/Application/Services/ValidateurCoup.cs`
- [Game rules](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/ReglesJeu.cs): `ChessGame.Core/Core/Application/Services/ReglesJeu.cs`
- [Move generator](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/GenerateurCoups.cs): `ChessGame.Core/Core/Application/Services/GenerateurCoups.cs`
- [Chessboard state](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Domain/Models/Echiquier.cs): `ChessGame.Core/Core/Domain/Models/Echiquier.cs`
- [Chess pieces](https://github.com/leuzthiam/chessgame/tree/main/ChessGame.Core/Core/Domain/Models/Pieces): `ChessGame.Core/Core/Domain/Models/Pieces`
- [Match state](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Domain/Models/EtatPartie.cs): `ChessGame.Core/Core/Domain/Models/EtatPartie.cs`
- [Move history](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/HistoriquesCoups.cs): `ChessGame.Core/Core/Application/Services/HistoriquesCoups.cs`

### Move assistance

- [Minimax engine](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/MoteurMinimax.cs): `ChessGame.Core/Core/Application/Services/MoteurMinimax.cs`
- [Position evaluation](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/EvaluationPosition.cs): `ChessGame.Core/Core/Application/Services/EvaluationPosition.cs`
- [Simple AI](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Core/Core/Application/Services/SimpleAi.cs): `ChessGame.Core/Core/Application/Services/SimpleAi.cs`

### Persistence and users

- [Match repository](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Repositories/PartieRepository.cs): `ChessGame.Infrastructure/Infrastructure/Persistence/Repositories/PartieRepository.cs`
- [Game save/load](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Sauvegardeur.cs): `ChessGame.Infrastructure/Infrastructure/Persistence/Sauvegardeur.cs`
- [EF Core context](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs): `ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs`
- [Persistence entities](https://github.com/leuzthiam/chessgame/tree/main/ChessGame.Infrastructure/Infrastructure/Persistence/Entities): `ChessGame.Infrastructure/Infrastructure/Persistence/Entities`
- **Database**
- [User service](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs): `ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs`
- [User records](https://github.com/leuzthiam/chessgame/blob/main/ChessGame.Infrastructure/Infrastructure/Persistence/Entities/UtilisateurEntity.cs): `ChessGame.Infrastructure/Infrastructure/Persistence/Entities/UtilisateurEntity.cs`

### Other components

- **Player**

## Connections

- Player → Board view: plays through (evidence: `README.md`)
- Board view → Match service: requests game actions (evidence: `ChessGameMAUI/Presentation/Views/EchiquierView.xaml.cs`)
- Game info viewmodel → Match service: uses match service (evidence: `ChessGameMAUI/Presentation/ViewModels/InfoPartieViewModel.cs`)
- Match service → Move validator: validates moves (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Game rules: checks rules (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Move generator: requests possible moves (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Chessboard state: updates game state (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Chessboard state → Chess pieces: tracks pieces (evidence: `ChessGame.Core/Core/Domain/Models/Echiquier.cs`)
- Chessboard state → Match state: holds match state (evidence: `ChessGame.Core/Core/Domain/Models/Echiquier.cs`)
- Match service → Match state: manages state (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Move history: updates history (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Game save/load: saves or loads (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Match service → Match repository: uses repository (evidence: `ChessGame.Core/Core/Application/Services/ServicePartie.cs`)
- Minimax engine → Position evaluation: evaluates positions
- Simple AI → Minimax engine: may delegate
- Match repository → EF Core context: queries and persists (evidence: `ChessGame.Infrastructure/Infrastructure/Persistence/Repositories/PartieRepository.cs`)
- Game save/load → Chessboard state: serializes game state (evidence: `ChessGame.Infrastructure/Infrastructure/Persistence/Sauvegardeur.cs`)
- EF Core context → Persistence entities: maps entities (evidence: `ChessGame.Infrastructure/Infrastructure/Persistence/Data/ChessDbContext.cs`)
- EF Core context → Database: stores records
- User service → EF Core context: uses context (evidence: `ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs`)
- User service → User records: manages users (evidence: `ChessGame.Infrastructure/Infrastructure/Services/UtilisateurService.cs`)
