woojiahao
Fun day today! Quite straightforward but the key observations are:
Spoilers
- Finding the column-wise reflection line is the same as transposing the pattern and finding the row-wise reflection line so we just need to develop 1 search algorithm
- Smudges correspond to the differences between rows, so if the total differences is exactly 1, then a smudge can exist
- We only need to compare between the minimum between the (top, bottom) from the reflection line, this saves a teeny bit of time
https://github.com/woojiahao/aoc/blob/main/lib/aoc/2023/day_13.ex
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)
rugyoga
lud
Easier than yesterday
https://github.com/lud/adventofcode/blob/main/lib/solutions/2023/day13.ex
Today I learnt that you can match a 0-length binary part in a patter.
Each pattern is a list of string, so to change a smudge I need to update the string at list index Y and change a character in that string at index X. The following code works when X is zero.
I used
Stream.resourceinstead ofStream.unfoldbecause it lets you return an empty list, which is convenient to reset the stream state to X=0 and Y+1.Aetherus
I’m so not proud of my code. Just a pile of junk. Ctrl+C & Ctrl+V everywhere. Anyway, I post it here.
https://github.com/Aetherus/advent-of-code/blob/master/2023/day-13.livemd
tywhisky
I have optimized the code as much as possible to make it appear more comprehensible. If there are any parts that someone doesn’t understand, I am more than willing to add additional comments.
Solution
bjorng
The approach I took for solving part 1 was not useful for part 1, so I had to rewrite my solver so that it was able to handle part 2.
My solution:
https://github.com/bjorng/advent-of-code-2023/blob/main/day13/lib/day13.ex
lud
Nice usage of bit strings
hauleth
Day 13
Setup
Part 1
Part 2
trnasistor
My beginner’s solution, Day 13 part 1. Point of Incidence
midouest
Went with Nx again for today’s problem.
Part 1
Part 2
stevensonmt
I probably over complicated parsing the input, but it worked really well. One thing that got highlighted (for me again) was that the
:etsmodule is kind of non-ergonomic. Like there’s noupdate_or_insertorinsert_newtype of functions. I was feeling pretty clever about how easy it was to add the smudge factor to part 1 and make it reusable.One of my favorite things about AoC is seeing the various different approaches. What I’ve learned is that the way the data gets structured really dictates how you are able to approach the logic. Often when I’m trying to understand the solutions from others I find I’m struggling because I set up the data so differently that I can’t shift my head around to the flow of the data through their solution.