API Reference¶
Core Functions¶
Board Management¶
parseFEN(const char *fen) — Function
Parameters: fen – FEN string describing position
Returns: void
Parses a FEN string and sets up the board position, including piece placement, side to move, castling rights, en passant square, and initializes the hash key.
printBoard() — Function
Parameters: None
Returns: void
Prints the current board position to stdout with piece symbols, side to move, castling rights, en passant square, and hash key.
Move Generation¶
generateMoves(moves *moveList) — Function
Parameters: moveList – pointer to move list structure
Returns: void
Generates all pseudo-legal moves for the current position and stores them in the provided move list.
makeMove(int move, int moveFlag) — Function
Parameters: move – encoded move, moveFlag – allMoves or onlyCaptures
Returns: int – 1 if legal, 0 if illegal
Attempts to make a move on the board. Returns 1 if the move is legal (doesn’t leave own king in check), 0 otherwise.
Search¶
searchPosition(int depth) — Function
Parameters: depth – maximum search depth
Returns: void
Searches the current position using iterative deepening and prints the best move via UCI protocol.
negamax(int alpha, int beta, int depth) — Function
Parameters: alpha, beta – search window, depth – remaining depth
Returns: int – position score
Core search function implementing negamax with alpha-beta pruning.
Evaluation¶
evaluate() — Function
Parameters: None
Returns: int – position score in centipawns
Returns a static evaluation of the current position from the perspective of the side to move.
isAttacked(int square, int side) — Function
Parameters: square – target square, side – attacking side
Returns: int – 1 if attacked, 0 otherwise
Checks if a square is attacked by the specified side.