# gyatsoyt/gyatsochess architecture

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

- Interactive diagram: https://gitdiagram.com/gyatsoyt/gyatsochess
- Repository: https://github.com/gyatsoyt/gyatsochess

## Overview

Gyatso is a UCI-compatible chess engine. Its principal workflow is receiving a UCI search request, managing search time and threads, exploring legal moves, and returning a best move; search uses move ordering, position evaluation, and transposition data. The README also documents Chess960/DFRC, NNUE with embedded weights and SIMD acceleration, and performance-oriented search features. With no source excerpts available, relationships below are limited to those the README describes; unsampled implementation details are not inferred.

Main entry points: [`Gyatso/src/search.nim`](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/search.nim) (Search), [`Gyatso/src/moveorderer.nim`](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/moveorderer.nim) (Move Ordering), [`Gyatso/src/nnue.nim`](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/nnue.nim) (NNUE Network), [`Gyatso/src/uci.nim`](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/uci.nim) (UCI Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["UCI and Timing"]
  node_uci["UCI Interface<br/>[uci.nim]"]
  node_timeman["Time Manager<br/>[timeman.nim]"]
end

subgraph group_chess["Chess Position"]
  node_board["Position and Rules<br/>[board.nim]"]
  node_coretypes["Chess Types<br/>[coretypes.nim]"]
  node_movegen["Move Generation<br/>[movegen.nim]"]
  node_attacks["Attacks and Bitboards<br/>[attacks.nim]"]
  node_bitboard["Bitboard Operations<br/>[bitboard.nim]"]
end

subgraph group_search["Search and Ordering"]
  node_search["Search<br/>[search.nim]"]
  node_moveorder["Move Ordering<br/>[moveorderer.nim]"]
  node_history["Search History<br/>[history.nim]"]
  node_see["Exchange Evaluation<br/>[see.nim]"]
  node_tt[("Transposition Table<br/>[tt.nim]")]
  node_zobrist["Position Hashing<br/>[zobrist.nim]"]
end

subgraph group_evaluation["Evaluation and Runtime"]
  node_evaluate["Position Evaluation<br/>[evaluate.nim]"]
  node_nnue["NNUE Network<br/>[nnue.nim]"]
  node_weights["Embedded Weights<br/>[GyatsoNet1024.bin]"]
  node_simd["SIMD Operations<br/>[simd.nim]"]
  node_threads["Parallel Search<br/>[threads.nim]"]
end

node_gui(("UCI GUI"))

node_gui -->|"sends UCI"| node_uci
node_uci -->|"starts search"| node_search
node_search -->|"sets time limits"| node_timeman
node_search -->|"searches moves"| node_movegen
node_search -->|"evaluates positions"| node_evaluate
node_search -->|"orders moves"| node_moveorder
node_moveorder -->|"scores with history"| node_history
node_moveorder -->|"uses SEE"| node_see
node_search -->|"probes and stores"| node_tt
node_tt -->|"uses hashing"| node_zobrist
node_evaluate -->|"uses NNUE"| node_nnue
node_nnue -->|"uses embedded weights"| node_weights
node_nnue -->|"accelerates math"| node_simd
node_search -->|"runs parallel search"| node_threads
node_movegen -->|"supports chess variants"| node_board
node_search -->|"checks draw rules"| node_board

click node_uci "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/uci.nim"
click node_timeman "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/timeman.nim"
click node_board "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/board.nim"
click node_coretypes "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/coretypes.nim"
click node_movegen "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/movegen.nim"
click node_attacks "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/attacks.nim"
click node_bitboard "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/bitboard.nim"
click node_search "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/search.nim"
click node_moveorder "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/moveorderer.nim"
click node_history "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/history.nim"
click node_see "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/see.nim"
click node_tt "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/tt.nim"
click node_zobrist "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/zobrist.nim"
click node_evaluate "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/evaluate.nim"
click node_nnue "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/nnue.nim"
click node_weights "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/Net/GyatsoNet1024.bin"
click node_simd "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/simd.nim"
click node_threads "https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/threads.nim"

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_uci,node_timeman,node_gui toneBlue
class node_board,node_coretypes,node_movegen,node_attacks,node_bitboard toneAmber
class node_search,node_moveorder,node_history,node_see,node_tt,node_zobrist toneMint
class node_evaluate,node_nnue,node_weights,node_simd,node_threads toneRose
```

## Components

### UCI and Timing

- [UCI Interface](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/uci.nim): `Gyatso/src/uci.nim`
- [Time Manager](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/timeman.nim): `Gyatso/src/timeman.nim`

### Chess Position

- [Position and Rules](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/board.nim): `Gyatso/src/board.nim`
- [Chess Types](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/coretypes.nim): `Gyatso/src/coretypes.nim`
- [Move Generation](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/movegen.nim): `Gyatso/src/movegen.nim`
- [Attacks and Bitboards](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/attacks.nim): `Gyatso/src/attacks.nim`
- [Bitboard Operations](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/bitboard.nim): `Gyatso/src/bitboard.nim`

### Search and Ordering

- [Search](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/search.nim): `Gyatso/src/search.nim`
- [Move Ordering](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/moveorderer.nim): `Gyatso/src/moveorderer.nim`
- [Search History](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/history.nim): `Gyatso/src/history.nim`
- [Exchange Evaluation](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/see.nim): `Gyatso/src/see.nim`
- [Transposition Table](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/tt.nim): `Gyatso/src/tt.nim`
- [Position Hashing](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/zobrist.nim): `Gyatso/src/zobrist.nim`

### Evaluation and Runtime

- [Position Evaluation](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/evaluate.nim): `Gyatso/src/evaluate.nim`
- [NNUE Network](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/nnue.nim): `Gyatso/src/nnue.nim`
- [Embedded Weights](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/Net/GyatsoNet1024.bin): `Gyatso/Net/GyatsoNet1024.bin`
- [SIMD Operations](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/simd.nim): `Gyatso/src/simd.nim`
- [Parallel Search](https://github.com/gyatsoyt/gyatsochess/blob/main/Gyatso/src/threads.nim): `Gyatso/src/threads.nim`

### Other components

- **UCI GUI**

## Connections

- UCI GUI → UCI Interface: sends UCI (evidence: `README.md`)
- UCI Interface → Search: starts search (evidence: `README.md`)
- Search → Time Manager: sets time limits (evidence: `README.md`)
- Search → Move Generation: searches moves (evidence: `README.md`)
- Search → Position Evaluation: evaluates positions (evidence: `README.md`)
- Search → Move Ordering: orders moves (evidence: `README.md`)
- Move Ordering → Search History: scores with history (evidence: `README.md`)
- Move Ordering → Exchange Evaluation: uses SEE (evidence: `README.md`)
- Search → Transposition Table: probes and stores (evidence: `README.md`)
- Transposition Table → Position Hashing: uses hashing (evidence: `README.md`)
- Position Evaluation → NNUE Network: uses NNUE (evidence: `README.md`)
- NNUE Network → Embedded Weights: uses embedded weights (evidence: `README.md`)
- NNUE Network → SIMD Operations: accelerates math (evidence: `README.md`)
- Search → Parallel Search: runs parallel search (evidence: `README.md`)
- Move Generation → Position and Rules: supports chess variants (evidence: `README.md`)
- Search → Position and Rules: checks draw rules (evidence: `README.md`)
