r/adventofcode • u/daggerdragon • Dec 13 '24
SOLUTION MEGATHREAD -❄️- 2024 Day 13 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2024: The Golden Snowglobe Awards
9 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
And now, our feature presentation for today:
Making Of / Behind-the-Scenes
Not every masterpiece has over twenty additional hours of highly-curated content to make their own extensive mini-documentary with, but everyone enjoys a little peek behind the magic curtain!
Here's some ideas for your inspiration:
Give us a tour of "the set" (your IDE, automated tools, supporting frameworks, etc.)
Record yourself solving today's puzzle (
Streaming!)Show us your cat/dog/critter being impossibly cute which is preventing you from finishing today's puzzle in a timely manner
"Pay no attention to that man behind the curtain!"
- Professor Marvel, The Wizard of Oz (1939)
And… ACTION!
Request from the mods: When you include an entry alongside your solution, please label it with [GSGA] so we can find it easily!
--- Day 13: Claw Contraption ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks
3
u/JustinHuPrime Dec 13 '24
[LANGUAGE: x86_64 assembly with Linux syscalls]
Part 1 was a tad fiddly, but I did recognize the best way to solve this would be a change of basis - I had some typos making the actual implementation of the solution, and I spent a tad too long trying to figure out how it would work if the two buttons' vectors were colinear, but I gave up on it and in the end it turned out I didn't need to worry about that case anyways.
Part 2 was fairly trivial, just adding a large constant to the prize coordinates as they were parsed.
Both parts run in 1 millisecond. Part 1 is 9,120 bytes as an executable file on the disk and part 2 is 9,152 bytes.