From 7ac7491d535dd38aefc002b187a0dd7a46c7c2f2 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 14 Feb 2009 22:40:42 +0000 Subject: [PATCH] svn: r13586 --- .../games/chat-noir/chat-noir-literate.ss | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/collects/games/chat-noir/chat-noir-literate.ss b/collects/games/chat-noir/chat-noir-literate.ss index bb249256eb..2d3e051e73 100755 --- a/collects/games/chat-noir/chat-noir-literate.ss +++ b/collects/games/chat-noir/chat-noir-literate.ss @@ -1,33 +1,45 @@ #reader "literate-reader.ss" + + +@title{Chat Noir} + +Chat Noir. What a game. + @chunk[
] -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[ -(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[ (define-struct cell (p blocked?) #:transparent)] +@section{Init Junk} @chunk[ @@ -78,6 +92,9 @@ key has been pushed down. (map (λ (x) (cons (car x) (cadr x))) init)))] +@section{Everything Else} + + @chunk[ #;'()