From: Jakob Cornell Date: Tue, 25 Jun 2019 05:50:51 +0000 (-0500) Subject: Remove duplicate code X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=c694a2f1b9ec5e8c9c010653a98fbfecf943cce1;p=zoombinis-solve.git Remove duplicate code --- diff --git a/puzzles/allergic_cliffs/l4.py b/puzzles/allergic_cliffs/l4.py index 798a7b9..7f2d538 100644 --- a/puzzles/allergic_cliffs/l4.py +++ b/puzzles/allergic_cliffs/l4.py @@ -34,7 +34,7 @@ class Instance: def check_split(rule): cts = {cliff: 0 for cliff in Cliff} for z in zoombinis: - cts[Instance.assign(z, rule)] += 1 + cts[assign(z, rule)] += 1 return all(v == 8 for v in cts.values()) self.cand_rules = frozenset( @@ -46,11 +46,6 @@ class Instance: if check_split(rule) ) - @staticmethod - def assign(zoombini, rule): - (cliff, attrs) = rule - return cliff if zoombini.attrs & attrs else cliff.other() - def filtered_rules(self, rules, across): def check(rule): (cliff, attrs) = rule @@ -73,7 +68,7 @@ class Instance: def cliff_scores(self, z): cts = {cliff: 0 for cliff in Cliff} for rule in self.cand_rules: - cts[Instance.assign(z, rule)] += 1 + cts[assign(z, rule)] += 1 return cts def next_pair(self):