BDyc^V$Games W@@ @ @  x% x Wator.docTEXTMACA@ !"Rļ{Y Wator.lnkTEXTMACA!UCUIjWator1.C.TEXTMACA@@"UUkWator2.C.TEXTMACA@#UlU~np Desktop DF(DTFLDMGR@ǰU^V Watorbm> WheelynytR@ Window DemoΤΤREWheel Folder*%Games W% Desktop DF%Wheel%Game #3% Wator.docb8 Games Wycbw 3\Games W DesktopFNDRERIK@o@yd@  Desktop DB(BTFLDMGR@ǰU^V b WheelAPPLWHBB!@LvST/ǰV._`*E Window Demor Window DemoAPPL....68nnEWator Folder Game #2TEXTMACA@RR#d. Game #3TEXTMACARMR Game#1#TEXTMACAQQ: WatorAPPLWATX!68]☷]=h~``DesktopFNDRERIK@FNDRERIK@ydo??8XlOK <J^0^1^2^3((JAU&Save 4&Cancel '' Finder 1.0WHBBICN#_FREFQw#fuaa-Ag f\&H$H0HS@kB[` T\HQk@ ":H@H<gSg$"z^" FgSFg%P`5P`P`C`/ L*/ $_"J&J(JNu"_-O-IB @NN^(ng.n @NJkJk` JlDD` DaDNuD`.HG?.HG_HGBG҇NuJkJk` JlDD`Da DDNuD`Jg6BGe RGJk `JGg*/$B㉴eRASGo` $Nu"<BNu BNuH@>H2HAB;`Qo`DGLNu?HB4JH&G:EB;PF8QDoF`8QDDDDgF8SDmLQCoSH`L?Nu? @Jf"HSHl D@2 SAnNu @"@Bg SAQB @NuJgBA0 @NuNVH`Bga0HN".RAN".Ҁ N^NuNVH`..l .-@ .N^NuNVH`B .NS-@ .찮l< nHH-@ n"n nRS`N^NuNVH`-n..l .D-@Bp ".N"0R .S np ".N-AJn..lR .S n- nB .NN^NuNVH`BR .S ng` .SN^NuNV-NB{̩0B?< -N/1 _+H/- -N/3/-/N"-@N nƱfBg/-/-Bh0J@g/-?<]NB-@ frN/-iNjNDB'?.mNA0.H0m mmmHmB mT/A0-H/HmBgBA0.H0m mhmmh0-Hmg0-H;@HmBgA0-H/BgA0-H N?0@2-mA@0-A?0-[@?A0-H/BgA0-H N?Rn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ABR`B/-?< _-HN nN P=PT2.TSAHBN=@RB/-?.R _-HV=|^=|\=|Z nV PZRn^C^RnZ nV PZ /fRn^A^BRnZ0.ZH+@ nV PHHm& nV P0.ZH"-C`R`/.V0.ZH"-A`BHn N/-?<HnG/-sHn` N4NNN*+@N^NuNV-NB?<B/<| _-H/./.s/.?<HnHnHmHm? *! ) ) ) ) ) * )k )O *! ** ) * *! )g ** ) ) ) ** *% $d(,0,48,<d@DHLPTX\`dXhl,ptx|V U 6_ ) *] )| *. )o )a ) * ) ) )[ ) ) ) )B ) )STR NSTRVj dummy textPFZOKFZdNo More0..x Player Name?(%dummy^_QxOK7K+Your guess at the puzzle ^0?_x\CancelTitle// THE WAY/ WE WE'RE==Phrase/ THE MORE/ THINGS CHANGE/ THE MORE THEY/ STAY THE SAME Thing// WALL TO WALL/ CARPETING.-Title/ AROUND/ THE WORLD/ IN EIGHTY/ DAYS76Slogan/ WOULDN'T/ YOU REALLY/ RATHER HAVE/ A BUICK Thing// INSTANT/ REPLAYThing// CAMEO/ APPEARANCETitle// DRESSED/ TO KILL/.Phrase/ HAVEN'T/ I SEEN/ YOU SOMEPLACE/ BEFORE10Phrase/ FLY LIKE A/ BUTTERFLY/ STING LIKE/ A BEE.-Phrase/+ FOR ALL YOU/ DO, THIS/ BUD'S FOR YOUPlace// IN THE/ DOGHOUSE43Phrase/ IF YOU/ CAN'T/ BEAT THEM/ JOIN THEMEvent// SUPERBOWL/ SUNDAY"!Place/+ THE/ TWILIGHT/ ZONE.-Phrase/+ LIFE IS A/ BOWL FULL/ OF CHERRIES,+Phrase/+ BET YOU/ CAN'T EAT/ JUST ONE Person// CIRCUS/ RINGMASTER#"People// THE HARLEM/ GLOBETROTTERSPerson// CAPTAIN/ JAMES T KIRK"!Phrase// THANK GOD/ IT'S FRIDAY! Phrase// STRAIGHT AS/ AN ARROWThing// STANDING/ OVATION$#People/+ THE/ BLUE/ ANGELS%$Thing/+ WIND/ CHILL/ FACTOR-,Phrase/+ LET'S JUST/ GET ONE/ THING STRAIGHT-,Phrase/+ YOU CAN BET/ YOUR BOTTOM/ DOLLARPlace/+/ NIAGARA FALLS#"People/+ THE/ THREE/ STOOGES)(Person/+ SPEAKER/ OF THE/ HOUSE! Phrase// LOOK BEFORE/ YOU LEAP! Phrase// PRETTY AS/ A BUTTON+*Fictional Characters// BATMAN AND/ ROBINThing// CHEEZE AND/ CRACKERSPerson// GAME SHOW/ HOST! Person// TOLL BOOTH/ COLLECTOR21Phrase/ STRANGER/ THINGS/ HAVE HAPPEN/ BEFORE$#Phrase// TOMORROW IS/ ANOTHER DAY Title// THE NEW/ YORK TIMES! Thing// VIDEO TAPE/ RECORDER Title// THE SOUND/ OF MUSIC"!Place// THE POINT OF/ NO RETURN54Phrase/ THE STRAW/ THAT BROKE/ THE CAMEL'S/ BACK! Phrase// TRY THIS ON/ FOR SIZE%$Person/+ JUNK/ FOOD/ JUNKIE'&Phrase/+ GOOD TO/ THE LAST/ DROP&%Title/+ AMERICA/ THE/ BEAUTIFUL('Title/+ THE HIGH/ AND THE/ MIGHTY+*Phrase/+ A PENNY/ FOR YOUR/ THOUGHTS&%Place/+ THE/ PUBLIC/ LIBRARY('Phrase/+ EAT/ DRINK AND/ BE MERRY*)Person/+ THE FASTEST/ GUN IN THE/ WEST"!Phrase// WOULD YOU DO/ ME A FAVOR Phrase// AS SOON/ AS POSSIBLEPerson// REGISTERED/ NURSEPerson// ALFRED/ HITCHCOCKPeople// NEW YORK/ RANGERSPhrase// HOW SWEET/ IT IS%$Phrase// WHERE DO WE/ GO FROM HERE&%Phrase// WHAT GOES UP/ MUST COME DOWN;:Phrase/ A BIRD IN/ THE HAND IS/ WORTH TWO/ IN THE BUSH<;Phrase/ IF AT FIRST/ YOU DON'T/ SUCCEED, TRY/ TRY AGAIN"!Phrase// THE CREAM/ OF THE CROP43Title/ IF IT'S/ TUESDAY,/ THIS MUST/ BE BELGIUM0/Phrase/ ONE IF BY/ LAND AND/ TWO IF BY/ SEA87Phrase/ THE BIGGER/ THEY ARE/ THE HARDER/ THEY FALL54Phrase/ IT AIN'T/ OVER TILL/ THE FAT/ LADY SINGS*)Phrase/+ A STITCH/ IN TIME/ SAVES NINE#"Title/+ THE/ MAGNIFICENT/ SEVEN.-Phrase/+ A PENNY/ SAVED IS A/ PENNY EARNED,+Phrase/+ GIVE ME/ LIBERTY OR/ GIVE ME DEATH.-Phrase/+ GOOD THINGS/ COME IN/ SMALL PACKAGES.-Phrase/+IT TAKES A/LICKEN AND/KEEPS ON TICKENPerson/+/ MILTON BEARLEThing// GREAT/ EXPECTATIONS*)Fictional Character// ROCKY/ BALBOAPerson// MANFRED/ KALZ Kdummy &OK% Wheel V1.0&""Written by Bob Boylan, Spring 19861$F#If you happen to like this program,+@$W-send me some incentive to create another one!o&ш391 Birchwood Rd.l%ˈMedford, NY 11763%-Portions of this program written using Mac C%o.Mac C is a trademark of Consulair Corporation Program written by me -- Bob B.WHBBICN#FREFAPPLaa-`>`>`>`>b`><`>`=`=`=`=l`=F`=&`<`<`<` #include #include #include #include "wator.h" GLOBAL WindowPtr graphWindow, statWindow, watorWindow; BOOL EventCheck() { EventRecord event; WindowPtr window; BITS code; LOCAL UCOUNT ctr = 10; if (ctr--) return(NO); /* only check every 10th call */ ctr = 10; GetNextEvent(everyEvent, &event); if (event.what == keyDown && tolower(event.message & BYTMASK) == 'q') exit(YES); else if (event.what == updateEvt) { BeginUpdate(event.message); if (event.message == graphWindow) UpdateGraph(); else if (event.message == watorWindow) UpdateWator(); else if (event.message == statWindow) UpdateStat(); EndUpdate(event.message); } else if (event.what == mouseDown) { if ((code=FindWindow(pass(event.where), &window)) == inContent) SelectWindow(window); else if (code == inDrag) { Rect dragRect; dragRect = screenBits.bounds; dragRect.top += 20; /* bypass menu bar */ InsetRect(&dragRect, 4, 4); SelectWindow(window); DragWindow(window, pass(event.where), &dragRect); } else if (code == inMenuBar) DoCommand(pass(event.where)); } else return(NO); return(YES); /* there was an event */ } de == inMenuBar) DopPo$|PF4 !4AZTEC C GAME TRAINING EXAMPLE MANX EDUCATION RMART SOURCEread wator.doc!!!! this file controlls the population graph for the wator example /* * Draw Population Graph * * This module draws and maintains the population graph. It consists of * two main functions: DrawGraph, and UpdateGraph. DrawGraph is called * every time a new data point is to be added to the graph. UpdateGraph * is called every time there is an update event for the graph window. * * DrawGraph simply draws lines between the previous and latest data point. * It also moves the separator bar. If the graph has wrapped around the * window, DrawGraph also erases the line between the data points immediately * to the right of the separator. * * UpdateGraph redraws the entire graph window. * * A little hint: When drawing a line, Quickdraw turns on the pixel just * below and to the right of every point that intersects the line. This * includes the endpoints. When drawing a graph from line segments, each * right-hand endpoint is the left-hand endpoint of the next segment. * This means that Quickdraw will draw each endpoint pixel TWICE!. This * can cause icky problems when you use the srcXor PenMode. Your Endpoints * never appear, since they are getting XOR'ed twice. To circumvent this * problem, you will notice that both DrawGraph, and UpdateGraph add 1 to * the coordinate of the left-hand endpoint of each segment. */ #include #include #include #include "wator.h" GLOBAL WindowPtr graphWindow; GLOBAL COUNT fishpop[GRAPH_WIDTH], sharkpop[GRAPH_WIDTH]; GLOBAL UCOUNT chronon; GLOBAL short nfish, nsharks; LOCAL UCOUNT old_chronon; LOCAL TBITS blkpat[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; LOCAL TBITS grypat[] = {0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa}; LOCAL TBITS ltgrypat[] = {0x88, 0x22, 0x44, 0x11, 0x88, 0x22, 0x44, 0x11}; /* * Add a new point to the population graph. */ VOID DrawGraph(f,s) UCOUNT f,s; { UCOUNT width, height, i; DOUBLE bitwidth, bitheight; Rect separator; LOCAL COUNT foldx = -1, foldy = -1, soldx = -1, soldy = -1; LOCAL BOOL first = YES; UCOUNT pos; SetPort(graphWindow); /* calculate the scale of the graph */ width = graphWindow->portRect.right - graphWindow->portRect.left; height = graphWindow->portRect.bottom - graphWindow->portRect.top; bitwidth = ((DOUBLE)width)/GRAPH_WIDTH; bitheight = ((DOUBLE)height)/(GRIDSIZE * GRIDSIZE); pos = chronon % GRAPH_WIDTH; if (first) { first = NO; foldx = 0; foldy = height - nfish * bitheight; soldx = 0; soldy = height - nsharks * bitheight; } /* erase old fish segment if any */ if (pos != GRAPH_WIDTH-1 && fishpop[pos + 1] != -1) { MoveTo((UCOUNT)(bitwidth*pos + 1), (UCOUNT)(height - bitheight*fishpop[pos])); PenMode(patXor); PenPat(&grypat); LineTo((UCOUNT)(bitwidth*(pos+1)), (UCOUNT)(height - bitheight*fishpop[pos+1])); } /* draw new fish segment */ fishpop[pos] = f; MoveTo(foldx+1, foldy); PenMode(patXor); PenPat(&grypat); foldx=(UCOUNT)(bitwidth*(pos)); foldy=(UCOUNT)(height - bitheight*fishpop[pos]); if (pos) LineTo(foldx, foldy); /* erase old shark segment */ if (pos != GRAPH_WIDTH-1 && sharkpop[pos + 1] != -1) { MoveTo((UCOUNT)(bitwidth*(pos) + 1), (UCOUNT)(height - bitheight*sharkpop[pos])); PenMode(patXor); PenPat(&blkpat); LineTo((UCOUNT)(bitwidth*(pos+1)), (UCOUNT)(height - bitheight*sharkpop[pos+1])); } sharkpop[pos] = s; /* draw new shark segment */ PenMode(patXor); PenPat(&blkpat); MoveTo(soldx+1, soldy); soldx=(UCOUNT)(bitwidth*(pos)); soldy=(UCOUNT)(height - bitheight*sharkpop[pos]); if (pos) LineTo(soldx, soldy); /* move the separator bar */ separator.top = 0; separator.bottom = height; separator.right=old_chronon * bitwidth + 1; separator.left=separator.right-2; PenMode(patXor); PenPat(&blkpat); PaintRect(&separator); /* turn off the old separator */ old_chronon = pos; separator.right=old_chronon * bitwidth + 1; separator.left=separator.right-2; PenMode(patXor); PenPat(&blkpat); PaintRect(&separator); /* turn on the new separator */ } /* * Re-draw the entire population graph */ VOID UpdateGraph() { UCOUNT width, height, i; DOUBLE bitwidth, bitheight; Rect separator; LOCAL UCOUNT soldx, soldy, foldx, foldy; LOCAL BOOL first = YES; SetPort(graphWindow); /* calculate the scale of the graph */ EraseRect(&graphWindow->portRect); width = graphWindow->portRect.right - graphWindow->portRect.left; height = graphWindow->portRect.bottom - graphWindow->portRect.top; bitwidth = ((DOUBLE)width)/GRAPH_WIDTH; bitheight = ((DOUBLE)height)/(GRIDSIZE * GRIDSIZE); /* draw the graticule */ PenMode(patCopy); PenPat(<grypat); for(i=50; i+ <+/. D@? D@?N(n0,TH|80,lH|9@0| 9@0,| 9@LN^ _PONALCBRECJoNV n CJ""Hn/-"?<NVHn/.?<NFN^ _PONUNCHICOJoNVHnHn?<N BBg/. n /(rNBgp-@N^ _PONITICON JoNV/.HnNHn?<?<N0.|=@0.|=@ n/(vBgBgBgBgN n/(rHnNN^.NuALCICONJoNV/.HnN\ n(ogHn/-&N` Hn/-*NN^.NuRAWWICOJoNVB n l60. g S@gS@g `&/.N`B/./.N-_`/.NN^ _ NCONPROCJoNVN-|DRVRB?<HzJNx+_/-/.NB?<Nf+_ /-BgNX/- BgNNNNN^NuETUPMEN@JoNVH(n0.H/,/N.0. H/,/N,B/,/NvB ,Ԑ//Nd П*Bg/N^=_LN^ _PONLEND JoNVH(n&n HnN8/-N.HmNv?<Nl-|.g.A"L B?<?<N.B?<?<'N-_` A"K B?<?<N.-nAC AC HnN|`Bg?,?+/N=_Bg?,?+/N=_Bg??/N=_Bg?,?+/N=_HnNHnNAC AC AC B/./N-_RF FohHnNPHnNHHnN@N8/.NLN^ _ NOOMRECTJoNV/ (n0. kf @n`H0;N(4@LA"L"""`/HzNAN/HztNzA^/HzDNlAn/HzN^N^NuNITIMAG 4FBE8FF09B7EC3FE66CC7BD83F8C1F00 00000000002100CE019401F9005906FF 50147FFC5BBF7EFC0AA00EE011101FF0 0FE008201AB00820FFFE9012F55E5554 FFF8FFF8FFFCFFFE7FFE7FFC3FFC1E78 047004E002C001003D7C7FFEFFFCFFF8 50294FC94009418947EA418C40083FF0 0FFC100A3FF540094FC9502950295029 100C040A6F009CB67F1C9CAE6A158114 002C1818C81ABE2C390DFC16B2060815 B53BE879A4F6B1E4669864B01FC00480 01F0078C1F263E8E5E5F7E9DBC5FFABDJoNV/ 0.ARAI0.A@CA(9|HlBgBg?<?<N(_N^ _TONETTHEBIJoNVHA+HBG`O RAI HH@J@J@WD@| #|;@ |(;@ mso 0-|d;@?HnN,?N?NHm?-?-0-|P?0-|(?N"O R/BBHmA?<N(/BgBgB<r/N" A!O RA&pA'H~O RA/0N|RG GoI||;|,;|Hm?<,?<?<|?<NrACZ BBHmA?<N'/BgBgB<p/N+_&mA'H~/-NLN^NuAKETHEFAuthorJoNV/ (nHlNAC 0.|=@HnNAC 0.|=@HnNAC / <N0.|=@0.|=@/,HnN(_N^.NuRAWSCROJoNV/ 0. ARAIHl THhHl 0.A Ht?<BN(_N^.NuRAWIMAGJoNVH<.M RA0g` Fg^HnNzM RA/0Nb m0HhNf m0HhN/-0NBG` ??N2RG Go/.N&`HnNpARA(p/ N m0HhNHlNH/ NB?<?<NHzN?<F?<"NHzjN?<B?<2NHzFN?<2?<JNHz$N/.NLN^ _TONPDATEFOB April 16,1982Andy Hertzfeld written byMacIntosh DeskTop DemoJoNV/Bn BGO RA"0V G_gRG`=G .N^.NuINDINDEJoNV/Bg/.N> Gn?N.N^.NuPDATEWIJoNVH(n WWg``Bg/ NT>O RA0g&L/ BgN|/ NbAC 0.nH|=@0.nH|=@0.|=@0.|=@HnNHnN 'm~AC HnN HnN HnHn<N/ <NO RAB0/-NZ/-NTLN^.NuPENWINDJoNVH(n WWg`Bg/ N0>O RA0 g&L/ BgNT/ N :AC 0.nH|=@0.nH|=@0.|=@0.|=@HnN HnN A'H~AC HnN HnN HnHnBgNX/ <N O RA/-N0/-N*LN^.NuYCLOSEWJoNVHnN X/-N N/-N/.N >N^NuRAWBUTTJoNVH nCJp@"S@nHnN TBgA?<N!/N &< n>/. ?.0.| ? T@?0.X@?N ( |??.N LN^ _ NAKECOMMJoNVHnN /-N BgN ?< ?<N HzjHm/N8HzTHm/N*Hz@Hm/NHz,Hm/N0-X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2((A0JAgB/`|/oLTNuN^Nu%_EOF NV,_H o1h>B.Bh(1|,B Bh!|$E@!J $h A0  gB/`|/oLTNuN^Nu%_EOLN NV,_0<`N^Nu%_BLKRD NV,_B@$_BB24"_ _JAlBA1h>!A.1|,!B$!I J@g`2((A0Bg>NN^Nu%_BLKWR NV,_0<`N^Nu%_UREAD NV,_BBB$_246"_.$@0<0B. @g!|@.1|ը.1|,!C$!I g`4((Ah0$_Bg>NNN^Nu%_UWRIT NV,_$_?:>/ NuN^Nu%_IORES NV,_$_0/ NuN^Nu%_UCLR NV,_NuN^Nu%_UBUSY NV,_`N^Nu%_GET NV,_$_"NN^Nu%_PUT NV,_/ o/P _NuN^Nu%_UPARR NV,_$_0"NN^Nu%_SEEK BNuNu _N]NNV,_$_024/ NuN^Nu%_RCHCK NV,_$_ NN^Nu%_SRCHK 54~K\~ICONMENU>CODEJ  #define FAST register #define GLOBAL extern #define IMPORT extern #define INTERN static #define LOCAL static #define VOID typedef unsigned char TEXT; typedef TEXT TBOOL, pBOOL; typedef char TINY; typedef double DOUBLE; typedef int ARGINT, BOOL; typedef long LONG; typedef short COUNT, METACH; typedef unsigned BYTES; typedef unsigned char UTINY, TBITS; typedef unsigned long ULONG, LBITS; typedef unsigned short BITS, UCOUNT; /* system parameters */ #define YES 1 #define NO 0 #define pTRUE 0x0100 #define pFALSE 0 #define FOREVER for (;;) #define BYTMASK 0377 /* macros */ #define abs(x) ((x) < 0 ? -(x) : (x)) #define isalpha(c) (islower(c) || isupper(c)) #define isdigit(c) ('0' <= (c) && (c) <= '9') #define islower(c) ('a' <= (c) && (c) <= 'z') #define isupper(c) ('A' <= (c) && (c) <= 'Z') #define iswhite(c) ((c) <= ' ' || 0177 <= (c)) #define max(x, y) (((x) < (y)) ? (y) : (x)) #define min(x, y) (((x) < (y)) ? (x) : (y)) #define tolower(c) (isupper(c) ? ((c) + ('a' - 'A')) : (c)) #define toupper(c) (islower(c) ? ((c) - ('a' - 'A')) : (c)) #define CONTROL(char) (0x1f & (char)) #define NIL (0L) #define NULL 0 #define NUL '\0' #define EOF -1 - ('a' - 'A')) : (c)) #define CONTROL(char) (0x1f & (char)) #define NIL (0L) #define NULL 0 #define NUL '\0' #define EOpPo$]RF414AZTEC C GAME TRAINING EXAMPLE MANX EDUCATION RMART SOURCEread wator.doc!!!! this file controlls the events in the wator example 54.WatorAPPLWATX APPLWATX ]6( #?<.A,+HC+IBBgN \OBgN+NVHBD`RD|l$H&E,H$CL3(58`HmԨn?6.(4.HւEJ28g?.?.NrXO`?.?.NXO`~`dLN^NuNVHHn6.?6. ?6.ZC?6. ZC?HnHmLN^NuNVHHn6.?6. ?6.\C?6. \C?HnHmLN^NuNVHHn6.?6. ?6.\C?6. \C?HnLN^NuNVHBga08|lDD0LN^NuNVH8.0|(H(H@LN^NuNVH0B?<HmN!XO/1 +@/-HmN!tXO/3/-Bg57LN^NuNVHB/.= -@&.t=C&.Ƽ=C nf nf ?<NTOLN^NuNVHB?< -@B?<B/< -@/.s$n6*j=C$n6*j=CBgBg?<=|`Rn n nJ?.HnꨋBg$n/06.@HÇ?6.HÇ?$n/?<N`TO`?<xNTTOE"n$$6.HÇn=C6.HÇn=CEC$$HnBg6.DC?6.^CHÇ=CEC$$6.n=CVn?.NTO-@$nT/ HnHnHnBgBHn?<BgUnTn6.HÇ4nҴoXHn$nT/ HnHnBgB$n2nԲoHn?<BgHnBg?<`Hn?<?<`/.N XO$n/ ?<N TOB?
NNVpH$n B?<:/.Nt\O&@JfBgHnpBgNN08.&n`"B/.a*XO8$KR:JDf B@LN^Nu/ /. NBPO0`NVpH&n+HJCfVH|1mLH|9nBH|0=CEp-JB.pBnBgHnBgN.0;@J@g B@LN^Nu0.`x`RD=DEp-JB.pBgHnBgN0J@f/ HnpN>XO/aPOJ@f0.``;|B@`NVH&n(n H?NTO?H?NTO68@JDg 0LN^Nu$KRJg$LRJfB@`"_0 _f`>N o0/g f SNuBNu o "ofNu0/|<`c <zb< Nu0/|<@c <Zb< Nu"_0 _f`>N0-gNVAB1@ x |1n o"H<fSH  Nu _ 2N o"H BA`QBNu<WatorStatisticssharks: %dfish: %dchronon: %dsharks: %dfish: %dchronon: %dUUUUWatorQuit UUUU"D"D0123456789abcdef 00000 @@@@@@@@@@@@@@@ @@@@@@@ @@@@@ @@@@ AAPPL `B ` 42lb8A",|P) /p(8 ???WATXICN#FREF OKd# Wator Setup4<K<100<FKnFishUd<20UFdxSharksn}<3nF}Fish Gestation<5FShark Gestation<3FShark Starvation44(dMs (0@HR` p0?f% <#@ h "a" @#<#` @@@j@ @@@P@5Xx>` 00 `by: Robert Martin ~ Wator ~# APopulation GraphSR54.Nz. CODERWATXvFREFICN#BNDLDITLDLOGICONSTR WIND P$0P /P0R0XP0cP1gPM1O`2O3O&3@OK2O4^ObR4HO44l Wator Documentation --------------------- The program of Wator has been provided as an example of MACINTOSH programming. The development environment was AZTEC C, on a 128K MAC with an external drive. If you find this example valuable, I would appreciate a nominal contribution of $5 so that I can continue to provide programming examples of this kind. Send to: Robert Martin 2826 Lee Ave Waukegan, IL 60085 Comments can be sent via EMAIL to 70156,240 Wator ------- The game of WATOR was invented by A. K. Dewdney. He wrote about it in the "COMPUTER RECREATIONS" column of the DEC '84 issue of "SCIENTIFIC AMERICAN". The world of wator is a toroidal planet, completely covered with water. For the purpose of this program, the surface of the torus has been unfolded, and is displayed as a rectangle. Wator has two types of inhabitants: sharks and fish. The fish have an unlimited food supply, breed happily. The sharks eat only fish, and will starve without food. Sharks also breed. Time passes on wator in increments called chronons. Each chronon, the fish and sharks move, eat, and breed. To start the game going, the user must decide on 5 critical values. % The initial number of fish % The initial number of sharks % The number of chronons it takes for a fish to breed. % The number of chronons it takes for a shark to breed. % The number of chronons it takes for a shark to starve. Once these values are set, there is nothing to do but watch as the sharks and fish arrange themselves into a neat little ecology. Sometimes the system becomes unstable, and all the fish get eaten. Of course then all the sharks die. Sometimes, there are too few fish to support all the sharks and the sharks all die, but the fish survive. Only the fish can win this game. The best the sharks can do is draw. Each fish and shark move in a random fashion, one space per chronon. If a shark can eat a fish in an adjacent space, it will do that rather than move to an empty square. The fish do not try to evade the sharks. When it comes time for a fish or a shark to breed, it must first move to an empty space, and then it leaves a fully mature offspring behind in the space it came from. Running the program --------------------- To start the game, double click the shark-and-fish icon of "wator". The opening sequence will run, and then a dialog box will be presented with the 5 values that you must specify. The default values represent a stable situation which is my favorite. Edit the values with mouse and keyboard, and push the "OK" button. The screen will fill with 3 windows. The most prominent, labelled "wator" is the rectangular representation of the unfolded torus of the planet of "Wator". In this window you will see black squares which are the sharks, and smaller grey squares which are the fish. As you watch they will dance around and multiply. The sharks will gobble down fish and array themsevles in fierce competition for feeding space. The second most prominent window is the population graph. This window displays two traces, the grey trace represents the fish population, the black trace represents the shark population. Each vertical division on the graph represents 200 individuals. Each horizontal division represents 50 chronons. A vertical separator bar divides the graph. To the left are the latest recordings, and to the right are the oldest. The separator moves from left to right, and then starts over again at the far left. The last window is labeled "statistics". It contains the current count of sharks and fish. It also contains the current time in chronons. Each of these windows may be dragged around with the mouse. To stop the game, select "Quit" from the "Wator" menu. Wator screens may be printed with the "caps-lock,shift,command-4" sequence. (see macintosh manual page 73). Wator Software ---------------- Wator was written in C, using the AZTEC C compiler. I began writing it before I had recieved my copy of "INSIDE MACINTOSH", and so alot of the initial work was based on educated guessing. The initial version of Wator drew a rectangle on the screen, and manipulated the sharks and fish within it. The initial values were retrieved as command line parameters. Later I added the statistics rectangle, and still later I changed the two rectangles into windows. After I recieved "INSIDE MACINTOSH" I was able to add the opening sequence (which uses a method which is based on the "About File..." portion of the wonderful example program written by Cary Clark), the dialog box for parameters, the population graph and the event handling. Wator consists of 9 source files: % Wator. c The root module, contains the rules for operating the sharks and fish. Also contains the highest level code for controlling the ancillary functions such as event dectection, and window updates. % Watorut. c Wator Utilities. A set of utilities used almost exclusively by wator.c in order to draw the sharks and fish, and control some of the mathematical limitations of the torus. % Watevent. c Detects and handles mouseDown, keyDown, and Update events. Knows how to drag windows. % Watopen. c Contains the opening sequence. The animation in this program is quite intriguing, and a close examination should be a rewarding experience. % Watparm. c Puts up the dialog box to get the initial values. This module is most interesting for finding out how to put Icons into dialog boxes. % Watgraph. c Draws and maintains the population graph. This was probably the most chalenging module to write. There are several subtleties whithin Quickdraw which I found out about. This module is also about as large as the AZTEC C will support on a 128K MAC. As it is I had to compile it using {-Z200} to reduce the string space. A close examination of this routine will be very rewarding. It covers some animation techniques as well as techniques for drawing graphs, and updating windows. % Watmenu. c Controlls the menu bar, and the execution of menu commands. % Wator. h Contains all the global constants and data structures. % std. h My own standard header, which has my favorite conventions installed. Wator Resources ----------------- I built all the resources with the first release of Apples Resource Editor which comes with the software supplement, and is also available from the MAUG. I kept the resources in a file named wator.res, and merged them into my linked code before running. I have not provided a copy of wator.res, since all the resources are available in the application itself. If you wish to do any development work on this program, I suggest that you first strip out the resources and then merge them back in when your changes have been made. Linking Wator --------------- I have provided a file named wator.lnk which contains the linking instructions for the linker. The command used to link the code after is is all compiled is: ln -f wator.lnk File Type ----------- The Application is given the type type of: APPL WATX by the "Set File" utility that comes with the software supplement. The bundle bit is set at the same time. License --------- This program may be used by anyone. I don't care if you copy it a million times, or give it away to all your freinds and relatives. But please don't charge any money for it. Also, if you copy the source code, please copy this document with it. What about me? ---------------- The game itself is yours. But if this write-up and the associated source code teach you something worth while, then I would appreciate a contribution of $5 to help me keep providing educational material like this. Send to : Robert Martin 2826 Lee Ave Waukegan, IL 60085 -m -o wator ccmp:lib/sacroot.o wator.o watorut.o watmenu.o watopen.o watparm.o watevent.o watgraph.o -lc x#include #include #include #include #include #include "wator.h" GLOBAL short nfish,nsharks,fbreed,sbreed,starve,tic; GetParams() { DialogPtr params; Handle **fishIcon, **sharkIcon; Rect dbox; BITS dtype; TEXT **junk; UCOUNT item; TEXT wrk[20]; InitDialogs(NIL); params = GetNewDialog(D_PARAM, NIL, -1L); GetDItem(params, 14, &dtype, &junk, &dbox); /* get fish item */ fishIcon = GetIcon(FISHICON); SetDItem(params, 14, iconItem, fishIcon, &dbox); GetDItem(params, 3, &dtype, &junk, &dbox); /* get shark item */ sharkIcon = GetIcon(SHARKICON); SetDItem(params, 3, iconItem, sharkIcon, &dbox); for (item=NULL; item != 1;) ModalDialog(NIL, &item); GetDItem(params, 4, &dtype, &junk, &dbox); /* get text for nfish */ GetIText(junk, &wrk); nfish = atoi(ptoc(wrk)); GetDItem(params, 6, &dtype, &junk, &dbox); /* get text for nsharks */ GetIText(junk, &wrk); nsharks = atoi(ptoc(wrk)); GetDItem(params, 8, &dtype, &junk, &dbox); /* get text for fbreed */ GetIText(junk, &wrk); fbreed = atoi(ptoc(wrk)); GetDItem(params, 10, &dtype, &junk, &dbox); /* get text for sbreed */ GetIText(junk, &wrk); sbreed = atoi(ptoc(wrk)); GetDItem(params, 12, &dtype, &junk, &dbox); /* get text for starve */ GetIText(junk, &wrk); starve = atoi(ptoc(wrk)); CloseDialog(params); } , &dtype, &junk, &dbox); /* get text #include #include #include "wator.h" fish(x,y) short x,y; { Rect r; static char pat[8]= {0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55}; SetRect(&r,x*CELLSIZE,y*CELLSIZE, x*CELLSIZE+(CELLSIZE-2), y*CELLSIZE+(CELLSIZE-2)); FillRect(&r,&pat); } shark(x,y) { Rect r; static char pat[8]= {~0,~0,~0,~0,~0,~0,~0,~0}; SetRect(&r,x*CELLSIZE,y*CELLSIZE, x*CELLSIZE+(CELLSIZE-1), y*CELLSIZE+(CELLSIZE-1)); FillRect(&r,&pat); } empty(x,y) { Rect r; SetRect(&r,x*CELLSIZE,y*CELLSIZE, x*CELLSIZE+(CELLSIZE-1), y*CELLSIZE+(CELLSIZE-1)); EraseRect(&r); } int aRandom() { register int r; r = Random(); if (r < 0) r = -r; return(r); } int grid(x) register int x; { return((x + GRIDSIZE) % GRIDSIZE); } r; r = Random(); if (r < 0) r = -r; return(r); } int grid(x) register int x; { return((x + G