--- Day 14: Restroom Redoubt ---I'm at total loss here - for part2 of day 14.
Part1 was very easy. Just some maps and filters and thats it.
These two functions below do all the work.However for part2, it's not that I do not know how to program it! Worse than that, I do not know what they want me to do?
And if Easter egg, this is what? A circle in the center of the grid?
Code:
;;; Advent of code 2024 - day18, part1 on BPI-F3 RISC-V;;; Chez code --- Day 14: Restroom Redoubt ---(load "utils.so")(define (move pp vp) (cons (modulo (+ (car pp) (car vp)) mxx)(modulo (+ (cdr pp) (cdr vp)) mxy)))(define (move100 ppl vpl) (do ([xyl ppl (map move xyl vpl)] [n 100 (sub1 n)]) ((zero? n) xyl)))(define (day14 file) (if (string=? file "input.txt") (begin (set! mxx 101) (set! mxy 103)) (begin (set! mxx 11) (set! mxy 7))) (let* ((pvl (map (lambda (s) (string-split-n s '(#\, #\space #\p #\v #\=))) (read-lines file))) (pvnl (map (lambda (ss) (map string->number ss)) pvl)) (pv-pairs (map (lambda (ns) (list (cons (first ns) (second ns)) (cons (third ns) (fourth ns))))pvnl)) (ppl (map car pv-pairs)) (vpl (map cadr pv-pairs)) (grid (move100 ppl vpl)) (q1x (quotient mxx 2)) (q1y (quotient mxy 2)) (q1 (filter (lambda (p) (and (< (car p) q1x) (< (cdr p) q1y))) grid)) (q2 (filter (lambda (p) (and (> (car p) q1x) (< (cdr p) q1y))) grid)) (q3 (filter (lambda (p) (and (< (car p) q1x) (> (cdr p) q1y))) grid)) (q4 (filter (lambda (p) (and (> (car p) q1x) (> (cdr p) q1y))) grid))) (* (length q1) (length q2) (length q3) (length q4))))Code:
> (time (lambda () (day14 "input.txt")))225943500#<time-duration 0.014984996>Part1 was very easy. Just some maps and filters and thats it.
These two functions below do all the work.
Code:
(define (move pp vp) (cons (modulo (+ (car pp) (car vp)) mxx)(modulo (+ (cdr pp) (cdr vp)) mxy)))(define (move100 ppl vpl) (do ([xyl ppl (map move xyl vpl)] [n 100 (sub1 n)]) ((zero? n) xyl)))A what??? Picture of Christmas tree? And then Easter egg? To me, this sounds very vague. First of all, is it a Christmas tree or Easter egg? And then, how should they look like? If, by Christmas tree, they mean a cone shape, starting from the bottom, and rising to the top, okay, I can try that, but I would really like a more detailed explanation.--- Part Two ---
During the bathroom break, someone notices that these robots seem awfully similar to ones built and used at the North Pole. If they're the same type of robots, they should have a hard-coded Easter egg: very rarely, most of the robots should arrange themselves into a picture of a Christmas tree.
What is the fewest number of seconds that must elapse for the robots to display the Easter egg?
And if Easter egg, this is what? A circle in the center of the grid?
Statistics: Posted by hrvoje064 — Fri Feb 21, 2025 7:10 am