extract lateral? function

main
Daniel Barlow 2023-01-23 22:39:06 +00:00
parent 1dd77f9657
commit 65e298c82c
1 changed files with 4 additions and 1 deletions

View File

@ -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