report position of the obstacle when stopped

main
Daniel Barlow 2023-01-23 22:22:12 +00:00
parent dc9088ffa5
commit 689fb894ad
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@
:l (turn-left rover)
_ (assert false (. "unrecognised command " string))))]
(if (at-obstacle? next-move)
(merge rover {:stopped true})
(merge rover {:stopped [next-move.x next-move.y]})
next-move)))
(fn fudge-for-pole [{: y &as r}]
@ -193,7 +193,7 @@
(expect "It does not move past obstacles"
(let [obstacles [[5 5] [7 5]]]
(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"