Expand description
Move Ordering
Functions used for ordering a list of moves from best to worst, or for picking the best move out of a list of moves.
Move ordering is important for alpha-beta pruning performance. If the best or good moves are searched early on in an alpha-beta search, pruning occurs more frequently.
Two strategies are used for when to move order.
- Sort an entire list of moves before processing.
- Pick and remove the best move from the move list each time a move is needed.
There are several strategies for move ordering which may be used.
- Sort first by principal variation moves, then by hash moves, then by Captures (SEE)
Functionsยง
- order_
all_ moves - Order all moves in a container completely, in order of worst move to best move.
Best moves are near the end to allow for iterating from best to worst move by using
while let Some(move_) = move_list.pop() ...
orfor move_ in move_list.into_iter().rev() ...
- pick_
best_ move - Pick and return the best move from a move list without allocation. When run to completion, this acts as a selection sort.