adventofcode

Apple 2024-12-14T05:19:44.381409Z

day 14 "display the Easter egg" wat!!!???

Benjamin 2024-12-15T12:18:49.276939Z

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

πŸŽ„ 1
πŸ‘πŸ» 1
ryan echternacht 2024-12-16T20:27:17.475299Z

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

Apple 2024-12-14T05:21:35.816389Z

"a picture of a Christmas tree"

Maravedis 2024-12-14T05:26:55.310279Z

I guess it means

..1..
.111.
11111

Maravedis 2024-12-14T05:27:00.195219Z

Like, a triangle?

Maravedis 2024-12-14T05:30:46.532669Z

Nvm, can't work, we only have 500 robots.

Apple 2024-12-14T05:31:43.302599Z

draw it with Swing and < > keys to go forward/backward?

Apple 2024-12-14T05:32:04.872939Z

feed data to gpt api and let it decide if it's a tree?

Maravedis 2024-12-14T05:32:48.517029Z

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.

Apple 2024-12-14T05:34:03.488999Z

https://adventofcode.com/2015

Maravedis 2024-12-14T05:35:30.118149Z

If it is a triangle, then the example input is worthless 😞

Maravedis 2024-12-14T05:37:21.210349Z

When the real puzzle is understanding the question... It's kinda fun, but I wished we had more to go off of.

Apple 2024-12-14T05:42:13.241099Z

i'm going to check if at certain point all the dots are connected

Apple 2024-12-14T05:42:19.505339Z

perhaps that's a tree shape

Apple 2024-12-14T05:42:40.436239Z

nah.....

Apple 2024-12-14T05:42:47.340069Z

erdos is done

1
erdos 2024-12-14T05:42:48.440739Z

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.)

Maravedis 2024-12-14T05:48:49.253769Z

@erdos can you just tell me whether it works with the sample input ?

erdos 2024-12-14T05:49:51.946149Z

not enough robots in sample input.

Maravedis 2024-12-14T05:50:00.073959Z

Ok makes sense. Thank you.

Apple 2024-12-14T06:03:03.027919Z

2024-12-14T06:10:57.055209Z

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

2024-12-14T06:15:25.330229Z

I assume we're making this the solutions thread

Apple 2024-12-14T06:17:22.807099Z

(= (freqs 1) (freqs 2)) the coordinates are not going to be the same. so this part will never work, right?

2024-12-14T06:22:08.099069Z

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

2024-12-14T06:26:28.833149Z

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

Maravedis 2024-12-14T06:44:04.932929Z

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".

Maravedis 2024-12-14T06:44:38.603609Z

Maravedis 2024-12-14T06:46:12.591149Z

Although with my input, the tree is kinda generated in the middle, so your mileage may vary.

Aleks 2024-12-14T07:54:05.699249Z

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

πŸ‘ 4
πŸ’‘ 1
exitsandman 2024-12-14T08:23:38.442279Z

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

βž• 1
πŸ˜‚ 1
tschady 2024-12-14T13:21:49.088099Z

;; 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.clj

exitsandman 2024-12-14T13:27:20.031779Z

the 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

πŸ™ŒπŸΌ 1
Maravedis 2024-12-14T13:28:29.426189Z

I do think the "intended" solution is the one where you check quadrants. Would make sense with the first part.

βž• 1
tschady 2024-12-14T13:29:22.214989Z

the scattered snow really screwed up all my approaches

exitsandman 2024-12-14T13:29:25.019919Z

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

tschady 2024-12-14T13:29:59.072559Z

reminds me of https://adventofcode.com/2018/day/10 but that had no extra snow floating around

exitsandman 2024-12-14T13:31:06.854839Z

the real solution of course is to train a ML model on Christmas trees and classify the pictures /s

Maravedis 2024-12-14T13:31:40.590699Z

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.

exitsandman 2024-12-14T13:32:08.526179Z

some commitment that!

Maravedis 2024-12-14T13:33:15.766599Z

Wait, there are no spoiler tags in slack. Wtf.

Maravedis 2024-12-14T13:33:36.579949Z

https://i.redd.it/pbtdh42q4r6e1.png SPOILER

