No IntCodes today, just too many asteroids.
Day 10 - The Problem
We home in on the distress call to find the elves trying to find the b...
For further actions, you may consider blocking this person and/or reporting abuse
Part 1 of day 10:
JS, spent way too long on this because I was mutating state in a for loop!
Things have settled down a little bit since Christmas, so I've got some time to actually complete AOC2019. Better 4 months late than never! Here's my solution to Day 10. Had some trouble deciding how to handle vertical slopes gracefully, and switching back and forth from global to relative coordinates, but finally got it handled.
Done with part one in swift. need bit more time for part two
Took so much time for part two. Actually went ahead and rewrote part one as well. Solution in swift
An ugly kotlin solution.
I'll clean it up tomorrow.
Ahh... that's better... More Sealed Classes/Discriminated Unions to the rescue. Managed to cut a lot of duplicated code out.
Things are getting complicated now! I like it!
In the first part I tried an arithmetic approach, trying to find - for each asteroid - if there was another one in line with the target location. JavaScript as usual:
The second part showed that it would have been too complex. So I just converted all the coordinates in polar, sorted them out and counted to the 200th asteroid. Finally, converted back to orthogonal coordinates:
Python today. And what a tough problem, especially part 2. Glad that's over.
@jon Guess you added wrong title for this post. It should be Day 10!
I was fixing it just as you noticed! That’s what I get for posting past my bedtime.
JS, I like and hate that you could pass part 1 with a bug in your code, that got me thinking for a while when doing part 2!!