svn: r13583

This commit is contained in:
Robby Findler 2009-02-14 20:59:45 +00:00
parent a1cd265b84
commit 093a897708

View File

@ -5,27 +5,37 @@
<everything-else>] <everything-else>]
The first main data definition for Chat Noir is the state of the world. The first main data definition for Chat Noir is the state of the world.
It consists of a structure with six fields: a @scheme[board], a
@scheme[posn] for the cat, the state of the game (@scheme[state] below),
a @scheme[posn] for the location of the mouse (or @scheme[#f] if the
mouse is not in the window), and a boolean indicating if the @tt{h}
key has been pushed down.
@chunk[<data-definitions> @chunk[<data-definitions>
(define-struct world (board cat state size mouse-posn h-down?) #:transparent) (define-struct world (board cat state size mouse-posn h-down?) #:transparent)
] ]
;; a world is: @verbatim[#<<---
;; (make-world board posn state number mouse posn-or-false boolean)
;; a state is either: ;; a state is either:
;; - 'playing ;; - 'playing
;; - 'cat-won ;; - 'cat-won
;; - 'cat-lost ;; - 'cat-lost
---
]
@verbatim[#<<---
;; a board is ;; a board is
;; (listof cell) ;; (listof cell)
---
]
@verbatim[#<<---
;; a cell is ;; a cell is
;; (make-cell (make-posn int[0-board-size] ;; (make-cell (make-posn int[0-board-size]
;; int[0-board-size]) ;; int[0-board-size])
;; boolean) ;; boolean)
---
]
@chunk[<data-definitions> @chunk[<data-definitions>
(define-struct cell (p blocked?) #:transparent)] (define-struct cell (p blocked?) #:transparent)]