πŸ‘ 1
πŸ˜‚ 1
jvuillermet 2024-12-14T13:51:33.769279Z

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?

exitsandman 2024-12-14T13:52:54.791039Z

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

Aleks 2024-12-14T15:24:23.752509Z

@jvuillermet I forgot about it, it will work the same way.

πŸ‘ 1
Felipe 2024-12-14T15:54:37.732509Z

feels like I'm going insane

Maravedis 2024-12-14T15:55:22.177439Z

Today definitely is old TV simulator day.

Felipe 2024-12-14T15:55:25.021209Z

I get two frames that look like a pattern, but not christmas trees?

genmeblog 2024-12-14T15:55:27.890219Z

HINT: My observation was that these vertical/horizontal bars appear in cycles, so it was enough to observe only them.

πŸ’‘ 1
Felipe 2024-12-14T15:55:48.276769Z

oh duh

Maravedis 2024-12-14T15:56:34.723739Z

@felipecortezfi Would you mind dropping the code of your visualization ? This is very pretty.

Felipe 2024-12-14T15:56:42.532009Z

sure! but fiddly but

Felipe 2024-12-14T15:57:38.049729Z

1
genmeblog 2024-12-14T15:58:55.920469Z

Here is mine, with visualization (animation + image gen): https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2024/day14.clj

1
Maravedis 2024-12-14T15:59:20.750919Z

Damn. I had forgotten about Jpanel... All those university hours are flooding back to me. I hated every seconds of it.

Felipe 2024-12-14T16:05:26.206049Z

πŸ₯³ 3
Felipe 2024-12-14T16:05:31.476349Z

it does exist!

Felipe 2024-12-14T16:06:21.287319Z

and that's the right answer πŸ˜„

jvuillermet 2024-12-14T16:06:45.400299Z

Satisfying isn't it?

Felipe 2024-12-14T16:06:47.489959Z

I think that was the most fun I've had in AOC since the breakout-playing opcode program

Felipe 2024-12-14T16:07:04.618589Z

@jvuillermet πŸ’―

Felipe 2024-12-14T16:13:34.292449Z

is there some meaning to the bounds being prime numbers or is that just to throw you off?

Felipe 2024-12-14T16:14:16.210399Z

I read 7, 11, 101, 103 and bells rang immediately. when I saw the part 2 text I giggled

djanus 2024-12-14T16:15:09.971519Z

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

😎 1
Felipe 2024-12-14T16:15:37.140289Z

@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

Felipe 2024-12-14T16:16:12.803959Z

@dj942 the christmas colors are a lovely touch

djanus 2024-12-14T16:17:01.310219Z

I was hoping that it’d help keep track of which robot is which when previewing a smaller example

djanus 2024-12-14T16:17:51.326689Z

anyway, https://codeberg.org/nathell/aoc2024/src/branch/main/src/aoc2024/day14.clj (both for calculating the answer and producing animgifs)

vncz 2024-12-14T17:41:29.137709Z

My answer (6911) seems not to be working

vncz 2024-12-14T17:45:12.930909Z

