From e39f23b24e4c452134d16699ba84eff14cac0a88 Mon Sep 17 00:00:00 2001 From: Nervonment Date: Fri, 14 Jun 2024 14:33:53 +0800 Subject: [PATCH] fix bug --- src/techniques/naked_subsets.rs | 45 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/techniques/naked_subsets.rs b/src/techniques/naked_subsets.rs index 39ad041..bdc71cf 100644 --- a/src/techniques/naked_subsets.rs +++ b/src/techniques/naked_subsets.rs @@ -376,29 +376,32 @@ where removes, } }); - if self.0.is_none() { - self.0 = - naked_subset(k, state, |r, c| (r, c)).map(|(house, cells, nums, removes)| { - NakedSubsetInfo { - k, - house: House::Row(house), - cells, - nums, - removes, - } - }); - if self.0.is_none() { - self.0 = naked_subset(k, state, |r, c| (c, r)).map( - |(house, cells, nums, removes)| NakedSubsetInfo { - k, - house: House::Column(house), - cells, - nums, - removes, - }, - ); + if self.0.is_some() { + return; + } + + self.0 = naked_subset(k, state, |r, c| (r, c)).map(|(house, cells, nums, removes)| { + NakedSubsetInfo { + k, + house: House::Row(house), + cells, + nums, + removes, } + }); + if self.0.is_some() { + return; } + + self.0 = naked_subset(k, state, |r, c| (c, r)).map(|(house, cells, nums, removes)| { + NakedSubsetInfo { + k, + house: House::Column(house), + cells, + nums, + removes, + } + }); } } fn appliable(&self) -> bool {