Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8162

Teaching and learning resources • Re: Advent of Code 2024

$
0
0
Here in the desert it's a rainy day.
Hmmm... Just looked at the code itself, and I have a hard-coded sequence in there
'(0 0 -1 1).
In the working directory for day22, I have a lot of other code that must have found that sequence, but honestly, I have forgotten how this works, and what it really does. Go figure - old age. :)
I see (0 0 -1 1) in the code at

viewtopic.php?p=2281631#p2281631

I expect your maximizing sequence is different than mine, but I haven't checked.

My impression is Roman's code at

https://github.com/elizarov/AdventOfCod ... 2_2_par.kt

also does a parallel search of all 130321 possible sequences. He computes the differences ahead of time so the search doesn't need to regenerate the secret numbers. I had expected the bit operations used to generate the secret numbers would be faster than reading memory, so it surprised me when the Pi 4 took more than half an hour.

I wonder if the Chapel compiler properly inlines the mix and prune functions. If not, that could account for some of the slowness.

Statistics: Posted by ejolson — Thu Mar 06, 2025 7:19 am



Viewing all articles
Browse latest Browse all 8162

Trending Articles