Skip to content

Instantly share code, notes, and snippets.

@c-garcia
Last active August 29, 2015 14:07
Show Gist options
  • Save c-garcia/b2d85ddd50253cc971b1 to your computer and use it in GitHub Desktop.
Save c-garcia/b2d85ddd50253cc971b1 to your computer and use it in GitHub Desktop.
Mars-rover kata usage from the REPL
(require
'[marsrover.grid :as grid]
'[marsrover.robot :as robot]
'[marsrover.core :refer :all])
;; 10x10 grid with obstacle at 1,1. Robot moves beside it.
(let [grid (grid/make-grid [10 10] [[1 1]])
robot (robot/make-robot [0 0] \n grid)]
(tell-robot robot "fffrf"))
;;{:robot {:pos [1 3], :dir \e, :grid {:dim [10 10], :obstacles {[1 1] true}}}, :status :ok}
;; 10x10 grid with obstacle at 1,1. Robot impacts ith it.
(let [grid (grid/make-grid [10 10] [[1 1]])
robot (robot/make-robot [0 0] \n grid)]
(tell-robot robot "rflfff"))
;;{:robot {:pos [1 0], :dir \n, :grid {:dim [10 10], :obstacles {[1 1] true}}}, :status :obstacle-found, :where [1 1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment