From b1bec57cafc89b97b99795da8484ee34da773105 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 4 Sep 2023 13:40:56 +0300 Subject: feat: order transpositions by score too --- src/grossmeister/ttable.rs | 13 ++++++++++--- 1 file 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 { // 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) } } -- cgit v1.2.3