Skip to content

Commit 5755de3

Browse files
committed
🎨 okay ruff i'll reformat for ya
1 parent eb19c96 commit 5755de3

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

aoc_25/solutions/day03.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""Day 3 - Title Goes Here"""
22

33
from typing import Any
4-
from utils.aoc_utils import report_results,input_for_day, AoCResult
4+
from utils.aoc_utils import report_results, input_for_day, AoCResult
55
from rich.progress import track
66

77
# Custom typing - can I have a medal for Best Lil Coder? ⭐
88
# Could I use 'Iterable'? yes. Am I going to? Not today!
99
# (Please don't take away my star)
1010
ListsOfBatteryLists = list[list[int]]
1111

12-
# I gotta practise on the examples given because the brain cells need warming up.
12+
# I gotta practise on the examples given because the brain cells need warming.
1313
EXAMPLE_LISTS: list[str] = [
1414
"987654321111111",
1515
"811111111111119",
@@ -41,17 +41,17 @@ def part1(data: ListsOfBatteryLists) -> int:
4141
# Gotta sliiiide through that list like you're sliding into some DMs ;)
4242
for i in range(len(x)-1):
4343
first_battery: int = x[i]
44-
the_rest: list[int] = x[i+1:] # the rest of the battery gang, yadayada
44+
the_rest: list[int] = x[i+1:] # the rest of battery gang, yadayada
4545

4646
biggest_of_the_rest: int = max(the_rest) # Bigger IS better.
4747

48-
# it dawned on me here, that I could have just done some list joining.
49-
# but I like to be faced with my mistakes to remind me of my humble roots
50-
# and so I can laugh at myself in a years time.
48+
# it dawned on me, that I could have just done some list joining.
49+
# but I like to be faced with my mistakes to remind me of
50+
# my humble roots and so I can laugh at myself in a years time.
5151
new_num: int = int(str(first_battery) + str(biggest_of_the_rest))
5252

5353
if new_num > current_highest:
54-
current_highest: int = new_num # HIGHER AND HIIIIGHER!
54+
current_highest = new_num # HIGHER AND HIIIIGHER!
5555

5656
p1_total_joltage += current_highest
5757
return p1_total_joltage
@@ -76,18 +76,23 @@ def part2(data: ListsOfBatteryLists) -> int:
7676
batteries_needed: int = 12
7777

7878
while batteries_needed > 0:
79-
# I figure, if you need 12 batteries, there's only so far fwd you can go in a battery
80-
# and still get 12? So you gotta work out where the first block 'ends'?
79+
# I figure, if you need 12 batteries,
80+
# there's only so far fwd you can go in a battery and still get 12?
81+
# So you gotta work out where the first block 'ends'?
8182
first_block_len: int = len(x) - batteries_needed
8283

83-
# peep the catchy as heck, short, descriptive, easy to remember variable names ...
84+
# peep the catchy as heck, short,
85+
# descriptive, easy to remember variable names ...
8486
highest_num_first_block: int = max(x[start_idx:first_block_len+1])
8587
biggest_batteries.append(highest_num_first_block)
86-
highest_num_idx: int = x.index(highest_num_first_block, start_idx, first_block_len+1)
88+
highest_num_idx: int = x.index(
89+
highest_num_first_block, start_idx, first_block_len+1
90+
)
8791
start_idx = highest_num_idx+1
8892
batteries_needed -= 1 # YEET 🔋
8993

90-
highest: str = ''.join(list(map(str, biggest_batteries))) # bigger, better, stronger.
94+
highest: str = ''.join(list(map(str, biggest_batteries)))
95+
# bigger, better, stronger.
9196
total_p2_joltage += int(highest)
9297
return total_p2_joltage
9398

0 commit comments

Comments
 (0)