# yoshie2000/plentychess architecture

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

- Interactive diagram: https://gitdiagram.com/yoshie2000/plentychess
- Repository: https://github.com/yoshie2000/plentychess

## Overview

##### Main Components

A. Core Engine Components:
- UCI Interface (uci.cpp/h)
- Search Engine (search.cpp/h)
- Board Representation (board.cpp/h, bitboard.cpp/h)
- Evaluation System (evaluation.cpp/h, nnue.cpp/h)
- Move Generation (move.cpp/h)

B. Supporting Systems:
- Thread Management (thread.cpp/h)
- Transposition Table (tt.cpp/h)
- Time Management (time.cpp/h)
- History Heuristics (history.cpp/h)
- Zobrist Hashing (zobrist.cpp/h)

**[External Interface Layer]**
- ↓ ↑
**[Core Engine Layer]**
- ↓ ↑
**[Support Systems Layer]**

##### Component Relationships

a) External Interface Flow:
UCI Interface → Search Engine → Board Representation

b) Evaluation Flow:
Board Representation → NNUE Evaluation → Search Engine

c) Move Generation Flow:
Board Representation → Move Generator → Search Engine

d) Support Systems Integration:
- Thread Manager ← → Search Engine
- Transposition Table ← → Search Engine
- Time Manager → Search Engine
- History Heuristics ← → Search Engine

##### Specific Implementation Details

- Rectangles: Core components (UCI, Search, Board)
- Hexagons: Neural Network components (NNUE)
- Rounded rectangles: Support systems (Thread, Time Management)

##### Additional Elements

Annotations for:
- NNUE Network specifications (7.2bn positions training data)
- Threading model
- Memory management for transposition tables
- Bitboard representation details

##### Neural network evaluation

Remember to indicate that this is a high-performance system designed for competitive play, as evidenced by its high ELO ratings and participation in major computer chess championships.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        UCI[UCI Interface]
    end

    subgraph Core
        Search[Search Engine]
        Board[Board Representation]
        BitBoard[BitBoard System]
        Move[Move Generator]
        Eval[Evaluation System]
        NNUE[NNUE Network]
        Engine[Main Engine]
    end

    subgraph Support
        Thread[Thread Manager]
        TT[(Transposition Table)]
        Time[Time Manager]
        History[History Heuristics]
        Zobrist[Zobrist Hashing]
        Magic[Magic Bitboard]
        Types[Core Types]
    end

    %% Core Relationships
    UCI --> Search
    Search --> Board
    Board --> BitBoard
    Board --> Move
    Move --> Search
    Board --> Eval
    Eval --> NNUE
    NNUE --> Search
    Engine --> Search

    %% Support System Relationships
    Thread <--> Search
    TT <--> Search
    Time --> Search
    History <--> Search
    Zobrist --> Board
    Magic --> BitBoard
    Types --> Board

    %% Styling
    classDef interface fill:#87CEEB
    classDef core fill:#90EE90
    classDef support fill:#D3D3D3
    classDef neural fill:#FFD700
    classDef storage fill:#FF6B6B

    class UCI interface
    class Search,Board,BitBoard,Move,Eval,Engine core
    class Thread,Time,History,Zobrist,Magic,Types support
    class NNUE neural
    class TT storage

    %% Click Events
    click UCI "https://github.com/Yoshie2000/PlentyChess/blob/main/src/uci.cpp"
    click Search "https://github.com/Yoshie2000/PlentyChess/blob/main/src/search.cpp"
    click Board "https://github.com/Yoshie2000/PlentyChess/blob/main/src/board.cpp"
    click BitBoard "https://github.com/Yoshie2000/PlentyChess/blob/main/src/bitboard.cpp"
    click Move "https://github.com/Yoshie2000/PlentyChess/blob/main/src/move.cpp"
    click Eval "https://github.com/Yoshie2000/PlentyChess/blob/main/src/evaluation.cpp"
    click NNUE "https://github.com/Yoshie2000/PlentyChess/blob/main/src/nnue.cpp"
    click Thread "https://github.com/Yoshie2000/PlentyChess/blob/main/src/thread.cpp"
    click TT "https://github.com/Yoshie2000/PlentyChess/blob/main/src/tt.cpp"
    click Time "https://github.com/Yoshie2000/PlentyChess/blob/main/src/time.cpp"
    click History "https://github.com/Yoshie2000/PlentyChess/blob/main/src/history.cpp"
    click Zobrist "https://github.com/Yoshie2000/PlentyChess/blob/main/src/zobrist.cpp"
    click Magic "https://github.com/Yoshie2000/PlentyChess/blob/main/src/magic.cpp"
    click Types "https://github.com/Yoshie2000/PlentyChess/blob/main/src/types.h"
    click Engine "https://github.com/Yoshie2000/PlentyChess/blob/main/src/engine.cpp"
```
