simon

simon

Note by the Moderators: This topic is to talk about Day 4 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.


Day 4 is in the bag after a bit of a struggle.

For part 1 I had two minutes which has the same count of times asleep for a guard and typically (well, maybe fortunately) my code returned the second minute value which was rejected. I changed my code to look for the earliest minute with the maximum count and all was well.

Part 2 was all down to me and a stupid code mistake but my test using the sample data was passing which threw me off for a while (the same problem happened with part 1). I should probably add my own test data in so that my tests are more comprehensive.

My code was more structured today (I’m using more functions and also a couple of structs) but I’ve still got some Enum.reduce/3 calls in my pipelines which I need to move into their own functions.

And for variety, unlike using regex to parse the data strings which I did yesterday, today I used String.slice/2.

Still need to document things properly however.

Code is at https://github.com/simon-wolf/advent-of-code-2018/blob/master/lib/advent_of_code_2018/day_04.ex

Showing Posts 1 to 1

sasajuric

sasajuric

Author of Elixir In Action

I’m not committed to AoC this year, but today I discussed the task with a friend, so I solved it. My solution is here.

— All posts loaded —

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
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
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
Dmk
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

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews