Unable to load image

rDrama Advent of Code Day 13: Unlucky Edition

Summary for those just joining us:

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

9
Jump in the discussion.

No email address required.

Thank god they gave us one where the bruteforce runs in 10ms

Jump in the discussion.

No email address required.

He owed us after yesterday. I was worried that he might add diagonals for part 2 but I think he's made us do that in other years.

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17024633299130785.webp

Pretty easy today, for part 2 just replaced the string comparison using ==, for my own function that allows exactly one char to be not equal.

Jump in the discussion.

No email address required.

Unlucky indeed if you fuck up in at least one of the many ways provided :/ Albeit to be honest I have mainly myself to blame, especially after boasting about writing careful, stupid-mistakes-proof code, and then not doing that today.

I'm especially bitter about part two. It required changing literally three lines trivially, yet I managed to make a stupid logic mistake (allowing s == 0 unconditionally) and wasted 8 minutes on it.

   def is_mirrored(m):
       def check(i):
           cnt = min(i, len(m) - i)
           assert cnt
           s = 0
           for k in range(cnt):
               s += np.sum(m[i - k - 1] != m[i + k])
           if s == (1 if second else 0):
               return i
       for i in range(1, len(m)):
           c = check(i)
           if c: return c```
Jump in the discussion.

No email address required.

I did the opposite where I accidentally treated s=0 as my unassigned case and also spent about 8 minutes on it

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17024487738584368.webp

Jump in the discussion.

No email address required.

Part 1:

https://i.rdrama.net/images/17024530878273795.webp

Part 2:

https://i.rdrama.net/images/17024530883216646.webp

Seemed fairly easy today, yesterday was heck. Glad it didn't involve any string manipulation, I'm finding Nim really lacking in that regard.

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17024694539862967.webp

Jump in the discussion.

No email address required.

Abusing numpy made today easy and fun :marseyembrace:

https://i.rdrama.net/images/17024450815908937.webp

Jump in the discussion.

No email address required.

>didn't give us a really big matrix for part 2

:marseygiveup:

r←'.'=↑¨((0≠≢¨)⊆⊢)⊃⎕NGET'13.in'1
p←{⍺←1 ⋄ ⍉∘((1+≢)↑⊢)⍣(2×⍺)⊢⍵}
f←{(⊂∘⍒⌷⊢)⊃,/(⊖∘⌽,⍥⊂⊢)¨⍵∘{(⍺-⍵)p(⌽,⍨⍴1↑⍨1∘+)⍵}¨¯1+1↓(2∘|⊢⍤/⊢)⍳⍵}
A←⍬ ⋄ V←⍬ ⋄ fc←{⍵∊A:V⊃⍨A⍳⍵ ⋄ o←f ⍵ ⋄ A⊢←A,⍵ ⋄ V⊢←V,⊂o ⋄ o}
g←{i⊣⍣(≢i←⍸(⊢≡m∘∧)¨fc≢m←(∘.≡)⍨↓⍵)⊢0}
h←{i⊣⍣(≢i←⍸(2∘=(+/∘∊m∘×))¨fc≢m←(∘.(+/≠))⍨↓⍵)⊢0}
s←{+/∊(⍺⍺¨⍉¨⍵)+100∘ר⍺⍺¨⍵}
⎕←g s r
⎕←h s r
Jump in the discussion.

No email address required.

I haven't finished yesterday's yet, I had to do a 10pm pivot to recursive in the hope that p2 would finish and I'm still bug fixing. Today's better be easy.

Jump in the discussion.

No email address required.

I'm eepy tired today and couldn't be bothered being clever since it was easy enough to brute force with awful frankensteined code

https://i.rdrama.net/images/17025106113129127.webp

Jump in the discussion.

No email address required.

It took me hours just to understand the question and many more hours to finally write something that ended up being extremely simple

https://i.rdrama.net/images/17025703410446942.webp

Jump in the discussion.

No email address required.

FUUUUUUUUUUU---

Never has my skill issue been so bluntly been shown to me as when I try to do these in C.

I finished part 1 example then clicked the real list & it's variable width which screws up my whole shit. I'm sure it's not that big a deal but fml

Jump in the discussion.

No email address required.

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.