sb8244
Author of Real-Time Phoenix
Note: This topic is to talk about Day 10 of the Advent of Code 2019 .
There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:
39276-eeb74f9a
Trending in Challenges
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sb8244
My solution is here. I actually documented the approach in pt1 / pt2 at the top. I won’t paste it here to avoid spoilers, it’s still early on the day.
aaronnamba
Part 1 and Part 2 (most days, I clone my Part 1 solution before starting on Part 2, to preserve it as it was).
I kinda like how this one turned out. Less brute-force-y than most of my other solutions, but boy did it take a long time to get there.
xfix
I have no idea about trigonometry. Oh well. Didn’t implement the part with looping, because the task actually didn’t ask for it (look, I can tell that won’t be necessary when my first part solution was bigger than 200).
ug0
My solution.
jenarvaezg
Day 10 of elixir! My solution
It looks more messy than what I originally expected. Also my solution for part 2 only works on small inputs, I might refactor it a bit
sasajuric
My solution. Today’s challenge was finicky, but fun! Used a bit of trigonometry (atan2) and gb_trees for the second part.
qhwa
Here’s my solution.
My hero functions today are
Enum.group_byand:math.atan2.There’s a trick in part 2. I was about to write an algorithm to find the result. But before start I inspected my data and found 200 is not enough to finish a single round. So the process is super easy.
I’m not sure if this works for others, because not everyone’s input is the same. I guess not because one time after I provided a wrong answer, it told me that my wrong answer is someone else’s right answer.
bjorng
Not my day today…
My solution, slightly cleaned up after I got both parts working.
I figured out how to solve part 1 without using any floating point arithmetic.
After some false starts trying to solve part 2, I searched some hints on the Internet, and found out how to use
atan2(). I also saw that it didn’t actually seem necessary to go round more than once, since the 200th asteroid was reached before the first round ended, so I didn’t bother implementing going round more than once.mexicat
Happy enough with my solution. I fiddled around a lot before realizing I could just calculate angles between points…
mortalisk
Hi. Just joined the forum now, although I have been helped by people here for some time now. Joined the leaderboard, so figured I should be a member
Anyway, here is my solution for day 10
Since there were more visible asteroids than 200, simply sorting by angle and taking the closest one works.