hi , first of all im not a native english speaker
i wanna know ho to implement a labyrinth in lisp?
think u
north
+-----------+---+
| | |
| +-------+ | Lisp direction-keywords
| | |
| + +-------+ :n = north
w | | | e
e | +---+ + | a :s = south
s | | | | s
t | +---+---+ | t :e = east
| | |
+---+ | + | :w = west
| | | |
| +---+ | |
| | |
+-----------+---+
south(defparameter *maze*
(make-array '(7 4) :initial-contents
'(((:s :e) (:e :w) (:w) (:s))
((:n :s) (:s :e) (:e :w) (:n :w))
((:n :s :e) (:n :w) (:s :e) (:s :w))
((:n :s) (:e) (:n :w) (:n :s))
((:n :e) (:s :w) (:s :e) (:n :s :w))
((:s :e) (:n :w) (:n :s) (:n :s))
((:n :e) (:e :w) (:n :w) (:n)))))(defun move-possible-p (y x direction-keyword)
(find direction-keyword (aref *maze* y x)))Users browsing this forum: Bing [Bot] and 3 guests