(defvar *castle*
'((0 2 0 0 0 0 0)
(1 3 3 3 0 0 0)
(2 0 5 2 0 0 0)
(0 5 0 0 0 0 0)
(4 0 0 3 15 13 0)
(0 0 1 0 0 0 0)
(0 8 0 0 0 0 0)
(7 10 0 0 0 0 0)
(0 19 0 8 0 8 0)
(8 0 11 0 0 0 0)
(0 0 10 0 0 0 0)
(0 0 0 13 0 0 0)
(0 0 12 0 5 0 0)
(0 15 17 0 0 0 0)
(14 0 0 0 0 5 0)
(17 0 19 0 0 0 0)
(18 16 0 14 0 0 0)
(0 17 0 0 0 0 0)
(9 0 16 0 0 0 0)))
;;; 해당번호 방을 가져오는 함수
(defun get-room (room-num)
(nth (- room-num 1) *castle*))
;;; 방의 리스트에서 각 요소를 가져오는 함수
(defun get-rooms-element (room element)
(cond ((char= element #\n) (car room))
((char= element #\s) (nth 1 room))
((char= element #\e) (nth 2 room))
((char= element #\w) (nth 3 room))
((char= element #\u) (nth 4 room))
((char= element #\d) (nth 5 room))
((char= element #\m) (nth 6 room))
(t
nil)))
댓글 없음:
댓글 쓰기