rover

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

commit 65e298c82cd8fca858dde423450d0008029bfe8b
parent 1dd77f9657ba2a2aecc7edf5c9d95c1a15e0b2e6
Author: Daniel Barlow <dan@telent.net>
Date:   Mon, 23 Jan 2023 22:39:06 +0000

extract lateral? function

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

diff --git 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