bjorng
Erlang Core Team
This topic is about Day 14 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/leaderboard/private/view/39276
The join code is:
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)
bjorng
Hello, everyone. I’m back. This year I didn’t want to do every AOC puzzle the minute it was posted every day for 25 straight days as I did the last two years. Two weeks in I realized that I missed this yearly opportunity to learn some more Elixir, so I will drop in here now and then, probably doing some of the puzzles out of order.
Today’s puzzle was a fun one. Here is my solution.
lud
I did not use bitwise operators. The input is sufficiently small so I just set X bits one by one for part 2
The parse_input! is piped into
part_oneandpart_twoby external runner code or unit tests.It is not fast (the
part_twofunction terminates in 150ms) but the code is simple to reason about so it is fine to meAetherus
Today I reinstalled the operating system on my laptop, and I just finished recovering my GitHub account, so it’s a bit late to post my solutions to today’s quizzes.
I didn’t use bitwise operations, either, because I couldn’t find a neat one. I hope to see some smart solutions.
Anyway, here’s my solution:
Part 1
Part 2
cblavier
Hi there
Part1 was easy to me (used Bitwise operator), but I struggled with recursion for Part2 until I found out that I could manage without recursion
My code here :
Part1 / Part2
the bitwise part for anyone interested
EDIT : simplified my Part 2 code, to remove a lot of string manipulations
Part2 address generation
akash-akya
Mostly straightforward bitwise operations, nothing interesting I guess.
Main section from part two:
faried
Part 1: simple, pretty straightforward. Part 2: ugly. So ugly.
Papey
Part 1 was pretty simple.
For part 2 I’ve tried to used some stuff I made for part one : what a mistake. I spend a lot time figuring out that the way mask is applied in part 2 is not the same as part 1.
At the end, it works, but it’s a bit ugly. Since I convert everything to ints, I use a floating bit mask where each floating point is set to 1. And a recursion to find address combinations :
Full code for part 1 and 2
Edit, after some clean up and refacto, it’s quite nice in fact !
kwando
Bitwise FTW.
ricardo-h
part 1 and 2
was not concerned with clean code or performance today
just to win +2 gold stars
blue_quartz
I decided to create an account here just to show my hacky, bitwise-less implementation.
Couldn’t figure out the more optimal ways of fiddling with bits (especially when it seems pretty native to Elixir/Erlang), so I slugged it out with pure String manipulation. As long as the day’s solution take less than a second for both parts on my mid-range laptop, it’s fast enough for me.