11"""Day 1 - Secret Entrance"""
2+
23from typing import Any
34from utils .aoc_utils import report_results , AoCResult , input_for_day
45
1314 "L1" ,
1415 "L99" ,
1516 "R14" ,
16- "L82"
17+ "L82" ,
1718]
18- DATA = input_for_day (1 , 2025 , ff = ' list' )
19+ DATA = input_for_day (1 , 2025 , ff = " list" )
1920
2021
2122def parse_input (data : list [str ]) -> tuple [int , int ]:
@@ -28,26 +29,29 @@ def parse_input(data: list[str]) -> tuple[int, int]:
2829 tuple[int, int]: land on zero, click over zero.
2930 """
3031 zero_counter : int = 0
31- # click_over_count: int = 0
32+ click_over_count : int = 0
3233 start : int = 50
34+ pos : int = 50
3335
3436 for x in data :
3537 # assuming data will always be in a valid format
3638 direction , num = x [0 ], int (x [1 :])
37- # print(direction, num)
39+ prev_pos : int = pos
3840
39- if direction == 'L' :
40- start -= num
41- else :
42- start += num
41+ if direction == "L" :
42+ pos -= num
43+ click_over_count += (- pos ) // 100 - (- prev_pos ) // 100
4344
44- start %= 100
45+ else :
46+ pos += num
47+ click_over_count += pos // 100 - prev_pos // 100
4548
49+ start = pos % 100
4650 if start == 0 :
4751 # lands on zero following a turn
4852 zero_counter += 1
4953
50- return zero_counter , 0
54+ return zero_counter , click_over_count
5155
5256
5357@report_results
@@ -56,7 +60,7 @@ def solveday(data: list[str]) -> AoCResult:
5660 return p1 , p2
5761
5862
59- expected_test_results : AoCResult = (3 , 0 )
63+ expected_test_results : AoCResult = (3 , 6 )
6064
6165
6266def tests (test_input : Any ) -> None :
0 commit comments