aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-09-04 13:40:56 +0300
committereug-vs <eugene@eug-vs.xyz>2023-09-04 13:40:56 +0300
commitb1bec57cafc89b97b99795da8484ee34da773105 (patch)
tree975f0ac3a36fc8e260105defb1e39e06983b90a6
parent6a91432045963b00bbb79938e918d100f171b3d4 (diff)
downloadchessnost-b1bec57cafc89b97b99795da8484ee34da773105.tar.gz
feat: order transpositions by score too
-rw-r--r--src/grossmeister/ttable.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/grossmeister/ttable.rs b/src/grossmeister/ttable.rs
index 0420e22..8838093 100644
--- a/src/grossmeister/ttable.rs
+++ b/src/grossmeister/ttable.rs
@@ -44,10 +44,17 @@ impl PartialOrd for TranspositionTableItem {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
// Order by depth first, then node type
let depth_ordering = self.depth.partial_cmp(&other.depth);
- match depth_ordering {
- Some(Ordering::Equal) => self.node_type.partial_cmp(&other.node_type),
- _ => depth_ordering,
+ if depth_ordering != Some(Ordering::Equal) {
+ return depth_ordering
}
+
+ let node_ordering = self.node_type.partial_cmp(&other.node_type);
+
+ if node_ordering != Some(Ordering::Equal) {
+ return node_ordering
+ }
+
+ self.score.partial_cmp(&other.score)
}
}