bjorng
Erlang Core Team
I went for a brute-force solution, implementing the most straight-forward algorithm I could think of. That initial implementation solved both parts in about 10 minutes.
After that, I did some simple improvements that reduced the time to about two and a half minutes.
Now I will optimize my spare time and take the rest of the day off.
https://github.com/bjorng/advent-of-code-2023/blob/main/day22/lib/day22.ex
Trending in Challenges
Other Trending Topics
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
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
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
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
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lud
I’m just discovering part 2 at the moment and I was planning to do the same, just run everything and count.
I was coming here in the hope to find a better simulation algorithm because mine is slow AF.
But I am glad that part 2 was not “actually just drop 10 000 times the set of bricks from the sky and do the same as P1”. Thank goodness.
lud
Ok so finally finished it.. I’m slow
It takes 28 seconds for each part, mostly to make all the bricks fall. Summing each chain reaction takes 1 second.
I’m all ears for a better falling algorithm if anyone reads this ever
Edit, ok, got it under 2sec for part 1 and 2.5 for part 2, thanks to this monstruosity:
I LOVE that it is possible to do basic math in guards
Solution
exists
No fancy algorithm needed this time. To adjust for part 2, I just needed to add an extra bit of the result that’s passed up (whether a brick fell or not). Mine runs in under a second for both parts… the most “inventive” thing I used is that for each {x,y} position I remember the highest occupied “z” coordinate, which gives an easy way to check how deep the next brick can fall…
code
pehbehbeh
Solved part 1 with a graph and part 2 is just brute force. Could have also brute forced part 1 after the “counting” adjustments for part 2…
https://github.com/pehbehbeh/adventofcode/blob/main/2023/22.livemd
midouest
Got stuck on part 1 for a couple days and could not figure out what I was doing wrong. My code was working on all the examples I could find, but no the puzzle input. This morning I decided I would try to visualize the stack using three.js and a custom Kino:
The z-fighting between the bricks revealed that my stacking algorithm was off. I thought that I could sort the bricks and then just use
Enum.findto take the first intersecting brick that was settled. I actually needed to take the intersecting brick with the maximum z position.Part 1 runs in 0.3s and part 2 runs in 0.8s.
Part 1
Part 2
Kino + three.js
code-shoily
Such a beautiful set of LoCs! Thank you for this, helped me quite a bit!