Update api
This commit is contained in:
parent
f0ccb136eb
commit
d261883d41
6 changed files with 91 additions and 11 deletions
|
@ -39,6 +39,13 @@
|
|||
(format t "~%Direction: ~a" dir)
|
||||
(format t "~%Food: ~a" food)))
|
||||
|
||||
(defgeneric dump (g)
|
||||
(:documentation "Dump a game. Return a plist."))
|
||||
|
||||
(defmethod dump ((g game))
|
||||
(with-slots (snake food game-over) g
|
||||
(list :snake snake :food food :game-over game-over)))
|
||||
|
||||
;;; Note that there is no waranty that nb food are added (ex: if food position collide with snake position)
|
||||
(defgeneric add-food (g nb)
|
||||
(:documentation "Add food on the game grid."))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue