Hyperion addresses the board as a 14×14 grid:
bit = rank * 14 + file
The four 3×3 corner regions are invalid. The remaining 160 squares are stored inside an aligned 256-bit value made from four 64-bit limbs.
This mapping keeps directional offsets simple:
North +14
South -14
East +1
West -1
NorthEast +15
NorthWest +13
SouthEast -13
SouthWest -15
Compile-time source masks prevent shifts from wrapping across files or entering invalid corners.
Position maintains:
- Six bitboards per color
- One occupancy bitboard per color
- Total occupancy
- A 196-entry mailbox
- Side to move
- Rule mode
- Eight castling-right bits
- En-passant target and victim squares
- Halfmove clock
- Ply count
- Incremental 64-bit Zobrist key
The mailbox makes captures and piece identification constant-time, while bitboards handle attacks and bulk occupancy operations.
The default slider backend uses precomputed directional rays:
ray
→ intersect occupied
→ locate nearest blocker
→ remove squares beyond blocker
This requires no large lookup table and was the fastest backend in the included build-machine benchmark.
The optional backend compresses occupied squares on each directional ray using BMI2 PEXT, then performs a table lookup. It serves the same role as magic bitboards on an 8×8 board but fits the irregular 160-square geometry more naturally.
Use the benchmark before selecting it; BMI2 availability does not guarantee that this backend is faster on a particular CPU.
Hyperion first generates pseudo-legal moves. It then uses a fast path:
- If the king is not in check, ordinary moves from unpinned non-king pieces are accepted directly.
- King moves, en-passant moves, and moves from pinned pieces are verified with make/undo.
- If the king is already in check, every candidate is verified.
This preserves correctness while removing most make/undo traffic in normal positions.
StateInfo saves only the irreversible or overwritten state needed for undo:
- Zobrist key
- En-passant target
- En-passant victim
- Captured piece and square
- Side to move
- Castling rights
- Halfmove clock
- Ply
Piece placement and occupancy are reversed incrementally. The original Zobrist key is restored exactly.