diff options
-rw-r--r-- | src/grossmeister/ttable.rs | 13 |
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) } } |