Skip to content

Commit 93f45e4

Browse files
authored
fix day1 pt 2 (#19)
1 parent ba8fb7d commit 93f45e4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/advent_of_code/year_2025/day_01.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def points_at_zero_counter(current_position, turn_direction, distance):
2929
full_loops = distance // DIAL_SIZE
3030

3131
partial_loops = 0
32+
print("Case:", current_position, turn_direction, distance)
33+
print(" Full loops:", full_loops)
3234

3335
# Check if we passed zero in the remaining distance after full loops
3436
new_position = turn_dial(current_position, turn_direction, distance)
@@ -38,9 +40,12 @@ def points_at_zero_counter(current_position, turn_direction, distance):
3840
partial_loops += 1
3941

4042
# check if we landed on zero
41-
if new_position == 0:
43+
if current_position!=0 and new_position == 0:
44+
print(" Landed on zero, updating partial loops")
4245
partial_loops += 1
43-
46+
47+
print(" Partial loops:", partial_loops)
48+
4449
return full_loops + partial_loops
4550

4651
def solve(parsed_input):
@@ -67,9 +72,9 @@ def main(input_file):
6772
input = read_input(input_file)
6873
(result_part_1, result_part_2) = solve(input)
6974
print(
70-
f"Day 01: "
71-
f" Result for part 1 is {result_part_1}. "
72-
f" Result for part 2 is {result_part_2}. "
75+
f"Day 01 \n"
76+
f" Result for part 1 is {result_part_1} \n"
77+
f" Result for part 2 is {result_part_2} \n"
7378
)
7479

7580

tests/year_2025/test_day_01.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def test_points_at_zero_counter(turn_case):
7474
(50, 1, 1000, 10),
7575
(50, 1, 1050, 11),
7676
(0, 1, 100, 1),
77+
(0, 1, 200, 2),
7778
(0, 1, 1, 0),
7879
(50 , -1, 68, 1),
7980
(50 , 1, 68, 1),

0 commit comments

Comments
 (0)