svn: r13586
This commit is contained in:
parent
7cc349eab4
commit
7ac7491d53
|
@ -1,33 +1,45 @@
|
|||
#reader "literate-reader.ss"
|
||||
|
||||
|
||||
@title{Chat Noir}
|
||||
|
||||
Chat Noir. What a game.
|
||||
|
||||
@chunk[<main>
|
||||
<init-junk>
|
||||
<data-definitions>
|
||||
<everything-else>]
|
||||
|
||||
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.
|
||||
@schememodname[htdp/world]
|
||||
|
||||
@section{Data Definitions}
|
||||
|
||||
The main data structure for Chat Noir is @tt{world}.
|
||||
|
||||
@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)
|
||||
]
|
||||
|
||||
@verbatim[#<<---
|
||||
;; a state is either:
|
||||
;; - 'playing
|
||||
;; - 'cat-won
|
||||
;; - 'cat-lost
|
||||
---
|
||||
]
|
||||
|
||||
@verbatim[#<<---
|
||||
;; a board is
|
||||
;; (listof cell)
|
||||
---
|
||||
]
|
||||
It consists of a structure with six fields:
|
||||
@itemize{
|
||||
@item{
|
||||
a @scheme[board],}
|
||||
@item{
|
||||
a @scheme[posn] for the cat,}
|
||||
@item{the state of the game (@scheme[state] below), which can be one of
|
||||
@itemize{
|
||||
@item{@scheme['playing], indicating that the game is still going; this is the initial state.
|
||||
}
|
||||
@item{@scheme['cat-won], indicating that the game is over and the cat won, or}
|
||||
@item{@scheme['cat-lost], indicating that the game is over and the cat lost.}}
|
||||
}
|
||||
@item{
|
||||
a @scheme[posn] for the location of the mouse (or @scheme[#f] if the
|
||||
mouse is not in the window),}
|
||||
@item{and a boolean indicating if the @tt{h}
|
||||
key has been pushed down.}
|
||||
}
|
||||
|
||||
@verbatim[#<<---
|
||||
;; a cell is
|
||||
|
@ -36,9 +48,11 @@ key has been pushed down.
|
|||
;; boolean)
|
||||
---
|
||||
]
|
||||
|
||||
@chunk[<data-definitions>
|
||||
(define-struct cell (p blocked?) #:transparent)]
|
||||
|
||||
@section{Init Junk}
|
||||
|
||||
@chunk[<init-junk>
|
||||
|
||||
|
@ -78,6 +92,9 @@ key has been pushed down.
|
|||
(map (λ (x) (cons (car x) (cadr x)))
|
||||
init)))]
|
||||
|
||||
@section{Everything Else}
|
||||
|
||||
|
||||
@chunk[<everything-else>
|
||||
|
||||
#;'()
|
||||
|
|
Loading…
Reference in New Issue
Block a user