# univlille-meta/chess architecture

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

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

## Overview

##### Project type and purpose
- This is a Pharo‐based desktop application (a small chess game) that serves as a training playground for software engineering skills.
- It is organized as a set of Smalltalk packages (Core, UI, Importers, Tests) loaded via a Metacello Baseline.

##### Top-level components (from file tree and README)
- Baseline loader
- src/BaselineOfMygChess/package.st (Metacello baseline definition).
- Domain (Core engine)
- src/Myg-Chess-Core/package.st (Board, Square, Piece classes and move rules).
- Importers
- src/Myg-Chess-Importers/package.st (PGNImporter, FENImporter, parsing logic).
- UI
- Bloc/Toplo‐based UI elements: MyChessGame, square and piece renderers, event loop via BlSpace.
- Tests
- src/Myg-Chess-Tests/package.st (unit tests for Core and Importers).
- Configuration
- src/.properties (package metadata)
- .project (IDE integration)
- LICENSE, README.md

##### Relationships and interactions
- User → UI layer
- The player invokes MyChessGame freshGame, configures BlSpace, and interacts via mouse/keyboard.
- UI layer → Domain layer
- UI squares dispatch move requests to Board and Piece objects.
- Rendering logic reads Domain state (which pieces occupy which squares).
- Importers → Domain layer
- PGNImporter and FENImporter parse text and instantiate Domain objects (Board, Piece positions).
- Tests → Domain & Importers
- Unit tests exercise Core logic and parsing via Importers.
- Baseline loader → All packages
- Metacello uses the BaselineOfMygChess definition to load Core, UI, Importers, Tests into the Pharo image.

##### Architectural patterns and design principles
- Layered architecture: Presentation (UI) / Domain (Core) / Integration (Importers) / Tests.
- Composite UI: Board composed of Bloc elements (squares contain child elements).
- Event‐driven loop (BlSpace manages pulses and user events).
- Polymorphic dispatch for piece movement and rendering.
- Separation of concerns: parsing logic isolated in Importers, core rules in Core package, UI decoupled via Bloc/Toplo APIs.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Entities
    User["User"]:::external
    UI["UI Layer\n(MyChessGame & renderers)"]:::ui
    Bloc["Bloc/Toplo Libraries"]:::external
    Core["Myg-Chess-Core\n(Domain)"]:::core
    Importers["Myg-Chess-Importers\n(Integration)"]:::importers
    Tests["Myg-Chess-Tests\n(Testing)"]:::tests
    Baseline["Metacello Baseline\n(BaselineOfMygChess)"]:::baseline
    Config["Config\n(.properties)"]:::baseline
    IDE["IDE Integration\n(.project)"]:::baseline
    Docs["Documentation\n(README.md)"]:::baseline
    Lic["License\n(LICENSE)"]:::baseline

    %% Relationships
    User -->|"interacts"| UI
    UI -->|"invoke move, query state"| Core
    UI -->|"render, event loop"| Bloc
    Importers -->|"build board from PGN/FEN"| Core
    Tests -->|"unit tests"| Core
    Tests -->|"unit tests"| Importers
    Baseline -->|"load"| Core
    Baseline -->|"load"| Importers
    Baseline -->|"load"| UI
    Baseline -->|"load"| Tests
    Baseline --> Config
    Baseline --> IDE
    Baseline --> Docs
    Baseline --> Lic

    %% Click Events
    click Baseline "https://github.com/univlille-meta/chess/blob/main/src/BaselineOfMygChess/package.st"
    click Core "https://github.com/univlille-meta/chess/blob/main/src/Myg-Chess-Core/package.st"
    click Importers "https://github.com/univlille-meta/chess/blob/main/src/Myg-Chess-Importers/package.st"
    click Tests "https://github.com/univlille-meta/chess/blob/main/src/Myg-Chess-Tests/package.st"
    click Config "https://github.com/univlille-meta/chess/blob/main/src/.properties"
    click IDE "https://github.com/univlille-meta/chess/blob/main/.project"
    click Docs "https://github.com/univlille-meta/chess/blob/main/README.md"
    click Lic "https://github.com/univlille-meta/chess/tree/main/LICENSE"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085
    classDef ui fill:#d4edda,stroke:#155724,color:#155724
    classDef importers fill:#fff3cd,stroke:#856404,color:#856404
    classDef tests fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef baseline fill:#f8f9fa,stroke:#ced4da,color:#495057
    classDef external fill:#f5c6cb,stroke:#721c24,color:#721c24
```
