diff options
| author | Loic Guegan <manzerberdes@gmx.com> | 2019-05-09 18:38:31 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerberdes@gmx.com> | 2019-05-09 18:38:31 +0200 |
| commit | d261883d4148a87ea8f6bb6cef16be406a2c0a10 (patch) | |
| tree | c10fa38dbe394e3f4fc6269c0ba6cdfa7eed758e /server/game/game.lisp | |
| parent | f0ccb136eb945b19d3d9eec61ad8a15a0a9ba993 (diff) | |
Update api
Diffstat (limited to 'server/game/game.lisp')
| -rw-r--r-- | server/game/game.lisp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/game/game.lisp b/server/game/game.lisp index f909f36..9ea2029 100644 --- a/server/game/game.lisp +++ b/server/game/game.lisp @@ -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.")) |
