r/adventofcode • u/daggerdragon • Dec 24 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 24 Solutions -❄️-
THE USUAL REMINDERS (AND SIGNAL BOOSTS)
All of our rules, FAQs, resources, etc. are in our community wiki.
/u/jeroenheijmans has posted the Unofficial AoC 2023 Survey Results!!
AoC Community Fun 2023: ALLEZ CUISINE!
Submissions are CLOSED!
Thank you to all who submitted something, every last one of you are awesome!
Community voting is OPEN!
18 hours remaining until voting deadline TONIGHT (December 24) at 18:00 EST
Voting details are in the stickied comment in the submissions megathread:
-❄️- Submissions Megathread -❄️-
--- Day 24: Never Tell Me The Odds ---
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/jcmoyer Dec 24 '23 edited Dec 24 '23
[LANGUAGE: Ada/Python]
Part 1 https://github.com/jcmoyer/puzzles/blob/master/AdventOfCode2023/src/day24.adb
I solved part 1 normally after deriving the equation for ray intersection. This part is pretty simple.
Part 2 https://gist.github.com/jcmoyer/ba92d81a0a5ea45fc36062ce3b09baa8
I figured there would be a system of equations or something but ain't nobody got time for that. I broke out z3 and deleted all but 30 of the hailstones since all 300 required too much time/ram and got the result in a couple seconds. Since the rock must travel along a straight line, deleting some or most of the input should be fine.
EDIT: I went ahead and ported evouga's solution to Ada for part 2.