Internal API Reference
OrbisChessEngine.TTEntry — TypeTransposition table entry.
- key: Zobrist hash of the position (for collision checking)
- value: evaluation score
- depth: search depth at which this value was computed
- node_type: type of node (EXACT, LOWERBOUND, UPPERBOUND)
- best_move: best move found from this position
OrbisChessEngine._filter_legal_moves! — Method_filter_legal_moves!(board, pseudo, start, stop, moves, n_moves)Filters pseudo-legal moves into legal moves, avoiding full make/undo for moves that clearly cannot expose the king.
OrbisChessEngine.clearbit — MethodClear bit at square sq.
OrbisChessEngine.compute_eval_and_phase — Methodcompute_eval_and_phase(board::Board) -> (Int, Int)Compute the evaluation score (from White's perspective) and the game phase value from scratch for a given board.
OrbisChessEngine.count_bits — MethodCount the number of bits set in a UInt64.
OrbisChessEngine.extract_pv — MethodReconstruct the principal variation (PV) from the transposition table
OrbisChessEngine.file_rank — Methodfile_rank(sq) -> (Int, Int)Return file (1..8) and rank (1..8) for a square index
OrbisChessEngine.find_magic — MethodTry to find a magic number for a given square.
- sq: square index 0–63
- masks: precomputed mask table (bishop or rook)
- attack_fn: function (sq, occ) → attacks
- tries: number of random candidates to attempt
OrbisChessEngine.flip_table — MethodFlip a piece-square table vertically (white → black perspective). Input is a 64-element vector (row-major, starting at A8). Returns a new 64-element vector with ranks mirrored.
OrbisChessEngine.generate_magics — MethodCompute magic numbers for all squares.
- masks: precomputed mask table (bishop or rook)
- attack_fn: function (sq, occ) → attacks
OrbisChessEngine.generate_pawn_moves! — MethodGenerate pseudo-legal pawn moves in-place
board: Board structmoves: preallocated buffer to append moves
Returns: number of moves added
OrbisChessEngine.generate_pawn_moves — MethodGenerate pseudo-legal pawn moves for the side to move
board: Board struct
Returns: Vector of Move
OrbisChessEngine.is_fifty_move_rule — MethodCheck for fifty-move rule
board: Board struct
Returns: Bool
OrbisChessEngine.is_insufficient_material — Methodis_insufficient_material(board::Board) -> BoolCheck for insufficient material to mate
board: Board struct
OrbisChessEngine.is_threefold_repetition — MethodCheck for threefold repetition
board: Board struct
Returns: Bool
OrbisChessEngine.king_square — Methodking_square(board::Board, side::Side) -> IntGet the square index of the king for the given side
board: Board structside: Side (WHITE or BLACK)
Returns: Int (square index 0..63)
OrbisChessEngine.make_null_move! — MethodApply a null move (pass) to the board, modifying it in place. Used for null-move pruning.
OrbisChessEngine.move_ordering_score — Methodmove_ordering_score(board::Board, m::Move, ply::Int)Heuristic to score moves for ordering:
- Promotions are prioritized highest.
- Captures are prioritized higher.
- Moves giving check are prioritized.
- Quiet moves get a lower score.
OrbisChessEngine.next_square — Methodnext_square(sq::Int, dir::Tuple{Int,Int}) -> Union{Int,Nothing}Returns the next square index in direction dir = (df, dr) from sq. Returns nothing if it goes off-board.
OrbisChessEngine.occupancy — Methodoccupancy(board::Board) -> UInt64Returns a bitboard of all occupied squares.
OrbisChessEngine.occupancy_variations — MethodGenerate all possible occupancy bitboards for the given mask
OrbisChessEngine.piece_at — Methodpiece_at(board::Board, sq) -> IntReturn the piece type at a given square (0..63) using bitboards.
OrbisChessEngine.piece_from_symbol — Methodpiece_from_symbol(c::AbstractChar, side::Symbol)Return the piece constant corresponding to promotion symbol c and the moving side (:white or :black).
OrbisChessEngine.piece_square_value — MethodReturn the PSQT value of a piece on a given square.
- piece: Piece.WPAWN..Piece.BKING
- square: 0..63 (a1=0, h8=63)
- phase: Int (0..MAX_PHASE)
OrbisChessEngine.ray_between — Methodray_between(board, king_sq::Int, from_sq::Int) -> BoolReturns true if moving a piece from from_sq could open a sliding attack (rook, bishop, queen) towards the king at king_sq.
OrbisChessEngine.setbit — MethodSet bit at square sq.
OrbisChessEngine.sliding_attack_from_occupancy — MethodGeneric sliding attack generator.
- sq: square index
- occ: occupancy bitboard
- directions: list of (df, dr) directions
OrbisChessEngine.sliding_mask — MethodGeneric sliding mask generator.
- sq: square index (0..63)
- directions: list of (df, dr) directions
OrbisChessEngine.square_attacked — Methodsquare_attacked(board, sq, attacker) -> BoolCheck if a square is attacked by the given side.
board: Board structsq: Int (square index 0..63)attacker: Side (WHITE or BLACK)
Returns: Bool
OrbisChessEngine.square_index — MethodMap algebraic notation (e.g. 'e3') → square index (0..63).
OrbisChessEngine.square_index — MethodMap (file, rank) → square index (0..63). file=1→a, rank=1→1.
OrbisChessEngine.store_killer! — MethodStore a killer move for the given ply. Only quiet moves (non-captures) are stored.
- m: the move to store
- ply: the current ply
OrbisChessEngine.testbit — MethodCheck if bit at square sq is set.
OrbisChessEngine.tt_index — MethodGet index in transposition table from hash.
OrbisChessEngine.tt_probe — MethodLook up a position in the transposition table.
- hash: Zobrist hash of the position
- depth: current search depth
- α: alpha value
- β: beta value
Returns a tuple (value, best_move, hit) where hit is true if a valid entry was found.
OrbisChessEngine.tt_store — MethodStore an entry in the transposition table.
OrbisChessEngine.undo_null_move! — MethodUndo a null move, restoring the previous board state.