day22 - restart

This commit is contained in:
Stefan Harmuth 2022-12-23 17:18:26 +01:00
parent c4a78f9156
commit 7599c27d51

View File

@ -50,10 +50,11 @@ def walk(board: Grid, pos: Coordinate, directions: list, face: int = 0) -> (Coor
return pos, face
def fold(board: Grid):
def fold(board: Grid, start_pos: Coordinate):
# find sides and remember the one with the starting_position as it's the initial x, y plane
c_size = 4 if board.maxX < 50 else 50 # account for test case
dim_x, dim_y = ((board.maxX + 1) // c_size, (board.maxY + 1) // c_size)
# is there something in the front to fold back?
# is there something on the 4 sides to fold in?
# is there something on the 4 sides to fold up?
@ -93,7 +94,7 @@ class Day(AOCDay):
def part2(self) -> Any:
board, directions, start_position = self.get_map_and_directions()
fold(board)
fold(board, start_position)
#board.print(translate={None: ' ', False: '#', True: '.'})
return 5031