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

Teaching and learning resources • Re: Advent of Code 2024

$
0
0

Code:

;;; Advent of code 2024 - day22, part1 & part2, on BPI-F3 RISC-V;;; Chez code (load "utils.so")(define (next sn)  (let* ((sn1 (modulo (logxor sn (* sn 64)) 16777216)) (sn2 (modulo (logxor sn1 (quotient sn1 32)) 16777216)))    (modulo (logxor sn2 (* sn2 2048)) 16777216))) (define (next-sns sn)  (set! acc '())  (do ([i 2000 (sub1 i)]       [n sn (next n)])      ((zero? i) n)))(define (day22 file)  (let ((secretn (read-file file)))    (values (apply + (map next-sns secretn)) 'not-yet)))     > (time2 (lambda () (day22 "input.txt")))16894083306not-yet#<time-duration 0.005814532>   
Part2 will have to wait. No idea yet.

Statistics: Posted by hrvoje064 — Sat Dec 28, 2024 3:26 pm



Viewing all articles
Browse latest Browse all 8374

Trending Articles