igorb
For Part 1, I was lazy and didn’t want to maintain variables and pass them down to each function (which would also involve merging two different histories after each split), so I used the process dictionary trick I learned about in earlier days from @Aetherus to represent state and have the functions produce side effects (which I thought was ugly). For Part 2, though, I was quite happy with this approach because then I just wrapped this code in Task.async_stream/2 and found the max ![]()
https://github.com/ibarakaiev/advent-of-code-2023/blob/main/lib/advent_of_code/day_16.ex
Trending in Challenges
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
- #ai
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
rugyoga
Pretty straightforward.
A MapSet to prevent loops and brute force.
woojiahao
TIL of
~w()ato generate a list of atoms instead of words, pretty cool!https://github.com/woojiahao/aoc/blob/main/lib/aoc/y2023/day_16.ex
bjorng
My solution:
https://github.com/bjorng/advent-of-code-2023/blob/main/day16/lib/day16.ex
Aetherus
Not that interested in today’s puzzles.
Parsing input
Solutions for both parts
lud
Hello,
I was afraid that the second part would ask to rotate mirrors to create the maximum energy but thanks it was much easier.
I have no idea how to optimize that so I just simulate all the beams for part 2, and it takes more than one second. Any idea?
https://github.com/lud/adventofcode/blob/main/lib/solutions/2023/day16.ex
Aetherus
I did the same. It also took me more than 1 second to run, so I just parallelized them
lud
Ah yes I generally do not use task async stream because I like to debug the outputs but now that it works, i’ll try it
Edit: yeah, 500ms, good enough, thanks!
Also
ordered: falsecomes in handywoojiahao
I believe it’s possible to memoize the paths given
(row, column, direction). Since you’re just choosing a different starting position, but if the beam travelingleftreaches\, it should still be the same path throughout. Though, I did not try this out so it could be falsepehbehbeh
Bruteforced part 2 without memoization… takes around 16 seconds in LiveBook on my M2 Pro.
https://github.com/pehbehbeh/adventofcode/blob/main/2023/16.livemd
seoulection
Not sure if this is the right place to post this (and also probably a silly question), but how are y’all parsing the example input? It seems like the escape character is messing up the rows. I’m just doing a simple
String.split(input, "\n"), but the lists/rows are not equal length.