day 12: fix minor issue
This commit is contained in:
parent
4b124189a0
commit
a612240e50
4
12.rkt
4
12.rkt
|
@ -21,7 +21,7 @@
|
||||||
["L" (values (+ dir (d->r num)) x y)]
|
["L" (values (+ dir (d->r num)) x y)]
|
||||||
["R" (values (- dir (d->r num)) x y)]
|
["R" (values (- dir (d->r num)) x y)]
|
||||||
["F" (values dir (+ x (* num (cos dir))) (+ y (* num (sin dir))))])))
|
["F" (values dir (+ x (* num (cos dir))) (+ y (* num (sin dir))))])))
|
||||||
(inexact->exact (floor (abs (+ x y)))))
|
(inexact->exact (floor (+ (abs x) (abs y)))))
|
||||||
|
|
||||||
(define (part2 input)
|
(define (part2 input)
|
||||||
(define (rot x y d)
|
(define (rot x y d)
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
(values sx sy nwx nwy)]
|
(values sx sy nwx nwy)]
|
||||||
["F"
|
["F"
|
||||||
(values (+ sx (* num wx)) (+ sy (* num wy)) wx wy)])))
|
(values (+ sx (* num wx)) (+ sy (* num wy)) wx wy)])))
|
||||||
(inexact->exact (floor (abs (+ (abs sx) (abs sy))))))
|
(inexact->exact (floor (+ (abs sx) (abs sy)))))
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(require rackunit)
|
(require rackunit)
|
||||||
|
|
Loading…
Reference in New Issue