Public API Reference
OrbisChessEngine.BoardOrbisChessEngine.GameOrbisChessEngine.MoveOrbisChessEngine.MoveOrbisChessEngine.SearchResultOrbisChessEngine.UndoInfoOrbisChessEngine.evaluateOrbisChessEngine.game_statusOrbisChessEngine.game_statusOrbisChessEngine.in_checkOrbisChessEngine.make_moveOrbisChessEngine.make_move!OrbisChessEngine.make_timed_moveOrbisChessEngine.make_timed_move!OrbisChessEngine.perftOrbisChessEngine.perft_fastOrbisChessEngine.searchOrbisChessEngine.undo_moveOrbisChessEngine.undo_move!
OrbisChessEngine.Board — TypeBoardA chess board representation using bitboards.
bitboards: A fixed-size vector where each element corresponds to a piece type's bitboard.side_to_move: The side to move.castling_rights: A 4-bit integer representing castling rights (KQkq).en_passant: The square index (0-63) for en passant target, or -1 if none.halfmove_clock: The number of halfmoves since the last capture or pawn move (for the 50-move rule).position_history: A vector of position Zobrist hashes for detecting threefold repetition.undo_stack: A stack ofUndoInfostructs for unmaking moves.undo_index: The current index in the undo stack.eval_score: Cached evaluation score from White's point of view.game_phase_value: Cached phase numerator (sum of weights) for evaluation scaling.
OrbisChessEngine.Game — TypeGameA struct representing a chess game with time control.
- board: The current state of the chess board.
- white_time: Time remaining for White in milliseconds.
- black_time: Time remaining for Black in milliseconds.
- increment: Time increment per move in milliseconds.
OrbisChessEngine.Move — TypeMoveA chess move.
fromis a square index (0-63)tois a square index (0-63)promotionis the piece type promoted to (0 if none)captureis captured piece type (0 if none)castling: 0 = normal, 1 = kingside, 2 = queensideen_passant: true if en passant capture
OrbisChessEngine.Move — MethodMove(board::Board, str::AbstractString)Construct a Move from a long algebraic string like "e2e4" or "e7e8=Q", using the board to infer capture, en passant, and castling.
board: current Board statestr: move string in long algebraic notation
Captures are inferred based on the board state (so "e4d5" captures if d5 is occupied by opponent). Castling can be specified with "O-O" (kingside) or "O-O-O" (queenside). Also accepts "o-o", "0-0", "o-o-o", "0-0-0".
Note, that this function does not validate the legality of the move; it only constructs the Move object.
OrbisChessEngine.SearchResult — TypeSearchResultResult of a search operation.
score: The evaluation score of the position.move: The best move found.from_book: Boolean indicating if the move was from the opening book.
OrbisChessEngine.UndoInfo — TypeUndoInfoInformation needed to undo a move
captured_piece: The piece type that was captured, or 0 if none.en_passant: The previous en passant square.castling_rights: The previous castling rights.halfmove_clock: The previous halfmove clock.moved_piece: The piece type that was moved.promotion: The piece type if the move was a promotion, or 0 otherwise.is_en_passant: A boolean indicating if the move was an en passant capture.prev_eval_score: The evaluation score before the move.prev_game_phase_value: The game phase value before the move.
OrbisChessEngine.evaluate — Methodevaluate(board::Board) -> IntEvaluate a position from White’s perspective using piece-square tables.
- board: Board struct
OrbisChessEngine.game_status — Methodgame_status(board::Board) -> SymbolReturn the current game status (checkmate, stalemate, draw, or ongoing)
board: Board struct
Returns: Symbol - one of
:checkmate_white:checkmate_black:stalemate:draw_threefold:draw_fiftymove:draw_insufficient_material:ongoing
OrbisChessEngine.game_status — Methodgame_status(game::Game)Return the current game status (checkmate, stalemate, draw, timeout, or ongoing).
game: Game struct
Returns: Symbol — one of
:checkmate_white:checkmate_black:stalemate:draw_threefold:draw_fiftymove:draw_insufficient_material:timeout_white:timeout_black:ongoing
OrbisChessEngine.in_check — Methodin_check(board::Board, side::Side) -> BoolCheck if the king of the given side is in check
board: Board structside: Side (WHITE or BLACK)
Returns: Bool
OrbisChessEngine.make_move! — Methodmake_move!(board, m)Apply move m to board, modifying it in place.
board: Board structm: Move
OrbisChessEngine.make_move — Methodmake_move(board, m) -> BoardReturn a new board with move m applied, leaving the original board unchanged.
board: Board structm: Move
OrbisChessEngine.make_timed_move! — Methodmake_timed_move!(game::Game; opening_book::Union{Nothing, PolyglotBook}=KOMODO_OPENING_BOOK, verbose=false)Searches for and makes a move for the current player, updating the Game struct with the updated board and time remaining.
game: Game structopening_book: Optional PolyglotBook for opening movesverbose: If true, print move details and time used
The time allocated for the search is done automatically based on remaining time and increment. See search for details on how the search is performed.
OrbisChessEngine.make_timed_move — Methodmake_timed_move(game::Game; opening_book::Union{Nothing, PolyglotBook}=KOMODO_OPENING_BOOK, verbose=false) -> GameSearches for and makes a move for the current player, returning a new Game struct with the updated board and time remaining.
game: Game structopening_book: Optional PolyglotBook for opening movesverbose: If true, print move details and time used
The time allocated for the search is done automatically based on remaining time and increment. See search for details on how the search is performed.
OrbisChessEngine.perft — Methodperft(board::Board, depth::Int) -> IntCompute the number of leaf nodes reachable from the given board position at the given depth. It uses the Board struct to immitate search behavior. In particular, this means it still computes zobrist hashes and updates evaluation scores slowing it down compared to a minimal perft implementation.
OrbisChessEngine.perft_fast — Methodperft_fast(board::Board, depth::Int) -> IntCompute the number of leaf nodes reachable from the given board position at the given depth using multiple threads at the root. It uses the Board struct to immitate search behavior. In particular, this means it still computes zobrist hashes and updates evaluation scores slowing it down compared to a minimal perft implementation.
OrbisChessEngine.search — Methodsearch(
board::Board;
depth::Int,
opening_book::Union{Nothing, PolyglotBook} = KOMODO_OPENING_BOOK,
verbose::Bool = false,
time_budget::Int = typemax(Int)
)::SearchResultSearch for the best move using minimax with iterative deepening, alpha-beta pruning, quiescence search, null move pruning, and transposition tables.
Arguments:
board: current board positiondepth: search depthopening_book: if provided, uses a opening book. Default isKOMODO_OPENING_BOOK
taken from free-opening-books. Set to nothing to disable.
verbose: if true, prints search information and principal variation (PV) at each depthtime_budget: time in milliseconds to stop the search (if depth not reached)
Returns:
SearchResultcontaining the best move and its evaluation score (ornothingif no move found)
OrbisChessEngine.undo_move! — Methodundo_move!(board::Board, m::Move)Undo move m on board in place, restoring previous state.
board: Board structm: Move struct
OrbisChessEngine.undo_move — Methodundo_move(board::Board, m::Move) -> BoardReturn a new board with move m undone, leaving the original board unchanged.
board: Board structm: Move struct