filmov
tv
Advent of Code 2022 Day 23 Solve
Показать описание
Recording of me solving day 23 of Advent of Code 2022 in Python. Finished rank #71 and #57 for each part.
Finish times:
Part 1: 19:18
Part 2: 20:45 (+1:27)
BUGS. The first bug I had was not accounting for the fact that when there's no other elves in the 8-neighbors they just don't move at all, sure, I realized and fixed pretty quickly, leaderboard was still at ~10 for part 1 by the time my lockout ended. My other bug though... Spot what's wrong with the following:
dirs = [
[(-1,+0),(-1,-1),(-1,+1)],
[(+1,+0),(+1,-1),(+1,+1)],
[(+0,-1),(-1,-1),(+1,-1)],
[(+0,+1),(-1,+1),(+1,-1)]
]
(this is supposed to be a list of lists where the first direction in each sublist is the direction to move in, and the next two are the appropriate diagonals to check). The last one has an extra minus sign! Should be E, NE, SE, but I actually wrote E, NE, SW. I even tried to double check by running len(set(sum(dirs,start=[]))), but I forgot that corners needed to be counted twice, so I really should've looked at Counter(sum(dirs,start=[])).
I feel like in general I've gotten a lot faster this year but at the cost of making a lot more simple mistakes? To some extent those are correlated (read too fast, you miss things) but even for silly bugs where I'm not particularly rushing on things it happens.
0:00 - Part 1
19:25 - Part 2
20:52 - Commentary
Finish times:
Part 1: 19:18
Part 2: 20:45 (+1:27)
BUGS. The first bug I had was not accounting for the fact that when there's no other elves in the 8-neighbors they just don't move at all, sure, I realized and fixed pretty quickly, leaderboard was still at ~10 for part 1 by the time my lockout ended. My other bug though... Spot what's wrong with the following:
dirs = [
[(-1,+0),(-1,-1),(-1,+1)],
[(+1,+0),(+1,-1),(+1,+1)],
[(+0,-1),(-1,-1),(+1,-1)],
[(+0,+1),(-1,+1),(+1,-1)]
]
(this is supposed to be a list of lists where the first direction in each sublist is the direction to move in, and the next two are the appropriate diagonals to check). The last one has an extra minus sign! Should be E, NE, SE, but I actually wrote E, NE, SW. I even tried to double check by running len(set(sum(dirs,start=[]))), but I forgot that corners needed to be counted twice, so I really should've looked at Counter(sum(dirs,start=[])).
I feel like in general I've gotten a lot faster this year but at the cost of making a lot more simple mistakes? To some extent those are correlated (read too fast, you miss things) but even for silly bugs where I'm not particularly rushing on things it happens.
0:00 - Part 1
19:25 - Part 2
20:52 - Commentary
Комментарии