A C++20 engine core for the standard 14×14 cross-shaped four-player chess board shown in the reference image. The board uses 196 addressable grid indices inside a custom 256-bit bitboard, with the 36 invalid corner squares masked out to leave 160 playable squares.
alignas(32)four-limbuint256_t- Compile-time board masks, king attacks, knight attacks, pawn attacks, and rays
- Incrementally maintained piece, color, and total occupancy
- Mailbox lookup for constant-time captured-piece identification
- Zobrist hashing updated during make/undo
- Fixed-capacity move lists with no heap allocation
- Ray-scan slider attacks using nearest-blocker bit scans
- Optional BMI2/PEXT compressed directional attack tables (benchmarkable, not assumed faster)
- Exact make/undo and null-move restoration
Classic 8×8 multiplication-based magic bitboards do not transfer cleanly to an irregular 160-square board. Hyperion therefore includes a magic-style PEXT backend: each directional ray is compressed into a small occupancy index and looked up in a precomputed attack table. It uses about 18 MiB and falls back to the ray scanner on processors without BMI2. The ray scanner is the default because it benchmarked faster on the build machine; the included benchmark lets you choose correctly for your CPU.
Both backends are tested against each other for random occupancies.
position.inCheck();
position.inCheck(Color::Red);
position.givesCheck(move);
position.doMove(move, state);
position.undoMove(move, state);
position.canDoNullMove();
position.doNullMove(state);
position.undoNullMove(state);
movegen::generateMoves(position, moves);
movegen::generateCaptures(position, moves);
movegen::is_legal(position, move);
movegen::isCheckmate(position);
movegen::isStalemate(position);
movegen::perft(position, depth);- Red moves north
- Blue moves east
- Yellow moves south
- Green moves west
- Turn order: Red → Blue → Yellow → Green
- Team mode: Red/Yellow vs Blue/Green
- Free-for-all mode is also supported
- Teammate pieces are friendly blockers and cannot be captured
- Four-direction pawn movement and capture tables
- Double pawn pushes
- Promotion on each player’s 11th rank to queen, rook, bishop, or knight
- En passant state and make/undo logic
- Color-specific castling geometry
- Legal move filtering against self-check
The included start position matches the supplied board:
- Red:
R N B Q K B N Rond1–k1 - Blue:
R N B K Q B N Rona4–a11 - Yellow:
R N B K Q B N Rond14–k14 - Green:
R N B Q K B N Ronn4–n11
Each side has eight pawns on the adjacent line.
Open the extracted folder directly:
File → Open → Folder
Select Hyperion x64 Debug while developing and Hyperion x64 Release for perft and benchmarks. Use x64-release-pext only when your local benchmark shows the compressed tables are faster.
Build and test from a Developer PowerShell:
cmake --preset x64-release
cmake --build --preset x64-release
ctest --preset x64-releaseRun:
.\out\build\x64-release\Hyperion.exe
.\out\build\x64-release\hyperion_benchmark.exeHyperion.cpp Demo executable
Hyperion.h Umbrella include
include/hyperion/bitboard.hpp
include/hyperion/board.hpp
include/hyperion/attacks.hpp
include/hyperion/move.hpp
include/hyperion/position.hpp
include/hyperion/movegen.hpp
src/attacks.cpp
src/position.cpp
src/movegen.cpp
tests/engine_tests.cpp
benchmarks/benchmark.cpp
This package is the board and legal-move core. A competitive engine should build the following on top:
- Transposition table
- Iterative deepening and aspiration windows
- Alpha-beta/PVS search
- Quiescence search
- Null-move pruning using the included null-move API
- Late-move reductions
- Killer/history/countermove ordering
- Static exchange evaluation adapted for four players
- Team-aware evaluation
- Repetition and terminal-state handling
Before using null-move pruning, the search must also handle zugzwang safeguards and must never null-move while the current king is in check.