Change make-array to make-list

This commit is contained in:
Loic Guegan 2019-05-08 19:22:12 +02:00
parent 3c42acfdd9
commit 041e9fde3a

View file

@ -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))))))))))