# sscg13/prolix architecture

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

- Interactive diagram: https://gitdiagram.com/sscg13/prolix
- Repository: https://github.com/sscg13/prolix

## Overview

##### Main Components Identification
The system appears to be a chess engine with several key components:

a) Core Engine Components:
- Main engine logic (Prolix.cpp)
- Board representation (board.cpp)
- Move history tracking (history.cpp)
- Neural Network evaluation (nnue.cpp)

b) External Dependencies:
- Fathom (tablebase probing)
- incbin (binary file inclusion)

##### Component Relationships

Use the following connection types:

##### Specific Implementation Details

- Core Components: Blue
- External Dependencies: Green
- Resource Files: Orange

**[Component Grouping]**
**Main Engine Block:**

- Prolix.cpp      |
- (Main Controller)   |

- v

- Core Engine Components|
- board.cpp           |
- history.cpp         |
- nnue.cpp           |

- v

- External Components   |
- Fathom (tablebases) |
- incbin (binary)     |

##### Technical Details

Annotations for:
- Compilation requirements (clang++ preference)
- NNUE file format (Bullet format)
- Evaluation scale (-1.0 to +1.0 normalized)
- Special score values (270.00, 259.xy, etc.)

##### Data Flow Representation

Following flows:
- Input → Board representation
- Board state → NNUE evaluation
- → Tablebase probe (optional)
- Evaluation → Score normalization
- Score → Output formatting

This design should capture both the architectural structure and the unique features of a shatranj engine, distinguishing it from traditional chess engines while maintaining clarity about the system's components and their interactions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input_Layer
        CLI[Command Line Interface]
        MF[Build System]:::build
    end

    subgraph Core_Engine
        ME[Main Engine]:::main
        BR[Board Representation]:::core
        MH[Move History]:::core
        NN[Neural Network Evaluation]:::core
    end

    subgraph External_Components
        TB[Tablebase Probe]:::external
        IB[Binary Inclusion]:::external
    end

    subgraph Resources
        NNUE[NNUE Files]:::resource
        SYZ[Syzygy Tablebases]:::resource
        direction TB
        subgraph EPD_DBs
            EPD1[Balanced Positions]:::resource
            EPD2[DFRC Positions]:::resource
            EPD3[Unbalanced Positions]:::resource
            EPD4[Unbalanced2 Positions]:::resource
        end
    end

    CLI --> ME
    MF --> ME
    ME --> BR
    ME --> MH
    ME --> NN
    BR --> NN
    MH --> BR
    ME --> TB
    TB --> SYZ
    IB --> NNUE
    NN --> NNUE

    classDef main fill:#3498db
    classDef core fill:#2980b9
    classDef external fill:#27ae60
    classDef resource fill:#e67e22
    classDef build fill:#95a5a6

    click ME "https://github.com/sscg13/Prolix/blob/main/Prolix.cpp"
    click BR "https://github.com/sscg13/Prolix/blob/main/board.cpp"
    click MH "https://github.com/sscg13/Prolix/blob/main/history.cpp"
    click NN "https://github.com/sscg13/Prolix/blob/main/nnue.cpp"
    click TB "https://github.com/sscg13/Prolix/blob/main/external/Fathom/tbprobe.cpp"
    click IB "https://github.com/sscg13/Prolix/blob/main/external/incbin/incbin.h"
    click MF "https://github.com/sscg13/Prolix/tree/main/Makefile"
    click EPD1 "https://github.com/sscg13/Prolix/blob/main/shatranj_balanced.epd.zip"
    click EPD2 "https://github.com/sscg13/Prolix/blob/main/shatranj_dfrs.epd.zip"
    click EPD3 "https://github.com/sscg13/Prolix/blob/main/shatranj_unbalanced.epd.zip"
    click EPD4 "https://github.com/sscg13/Prolix/blob/main/shatranj_unbalanced2.epd.zip"
```
