moves forward southwards

main
Daniel Barlow 2023-01-22 17:15:23 +00:00
parent 74fb26f293
commit 89945064d5
1 changed files with 9 additions and 1 deletions

View File

@ -12,7 +12,9 @@
})))))
(fn command [rover commands]
{:x 0 :y 1 :direction :n})
(match rover.direction
:n {:x 0 :y (+ rover.y 1) :direction :n}
:s {:x 0 :y (- rover.y 1) :direction :s}))
(fn rover [x y direction]
{: x
@ -38,5 +40,11 @@
(r:command [:f])
{:x 0 :y 1 :direction :n}))
(let [r (rover 0 0 :s)]
(expect
"Moves south when pointing south and asked to move forward"
(r:command [:f])
{:x 0 :y -1 :direction :s}))
(print "OK")