diff options
author | Hunky Jimpjorps <thechairman@thechairman.info> | 2024-02-02 17:05:12 -0500 |
---|---|---|
committer | Hunky Jimpjorps <thechairman@thechairman.info> | 2024-02-02 17:05:12 -0500 |
commit | 48e35ad3b0b0c62f936784e4aca70b17c3b0e3f9 (patch) | |
tree | f59a13e0b5e80ab925220b4488c6e36b1bec660a /aoc2023-other/day-24/day-24b.rkt | |
parent | 87e9ab25ff70e215b537939a4bc23ab101f41dbe (diff) | |
download | gleam_aoc-48e35ad3b0b0c62f936784e4aca70b17c3b0e3f9.tar.gz gleam_aoc-48e35ad3b0b0c62f936784e4aca70b17c3b0e3f9.zip |
renaming
Diffstat (limited to 'aoc2023-other/day-24/day-24b.rkt')
-rw-r--r-- | aoc2023-other/day-24/day-24b.rkt | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/aoc2023-other/day-24/day-24b.rkt b/aoc2023-other/day-24/day-24b.rkt deleted file mode 100644 index b106b30..0000000 --- a/aoc2023-other/day-24/day-24b.rkt +++ /dev/null @@ -1,37 +0,0 @@ -#lang rosette - -(require advent-of-code - threading) - -(struct hail (posn vel)) -(struct posn (x y z)) -(struct vel (x y z)) - -(define input (fetch-aoc-input (find-session) 2023 24 #:cache #true)) - -(define (->struct f str) - (~> str (string-split _ ",") (map (λ~> string-trim string->number) _) (apply f _))) - -(define (parse-hail-record str) - (match-define (list p v) (string-split str " @ ")) - (hail (->struct posn p) (->struct vel v))) - -(define hail-paths - (for/list ([hail (in-list (string-split input "\n"))] ; - [_ (in-range 3)]) - (parse-hail-record hail))) - -;; part 1 - see day-24a.rkt -;; part 2 - -(define-symbolic px py pz vx vy vz integer?) - -(define sol - (solve ; - (for ([path (in-list hail-paths)]) - (define-symbolic* t integer?) - (assert (= (+ px (* vx t)) (+ (~> path hail-posn posn-x) (* (~> path hail-vel vel-x) t)))) - (assert (= (+ py (* vy t)) (+ (~> path hail-posn posn-y) (* (~> path hail-vel vel-y) t)))) - (assert (= (+ pz (* vz t)) (+ (~> path hail-posn posn-z) (* (~> path hail-vel vel-z) t))))))) - -(evaluate (+ px py pz) sol) |