(defn overlap? [x] 
  (->> x (map first)
       frequencies
       vals
       (some #(not= 1 %))))

vncz 2024-12-14T17:45:18.537489Z

This is what I am using to detect overlap

genmeblog 2024-12-14T17:47:50.622169Z

Maybe not overlapping approach is wrong in some cases?

vncz 2024-12-14T17:50:36.748159Z

That might be the case. I still cannot really find a great strategy though

jvuillermet 2024-12-14T18:00:10.204669Z

From what I've read, calculating the smallest risk score is the intended way consistent with part 1

jvuillermet 2024-12-14T18:01:33.970239Z

which worked for me although I did it after reading about it

genmeblog 2024-12-14T18:01:45.182349Z

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.

Alvydas Vitkauskas 2024-12-14T18:02:51.055039Z

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.

πŸ‘ 2
bhauman 2024-12-14T18:11:09.540849Z

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.

πŸ’― 1
Aleks 2024-12-14T18:53:04.467169Z

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.

❀️ 6
Aleks 2024-12-14T19:10:36.910249Z

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))

jurjanpaul 2024-12-14T20:56:30.593669Z

Needed a hint from here today after I was stuck on a search for symmetry. β€˜Non overlapping’ was the phrase that got me the solution, but ultimately rewrote my https://jurjanpaul.github.io/ape-cljs-playground/?code=KHByaW50bG4gIkFvQyAyMDI0IGRheSAxNCIpCgooZGVmIGlucHV0ICJwPTAsNCB2PTMsLTMKcD02LDMgdj0tMSwtMwpwPTEwLDMgdj0tMSwyCnA9MiwwIHY9MiwtMQpwPTAsMCB2PTEsMwpwPTMsMCB2PS0yLC0yCnA9Nyw2IHY9LTEsLTMKcD0zLDAgdj0tMSwtMgpwPTksMyB2PTIsMwpwPTcsMyB2PS0xLDIKcD0yLDQgdj0yLC0zCnA9OSw1IHY9LTMsLTMiKQooZGVmIG1heC14IDExKQooZGVmIG1heC15IDcpCgo7IHBhc3RlIHJlYWwgaW5wdXQgYmVsb3cgYW5kIHVuY29tbWVudAojXyhkZWYgaW5wdXQgIiIpCiNfKGRlZiBtYXgteCAxMDEpCiNfKGRlZiBtYXgteSAxMDMpCgoocmVxdWlyZSAnW2Nsb2p1cmUuZWRuIDphcyBlZG5dKQoKKGRlZiBwYXJzZS1pbnQgCiAgOzsganVzdCBiZXdhcmUgb2YgcHJlZml4IHplcm9lcyEhCiAgZWRuL3JlYWQtc3RyaW5nKQoKKGRlZm4gcGFyc2Utcm9ib3QgW2xdCiAgKC0%2BPiAocmUtc2VxICMiLT9cZCsiIGwpCiAgICAgICAobWFwIHBhcnNlLWludCkpKQoKKGRlZiBwYXJzZWQKICAoLT4%2BIGlucHV0CiAgICAgICBzdHJpbmcvc3BsaXQtbGluZXMKICAgICAgIChtYXAgcGFyc2Utcm9ib3QpKSkKCihkZWYgeHktPnF1YWRyYW50CiAgKGxldCBbaGFsZi14IChNYXRoL2Zsb29yICgvIG1heC14IDIpKQogICAgICAgIGhhbGYteSAoTWF0aC9mbG9vciAoLyBtYXgteSAyKSldCiAgICAoLT4%2BIChmb3IgW2kgKHJhbmdlIDIpCiAgICAgICAgICAgICAgIGogKHJhbmdlIDIpCiAgICAgICAgICAgICAgIDsgMCAxIDIgLi4uIDQgNSA2CiAgICAgICAgICAgICAgIHggKHJhbmdlICgqIGkgKGluYyBoYWxmLXgpKQogICAgICAgICAgICAgICAgICAgICAgICAoZGVjICgqIChpbmMgaSkgKGluYyBoYWxmLXgpKSkpCiAgICAgICAgICAgICAgIHkgKHJhbmdlICgqIGogKGluYyBoYWxmLXkpKQogICAgICAgICAgICAgICAgICAgICAgICAoZGVjICgqIChpbmMgaikgKGluYyBoYWxmLXkpKSkpXQogICAgICAgICAgIFtbeCB5XSBbaSBqXV0pCiAgICAgICAgIChpbnRvIHt9KSkpKQoKKGRlZm4gcnVuLXJvYm90IAogIFtuIFt4IHkgdnggdnldXQogIFsobW9kICgrIHggKCogbiB2eCkpIG1heC14KQogICAobW9kICgrIHkgKCogbiB2eSkpIG1heC15KQogICB2eAogICB2eV0pCgooZGVmbiBydW4tcm9ib3RzIAogIFtuIHJvYm90c10KICAobWFwIChwYXJ0aWFsIHJ1bi1yb2JvdCBuKSAKICAgICAgIHJvYm90cykpCgooZGVmbiBxdWFkcmFudAogIFtbeCB5IF8gX11dCiAgKHh5LT5xdWFkcmFudCBbeCB5XSkpCgooZGVmbiBzYWZldHktZmFjdG9yIFtyb2JvdHNdCiAgKC0%2BPiByb2JvdHMKICAgICAgIChncm91cC1ieSBxdWFkcmFudCkKICAgICAgIChtYXAgKGZuIFtbayB2XV0gKGlmIGsgKGNvdW50IHYpIDEpKSkKICAgICAgIChyZWR1Y2UgKikpKQoKKGRlZm4gcGFydDEgW10KICAoLT4%2BIChydW4tcm9ib3RzIDEwMCBwYXJzZWQpCiAgICAgICBzYWZldHktZmFjdG9yKSkKCihwcHJpbnQvcHByaW50ICh0aW1lIChwYXJ0MSkpKQoKI18oZGVmbiBuby1vdmVybGFwPwogICAgW3JvYm90c10KICAgICg9IChjb3VudCByb2JvdHMpCiAgICAgICAoY291bnQgKC0%2BPiByb2JvdHMgCiAgICAgICAgICAgICAgICAgICAobWFwIChwYXJ0aWFsIHRha2UgMikpCiAgICAgICAgICAgICAgICAgICBkaXN0aW5jdCkpKSkKCihkZWZuIHJlbmRlciBbcm9ib3RzXQogIChsZXQgW2ZpbGxlZCAoLT4%2BIHJvYm90cwogICAgICAgICAgICAgICAgICAgIChtYXAgKHBhcnRpYWwgdGFrZSAyKSkKICAgICAgICAgICAgICAgICAgICBzZXQpXQogICAgKGRvc2VxIFt5IChyYW5nZSAoaW5jIG1heC15KSldCiAgICAgICgtPj4gKGZvciBbeCAocmFuZ2UgKGluYyBtYXgteCkpXQogICAgICAgICAgICAgKGlmIChmaWxsZWQgW3ggeV0pCiAgICAgICAgICAgICAgICLigKIiCiAgICAgICAgICAgICAgICIgIikpCiAgICAgICAgICAgKHN0cmluZy9qb2luICIiKQogICAgICAgICAgIChwcmludGxuKSkpKSkKCihkZWZuIGZpbmQtbWluaW1hbC1zZiBbXQogIChsb29wIFtuIDAKICAgICAgICAgbWluaW11bSBuaWwKICAgICAgICAgc2VlbiAje31dCiAgICAobGV0IFtzdGF0ZSAocnVuLXJvYm90cyBuIHBhcnNlZCkKICAgICAgICAgIHNmIChzYWZldHktZmFjdG9yIHN0YXRlKQogICAgICAgICAgaCAoaGFzaCBzdGF0ZSldCiAgICAgIChpZiAoc2VlbiBoKQogICAgICAgIG1pbmltdW0KICAgICAgICAocmVjdXIgKGluYyBuKQogICAgICAgICAgICAgICAoaWYgKG9yIChub3QgbWluaW11bSkKICAgICAgICAgICAgICAgICAgICAgICAoPCBzZiAoZmlyc3QgbWluaW11bSkpKQogICAgICAgICAgICAgICAgIFtzZiBuXQogICAgICAgICAgICAgICAgIG1pbmltdW0pCiAgICAgICAgICAgICAgIChjb25qIHNlZW4gaCkpKSkpKQoKKGRlZm4gcGFydDIgW10KICAobGV0IFtbc2Ygbl0gKGZpbmQtbWluaW1hbC1zZildCiAgICAocmVuZGVyIChydW4tcm9ib3RzIG4gcGFyc2VkKSkKICAgIG4pKQogCihwcHJpbnQvcHByaW50ICh0aW1lIChwYXJ0MikpKQo%3D&amp;checksum=LTQ5NTIxOTM5OQ%3D%3D (in ape-cljs-playground on iPhone) to find the minimum β€˜safety factor’ before a new cycle starts.

Maravedis 2024-12-14T18:04:32.244089Z

I'm trying to complete old AoCs, and man, the last five days of 2015 are kicking my butt.

tildedave 2024-12-15T14:26:14.398819Z

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

Maravedis 2024-12-15T14:29:54.352459Z

The one with the calc of the factors is just messing me up x)

exitsandman 2024-12-15T07:32:49.169879Z

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

Maravedis 2024-12-15T07:50:13.646969Z

I did 2022 and 2023 when they came out, and they were much more manageable. 2015 has some very dry problems.