(deftemplate hunter "A hunter"(slot agent (default Xena))(slot x (type INTEGER))(slot y (type INTEGER))(slot alive (default TRUE)))(deftemplate cave
"Cave objects sore the hunter's model of the world"(slot x (type INTEGER)); (x,y) coordinates of cave(slot y (type INTEGER)); (slot visited (default FALSE)); Has the hunter been in it?(slot stench (default UNKNOWN)); Does the cave smell?(slot breeze (default UNKNOWN)); Is it breezy?(slot glitter (default UNKNOWN)); Is there a glitter in it?(slot has-wumpus (default UNKNOWN)); Is there a wumpus here?(slot has-pit (default UNKNOWN)); Is there a pit here?(slot has-gold (default UNKNOWN)); Is their gold here?(slot has-exit (default UNKNOWN))(slot safe (default UNKNOWN))); Is the cave safe -- no wumpus, no pit?;; functions -----------------------------------------------------------------(deffunction buildworld (?width ?height);; (buildworld N M) makes cave assertions for a NxM rectangular world.(printout t "Adding adj asserts for a " ?width " by " ?height " world." crlf)(bind ?x 1)(while (<= ?x ?width)(bind ?y 1)(while (<= ?y ?height)(if(> ?x 1) then (assert (adj ?x ?y (- ?x 1) ?y)))(if(> ?y 1) then (assert (adj ?x ?y ?x (- ?y 1))))(if(< ?x ?width) then (assert (adj ?x ?y (+ ?x 1) ?y)))(if(< ?y ?height) then (assert (adj ?x ?y ?x (+ ?y 1))))(bind ?y (+ 1 ?y)))(bind ?x (+ ?x 1))))