diff options
Diffstat (limited to 'oo.py')
-rw-r--r-- | oo.py | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -204,7 +204,29 @@ class ooPuzzle: # check boundary edge pairs - #TODO: check boundary edges dependent on toroidal + for y in range(self.Y): + l_piece = self.pieces [self.X-1, y] + l_orient = self.orients[self.X-1, y] + r_piece = self.pieces [0, y] + r_orient = self.orients[0, y] + l_edge = self.PIECE_ORIENT_TO_EDGES[l_piece, l_orient][2] + r_edge = self.PIECE_ORIENT_TO_EDGES[r_piece, r_orient][0] + if self.toroidal: + if l_edge != r_edge: return False + else: + if l_edge or r_edge: return False + + for x in range(self.X): + u_piece = self.pieces [x, self.Y-1] + u_orient = self.orients[x, self.Y-1] + d_piece = self.pieces [x, 0] + d_orient = self.orients[x, 0] + u_edge = self.PIECE_ORIENT_TO_EDGES[u_piece, u_orient][3] + d_edge = self.PIECE_ORIENT_TO_EDGES[d_piece, d_orient][1] + if self.toroidal: + if u_edge != d_edge: return False + else: + if u_edge or d_edge: return False return True |