rover

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 89945064d54fdb4af36b3b351b56bffbd3540ee3
parent 74fb26f2935c61e0cb1bd37778762be9c86041f0
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 22 Jan 2023 17:15:23 +0000

moves forward southwards

Diffstat:
Mrover.fnl | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/rover.fnl b/rover.fnl @@ -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")