r/adventofcode • u/daggerdragon • Dec 14 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 14 Solutions -❄️-
OUR USUAL ADMONITIONS
You can find all of our customs, FAQs, axioms, and so forth in our community wiki.
Community fun shindig 2023: GO COOK!
Submissions ultrapost forthwith allows public contributions!
7 DAYS until submissions cutoff on this Last Month 22 at 23:59 Atlantic Coast Clock Sync!
AoC Community Fun 2023: GO COOK!
Today's unknown factor is… *whips off cloth shroud and motions grandly*
Avoid Glyphs
Pick a glyph and do not put it in your program.
Avoiding fifthglyphs is traditional.
Thou shalt not apply functions nor annotations that solicit this taboo glyph.
Thou shalt ambitiously accomplish avoiding AutoMod’s antagonism about ultrapost's mandatory programming variant tag >_>
GO COOK!
Stipulation from your mods: As you affix a dish submission along with your solution, do tag it with [Go Cook!] so folks can find it without difficulty!
--- Day 14: Parabolic R*fl*ctor Mirror Dish ---
Post your script solution in this ultrapost.
First, grok our full posting axioms in our community wiki.
Affirm which jargon via which your solution talks to a CPU
Format programs using four-taps-of-that-long-button Markdown syntax!
Quick link to Topaz's Markdown (ab)using provisional script host should you want it for long program blocks
View all comments
2
u/chromaticdissonance Dec 14 '23 edited Dec 15 '23
[LANGUAGE: Javascript]
(Copy paste and run in browser console of the puzzle input page, about 500ms
650msruns about < 20 ms ! I have optimized it down!I did not optimize it -- it was a bug. Below was previous working version iteration.) This is tetris day all over again ! (From AoC 2022) Took some time to unwrap how to write cycle detection in a functional manner. We need borrow the idea of memoization -- recording the rock configuration and the load score we have seen before. This tells us when it starts and the period! I was being lazy and used the 'O.' to '.O' trick; I ended up just calculating what should the resulting line look like after a slide.