sasajuric
Author of Elixir In Action
Note: This topic is to talk about Day 15 of the Advent of Code.
For general discussion about the Advent of Code 2018 and links to topics of the other days, see this topic.
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
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
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #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
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sasajuric
Here is my take on day 15. This one was quite tedious, so I decided to work in small steps, and immediately introduced the
BoardandUnitmodules to separate concerns. Owing to that approach, I almost got it right in the first attemptbjorng
Here is my solution for day 15.
Unfortunately, I didn’t introduce structs and modules, so I wasted time updating code all over the place when I found I needed to change the representation. When I got it working on all examples, I found that it was far too slow to finish in a reasonable amount of time, so I spent more time optimizing the path finding code.
The code as it looks now finishes both parts in less than 30 minutes on my computer with my input. I am sure there are more optimizations that can be done, but I had to start working on the next day’s puzzle.
sasajuric
I didn’t optimize my code at all, but it takes about 7 sec to finish both parths. I think the key reason was that I used breadth-first search (implemented here) to find the paths to closest enemies.
bjorng
Interesting. I also use breadth-first search, but for some reason my implementation is much slower. I probably have a performance bug somwhere, doing more work than needed or using more memory than needed. It seems to be particularly slow when a unit does an unsuccessful search over the complete board without being able to find a square in enemy range.
JEG2
I finally have a way-too-slow solution to Day 15:
https://github.com/JEG2/advent_of_code_2018/blob/master/day_15/beverage_bandits.exs
I streamed it several times, but they aren’t worth watching.
marekciupak