aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/move_generation.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-02-23 13:21:57 +0300
committereug-vs <eugene@eug-vs.xyz>2023-02-23 14:01:19 +0300
commit43dc24718c442ef45f6cecf5790df0ab84a72cfc (patch)
tree16f446b1d5a3e0fdf638e0bcab16cf34ec338bd8 /src/grossmeister/move_generation.rs
parentf60c573ba71207c18a28413e3940a4e21b07c73f (diff)
downloadchessnost-43dc24718c442ef45f6cecf5790df0ab84a72cfc.tar.gz
refactor: apply clippy suggestions
Diffstat (limited to 'src/grossmeister/move_generation.rs')
-rw-r--r--src/grossmeister/move_generation.rs23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/grossmeister/move_generation.rs b/src/grossmeister/move_generation.rs
index 25d92c7..c3acc91 100644
--- a/src/grossmeister/move_generation.rs
+++ b/src/grossmeister/move_generation.rs
@@ -153,7 +153,7 @@ impl Grossmeister {
}
}
}
- return moves
+ moves
}
/// Evaluate move for move ordering, prioritizing efficient captures
@@ -195,25 +195,20 @@ impl Grossmeister {
let mut ordered_moves: Vec<Move> = moves_with_eval.iter().map(|(m, _)| *m).collect();
// Insert killer moves after winning captures
- let equal_capture_index = match moves_with_eval.iter().position(|(m, eval)| m.is_tactical() && *eval == 0.0) {
- Some(x) => x,
- None => 0,
- };
+ let equal_capture_index = moves_with_eval
+ .iter()
+ .position(|(m, eval)| m.is_tactical() && *eval == 0.0)
+ .unwrap_or(0);
for killer in killer_moves {
- match ordered_moves.iter().position(|m| *m == killer) {
- Some(index) => {
+ if let Some(index) = ordered_moves.iter().position(|m| *m == killer) {
let mov = ordered_moves.remove(index);
ordered_moves.insert(equal_capture_index, mov);
- }
- None => {}
- };
-
+ }
}
- match self.transposition() {
- Some(transposition) => ordered_moves.insert(0, transposition.mov),
- None => {},
+ if let Some(transposition) = self.transposition() {
+ ordered_moves.insert(0, transposition.mov);
}
ordered_moves