Skip to content

Commit

Permalink
fixed last column logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Sullivan committed Dec 10, 2022
1 parent fdddfad commit 7a07edd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/advent_of_code/day10/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@


def get_pixel_val(sprite_location: np.ndarray, curr_cycle: int) -> str:
orig_cycle = curr_cycle
if curr_cycle > 40:
curr_cycle = curr_cycle % 40
if curr_cycle == 0:
curr_cycle = 40
if any(sprite_location == curr_cycle - 1):
pixel = "#"
else:
Expand Down Expand Up @@ -59,7 +62,7 @@ def print_screen(input_str: str) -> str:
pixel_val = get_pixel_val(sprite_location, curr_cycle)
pixels.append(pixel_val)
sprite_location += instruction
return "".join(pixels)
return "".join(pixels).strip()


if __name__ == "__main__":
Expand Down

0 comments on commit 7a07edd

Please sign in to comment.