stevensonmt

stevensonmt

Advent of Code 2022 - Day 17

Couldn’t find a thread for this day so sorry if it already exists. I’m stumped. I’ve got a solution that works for the sample data but is off by one for the real data. Anyone mind looking at the code and suggesting where that bug comes from? I just can’t find it. The render and pattern finding functions are not relevant to this error as they are not called, but if you have suggestions for improving those I’m open for that feedback as well.

Marked As Solved

stevensonmt

stevensonmt

I don’t seem to be able to edit posts any more for some reason. The issue I have is that the 1712th block is a J shape that comes to rest atop a cross shape. For some reason mine is resting atop the vertical bit of the cross rather than the horizontal bit. I must have an issue in my shift calculation or my placement of pieces on the board but I can’t find it.
+++++
Nope. Problem is in parsing the input apparently. The horizontal block that lands before the cross is supposed to go R->L->L->L, but for some reason mine is trying to go R->R->R->L. This leads to the following cross block landing on top of that horizontal piece rather than nesting alongside it. Debugging continues.
+++++
Oh for crying out loud. I didn’t trim the input. I thought I’d be clever and convert the “<” and “>” to -1 and 1 by taking their codepoint value (60 and 62) and subtracting 61. But passing the “\n” character created a shift by -51 (which does nothing but throws the cycle out of phase). Trimming the input and my solution now works. Crikey.

Where Next?

Popular in Challenges Top

LostKobrakai
This topic is about Day 9 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/le...
New
New
NobbZ
Note by the Moderators: This topic is to talk about the Day 2 of the Advent of Code. For general discussion about the Advent of Code 201...
New
stevensonmt
Anyone else think the prompt for this challenge is contradictory? The rules for comparing packets include If both values are lists, c...
New
shritesh
I mapped both the cards and every possible hand to numeric values and sorted them. In part 2 I could only think of replacing the jokers w...
New
stevensonmt
Trying to get more facility with dynamic programming concepts on Leetcode and having an issue I can’t find a way around. It’s a chutes an...
New
cblavier
Hey there :wave: No magic or algorithmic finesse today, I just finished the challenge and I my code is quite slow (1sec for part1, 3se...
New
Aetherus
This topic is about Day 16 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/l...
New
New
Aetherus
Don’t know why the regex ~r/[\W && [^\.]]/x does not work in Elixir. It works pretty well in Ruby. Anyway, here is my solution:
New

Other popular topics Top

sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

We're in Beta

About us Mission Statement