pub struct SortedMoveAdder<'a> { /* private fields */ }Expand description
SortedMoveAdder collects moves including the piece-square score for making the move Moves are sorted by an ‘ordering score’ and stored in a provided SortedMoveHeap
Non-captures are ordered by priotising destination squares that are further up the board relative to the mover, with a bonus for pawns near promotion, a handicap for non-pawn moves to rank 1, and a handicap for pawn moves to low ranks.
Captures are ordered by most-valuable-victim / least-valuable-aggresor with piece scores worth: Pawn: 0 King: 1 (can only be aggresor) Knight: 2 Bishop: 3 Rook: 4 Queen: 5
Move ordering priorities: -250: promotion to bishop -200: promotion to rook -145..-145: capture and promotion to bishop (exact score based on MVV-LVA) -105..-95: capture and promotion to rook (exact score based on MVV-LVA) 0: non-pawn to rank 1 1: - 2: pawn to rank 3 3: pawn to rank 4, non-pawn to rank 2 4: pawn to rank 5, non-pawn to rank 3 5: non-pawn to rank 4 6: non-pawn to rank 5 7: non-pawn to rank 6 8: non-pawn to rank 7 9: non-pawn to rank 8 10: pawn to rank 6 11: pawn to rank 7 20: castle 25: promotion to knight 50: promotion to queen 95..105: capture (exact score based on MVV-LVA) 120..130: capture and promotion to knight (exact score based on MVV-LVA) 145..155: capture and promotion to queen (exact score based on MVV-LVA)
Note: rook and bishop promotions are penalized because queen promotion is nearly always a better choice
Implementations§
Source§impl<'a> SortedMoveAdder<'a>
impl<'a> SortedMoveAdder<'a>
pub fn new( piece_square_table: &'a PieceSquareTable, piece_grid: &'a [Piece; 64], stm: Side, moves: &'a mut SortedMoveHeap, ) -> SortedMoveAdder<'a>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'a> Debug for SortedMoveAdder<'a>
impl<'a> Debug for SortedMoveAdder<'a>
Source§impl<'a> Display for SortedMoveAdder<'a>
impl<'a> Display for SortedMoveAdder<'a>
Source§impl<'a> MoveAdder for SortedMoveAdder<'a>
impl<'a> MoveAdder for SortedMoveAdder<'a>
fn add_captures(&mut self, from: Square, targets: BB)
fn add_non_captures(&mut self, from: Square, targets: BB)
Source§fn add_castle(&mut self, castle: Castle)
fn add_castle(&mut self, castle: Castle)
Source§fn add_pawn_ep_capture(&mut self, from: Square, to: Square)
fn add_pawn_ep_capture(&mut self, from: Square, to: Square)
Source§fn add_pawn_pushes(&mut self, shift: usize, targets: BB)
fn add_pawn_pushes(&mut self, shift: usize, targets: BB)
Source§fn add_pawn_captures(&mut self, shift: usize, targets: BB)
fn add_pawn_captures(&mut self, shift: usize, targets: BB)
add_pawn_pushes. Do not use this for en-passant captures (use add_pawn_ep_capture)