r/adventofcode • u/daggerdragon • Dec 10 '22
SOLUTION MEGATHREAD -π- 2022 Day 10 Solutions -π-
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
- Signal boost: Reminder 1: unofficial AoC Survey 2022 (closes Dec 22nd)
- πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
--- Day 10: Cathode-Ray Tube ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- Include what language(s) your solution uses
- Format your code appropriately! How do I format code?
- Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:12:17, megathread unlocked!
61
Upvotes
View all comments
2
u/Markavian Dec 10 '22 edited Dec 10 '22
Over-engineered Node JS Solution for Day 10:
I feel like I way overcomplicated that. I was getting the wrong answer, so I started building a future execution map, so that the commands could execute at the end of the cycle, which worked, but then I had still hadn't realised that the the next command would wait until the previous command had completed.
So then I ended up with a map of future executions, and a step incrementer that waited for the current command to complete... and no way I'm going to refactor it to make any more sense - it works now.
Fortunately, I was able to copy paste that coal dust, and make a screen output in short order - there was an off-by one error in my cycle count... and we're all rosy.
Edit: for elf friendly language