Implement Index<T>, IndexMut<T> for Castle, PieceType and Color enums, use swap_remove instead of remove on sort_moves
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::{
|
||||
pub fn sort_moves(mut moves: Vec<Move>, mailbox: &Mailbox, tt_move: Option<Move>) -> Vec<Move> {
|
||||
if let Some(tt_move) = tt_move {
|
||||
if let Some(tt_move_index) = moves.iter().position(|&mv| mv == tt_move) {
|
||||
moves.remove(tt_move_index);
|
||||
moves.swap_remove(tt_move_index);
|
||||
moves.insert(0, tt_move);
|
||||
return moves;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user