diff options
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.")) |
