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

Teaching and learning resources • Re: Advent of Code 2024

$
0
0
--- Day 16: Reindeer Maze ---

Code:

(define (run seen from to dir)  (cond   ((equal? from to) '(0))   (else    (let* ((nbrs (neighbors from dir))   (not-seen    (filter (lambda (n) (not (member (cdr n) seen))) nbrs))   (new-seen (append (map cdr not-seen) seen)))(flatten (map  (lambda (nbr)    (inc (points (car nbr) dir) (run new-seen (cdr nbr) to (car nbr))))  not-seen))))))
This is just the main search function that finds the score.

Code:

hrvoje@debi5:~/Projects/advent-of-code/advent-2024/day-16/Chez$ schemeChez Scheme Version 10.1.0Copyright 1984-2024 Cisco Systems, Inc.> (load "day16mx-new.ss")> (time (lambda () (day16 "input.txt")))(99488)#<time-duration 7.724532502>
This is the timing from i5. Banana is too slow for this (about 115 seconds).

Statistics: Posted by hrvoje064 — Sun Feb 23, 2025 8:13 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles