Skip to content

Commit c297668

Browse files
authored
Merge pull request #1 from bloopy-code/newpart/day1-part2
🎉day 1 part 2 plus minor formatting changes!
2 parents bd67a69 + 543e2a3 commit c297668

File tree

12 files changed

+26
-11
lines changed

12 files changed

+26
-11
lines changed

aoc_25/solutions/day01.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 1 - Secret Entrance"""
2+
23
from typing import Any
34
from utils.aoc_utils import report_results, AoCResult, input_for_day
45

@@ -13,9 +14,9 @@
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

2122
def 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

6266
def tests(test_input: Any) -> None:

aoc_25/solutions/day02.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 2 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day03.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 3 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day04.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 4 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day05.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 5 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day06.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 6 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day07.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 7 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day08.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 8 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day09.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 9 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

aoc_25/solutions/day10.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Day 10 - Title Goes Here"""
2+
23
from typing import Any
34
from utils.aoc_utils import input_for_day, report_results, AoCResult
45

0 commit comments

Comments
 (0)