extract lateral? function
This commit is contained in:
parent
1dd77f9657
commit
65e298c82c
@ -10,9 +10,12 @@
|
|||||||
(any obstacles
|
(any obstacles
|
||||||
(fn [[ox oy]] (and (= ox x) (= oy y)))))
|
(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]
|
(fn try-to-drive [{: x : y : direction : stopped} distance]
|
||||||
(let [distance
|
(let [distance
|
||||||
(if (. {:w true :e true} direction)
|
(if (lateral? direction)
|
||||||
(/ distance (math.cos (/ (* math.pi y) 180)))
|
(/ distance (math.cos (/ (* math.pi y) 180)))
|
||||||
distance)]
|
distance)]
|
||||||
(match direction
|
(match direction
|
||||||
|
Loading…
Reference in New Issue
Block a user