rover

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

commit bcd833e26ba5aaa9054b2d9b76e8f9b30aa2eec9
parent 570fe8dadca9e8c4d09f1ec6f19d9271aafa4a97
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 22 Jan 2023 19:07:25 +0000

avoid resultant lateral movement except at equator

if x and y represent lat/long, the angular distance we move
along the lines of longitude will vary depending on latitude.

Diffstat:
Mrover.fnl | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rover.fnl b/rover.fnl @@ -96,9 +96,9 @@ (expect "Moves north when pointing south and asked to move backward" (execute r [:b]) {:x 3 :y 3 :direction :s})) -(let [r (rover 3 2 :e)] +(let [r (rover 3 0 :e)] (expect "Moves west when pointing east and asked to move backward" - (execute r [:b]) {:x 2 :y 2 :direction :e})) + (execute r [:b]) {:x 2 :y 0 :direction :e})) (let [r (rover 2 4 :e)] (expect "Rotates to south when pointing east and asked to turn right" @@ -114,8 +114,8 @@ (let [r (rover 1 1 :s)] (expect "Multiple commands are executed in the right order" - (execute r [:l :l :f :f :f :r :f]) - {:x 2 :y 4 :direction :e})) + (execute r [:l :l :f :f :f :r :f :b]) + {:x 1 :y 4 :direction :e})) "if we travel west past x=-180, x becomes positive 180"