sasajuric

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.

Showing Posts 1 to 6

sasajuric

sasajuric OP

Author of Elixir In Action

Here is my take on day 15. This one was quite tedious, so I decided to work in small steps, and immediately introduced the Board and Unit modules to separate concerns. Owing to that approach, I almost got it right in the first attempt :slight_smile:

bjorng

bjorng

Erlang Core Team

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

sasajuric OP

Author of Elixir In Action

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

bjorng

Erlang Core Team

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

JEG2

Author of Designing Elixir Systems with OTP

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.

— All posts loaded —

Where Next? Top

Trending in Challenges Top

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews