# noxioustab/nox_engine architecture

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

- Interactive diagram: https://gitdiagram.com/noxioustab/nox_engine
- Repository: https://github.com/noxioustab/nox_engine

## Overview

##### Project type and purpose
- This is a stand-alone, command-line UCI (Universal Chess Interface) chess engine written in C++.
- It reads UCI commands from stdin, uses bitboard representation, runs a Minimax search with alpha-beta pruning and NNUE evaluation, then writes best moves back to stdout.
- Purpose: provide a high-performance, modular chess engine core that can plug into any UCI-compatible GUI.

##### File structure
- Top-level:
- Makefile, README.md, .gitignore
- inc/ — all public headers for different modules
- src/ — C++ implementation files (board.cpp, search.cpp, main.cpp)
- Module breakdown (in inc/):
- noxengine.h: high-level engine API (initialization, UCI command loop)
- .h, board.h: bitboard and board-state management
- generation.h, move.h, tables.h, magicnumbers.h: move generation & attack tables
- search.h: Minimax + α-β pruning orchestration
- heuristics.h, traditional.h, nnue.h: evaluation layers (static + NNUE)
- settings.h, report.h, utils.h, chooser.h: configuration, logging, utility functions
- src/main.cpp: UCI input/output & engine lifecycle
- src/board.cpp, src/search.cpp: core logic implementations

##### README for additional insights
- Confirms UCI protocol, bitboards, minimax, alpha-beta, NNUE.
- Mentions future options: quiescence search, transposition tables, multithreading.

##### Detail checklist
- FEN loading and NNUE weight file as external data sources
- Iteration: Search Engine calls Move Generation repeatedly
- Future extension points (quiescence, multi-threading)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% I/O Layer
    subgraph "I/O Layer"
        UCI_Interface["UCI Interface Module"]:::io
    end

    %% Core Logic
    subgraph "Core Logic"
        Controller["NoxEngine Controller"]:::core
        subgraph "Position & Board Manager"
            PositionH["position.h"]:::core
            BoardH["board.h"]:::core
            BoardCPP["board.cpp"]:::core
        end
        subgraph "Move Generation"
            GenH["generation.h"]:::core
            MoveH["move.h"]:::core
            TablesH["tables.h"]:::core
            MagicH["magicnumbers.h"]:::core
        end
        subgraph "Search Engine"
            SearchH["search.h"]:::core
            SearchCPP["search.cpp"]:::core
        end
        subgraph "Evaluation Engine"
            HeurH["heuristics.h"]:::core
            TradH["traditional.h"]:::core
            NnueH["nnue.h"]:::core
        end
    end

    %% Utilities & Config
    subgraph "Utilities & Configuration"
        Settings["settings.h"]:::util
        Report["report.h"]:::util
        Utils["utils.h"]:::util
        Chooser["chooser.h"]:::util
    end

    %% Data Assets
    subgraph "Data Assets"
        TablesData[(Precomputed Tables)]:::data
        NNUEModel[(net.bin)]:::data
        FENData[(FEN Strings)]:::data
    end

    %% Build & Docs
    subgraph "Build & Documentation"
        Makefile["Makefile"]:::util
        README["README.md"]:::util
    end

    %% Connections
    UCI_Interface -->|"send UCI commands"| Controller
    Controller -->|"load FEN, apply moves"| PositionH
    Controller --> SearchH
    SearchH --> GenH
    SearchH --> HeurH
    SearchH --> NnueH
    HeurH --> PositionH
    NnueH --> TablesData
    GenH --> TablesData
    PositionH --> TablesData
    Controller -->|return bestmove/info| UCI_Interface
    Controller --> Settings
    Controller --> Report
    Controller --> Utils
    Controller --> Chooser

    %% Future Extensions Annotation
    SearchH -.->|quiescence, transposition| GenH
    SearchH -.->|multithreading| Controller

    %% Click Events
    click UCI_Interface "https://github.com/noxioustab/nox_engine/blob/main/src/main.cpp"
    click Controller "https://github.com/noxioustab/nox_engine/blob/main/inc/noxengine.h"
    click PositionH "https://github.com/noxioustab/nox_engine/blob/main/inc/position.h"
    click BoardH "https://github.com/noxioustab/nox_engine/blob/main/inc/board.h"
    click BoardCPP "https://github.com/noxioustab/nox_engine/blob/main/src/board.cpp"
    click GenH "https://github.com/noxioustab/nox_engine/blob/main/inc/generation.h"
    click MoveH "https://github.com/noxioustab/nox_engine/blob/main/inc/move.h"
    click TablesH "https://github.com/noxioustab/nox_engine/blob/main/inc/tables.h"
    click MagicH "https://github.com/noxioustab/nox_engine/blob/main/inc/magicnumbers.h"
    click SearchH "https://github.com/noxioustab/nox_engine/blob/main/inc/search.h"
    click SearchCPP "https://github.com/noxioustab/nox_engine/blob/main/src/search.cpp"
    click HeurH "https://github.com/noxioustab/nox_engine/blob/main/inc/heuristics.h"
    click TradH "https://github.com/noxioustab/nox_engine/blob/main/inc/traditional.h"
    click NnueH "https://github.com/noxioustab/nox_engine/blob/main/inc/nnue.h"
    click Settings "https://github.com/noxioustab/nox_engine/blob/main/inc/settings.h"
    click Report "https://github.com/noxioustab/nox_engine/blob/main/inc/report.h"
    click Utils "https://github.com/noxioustab/nox_engine/blob/main/inc/utils.h"
    click Chooser "https://github.com/noxioustab/nox_engine/blob/main/inc/chooser.h"
    click Makefile "https://github.com/noxioustab/nox_engine/tree/main/Makefile"
    click README "https://github.com/noxioustab/nox_engine/blob/main/README.md"

    %% Styles
    classDef io fill:#9f6,stroke:#333;
    classDef core fill:#6cf,stroke:#333;
    classDef util fill:#ccc,stroke:#333;
    classDef data fill:#fc6,stroke:#333;
```
