day 14 "display the Easter egg" wat!!!???
https://github.com/benjamin-asdf/advent-of-code/blob/master/src/Y2024/day14.clj youtube + animation with quil: https://youtu.be/nIaC45Uzhm4?si=i3p1ztJ6soF-4m0r&t=4059
Thanks for the tips π. I went with the "find a comparatively low safety score" and that worked well. My p1 score was >200M, so I looked for scores <100M and found 2 in the first 10k steps. the second of those was correct
"a picture of a Christmas tree"
I guess it means
..1..
.111.
11111Like, a triangle?
Nvm, can't work, we only have 500 robots.
draw it with Swing and < > keys to go forward/backward?
feed data to gpt api and let it decide if it's a tree?
The easter egg in the source code is
This puzzle was originally going to be about the motion of space rocks in a fictitious arcade game called Meteoroids, but we just had an arcade puzzle.
but I don't think it helps much.
https://www.google.com/search?q=a+picture+of+a+Christmas+tree+ascii
If it is a triangle, then the example input is worthless π
When the real puzzle is understanding the question... It's kinda fun, but I wished we had more to go off of.
i'm going to check if at certain point all the dots are connected
perhaps that's a tree shape
nah.....
erdos is done
I vaguely remembered how the Christmas tree looked like in https://adventofcode.com/2015. So I just started to search for long sequences of robots in a single row, and validated by looking at it π https://github.com/erdos/advent-of-code/blob/master/2024/day14.clj (check the https://github.com/erdos/advent-of-code/commit/202042b7d29417e63a9f0ec79d4c358325e30cee#commitcomment-150354355 at your own risk.)
@erdos can you just tell me whether it works with the sample input ?
not enough robots in sample input.
Ok makes sense. Thank you.
https://gitlab.com/maximoburrito/advent2024/-/blob/main/src/day14/main.clj I didn't really enjoy the puzzle aspect of this, but I guess trying new things is better than getting stale
I assume we're making this the solutions thread
(= (freqs 1) (freqs 2)) the coordinates are not going to be the same. so this part will never work, right?
It was very often true, but none of those cases were the target, which is why it was commented out. I was hoping maybe the trick would be to search for something symmetrical. The other block filters for rows with more than the normal number of bots. That did find the solution, but there was still a lot of noise
Although looking back, the quadrant with the tree did have an unusually high number of bots, so maybe searching on that that would have been another thing to try
That's how I solved it: iterate until a quadrant has more than half the bots in it. Based on the line in the question "most of the robots should arrange themselves".
Although with my input, the tree is kinda generated in the middle, so your mileage may vary.
An approach I came up with is to find a state where the robots do not overlap with each other. That's the Easter egg state
https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2024/day_14.clj
I didn't expect AoC to go from leetcode to proper software engineering with effectively unspecified requirements π Though it is one way to give the LLM bros a bit to think about, IMO this was a bit too vague
;; first I tried symmetry (nope, it's not centered)
;; then I tried smallest bounding box (nope, there's snow in the pic)
;; then searched for long contiguous lines, checked render, got the answer
;; looked up other sol'ns, saw that there's no overlap in answer
https://github.com/tschady/advent-of-code/blob/main/src/aoc/2024/d14.cljthe most elegant solution I saw sorted the images in the period by the variance of the bots' coordinates under the assumption that structured images are much less "scattered" than unstructured ones
I do think the "intended" solution is the one where you check quadrants. Would make sense with the first part.
the scattered snow really screwed up all my approaches
someone also tried sorting by the "safety score" or however it was called, but the tree still was "just" 11th lowest so it required a bit more manual inspection
reminds me of https://adventofcode.com/2018/day/10 but that had no extra snow floating around
the real solution of course is to train a ML model on Christmas trees and classify the pictures /s
Did you see the guy who just outputed every iteration and scrolled in their "big picture view" mode on windows? I thought it was hysterical.
some commitment that!
Wait, there are no spoiler tags in slack. Wtf.
This is my quadrant count (222 146 67 50). Not so obvious that it's an outlier but it seems to be.
@zelark solution to test uniqueness is quite interesting as well. Did you consider using distinct?
it ought to be an outlier, of course positions aren't random but you'd expect the bots to be more or less evenly spread out in the average case
feels like I'm going insane
Today definitely is old TV simulator day.
I get two frames that look like a pattern, but not christmas trees?
HINT: My observation was that these vertical/horizontal bars appear in cycles, so it was enough to observe only them.
oh duh
@felipecortezfi Would you mind dropping the code of your visualization ? This is very pretty.
sure! but fiddly but
Here is mine, with visualization (animation + image gen): https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2024/day14.clj
image: https://github.com/genmeblog/advent-of-code/blob/master/images/advent_of_code_2024/day14.jpg
Damn. I had forgotten about Jpanel... All those university hours are flooding back to me. I hated every seconds of it.
it does exist!
and that's the right answer π
Satisfying isn't it?
I think that was the most fun I've had in AOC since the breakout-playing opcode program
@jvuillermet π―
is there some meaning to the bounds being prime numbers or is that just to throw you off?
I read 7, 11, 101, 103 and bells rang immediately. when I saw the part 2 text I giggled
Used https://github.com/phronmophobic/clogif for visualisations π Hopefully itβs not the same answer for everyone, if so please tell me and Iβll resubmit the gif without spoilers
@malaingreclement I was too lazy to get Joy of Clojure from the bookshelf and had to resort to ChatGPT, hence the obvious comment I forgot to erase. not cheating if it's boilerplate, right? heh
@dj942 the christmas colors are a lovely touch
I was hoping that itβd help keep track of which robot is which when previewing a smaller example
anyway, https://codeberg.org/nathell/aoc2024/src/branch/main/src/aoc2024/day14.clj (both for calculating the answer and producing animgifs)
My answer (6911) seems not to be working
(defn overlap? [x]
(->> x (map first)
frequencies
vals
(some #(not= 1 %))))This is what I am using to detect overlap
Maybe not overlapping approach is wrong in some cases?
That might be the case. I still cannot really find a great strategy though
From what I've read, calculating the smallest risk score is the intended way consistent with part 1
which worked for me although I did it after reading about it
From an image of the christmas tree I see two another approaches: minimal sum of distances between robots and looking for nxn (say 5x5) square of robots.
The best idea Iβve head and tried - to look for the tip of the tree (small triange). Easy and fast to check, and works well. And it comes directly from the description of the puzzle, as every tree must have the tip.
And hereβs mine: https://github.com/bhauman/adv2024/blob/main/src/adv2024/day14/sol.clj My approach to find the tree: was to use the quadrants from part 1 and assume that for a given Xmas tree the sum of robots in the top two quadrants would have to be significantly less than the bottom two. I had 62 of those and I just scrolled through them to find the Easter egg. I also found the cycle length to cap off the search.
I just realised another way to find it. We are focusing on the Christmas tree; however, we already have the safety factor. The right state will have a significantly lower safety factor than other states:
[7128 222555816]
[7129 223568156]
[7130 224379375]
[7131 225230544]
[7132 80277504] <- it's here
[7133 222430000]
[7134 215613615]
[7135 216872568]
[7136 223833600]
[7137 220725960]
And to limit search space we can find a cycle.and the code
(->> (parse-input input)
(iterate step)
(map-indexed vector)
(reduce (fn [seen [idx state]]
(if (seen state)
(reduced seen)
(assoc seen state idx)))
{})
(apply min-key (comp safety-factor key))
(val))
I'm trying to complete old AoCs, and man, the last five days of 2015 are kicking my butt.
I got into AoC last year (2023 first year) and did all the old ones over the first half of 2024. my memory is that the quality really ramped up around 2018, where even the easy ones were pretty fun. gl with finishing off 2015
The one with the calc of the factors is just messing me up x)
this is my first year doing this, atm everything is fairly manageable but I heard the last problems are quite the task if you aren't eating leetcode for breakfast, lunch and dinner
I did 2022 and 2023 when they came out, and they were much more manageable. 2015 has some very dry problems.