Module moveorder

Module moveorder 

Source
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.

  1. Sort an entire list of moves before processing.
  2. 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.

  1. 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() ... or for 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.