From bcd833e26ba5aaa9054b2d9b76e8f9b30aa2eec9 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 22 Jan 2023 19:07:25 +0000 Subject: [PATCH] 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. --- rover.fnl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rover.fnl b/rover.fnl index c505434..c0cc799 100644 --- 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"