report position of the obstacle when stopped
This commit is contained in:
parent
dc9088ffa5
commit
689fb894ad
@ -57,7 +57,7 @@
|
|||||||
:l (turn-left rover)
|
:l (turn-left rover)
|
||||||
_ (assert false (. "unrecognised command " string))))]
|
_ (assert false (. "unrecognised command " string))))]
|
||||||
(if (at-obstacle? next-move)
|
(if (at-obstacle? next-move)
|
||||||
(merge rover {:stopped true})
|
(merge rover {:stopped [next-move.x next-move.y]})
|
||||||
next-move)))
|
next-move)))
|
||||||
|
|
||||||
(fn fudge-for-pole [{: y &as r}]
|
(fn fudge-for-pole [{: y &as r}]
|
||||||
@ -193,7 +193,7 @@
|
|||||||
(expect "It does not move past obstacles"
|
(expect "It does not move past obstacles"
|
||||||
(let [obstacles [[5 5] [7 5]]]
|
(let [obstacles [[5 5] [7 5]]]
|
||||||
(execute (rover 5 3 :n obstacles) [:f :f :f :f :f :f]))
|
(execute (rover 5 3 :n obstacles) [:f :f :f :f :f :f]))
|
||||||
{:x 5 :y 4 :direction :n :stopped true})
|
{:x 5 :y 4 :direction :n :stopped [5 5]})
|
||||||
|
|
||||||
|
|
||||||
;; "TODO: deal with the south pole special casing"
|
;; "TODO: deal with the south pole special casing"
|
||||||
|
Loading…
Reference in New Issue
Block a user