Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 1.33 KB

File metadata and controls

67 lines (50 loc) · 1.33 KB

Engine-Core API ♟️

Checks and attacks

position.inCheck();
position.inCheck(Color::Blue);
position.checkers(Color::Blue);
position.pinnedPieces(Color::Blue);
position.givesCheck(move);
position.checked_opponents_after(move);

Move generation

MoveList<> moves;

movegen::generateMoves(position, moves);
movegen::generateCaptures(position, moves);
movegen::generateEvasions(position, moves);

movegen::is_pseudo_legal(position, move);
movegen::is_legal(position, move);
movegen::has_legal_move(position);
movegen::isCheckmate(position);
movegen::isStalemate(position);

Make and undo

StateInfo state;
position.doMove(move, state);
position.undoMove(move, state);

Null moves

if (position.canDoNullMove()) {
    StateInfo state;
    position.doNullMove(state);
    // Search reduced null-move branch.
    position.undoNullMove(state);
}

Null-move pruning belongs in the search layer. Do not use it while in check, and add zugzwang safeguards before relying on it competitively.

Slider backend

attacks::set_slider_backend(attacks::SliderBackend::RayScan);

if (magic::available()) {
    magic::enable();
}

Perft

const std::uint64_t nodes = movegen::perft(position, 4);

Perft is included for move-generation verification, not as the final search implementation.