Advent of Code 2024 | Day 04 "Ceres Search"

  Рет қаралды 3,745

HyperNeutrino

HyperNeutrino

Күн бұрын

Пікірлер: 29
@TheGhost9919
@TheGhost9919 7 күн бұрын
I'm genuinely fascinated every day by the way your brain is working, it's impressive, especially if taking into account you deal with it all in less than 10min from scratch
@jb31842
@jb31842 7 күн бұрын
I had a nice NumPy version of this to check the corners using offset views of the main grid. Been beating my head on the desk for why my counts were too high. Turns out I didn't pay enough attention to the requirement that the 'M' and 'S' corners must be adjacent. 🤬
@vegeta3993
@vegeta3993 7 күн бұрын
I checked substrings in the rows for part one, in part two I did a 3x3 grid search. Could've it based on every A but I used the same condition as you for the final X-MAS check
@mairex3803
@mairex3803 7 күн бұрын
Nice solutions! For the second part i just checked whether both diagonals sum of unicode values was equal to ord('S') + ord('M').
@hyper-neutrino
@hyper-neutrino 7 күн бұрын
that's a very interesting way to do it! i'm surprised that works given that that could hit false positives like T+L unless you checked that they were all equal to S or M first. i probably would've done like, set(diagonals) = {"S", "M"} since that ignores order. or sorted.
@galactic_fx
@galactic_fx 8 күн бұрын
i hard coded this one 😭😭😭😭
@ybertold6882
@ybertold6882 7 күн бұрын
How so?
@galactic_fx
@galactic_fx 6 күн бұрын
@ manual position checks with indices instead of looping through arrays
@hyperbolia-44031
@hyperbolia-44031 8 күн бұрын
For part 2, I just checked all 3x3 squares for desired patterns lmao
@oldmajor5240
@oldmajor5240 8 күн бұрын
Nice! For the second part, I just counted how many times the A-tiles got covered and add one to the result for every A-tile that got covered twice.
@DarkNobody2011
@DarkNobody2011 8 күн бұрын
Clever!
@vegeta3993
@vegeta3993 7 күн бұрын
What do you mean by a tile being 'covered' and 'covered twice'?
@oldmajor5240
@oldmajor5240 7 күн бұрын
@@vegeta3993 You run the algorithm from part1 except, that now you only allow diagonal words. Now if you find a word, I will say that that word "covers" its letter-tiles. So if an A-tile is covered twice, it means that there are two diagonal words that covered it.
@DeviantFox
@DeviantFox 8 күн бұрын
I had the right idea, just fumbled getting through it very very badly.
@RickMMarina
@RickMMarina 8 күн бұрын
Nice approach, more or less like mine. For second part I just checked corners for all 'A' points this way: First, checking if all corners are inside bounds, then comparing total 'M' and total 'S' corners with 2, and finally checking if just two diagonal corners are different. List corners = [q1, q2, q3, q4]; if (corners.All(x=> InBounds(x)) && corners.Count(p=> map[p.y][p.x] == 'M') == 2 && corners.Count(p=> map[p.y][p.x] == 'S') == 2 && map[q1.y][q1.x] != map[q3.y][q3.x]) { return 1; }
@abroy77
@abroy77 8 күн бұрын
you're back!! awesome!
@supernenechi
@supernenechi 7 күн бұрын
Spent the entire day on this puzzle! And this man cracks it out like it's nothing. And I know it's nothing, but it still makes me feel a bit pathetic. I guess as a DevOps engineer rather than an actual developer, at least I'm a better YAML engineer than programmer, but still.
@hyper-neutrino
@hyper-neutrino 7 күн бұрын
don't get discouraged! this wasn't a trivial problem and i messed it up in my first attempt and had to retry it. also correction, i'm a woman not a man jsyk :) good luck with the later problems! you'll improve and there's no shame taking a while to figure something out
@rexsybimatrimawahyu3292
@rexsybimatrimawahyu3292 7 күн бұрын
i genuinely want to learn more how you can handle these aoc questions, what book or sources you reading to get where you want to this day????? cos i know programming and know how to build app but im suck at algorithm question like this :)
@hyper-neutrino
@hyper-neutrino 7 күн бұрын
hard to say. i wish i could recommend resources but it's been a long time since i referred to specific resources and i've been coding for over a decade so it is mostly just extensive experience at this point
@SlickMona
@SlickMona 7 күн бұрын
For P2 I just went with Diagonal1 in ("MS", "SM") and Diagonal2 in ("MS", "SM"). Seems a little simpler than doing all four at once?
@hyper-neutrino
@hyper-neutrino 6 күн бұрын
i'd say they're about the same. being able to do set(d1) == set(d2) == set("SM") would make this approach better though
@Andres-it2du
@Andres-it2du 7 күн бұрын
I did something similar for part 2, but for part 1 I just got all the strings for lines, columns and diagonals and looked for /XMAS|SAMX/ occurrences in each on of those strings. If it’s stupid and it works it ain’t stupid, right?😅
@shell11_
@shell11_ 7 күн бұрын
how did you get the diagonals?
@hyper-neutrino
@hyper-neutrino 7 күн бұрын
that's what i tried first. getting the diagonals is something i am apparently very terrible at and that is why i got such a bad time
@Andres-it2du
@Andres-it2du 7 күн бұрын
@@hyper-neutrino yeah, same, it took me like an hour of trial and error, I was too stubborn to quit at that point lol
@bartomiejbigda3288
@bartomiejbigda3288 8 күн бұрын
I had the same solution for part 1. For part 2, I considered that the “X” could also be formed using vertical and horizontal lines instead of just diagonals. After solving part 1, where we checked every direction, it felt natural for me to think this way. That said, I did take a quick look at the AoC subreddit for memes as hints, and the first meme I saw gave it away.
@vikingthedude
@vikingthedude 7 күн бұрын
i didn't know about the subreddit. Thanks had a good laugh and i'll be sure to avoid it while i haven't solved the problem yet!
@patritchie1317
@patritchie1317 8 күн бұрын
Your voice is very prebby :3
Advent of Code 2024 | Day 05 "Print Queue"
15:47
HyperNeutrino
Рет қаралды 2,9 М.
Advent of Code 2024 | Day 12 "Garden Groups"
34:49
HyperNeutrino
Рет қаралды 470
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 17 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 28 МЛН
Coding in a Random Programming Language Everyday (Huge Mistake)
17:17
Advent of Code 2024 | Day 11 "Plutonian Pebbles"
9:11
HyperNeutrino
Рет қаралды 2,7 М.
Advent of Code 2024 Go - Day 1: Historian Hysteria
11:29
Josh Ackland
Рет қаралды 2,2 М.
Why YOU Should Do Advent of Code
4:34
Theo - t3․gg
Рет қаралды 35 М.
This Video is AI Generated! SORA Review
16:41
Marques Brownlee
Рет қаралды 2,9 МЛН
(Neo)Vim Made Me a Better Software Developer
40:27
vim-jp
Рет қаралды 29 М.
Day 2 | Advent of Code 2024 | Better Time Complexity
15:14
Errichto Algorithms
Рет қаралды 10 М.
Advent of Code 2024 | Day 09 "Disk Fragmenter"
12:04
HyperNeutrino
Рет қаралды 3 М.
Linux Kernel 6.12 | This is Historic
1:07:22
Maple Circuit
Рет қаралды 118 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 222 М.