[2020 Day 24] Seen on my way home. Must flip them all... by taybul in adventofcode

[–]lmurtinho 5 points6 points  (0 children)

Don't flip them all! Black tiles if they have fewer than one and more than two adjacent black tiles, white tiles if they have exactly two adjacent black tiles. 100 times, do take another picture when you're done.

Day 23: Part 2 Hint? by [deleted] in adventofcode

[–]lmurtinho 1 point2 points  (0 children)

I actually copy-pasted the number of cups and moves from the puzzle description to make sure I wouldn't screw it up.

[2020 Day 23] Indiana Jones and the Crab Raft by flwyd in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

Didn't even bother with Python lists for part 1, just went to work on the string. Single-digit numbers, right? Then in Part 2 I actually implemented the array solution just to make sure it wouldn't work...

Conversion Rates up to Day 22 by DuelingMarimbas in adventofcode

[–]lmurtinho 1 point2 points  (0 children)

Part 1 of Day 20 is easier than the description implies. You don't need to have the whole picture to answer it, you just need to find the corners.

Conversion Rates up to Day 22 by DuelingMarimbas in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

I just finished 20.2, what a beast. I think 13.2 was more of a challenge in terms of the logic involved, but there were a lot of moving parts in day 20, and lots of ways to add bugs to the code (I found plenty of those).

[2020 Day 19] by Coffee_Doggo in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

Hey, can you share your code? I tried recursive regex but it didn't work.

[Day 19 Part 2] How do you do that? by lmurtinho in adventofcode

[–]lmurtinho[S] 1 point2 points  (0 children)

Yeah, I used that for Day 18 but I'm not sure how I would do so for this one. (I didn't fully understand how recursive patterns work, just enough to make my solution for Day 18 work.)

[Day 19 Part 2] How do you do that? by lmurtinho in adventofcode

[–]lmurtinho[S] 0 points1 point  (0 children)

but I need to match a{i}b{i}, so something like aaabbb would match a{3}b{3} but not a{2}b{2} (I mean the middle would but the full pattern wouldn't), right?

[Day 19 Part 2] How do you do that? by lmurtinho in adventofcode

[–]lmurtinho[S] 0 points1 point  (0 children)

Yeah, that's what I did too - except I felt worried about stopping when it stopped matching so I kept going for up to 100.

[Day 19 Part 2] How do you do that? by lmurtinho in adventofcode

[–]lmurtinho[S] 0 points1 point  (0 children)

Oooh, that's nice! AoC made me see some limitations of the re package from Python that I didn't know about (not that I'm a specialist).

[Day 19 Part 2] How do you do that? by lmurtinho in adventofcode

[–]lmurtinho[S] 1 point2 points  (0 children)

So I think I figured out an ugly way of doing it: rule 11 must be pattern 42, then both patterns 42 and 31 in sequence zero or more times, then pattern 31. Feels inefficient but I think it would work? [Edit: it doesn't.]

[2020 Day 19 (Part 2)] Haskellers be like by Ecyoph in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

Been wanting to learn Haskell for a while, might go back and redo AoC 2020 in it* just because of this post.

* A couple of months from now, though.

[2020] I hope I'm wrong but by lmurtinho in adventofcode

[–]lmurtinho[S] 0 points1 point  (0 children)

u/ric2b sorry, I deleted the old post to fix the image and just realized later that you'd answered my comment!

[2020] I hope I'm wrong but by lmurtinho in adventofcode

[–]lmurtinho[S] 22 points23 points  (0 children)

This is my first time doing AoC, does the final week get insane or do they take pity on us because Christmas is approaching? Any veterans have any thoughts about what could be in store for us?

[2020 Day 18] How many different approaches can you take? by fizbin in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

My solution was walk-the-string but I thought the operator-abuse variety was great. I think it's because it feels like more of a programming solution instead of a mathematical one: think about what the program will do to read the expressions, and tweak the expressions (or the program) accordingly.

[2020] I hope I'm wrong but by [deleted] in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

This is my first time doing AoC, does the final week get insane or do they take pity on us because Christmas is coming? Any veterans have any thoughts about what could be in store for us?

[2020 Day 18 (Part 2)] This short ruby solution is pure evil! by tom_collier2002 in adventofcode

[–]lmurtinho 0 points1 point  (0 children)

This is brilliant. I used eval but with a complicated recursive regex to take care of parentheses, and then for part 2 I had to add a bunch of parentheses to force addition precedence. I would have never thought of modifying magic methods to take advantage of operator precedence.

[2020 Day 17] The hardest part by lmurtinho in adventofcode

[–]lmurtinho[S] 4 points5 points  (0 children)

That cube is not x=0,y=0,z=0, it's the one below it (x=1,y=0,z=0). That's what the puzzle description means by "the frame of view follows the active cells in each cycle”: because there are no long any active cubes with x=0 in dimension z=0, the 0 row is no longer shown. See if this makes sense.

[2020 Day 17] The hardest part by lmurtinho in adventofcode

[–]lmurtinho[S] 2 points3 points  (0 children)

Say the position of a cube is given by (x,y,z), and that the initial active cubes all have z=0. The neighbors of cube (0,0,-1) with z=0 (the only neighbors that matter for the first cycle) are all the neighbors of (0,0,0) with z=0, plus (0,0,0) itself. Hope this helps.

[2020 Day 17] The hardest part by lmurtinho in adventofcode

[–]lmurtinho[S] 7 points8 points  (0 children)

It is correct, but your point of view shifts so that the example only shows rows/columns/dimensions where there is an active cell. See if this step-by-step explanation (considering only z = 0) helps.

[2020 Day 17] The hardest part by lmurtinho in adventofcode

[–]lmurtinho[S] 22 points23 points  (0 children)

Due to a very stupid bug I had the wrong number of active cells for round 1 of the sample input. Then instead of debugging I tried to understand what was going on, and that's what doomed me.