Environment Code

(setf *envt*

'(

       (1 (nil 2 5 nil))

       (2 (nil 3 6 1))

       (3 (nil 4 7 2))

       (4 (nil nil 8 3))

       (5 (1 6 9 nil))

       (6 (2 nil nil 5))

       (7 (3 8 10 nil))

       (8 (4 nil 13 7))

       (9 (5 10 11 nil))

       (10 (7 nil 12 9))

       (11 (9 12 nil nil))

       (12 (10 13 nil 11))

       (13 (8 nil nil 12))

))

 

(setf *robotposn* 7)

(setf *n* 0 *e* 1 *s* 2 *w* 3)

 

(defun gethalls (cur-robotposn)(second (assoc cur-robotposn *envt*)))

 

(defun MovRobi (direction)

  (setf *robotposn* (nth direction (gethalls *robotposn*)))

  (list *robotposn* (boolize (gethalls *robotposn*)))

)

 

(defun boolize (list)

  (mapcar #'(lambda (x)(when x t)) list))

 

(defun whereamI? ()(list *robotposn* (boolize (gethalls *robotposn*))))

 

(defun inenvt (node)(assoc node *envt*))