Site
Gitweb
Static
projects
/
zoombinis-solve.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
42525c2
)
Remove duplicate code
master
author
Jakob Cornell
<jakob@jcornell.net>
Tue, 25 Jun 2019 05:50:51 +0000
(
00:50
-0500)
committer
Jakob Cornell
<jakob@jcornell.net>
Tue, 25 Jun 2019 05:50:51 +0000
(
00:50
-0500)
puzzles/allergic_cliffs/l4.py
patch
|
blob
|
history
diff --git
a/puzzles/allergic_cliffs/l4.py
b/puzzles/allergic_cliffs/l4.py
index 798a7b9cd22ff8c22012be3298e4e9a97054fbcb..7f2d5382e838942c4da892f2ee81a9b2a03e4b76 100644
(file)
--- 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:
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(
return all(v == 8 for v in cts.values())
self.cand_rules = frozenset(
@@
-46,11
+46,6
@@
class Instance:
if check_split(rule)
)
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
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:
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):
return cts
def next_pair(self):