Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions aoc_25/solutions/day01.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 1 - Secret Entrance"""

from typing import Any
from utils.aoc_utils import report_results, AoCResult, input_for_day

Expand All @@ -13,9 +14,9 @@
"L1",
"L99",
"R14",
"L82"
"L82",
]
DATA = input_for_day(1, 2025, ff='list')
DATA = input_for_day(1, 2025, ff="list")


def parse_input(data: list[str]) -> tuple[int, int]:
Expand All @@ -28,26 +29,29 @@ def parse_input(data: list[str]) -> tuple[int, int]:
tuple[int, int]: land on zero, click over zero.
"""
zero_counter: int = 0
# click_over_count: int = 0
click_over_count: int = 0
start: int = 50
pos: int = 50

for x in data:
# assuming data will always be in a valid format
direction, num = x[0], int(x[1:])
# print(direction, num)
prev_pos: int = pos

if direction == 'L':
start -= num
else:
start += num
if direction == "L":
pos -= num
click_over_count += (-pos) // 100 - (-prev_pos) // 100

start %= 100
else:
pos += num
click_over_count += pos // 100 - prev_pos // 100

start = pos % 100
if start == 0:
# lands on zero following a turn
zero_counter += 1

return zero_counter, 0
return zero_counter, click_over_count


@report_results
Expand All @@ -56,7 +60,7 @@ def solveday(data: list[str]) -> AoCResult:
return p1, p2


expected_test_results: AoCResult = (3, 0)
expected_test_results: AoCResult = (3, 6)


def tests(test_input: Any) -> None:
Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day02.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 2 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day03.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 3 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day04.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 4 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day05.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 5 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day06.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 6 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day07.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 7 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day08.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 8 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day09.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 9 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day10.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 10 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day11.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 11 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down
1 change: 1 addition & 0 deletions aoc_25/solutions/day12.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Day 12 - Title Goes Here"""

from typing import Any
from utils.aoc_utils import input_for_day, report_results, AoCResult

Expand Down