svn: r13586

This commit is contained in:
Robby Findler 2009-02-14 22:40:42 +00:00
parent 7cc349eab4
commit 7ac7491d53

View File

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