# dhg14n9/mythos architecture

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

- Interactive diagram: https://gitdiagram.com/dhg14n9/mythos
- Repository: https://github.com/dhg14n9/mythos

## Overview

Mythos is a Rust chess engine exposed through UCI, with a search-and-evaluation runtime and a separate PGN-to-training-position data generator. The main binary dispatches ordinary use to the UCI runner; sampled search code uses board state, move selection, NNUE evaluation, and search tables. The README documents GUI compatibility, but the UCI implementation and several subsystems were not sampled, so internal links from that runner are omitted. The training tool’s parsing and conversion dispatch are visible in its entry point; deeper module wiring is not assumed.

Main entry points: [`src/search.rs`](https://github.com/dhg14n9/mythos/blob/master/src/search.rs) (Search), [`src/nnue/mod.rs`](https://github.com/dhg14n9/mythos/blob/master/src/nnue/mod.rs) (NNUE evaluation), [`src/nnue/accumulator.rs`](https://github.com/dhg14n9/mythos/blob/master/src/nnue/accumulator.rs) (Feature accumulator), [`datagen/src/main.rs`](https://github.com/dhg14n9/mythos/blob/master/datagen/src/main.rs) (Data generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Engine interface"]
  node_engine["Engine binary<br/>[main.rs]"]
  node_uci["UCI runner<br/>[uci.rs]"]
end

subgraph group_chess["Chess runtime"]
  node_board["Board state<br/>[board.rs]"]
  node_movegen["Move generation<br/>[movegen.rs]"]
  node_lookup["Attack lookup<br/>[lookup.rs]"]
  node_types["Chess types<br/>[mod.rs]"]
end

subgraph group_evaluation["Search and evaluation"]
  node_search["Search<br/>[search.rs]"]
  node_movepicker["Move picker<br/>[movepicker.rs]"]
  node_nnue["NNUE evaluation<br/>[mod.rs]"]
  node_network["Network inference<br/>[network.rs]"]
  node_accumulator["Feature accumulator<br/>[accumulator.rs]"]
  node_tables["Search tables<br/>[tables.rs]"]
  node_tunables["Search parameters<br/>[tunables.rs]"]
end

subgraph group_training["Training data"]
  node_datagen["Data generator<br/>[main.rs]"]
  node_pgn["PGN reader<br/>[pgn.rs]"]
  node_convert["Game conversion<br/>[convert.rs]"]
  node_san["SAN parsing<br/>[san.rs]"]
end

node_gui(("Chess GUI"))
node_pgn_input(("PGN input"))

node_gui -->|"starts engine"| node_engine
node_engine -->|"runs UCI"| node_uci
node_uci -->|"UCI output"| node_gui
node_board -->|"queries attacks"| node_lookup
node_search -->|"updates positions"| node_board
node_search -->|"selects moves"| node_movepicker
node_search -->|"evaluates positions"| node_nnue
node_search -->|"uses search state"| node_tables
node_search -->|"reads parameters"| node_tunables
node_nnue -->|"evaluates with"| node_network
node_nnue -->|"materializes features"| node_accumulator
node_accumulator -->|"reads weights"| node_network
node_accumulator -->|"reads position"| node_board
node_pgn_input -->|"provides games"| node_datagen
node_datagen -->|"reads games"| node_pgn
node_datagen -->|"converts games"| node_convert

click node_engine "https://github.com/dhg14n9/mythos/blob/master/src/main.rs"
click node_uci "https://github.com/dhg14n9/mythos/blob/master/src/uci.rs"
click node_board "https://github.com/dhg14n9/mythos/blob/master/src/board/board.rs"
click node_movegen "https://github.com/dhg14n9/mythos/blob/master/src/board/movegen.rs"
click node_lookup "https://github.com/dhg14n9/mythos/blob/master/src/board/lookup.rs"
click node_types "https://github.com/dhg14n9/mythos/blob/master/src/types/mod.rs"
click node_search "https://github.com/dhg14n9/mythos/blob/master/src/search.rs"
click node_movepicker "https://github.com/dhg14n9/mythos/blob/master/src/movepicker.rs"
click node_nnue "https://github.com/dhg14n9/mythos/blob/master/src/nnue/mod.rs"
click node_network "https://github.com/dhg14n9/mythos/blob/master/src/nnue/network.rs"
click node_accumulator "https://github.com/dhg14n9/mythos/blob/master/src/nnue/accumulator.rs"
click node_tables "https://github.com/dhg14n9/mythos/blob/master/src/tables.rs"
click node_tunables "https://github.com/dhg14n9/mythos/blob/master/src/tunables.rs"
click node_datagen "https://github.com/dhg14n9/mythos/blob/master/datagen/src/main.rs"
click node_pgn "https://github.com/dhg14n9/mythos/blob/master/datagen/src/pgn.rs"
click node_convert "https://github.com/dhg14n9/mythos/blob/master/datagen/src/convert.rs"
click node_san "https://github.com/dhg14n9/mythos/blob/master/datagen/src/san.rs"

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_engine,node_uci,node_gui toneBlue
class node_board,node_movegen,node_lookup,node_types toneAmber
class node_search,node_movepicker,node_nnue,node_network,node_accumulator,node_tables,node_tunables toneMint
class node_datagen,node_pgn,node_convert,node_san toneRose
class node_pgn_input toneIndigo
```

## Components

### Engine interface

- [Engine binary](https://github.com/dhg14n9/mythos/blob/master/src/main.rs): `src/main.rs`
- [UCI runner](https://github.com/dhg14n9/mythos/blob/master/src/uci.rs): `src/uci.rs`

### Chess runtime

- [Board state](https://github.com/dhg14n9/mythos/blob/master/src/board/board.rs): `src/board/board.rs`
- [Move generation](https://github.com/dhg14n9/mythos/blob/master/src/board/movegen.rs): `src/board/movegen.rs`
- [Attack lookup](https://github.com/dhg14n9/mythos/blob/master/src/board/lookup.rs): `src/board/lookup.rs`
- [Chess types](https://github.com/dhg14n9/mythos/blob/master/src/types/mod.rs): `src/types/mod.rs`

### Search and evaluation

- [Search](https://github.com/dhg14n9/mythos/blob/master/src/search.rs): `src/search.rs`
- [Move picker](https://github.com/dhg14n9/mythos/blob/master/src/movepicker.rs): `src/movepicker.rs`
- [NNUE evaluation](https://github.com/dhg14n9/mythos/blob/master/src/nnue/mod.rs): `src/nnue/mod.rs`
- [Network inference](https://github.com/dhg14n9/mythos/blob/master/src/nnue/network.rs): `src/nnue/network.rs`
- [Feature accumulator](https://github.com/dhg14n9/mythos/blob/master/src/nnue/accumulator.rs): `src/nnue/accumulator.rs`
- [Search tables](https://github.com/dhg14n9/mythos/blob/master/src/tables.rs): `src/tables.rs`
- [Search parameters](https://github.com/dhg14n9/mythos/blob/master/src/tunables.rs): `src/tunables.rs`

### Training data

- [Data generator](https://github.com/dhg14n9/mythos/blob/master/datagen/src/main.rs): `datagen/src/main.rs`
- [PGN reader](https://github.com/dhg14n9/mythos/blob/master/datagen/src/pgn.rs): `datagen/src/pgn.rs`
- [Game conversion](https://github.com/dhg14n9/mythos/blob/master/datagen/src/convert.rs): `datagen/src/convert.rs`
- [SAN parsing](https://github.com/dhg14n9/mythos/blob/master/datagen/src/san.rs): `datagen/src/san.rs`

### Other components

- **Chess GUI**
- **PGN input**

## Connections

- Chess GUI → Engine binary: starts engine
- Engine binary → UCI runner: runs UCI
- UCI runner → Chess GUI: UCI output
- Board state → Attack lookup: queries attacks
- Search → Board state: updates positions
- Search → Move picker: selects moves
- Search → NNUE evaluation: evaluates positions
- Search → Search tables: uses search state
- Search → Search parameters: reads parameters
- NNUE evaluation → Network inference: evaluates with
- NNUE evaluation → Feature accumulator: materializes features
- Feature accumulator → Network inference: reads weights
- Feature accumulator → Board state: reads position
- PGN input → Data generator: provides games
- Data generator → PGN reader: reads games
- Data generator → Game conversion: converts games
