def delve_tunnel(self, x, y, next_x, next_y): x1, x2 = sort(x, next_x) y1, y2 = sort(y, next_y) for x in range(x1, x2 + 1): for y in range(y1, y2 + 1): self.cells[x, y] &= ~ENTRANCE self.cells[x, y] |= CORRIDOR return True
def sound_tunnel(self, mid_x, mid_y, next_x, next_y): if next_x < 0 or next_x > self.width or next_y < 0 or next_y > self.height: return False x1, x2 = sort(mid_x, next_x) y1, y2 = sort(mid_y, next_y) for x in range(x1, x2 + 1): for y in range(y1, y2 + 1): if self.cells[x, y] & BLOCK_CORR: return False return True