bjorng

bjorng

Erlang Core Team

Note: This topic is to talk about Day 12 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

Showing Posts 1 to 10

bjorng

bjorng OP

Erlang Core Team

Fun, but tricky!

Here is my solution.

cblavier

cblavier

Just starting to read the instructions, sound tricky indeed.
Is there a typo in applied velocity example? I believe new x should be 3 :thinking:

bjorng

bjorng OP

Erlang Core Team

No, it seems to be correct.

Adding 1 and -2 gives -1. Did you try to subtract -2 from 1?

cblavier

cblavier

Replying to myself: x velocity is -2 and not simply 2

It’s going to be tough :sweat_smile:

QuinnWilton

QuinnWilton

Part 2 was tough, but I enjoyed it!

I thought I was being clever by walking forward and backward at the same time, but that still took too long.

sasajuric

sasajuric

Author of Elixir In Action

This is my solution. Takes about 15sec for the second part. I’m not doing it very efficiently since I’m computing per-dimension cycle from scratch, so I have to do three large passes, when I could solve everything in one. I should probably also replace the stream-based logic with Enum.reduce_while or a recursion. But I was too lazy for that, and this produced the result within a “reasonable” time.

aaronnamba

aaronnamba

I couldn’t figure out part 2 on my own, the puzzle title made me read up on the N-Body Problem, which made me :crazy_face:.

After a couple hours of spinning my wheels (and my computer’s fans), I went looking for the tiniest hint (not spoiler/solution) I could find, which I ended up getting from this post from reddit.

Once I got the basic idea, it took just a couple minutes to code up a solution. And that gave me an answer in about 1 second. Sheesh.

My eventual part 2 solution

xfix

xfix

I didn’t figure out the trick myself. Oh well.

jenarvaezg

jenarvaezg

My solution for today, sadly I got spoiled for part2, but I don’t think I’d have come up with the solution by myself anyways

ihabunek

ihabunek

Here is mine. Like many people here, I also required a hint for part 2, so feeling a little stupid. But after that had no problems and the program runs under 1 second.

Where Next? Top

Trending in Challenges Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews