Skip to content

Commit a1c7ac5

Browse files
committed
fix redundancy checker to consider mirrored rules as well
All equivalent representations of the same rule should yield the same outcome as to whether the rule contains redundant adjacencies. This now finds about 127k additional redundant rules.
1 parent bb63ed6 commit a1c7ac5

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/scala/scripts/RedundantAdjacenciesChecker.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ object RedundantAdjacenciesChecker extends Rul2Checker {
132132
}
133133

134134
def isRedundantAdjacency(rule: Rule[IdTile], lookupRule: PartialFunction[EquivRule, Rule[IdTile]]): Boolean = {
135-
val a = rule(0)
136-
def checkOrth() = {
135+
def checkOrth(rule: Rule[IdTile]) = {
136+
val a = rule(0)
137137
val c = rule(1)
138138
orthogonalSurrogateTiles.exists { b =>
139139
if (b.id == a.id || b.id == c.id) { // this would depend on the same rule
@@ -144,7 +144,8 @@ object RedundantAdjacenciesChecker extends Rul2Checker {
144144
}
145145
}
146146
}
147-
def checkDiag() = {
147+
def checkDiag(rule: Rule[IdTile]) = {
148+
val a = rule(0)
148149
val d = rule(1)
149150
diagonalSurrogateTiles.exists { case (b, c, southBound) =>
150151
if (c.id == a.id || b.id == d.id) { // this would depend on the same rule
@@ -155,7 +156,10 @@ object RedundantAdjacenciesChecker extends Rul2Checker {
155156
}
156157
}
157158
}
158-
checkOrth() || checkDiag()
159+
checkOrth(rule) || checkDiag(rule) || {
160+
val ruleFlipped = rule.map(_ * R2F1) // checking the flipped rule is important to ensure that two equivalent rules are both either redundant or not
161+
checkOrth(ruleFlipped) || checkDiag(ruleFlipped)
162+
}
159163
}
160164

161165
}

0 commit comments

Comments
 (0)