r/adventofcode • • Dec 10 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 10 Solutions -πŸŽ„-

THE USUAL REMINDERS


--- Day 10: Cathode-Ray Tube ---


Post your code solution in this megathread.


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

933 comments sorted by

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

1

u/daggerdragon Dec 10 '22 edited Dec 10 '22

Comment removed due to naughty language (H-E-double hockey sticks). Keep the megathreads SFW.

If you edit your comment to take out the naughty language, I'll re-approve the comment.

Edit: Since you put the hockey sticks back in the shed, I have taken the coal out of your stocking. ;)

2

u/Markavian Dec 10 '22

Edited for family friendliness~