Module eval

Source
Expand description

Static Evaluation Functions.

An evaluation function may have two types of calls: relative or absolute.

An absolute score treats White as a maxing player and Black as a minning player, so a centipawn score of +10 is winning for White, while -10 is winning for Black. A relative score treats the player to move as the maxing player, so if it is Black to move, +10 is winning for Black.

Constants§

PASS_PAWN_PATTERN
PASS_PAWN_SIZE
Warning: Do not use, unfinished.

Functions§

draw
Return a score representing a stalemate. Uses a contempt factor to indicate how bad a draw is for the engine.
evaluate
Primary hand-crafted evaluate function for engine, with return relative to player to move. Statically evaluates a non-terminal position.
evaluate_abs
Primary evaluate function for engine. Statically evaluate a non-terminal position using a variety of heuristics.
king_safety
material
Returns relative strength difference of pieces in position. Is equivalent of piece_centipawn(White) - pieces_centipawn(Black). A positive value is an advantage for white, 0 is even, negative is advantage for black.
mobility
Return value of number of moves that can be made from a position.
pass_pawns
Returns Centipawn difference for passed pawns.
piece_square_lookup
Returns value from looking up each piece square in precalculated tables.
terminal
Given a terminal node, return a score representing a checkmate or a draw. The return score is relative to the player to move.
terminal_abs
Given a terminal node (no moves can be made), return a score representing a checkmate for white/black, or a draw.
xray_king_attacks
Returns value from sliding pieces attacking opposing king on otherwise empty chessboard.