diff --git a/rover.fnl b/rover.fnl index 6fbdb8f..c0405d7 100644 --- a/rover.fnl +++ b/rover.fnl @@ -10,9 +10,12 @@ (any obstacles (fn [[ox oy]] (and (= ox x) (= oy y))))) +(fn lateral? [direction] + (. {:w true :e true} direction)) + (fn try-to-drive [{: x : y : direction : stopped} distance] (let [distance - (if (. {:w true :e true} direction) + (if (lateral? direction) (/ distance (math.cos (/ (* math.pi y) 180))) distance)] (match direction