This commit is contained in:
Stefan Harmuth 2022-12-19 04:49:46 +01:00
parent f5544299da
commit 798e8c3faa

View File

@ -298,7 +298,8 @@ class Grid:
while queue:
current = queue.popleft()
found_end = False
for c in self.getNeighboursOf(current, includeDiagonal=includeDiagonal, includeDefault=self.__default not in walls):
for c in self.getNeighboursOf(current, includeDiagonal=includeDiagonal,
includeDefault=self.__default not in walls):
if c in came_from and self.get(c) in walls:
continue
came_from[c] = current
@ -411,7 +412,9 @@ class Grid:
print()
def get_aoc_ocr_string(self, x_shift: int = 0, y_shift: int = 0):
return convert_array_6([['#' if self.get(Coordinate(x + x_shift, y + y_shift)) else '.' for x in self.rangeX()] for y in self.rangeY()])
return convert_array_6(
[['#' if self.get(Coordinate(x + x_shift, y + y_shift)) else '.' for x in self.rangeX()] for y in
self.rangeY()])
def __str__(self, true_char: str = '#', false_char: str = "."):
return "/".join(