r/adventofcode • • Dec 13 '21

Upping the Ante Day 13 - 8-bit NES

Almost caught up, only day 12 remaining and it is close to complete! :D

Day 13 was fun. The "first-thing-that-comes-to-mind-is-to-use-a-matrix"-solution instantly fails due to not enough RAM to hold the matrix, so instead I just update the coords for each dot with every fold. Might actually be easier than a matrix-based solution tbh, didn't consider it too much since it is not feasible on the NES.

It is one of the slower days compute-wise. Takes just over ~4 minutes to solve (which I guess is still fast compared to for instance day 5 that takes well over an hour ;)).

https://github.com/pellsson/aoc2021/blob/main/day13.asm

40 Upvotes

12 comments sorted by

View all comments

Show parent comment

2

u/hackerpellsson Dec 13 '21

Ah shit yeah. That is very clever. Would have been significantly easier to implement.

2

u/p88h Dec 13 '21

I've added my python variant that implements it to the thread. When I attempted this in the morning, I made mistakes a couple of times (and this might be an understatement), so ended up using regular folding approach first, too many confusing off-by-ones.