Skip to content

Latest commit

 

History

History
130 lines (105 loc) · 3.47 KB

File metadata and controls

130 lines (105 loc) · 3.47 KB

About the include/bitbishop/ tree

Purpose

include/bitbishop exposes the public building blocks of the chess engine.

Tip

src/bitbishop and tests/bitbishop mirror the same architecture and contain, respectively, implementation files and tests.

Top-level headers

Top-level headers are intentionally documented in detail because they are stable.

Core board model

Shared engine data

Directory guide

include/bitbishop/
├── attacks - Occupancy-aware attack queries
├── engine - Evaluation and search
├── interface - UCI protocol and search orchestration
├── lookups - Compile-time geometry and precomputed tables
├── movegen - Legal move generation and king safety
├── moves - Reversible move execution and move history
└── tools - Perft and other developer tools

Layering

[!NOTE] The arrows below represent the usual flow of information between layers, not necessarily every direct include dependency.

flowchart TD

    TopLevelHeaders("`
        **Top Level Headers**
        -
        inlcude/bitbishop/*.hpp
    `")
    LookupTables("`
        **Lookup Tables**
        Compile-time geometry and precomputed tables
        -
        inlcude/bitbishop/lookups/*.hpp
    `")
    Attacks("`
        **Attacks**
        Occupancy-aware attack queries
        -
        inlcude/bitbishop/attacks/*.hpp
    `")
    MoveGen("`
        **Move Generation**
        Legal move generation and king safety
        -
        inlcude/bitbishop/movegen/*.hpp
    `")
    Moves("`
        **Move Execution**
        Reversible move execution and move history
        -
        inlcude/bitbishop/moves/*.hpp
    `")
    Engine("`
        **Search Engine**
        Evaluation and search
        -
        inlcude/bitbishop/engine/*.hpp
    `")
    Interface("`
        **Interface**
        UCI protocol and search orchestration
        -
        inlcude/bitbishop/interface/*.hpp
    `")
    Tools("`
        **Dev tools**
        Perft and other developer tools
        -
        inlcude/bitbishop/tools/*.hpp
    `")
    OutsideWorld("`
        Outside world
        CLI, GUI, Tests...
    `")

    LookupTables --> TopLevelHeaders

    Attacks --> LookupTables

    MoveGen --> Attacks
    MoveGen --> LookupTables

    Moves --> MoveGen

    Engine --> Moves
    Engine --> MoveGen

    Interface --> Engine

    Tools --> Moves
    Tools --> MoveGen

    OutsideWorld --> Interface
Loading

Dependency rule of thumb

  • If code is position-independent geometry, it belongs in lookups/.
  • If it needs occupancy but not legal-move filtering, it belongs in attacks/.
  • If it decides which moves are legal, it belongs in movegen/.
  • If it applies or reverts a chosen move, it belongs in moves/.
  • If it evaluates or selects moves, it belongs in engine/.
  • If it talks to a GUI, CLI, or protocol, it belongs in interface/.
  • If it exists mainly to validate or debug the engine, it belongs in tools/.