use unstable sort, small optimization

This commit is contained in:
jackjohn7 2026-04-15 02:47:46 -05:00
parent de02670685
commit a4cbde9713

View file

@ -93,7 +93,7 @@ pub fn alphabeta(mut game: Game, depth: u8, mut alpha: i8, mut beta: i8) -> (Boa
// since we're considering the "best" moves first. // since we're considering the "best" moves first.
// We do this by mapping moves to ranked moves and then sorting. // We do this by mapping moves to ranked moves and then sorting.
let mut moves = explode_board(moves).map(MoveRank::from).collect::<Vec<_>>(); let mut moves = explode_board(moves).map(MoveRank::from).collect::<Vec<_>>();
moves.sort(); moves.sort_unstable();
let moves = moves let moves = moves
.into_iter() .into_iter()
.map(MoveRank::into_inner) .map(MoveRank::into_inner)