Change make-array to make-list
This commit is contained in:
parent
3c42acfdd9
commit
041e9fde3a
1 changed files with 3 additions and 4 deletions
|
@ -57,9 +57,8 @@
|
|||
(let* ((old-size (length snake))
|
||||
(new-size (+ old-size grow-size))
|
||||
(tail (nth (- old-size 1) snake))
|
||||
(new-tail (make-list grow-size :initial-element tail))
|
||||
(new-snake (coerce (make-array new-size :initial-contents `(,@snake ,@new-tail)) 'list)))
|
||||
new-snake))
|
||||
(new-tail (make-list grow-size :initial-element tail)))
|
||||
(append snake new-tail)))
|
||||
|
||||
|
||||
|
||||
|
@ -113,4 +112,4 @@
|
|||
(let ((x (random size-x))
|
||||
(y (random size-y)))
|
||||
(when (eq (member (list x y) snake :test #'equal-coord) nil) ; Add if there is no conflict between snake and food position
|
||||
(setf food (coerce (make-array (1+ (length food)) :initial-contents `(,@food ,(list x y))) 'list))))))))
|
||||
(format t "~a" (append food `(,(list x y))))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue