我正在制作一个两人井字游戏,并且正处于解决代码中所有错误的阶段。我坚持的当前错误是illegal function call
以下代码中的错误:
(cond
[...snip...]
((= CHOICE 3)
(IF (NUMBERP (AREF *BOARD* 0 2))
(SETF (AREF *BOARD* 0 2) *MARKER*)
(INVALID-SELECTION)))
我究竟做错了什么?
编辑整个函数如下所示:
(defun select (choice)
(cond ((= choice 1)
(if (numberp (aref *board* 0 0)) (setf (aref *board* 0 0) *marker*)
(invalid-selection))))
((= choice 2)
(if (numberp (aref *board* 0 1)) (setf (aref *board* 0 1) *marker*)
(invalid-selection))))
((= choice 3)
(if (numberp (aref *board* 0 2)) (setf (aref *board* 0 2) *marker*)
(invalid-selection))))
((= choice 4)
(if (numberp (aref *board* 1 0)) (setf (aref *board* 1 0) *marker*)
(invalid-selection))))
((= choice 5)
(if (numberp (aref *board* 1 1)) (setf (aref *board* 1 1) *marker*)
(invalid-selection))))
((= choice 6)
(if (numberp (aref *board* 1 2)) (setf (aref *board* 1 2) *marker*)
(invalid-selection))))
((= choice 7)
(if (numberp (aref *board* 2 0)) (setf (aref *board* 2 0) *marker*)
(invalid-selection))))
((= choice 8)
(if (numberp (aref *board* 2 1)) (setf (aref *board* 2 1) *marker*)
(invalid-selection))))
((= choice 9)
(if (numberp (aref *board* 2 2)) (setf (aref *board* 2 2) *marker*)
(invalid-selection))))