Day 6: Guard Gallivant | Advent of Code 2024

  Рет қаралды 2,936

William Y. Feng

William Y. Feng

Күн бұрын

Пікірлер: 18
@koushikm
@koushikm Ай бұрын
For bounds checking the column, we want 0
@womogenes
@womogenes Ай бұрын
true! i've just noticed that most grids in aoc are square, so it was faster for me to think about just n and not both n and m.
@gorkemeldeniz9579
@gorkemeldeniz9579 Ай бұрын
I did exactly the same approach execpt the checking only the guard paths this is good enhancement for performance thank you William
@TheFrogfather1
@TheFrogfather1 Ай бұрын
Got there eventually - again there was a day job to do in between parts 1 and 2. Spent a long time with a confusing off by one error caused by me forgetting that Pascal strings are 1 indexed. I have known this for over 40 years! Oh dear.
@womogenes
@womogenes Ай бұрын
woah! using pascal sounds super cool. glad you got it!
@benjamin7480
@benjamin7480 Ай бұрын
Imagine waiting all that time for the bruteforce to finish and then finding out the answer is wrong lol
@womogenes
@womogenes Ай бұрын
that would be horrible 😓 but getting the right answer on part 1 gave me confidence!
@xsni12
@xsni12 Ай бұрын
i don't understand one thing - why don't you need to store a direction in og_seen set? in part 2 when going through the og_seen set, you always go through directions starting from going up, even if the guard originally didn't go up, how does it work correctly? can't wrap my brain around it
@womogenes
@womogenes Ай бұрын
i believe the problem statement says that the guard always originally faces up.
@enjoful
@enjoful Ай бұрын
Cool!
@hoangfromvietnam
@hoangfromvietnam Ай бұрын
bro it's like you know the question beforehand you don't even trying to read the question and graph it out just go straight to code. May I ask how did you do that?
@womogenes
@womogenes Ай бұрын
i look at the example inputs to try and understand how the problem works. usually reading all the flavortext is not requred.
@isakblomster43
@isakblomster43 Ай бұрын
Just a heads up the part 2 solution is off by one, only for certain inputs since "The new obstruction can't be placed at the guard's starting position - the guard is there right now and would notice." And this solution does not account for this.
@womogenes
@womogenes Ай бұрын
true! let me fix this.
@Ryan-od1ev
@Ryan-od1ev Ай бұрын
hey, how do you get that progress bar in your terminal once you run your code? is it a vsc extenson? i also did part 2 using brute force, but with no progress bar, it was hard to know if the program was even running
@OlympusTiger
@OlympusTiger Ай бұрын
There are some python libraries that can do the progress bar . Here he uses tqdm.
@womogenes
@womogenes Ай бұрын
yep, i use tqdm (github.com/tqdm/tqdm). very convenient, pretty much a drop-in for automatic progress bars.
@bohs2000
@bohs2000 Ай бұрын
your "makes_loop if right shape" logic is where I'd like to go, but the logic makes my brain hurt. (shape can be rotated, and scaled up in each dimension, and counted if missing obstacle is on current path *and* is in right orientation... yada yada)
Day 7: Bridge Repair | Advent of Code 2024
10:19
William Y. Feng
Рет қаралды 2,4 М.
Day 9: Disk Fragmenter | Advent of Code 2024
34:30
William Y. Feng
Рет қаралды 1,8 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Advent of Code 2024 | Day 08 "Resonant Collinearity"
19:46
HyperNeutrino
Рет қаралды 3,1 М.
Rendering 2D objects - Software from scratch
1:45:23
Muukid
Рет қаралды 39 М.
Day 6 | Advent of Code 2024
22:18
Errichto Algorithms
Рет қаралды 10 М.
I am not sorry for switching to C
11:34
Sheafification of G
Рет қаралды 211 М.
Advent of Code 2024 Day 14 - 12th gold star!
16:32
Neil Thistlethwaite
Рет қаралды 3,8 М.
Day 5: Print Queue | Advent of Code 2024
26:28
William Y. Feng
Рет қаралды 3 М.
Advent of Code 2024 Day 1: Historian Hysteria in C# ✅✅
13:20
Martin Zikmund
Рет қаралды 2,6 М.
Day 15: Warehouse Woes | Advent of Code 2024
15:05
William Y. Feng
Рет қаралды 893
Advent of Code 2024 (Day 6)
1:08:06
Ryan Haskell
Рет қаралды 154
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН