home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1998-10-20 | 10.9 KB | [TEXT/KAHL] |
view JSON data
|
view as text
|
open on a Mac
|
open on a PC
This file was processed as: MacBinary
(archive/macBinary).
You can browse this item here: Morpion.c
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Tue Oct 20 10:31:58 1998, modified Tue Oct 20 10:31:58 1998, creator Think C, type ASCII, 10433 bytes "Morpion.c" , at 0x2941 428 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [KAHL] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 4d 6f 72 70 69 6f | 6e 2e 63 00 00 00 00 00 |..Morpio|n.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 28 c1 00 | 00 01 ac b2 52 4f 5e b2 |.....(..|....RO^.|
|00000060| 52 4f 5e 00 00 06 00 00 | 00 00 00 00 00 00 00 00 |RO^.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ac 12 00 00 |........|........|
|00000080| 2f 2a 0d 09 4d 6f 72 70 | 69 6f 6e 20 28 46 72 65 |/*..Morp|ion (Fre|
|00000090| 6e 63 68 29 20 3d 3d 20 | 35 20 49 6e 20 41 20 52 |nch) == |5 In A R|
|000000a0| 6f 77 20 28 45 6e 67 6c | 69 73 68 29 0d 09 54 68 |ow (Engl|ish)..Th|
|000000b0| 65 20 66 69 72 73 74 20 | 6f 6e 65 20 77 68 6f 20 |e first |one who |
|000000c0| 70 75 74 73 20 35 20 6d | 61 72 6b 65 72 73 20 69 |puts 5 m|arkers i|
|000000d0| 6e 20 61 20 72 6f 77 20 | 28 68 6f 72 69 7a 6f 6e |n a row |(horizon|
|000000e0| 74 61 6c 2c 20 76 65 72 | 74 69 63 61 6c 20 6f 72 |tal, ver|tical or|
|000000f0| 20 64 69 61 67 6f 6e 61 | 6c 29 20 77 69 6e 73 2e | diagona|l) wins.|
|00000100| 20 54 68 65 20 63 6f 6d | 70 75 74 65 72 20 70 6c | The com|puter pl|
|00000110| 61 79 73 20 61 67 61 69 | 6e 73 74 20 69 74 73 65 |ays agai|nst itse|
|00000120| 6c 66 2e 0d 09 0d 09 54 | 68 69 73 20 73 6d 61 6c |lf.....T|his smal|
|00000130| 6c 20 66 61 64 65 72 20 | 69 73 20 69 6e 74 65 6e |l fader |is inten|
|00000140| 64 65 64 20 61 73 20 61 | 20 63 6f 64 65 20 65 78 |ded as a| code ex|
|00000150| 61 6d 70 6c 65 2e 20 49 | 74 20 69 73 20 62 61 73 |ample. I|t is bas|
|00000160| 65 64 20 6f 6e 20 46 61 | 64 65 72 53 68 65 6c 6c |ed on Fa|derShell|
|00000170| 2c 20 77 72 69 74 74 65 | 6e 20 62 79 20 54 6f 6d |, writte|n by Tom|
|00000180| 20 44 6f 77 64 79 2e 0d | 09 54 68 69 73 20 63 6f | Dowdy..|.This co|
|00000190| 64 65 20 69 73 20 68 65 | 72 65 62 79 20 70 6c 61 |de is he|reby pla|
|000001a0| 63 65 64 20 69 6e 74 6f | 20 74 68 65 20 70 75 62 |ced into| the pub|
|000001b0| 6c 69 63 20 64 6f 6d 61 | 69 6e 2e 20 55 73 65 20 |lic doma|in. Use |
|000001c0| 69 74 20 61 73 20 61 20 | 74 65 6d 70 6c 61 74 65 |it as a |template|
|000001d0| 20 74 6f 20 77 72 69 74 | 65 20 79 6f 75 72 20 66 | to writ|e your f|
|000001e0| 61 64 65 72 73 21 0d 09 | 09 0d 09 59 6f 75 20 63 |aders!..|...You c|
|000001f0| 61 6e 20 75 73 65 20 67 | 6c 6f 62 61 6c 20 76 61 |an use g|lobal va|
|00000200| 72 69 61 62 6c 65 73 2c | 20 74 68 65 79 20 61 72 |riables,| they ar|
|00000210| 65 20 73 74 6f 72 65 64 | 20 61 73 20 61 6e 20 6f |e stored| as an o|
|00000220| 66 66 73 65 74 20 66 72 | 6f 6d 20 41 34 20 75 73 |ffset fr|om A4 us|
|00000230| 69 6e 67 20 54 48 49 4e | 4b 27 73 20 53 65 74 75 |ing THIN|K's Setu|
|00000240| 70 41 34 2f 52 65 73 74 | 6f 72 65 41 34 20 70 72 |pA4/Rest|oreA4 pr|
|00000250| 6f 63 65 64 75 72 65 73 | 2e 0d 09 0d 09 54 68 69 |ocedures|.....Thi|
|00000260| 73 20 66 61 64 65 72 20 | 61 6c 73 6f 20 64 65 6d |s fader |also dem|
|00000270| 6f 6e 73 74 72 61 74 65 | 73 20 74 68 65 20 75 73 |onstrate|s the us|
|00000280| 65 20 6f 66 20 63 61 6c | 6c 62 61 63 6b 20 72 6f |e of cal|lback ro|
|00000290| 75 74 69 6e 65 73 20 62 | 79 20 70 6c 61 79 69 6e |utines b|y playin|
|000002a0| 67 20 73 6f 75 6e 64 2e | 20 4e 6f 74 65 20 74 68 |g sound.| Note th|
|000002b0| 61 74 20 69 6e 20 6f 72 | 64 65 72 20 74 6f 20 70 |at in or|der to p|
|000002c0| 6c 61 79 20 73 6f 75 6e | 64 2c 20 79 6f 75 20 6d |lay soun|d, you m|
|000002d0| 75 73 74 0d 09 72 65 71 | 75 65 73 74 20 61 20 73 |ust..req|uest a s|
|000002e0| 6f 75 6e 64 20 63 68 61 | 6e 6e 65 6c 20 66 72 6f |ound cha|nnel fro|
|000002f0| 6d 20 44 61 72 6b 53 69 | 64 65 20 62 79 20 63 72 |m DarkSi|de by cr|
|00000300| 65 61 74 69 6e 67 20 61 | 20 27 43 68 6e 6c 27 20 |eating a| 'Chnl' |
|00000310| 30 20 72 65 73 6f 75 72 | 63 65 2e 20 0d 2a 2f 0d |0 resour|ce. .*/.|
|00000320| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 4d 65 6d 6f 72 |.#includ|e <Memor|
|00000330| 79 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 57 |y.h>.#in|clude <W|
|00000340| 69 6e 64 6f 77 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |indows.h|>.#inclu|
|00000350| 64 65 20 3c 44 69 61 6c | 6f 67 73 2e 68 3e 0d 23 |de <Dial|ogs.h>.#|
|00000360| 69 6e 63 6c 75 64 65 20 | 3c 45 72 72 6f 72 73 2e |include |<Errors.|
|00000370| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 6f 6f |h>.#incl|ude <Too|
|00000380| 6c 55 74 69 6c 73 2e 68 | 3e 0d 0d 23 69 6e 63 6c |lUtils.h|>..#incl|
|00000390| 75 64 65 20 22 46 61 64 | 65 72 2e 68 22 09 09 09 |ude "Fad|er.h"...|
|000003a0| 09 09 09 09 09 2f 2f 20 | 69 6e 63 6c 75 64 65 20 |.....// |include |
|000003b0| 44 61 72 6b 53 69 64 65 | 27 73 20 69 6e 74 65 72 |DarkSide|'s inter|
|000003c0| 66 61 63 65 0d 0d 23 69 | 66 64 65 66 20 54 48 49 |face..#i|fdef THI|
|000003d0| 4e 4b 5f 43 0d 09 23 64 | 65 66 69 6e 65 20 51 55 |NK_C..#d|efine QU|
|000003e0| 49 43 4b 44 52 41 57 42 | 4c 41 43 4b 09 28 71 64 |ICKDRAWB|LACK.(qd|
|000003f0| 2e 62 6c 61 63 6b 29 0d | 09 23 64 65 66 69 6e 65 |.black).|.#define|
|00000400| 20 51 55 49 43 4b 44 52 | 41 57 57 48 49 54 45 09 | QUICKDR|AWWHITE.|
|00000410| 28 71 64 2e 77 68 69 74 | 65 29 0d 23 65 6c 73 65 |(qd.whit|e).#else|
|00000420| 0d 09 23 64 65 66 69 6e | 65 20 51 55 49 43 4b 44 |..#defin|e QUICKD|
|00000430| 52 41 57 42 4c 41 43 4b | 09 28 26 71 64 2e 62 6c |RAWBLACK|.(&qd.bl|
|00000440| 61 63 6b 29 0d 09 23 64 | 65 66 69 6e 65 20 51 55 |ack)..#d|efine QU|
|00000450| 49 43 4b 44 52 41 57 57 | 48 49 54 45 09 28 26 71 |ICKDRAWW|HITE.(&q|
|00000460| 64 2e 77 68 69 74 65 29 | 0d 23 65 6e 64 69 66 0d |d.white)|.#endif.|
|00000470| 0d 2f 2f 20 43 6f 6e 73 | 74 61 6e 74 73 2e 20 54 |.// Cons|tants. T|
|00000480| 68 65 73 65 20 61 72 65 | 20 73 70 65 63 69 66 69 |hese are| specifi|
|00000490| 63 20 74 6f 20 4d 6f 72 | 70 69 6f 6e 2c 20 79 6f |c to Mor|pion, yo|
|000004a0| 75 20 63 61 6e 20 74 68 | 72 6f 77 20 74 68 65 6d |u can th|row them|
|000004b0| 20 61 77 61 79 20 69 66 | 20 79 6f 75 20 61 72 65 | away if| you are|
|000004c0| 20 77 72 69 74 69 6e 67 | 20 61 20 6e 65 77 20 66 | writing| a new f|
|000004d0| 61 64 65 72 2e 0d 0d 23 | 64 65 66 69 6e 65 09 62 |ader...#|define.b|
|000004e0| 6f 72 64 65 72 09 09 32 | 0d 0d 23 64 65 66 69 6e |order..2|..#defin|
|000004f0| 65 09 65 6d 70 74 79 09 | 09 30 0d 23 64 65 66 69 |e.empty.|.0.#defi|
|00000500| 6e 65 09 70 6c 61 79 65 | 72 31 09 09 31 0d 23 64 |ne.playe|r1..1.#d|
|00000510| 65 66 69 6e 65 09 70 6c | 61 79 65 72 32 09 09 32 |efine.pl|ayer2..2|
|00000520| 0d 0d 2f 2f 20 47 6c 6f | 62 61 6c 20 76 61 72 69 |..// Glo|bal vari|
|00000530| 61 62 6c 65 73 2c 20 72 | 65 66 65 72 65 6e 63 65 |ables, r|eference|
|00000540| 64 20 75 73 69 6e 67 20 | 41 34 2e 20 41 6c 73 6f |d using |A4. Also|
|00000550| 20 4d 6f 72 70 69 6f 6e | 2d 73 70 65 63 69 66 69 | Morpion|-specifi|
|00000560| 63 2e 0d 51 44 47 6c 6f | 62 61 6c 73 09 71 64 3b |c..QDGlo|bals.qd;|
|00000570| 0d 0d 73 68 6f 72 74 09 | 09 78 6c 6f 63 2c 20 79 |..short.|.xloc, y|
|00000580| 6c 6f 63 3b 09 09 09 09 | 09 09 2f 2f 20 73 74 61 |loc;....|..// sta|
|00000590| 72 74 69 6e 67 20 6c 6f | 63 61 74 69 6f 6e 20 6f |rting lo|cation o|
|000005a0| 66 20 74 68 65 20 67 72 | 69 64 0d 73 68 6f 72 74 |f the gr|id.short|
|000005b0| 20 09 09 78 73 69 7a 65 | 2c 20 79 73 69 7a 65 3b | ..xsize|, ysize;|
|000005c0| 09 09 09 09 09 09 2f 2f | 20 57 69 64 74 68 20 61 |......//| Width a|
|000005d0| 6e 64 20 68 65 69 67 68 | 74 20 6f 66 20 67 72 69 |nd heigh|t of gri|
|000005e0| 64 0d 73 68 6f 72 74 09 | 09 78 63 2c 20 79 63 3b |d.short.|.xc, yc;|
|000005f0| 09 09 09 09 09 09 09 2f | 2f 20 50 69 78 65 6c 20 |......./|/ Pixel |
|00000600| 63 6f 6f 72 64 69 6e 61 | 74 65 73 20 6f 66 20 74 |coordina|tes of t|
|00000610| 6f 70 6c 65 66 74 20 63 | 6f 72 6e 65 72 0d 48 61 |opleft c|orner.Ha|
|00000620| 6e 64 6c 65 09 09 67 72 | 69 64 2c 20 70 6f 69 6e |ndle..gr|id, poin|
|00000630| 74 73 2c 20 70 6f 73 73 | 69 62 6c 65 3b 09 0d 73 |ts, poss|ible;..s|
|00000640| 68 6f 72 74 09 09 76 61 | 6c 75 65 5b 35 5d 5b 35 |hort..va|lue[5][5|
|00000650| 5d 3b 0d 73 68 6f 72 74 | 09 09 74 75 72 6e 3b 09 |];.short|..turn;.|
|00000660| 09 09 09 09 09 09 09 2f | 2f 20 54 65 6c 6c 73 20 |......./|/ Tells |
|00000670| 77 68 6f 27 73 20 75 70 | 0d 42 6f 6f 6c 65 61 6e |who's up|.Boolean|
|00000680| 09 09 64 72 61 77 2c 20 | 77 69 6e 6e 65 72 3b 09 |..draw, |winner;.|
|00000690| 09 09 09 09 09 2f 2f 20 | 45 6e 64 2d 6f 66 2d 67 |.....// |End-of-g|
|000006a0| 61 6d 65 20 66 6c 61 67 | 73 0d 73 68 6f 72 74 09 |ame flag|s.short.|
|000006b0| 09 75 6e 69 74 3b 09 09 | 09 09 09 09 09 09 2f 2f |.unit;..|......//|
|000006c0| 20 53 69 7a 65 20 6f 66 | 20 73 71 75 61 72 65 73 | Size of| squares|
|000006d0| 0d 6c 6f 6e 67 09 09 6e | 65 78 74 44 72 61 77 3b |.long..n|extDraw;|
|000006e0| 09 09 09 09 09 09 2f 2f | 20 54 69 63 6b 43 6f 75 |......//| TickCou|
|000006f0| 6e 74 20 6f 66 20 74 68 | 65 20 6e 65 78 74 20 74 |nt of th|e next t|
|00000700| 69 6d 65 20 74 6f 20 64 | 72 61 77 0d 0d 2f 2f 20 |ime to d|raw..// |
|00000710| 67 72 69 64 20 69 73 20 | 63 6f 6e 73 69 64 65 72 |grid is |consider|
|00000720| 65 64 20 61 73 20 61 20 | 74 77 6f 20 64 69 6d 65 |ed as a |two dime|
|00000730| 6e 73 69 6f 6e 61 6c 20 | 61 72 72 61 79 20 30 2e |nsional |array 0.|
|00000740| 2e 78 73 69 7a 65 2d 31 | 2c 20 30 2e 2e 79 73 69 |.xsize-1|, 0..ysi|
|00000750| 7a 65 2d 31 20 6f 66 20 | 63 68 61 72 73 0d 2f 2f |ze-1 of |chars.//|
|00000760| 20 70 6f 69 6e 74 73 20 | 61 73 20 61 6e 20 61 72 | points |as an ar|
|00000770| 72 61 79 20 30 2e 2e 78 | 73 69 7a 65 2d 31 2c 20 |ray 0..x|size-1, |
|00000780| 30 2e 2e 79 73 69 7a 65 | 2d 31 20 6f 66 20 73 68 |0..ysize|-1 of sh|
|00000790| 6f 72 74 73 0d 2f 2f 20 | 70 6f 73 73 69 62 6c 65 |orts.// |possible|
|000007a0| 20 61 73 20 61 6e 20 61 | 72 72 61 79 20 30 2e 2e | as an a|rray 0..|
|000007b0| 78 73 69 7a 65 2a 79 73 | 69 7a 65 2d 31 20 6f 66 |xsize*ys|ize-1 of|
|000007c0| 20 70 6f 69 6e 74 73 0d | 0d 23 64 65 66 69 6e 65 | points.|.#define|
|000007d0| 09 47 72 69 64 28 78 2c | 20 79 29 09 09 28 28 63 |.Grid(x,| y)..((c|
|000007e0| 68 61 72 2a 29 20 28 2a | 67 72 69 64 29 29 20 5b |har*) (*|grid)) [|
|000007f0| 78 73 69 7a 65 20 2a 20 | 79 20 2b 20 78 5d 0d 23 |xsize * |y + x].#|
|00000800| 64 65 66 69 6e 65 09 50 | 6f 69 6e 74 73 28 78 2c |define.P|oints(x,|
|00000810| 20 79 29 09 28 28 73 68 | 6f 72 74 2a 29 20 28 2a | y).((sh|ort*) (*|
|00000820| 70 6f 69 6e 74 73 29 29 | 20 5b 78 73 69 7a 65 20 |points))| [xsize |
|00000830| 2a 20 79 20 2b 20 78 5d | 0d 23 64 65 66 69 6e 65 |* y + x]|.#define|
|00000840| 09 50 6f 73 73 69 62 6c | 65 28 78 29 09 28 28 50 |.Possibl|e(x).((P|
|00000850| 6f 69 6e 74 2a 29 20 28 | 2a 70 6f 73 73 69 62 6c |oint*) (|*possibl|
|00000860| 65 29 29 20 5b 78 5d 0d | 0d 76 6f 69 64 20 53 74 |e)) [x].|.void St|
|00000870| 61 72 74 47 61 6d 65 20 | 28 76 6f 69 64 29 0d 7b |artGame |(void).{|
|00000880| 0d 09 6c 6f 6e 67 09 09 | 69 78 3b 0d 09 63 68 61 |..long..|ix;..cha|
|00000890| 72 20 09 09 2a 70 3b 0d | 0d 09 74 75 72 6e 20 3d |r ..*p;.|..turn =|
|000008a0| 20 70 6c 61 79 65 72 31 | 3b 09 09 09 09 09 09 09 | player1|;.......|
|000008b0| 09 09 09 09 09 2f 2f 20 | 77 68 69 74 65 20 70 6c |.....// |white pl|
|000008c0| 61 79 73 20 66 69 72 73 | 74 0d 09 64 72 61 77 20 |ays firs|t..draw |
|000008d0| 3d 20 77 69 6e 6e 65 72 | 20 3d 20 66 61 6c 73 65 |= winner| = false|
|000008e0| 3b 09 09 09 09 09 09 09 | 09 09 09 0d 09 66 6f 72 |;.......|.....for|
|000008f0| 20 28 70 20 3d 20 2a 67 | 72 69 64 2c 20 69 78 20 | (p = *g|rid, ix |
|00000900| 3d 20 78 73 69 7a 65 2a | 79 73 69 7a 65 3b 20 69 |= xsize*|ysize; i|
|00000910| 78 3b 20 70 2b 2b 2c 20 | 69 78 2d 2d 29 20 2a 70 |x; p++, |ix--) *p|
|00000920| 20 3d 20 65 6d 70 74 79 | 3b 09 09 09 2f 2f 20 63 | = empty|;...// c|
|00000930| 6c 65 61 72 20 74 68 65 | 20 67 72 69 64 0d 7d 0d |lear the| grid.}.|
|00000940| 0d 2f 2f 20 43 61 6c 6c | 65 64 20 77 68 65 6e 20 |.// Call|ed when |
|00000950| 66 61 64 65 72 20 69 73 | 20 73 74 61 72 74 69 6e |fader is| startin|
|00000960| 67 20 75 70 2c 20 62 65 | 66 6f 72 65 20 77 69 6e |g up, be|fore win|
|00000970| 64 6f 77 20 68 61 73 20 | 62 65 65 6e 20 63 72 65 |dow has |been cre|
|00000980| 61 74 65 64 2e 0d 2f 2f | 20 57 65 20 69 6e 69 74 |ated..//| We init|
|00000990| 69 61 6c 69 7a 65 20 6f | 75 72 20 67 6c 6f 62 61 |ialize o|ur globa|
|000009a0| 6c 20 76 61 72 69 61 62 | 6c 65 73 20 68 65 72 65 |l variab|les here|
|000009b0| 2e 0d 0d 4f 53 45 72 72 | 09 50 72 65 66 6c 69 67 |...OSErr|.Preflig|
|000009c0| 68 74 46 61 64 65 72 28 | 4d 61 63 68 69 6e 65 49 |htFader(|MachineI|
|000009d0| 6e 66 6f 50 74 72 20 6d | 61 63 68 69 6e 65 49 6e |nfoPtr m|achineIn|
|000009e0| 66 6f 2c 20 6c 6f 6e 67 | 20 2a 6d 69 6e 54 69 63 |fo, long| *minTic|
|000009f0| 6b 73 2c 20 6c 6f 6e 67 | 20 2a 6d 61 78 54 69 63 |ks, long| *maxTic|
|00000a00| 6b 73 29 0d 7b 09 0d 09 | 52 65 63 74 09 09 62 6f |ks).{...|Rect..bo|
|00000a10| 75 6e 64 73 3b 0d 09 6c | 6f 6e 67 09 09 67 72 69 |unds;..l|ong..gri|
|00000a20| 64 73 69 7a 65 3b 0d 09 | 73 68 6f 72 74 09 61 2c |dsize;..|short.a,|
|00000a30| 20 62 3b 0d 09 0d 09 2a | 6d 69 6e 54 69 63 6b 73 | b;....*|minTicks|
|00000a40| 20 3d 20 31 3b 09 09 09 | 09 09 09 09 09 09 2f 2f | = 1;...|......//|
|00000a50| 20 54 65 6c 6c 20 44 61 | 72 6b 53 69 64 65 20 68 | Tell Da|rkSide h|
|00000a60| 6f 77 20 6f 66 74 65 6e | 20 77 65 20 77 61 6e 74 |ow often| we want|
|00000a70| 20 74 6f 20 62 65 20 63 | 61 6c 6c 65 64 2e 0d 09 | to be c|alled...|
|00000a80| 2a 6d 61 78 54 69 63 6b | 73 20 3d 20 31 35 3b 0d |*maxTick|s = 15;.|
|00000a90| 09 0d 09 42 6c 6f 63 6b | 4d 6f 76 65 28 6d 61 63 |...Block|Move(mac|
|00000aa0| 68 69 6e 65 49 6e 66 6f | 2d 3e 61 70 70 6c 69 63 |hineInfo|->applic|
|00000ab0| 61 74 69 6f 6e 51 44 2c | 20 26 71 64 2c 20 73 69 |ationQD,| &qd, si|
|00000ac0| 7a 65 6f 66 28 71 64 29 | 29 3b 0d 09 0d 09 2f 2f |zeof(qd)|);....//|
|00000ad0| 20 54 68 65 20 72 65 73 | 74 20 69 73 20 73 70 65 | The res|t is spe|
|00000ae0| 63 69 66 69 63 20 74 6f | 20 4d 6f 72 70 69 6f 6e |cific to| Morpion|
|00000af0| 2e 0d 09 0d 09 75 6e 69 | 74 20 3d 20 6d 61 63 68 |.....uni|t = mach|
|00000b00| 69 6e 65 49 6e 66 6f 2d | 3e 66 61 64 65 72 53 65 |ineInfo-|>faderSe|
|00000b10| 74 74 69 6e 67 73 2d 3e | 74 68 65 53 68 6f 72 74 |ttings->|theShort|
|00000b20| 73 5b 31 5d 3b 09 09 09 | 09 09 2f 2f 20 72 65 61 |s[1];...|..// rea|
|00000b30| 64 20 74 68 65 20 73 65 | 74 74 69 6e 67 73 0d 09 |d the se|ttings..|
|00000b40| 62 6f 75 6e 64 73 20 3d | 20 6d 61 63 68 69 6e 65 |bounds =| machine|
|00000b50| 49 6e 66 6f 2d 3e 74 68 | 65 53 63 72 65 65 6e 73 |Info->th|eScreens|
|00000b60| 5b 30 5d 2e 62 6f 75 6e | 64 73 3b 09 09 09 09 09 |[0].boun|ds;.....|
|00000b70| 09 2f 2f 20 63 6f 6d 70 | 75 74 65 20 74 68 65 20 |.// comp|ute the |
|00000b80| 73 69 7a 65 20 6f 66 20 | 6f 75 72 20 67 72 69 64 |size of |our grid|
|00000b90| 0d 09 78 6c 6f 63 20 3d | 20 62 6f 75 6e 64 73 2e |..xloc =| bounds.|
|00000ba0| 6c 65 66 74 3b 0d 09 79 | 6c 6f 63 20 3d 20 62 6f |left;..y|loc = bo|
|00000bb0| 75 6e 64 73 2e 74 6f 70 | 3b 0d 09 78 73 69 7a 65 |unds.top|;..xsize|
|00000bc0| 20 3d 20 28 62 6f 75 6e | 64 73 2e 72 69 67 68 74 | = (boun|ds.right|
|00000bd0| 20 2d 20 62 6f 75 6e 64 | 73 2e 6c 65 66 74 20 2d | - bound|s.left -|
|00000be0| 20 36 20 2a 20 75 6e 69 | 74 29 20 2f 20 75 6e 69 | 6 * uni|t) / uni|
|00000bf0| 74 3b 0d 09 79 73 69 7a | 65 20 3d 20 28 62 6f 75 |t;..ysiz|e = (bou|
|00000c00| 6e 64 73 2e 62 6f 74 74 | 6f 6d 20 2d 20 62 6f 75 |nds.bott|om - bou|
|00000c10| 6e 64 73 2e 74 6f 70 20 | 2d 20 36 20 2a 20 75 6e |nds.top |- 6 * un|
|00000c20| 69 74 29 20 2f 20 75 6e | 69 74 3b 0d 09 78 63 20 |it) / un|it;..xc |
|00000c30| 3d 20 62 6f 75 6e 64 73 | 2e 6c 65 66 74 20 2b 20 |= bounds|.left + |
|00000c40| 28 62 6f 75 6e 64 73 2e | 72 69 67 68 74 20 2d 20 |(bounds.|right - |
|00000c50| 62 6f 75 6e 64 73 2e 6c | 65 66 74 20 2d 20 75 6e |bounds.l|eft - un|
|00000c60| 69 74 20 2a 20 78 73 69 | 7a 65 29 20 2f 20 32 3b |it * xsi|ze) / 2;|
|00000c70| 0d 09 79 63 20 3d 20 62 | 6f 75 6e 64 73 2e 74 6f |..yc = b|ounds.to|
|00000c80| 70 20 2b 20 28 62 6f 75 | 6e 64 73 2e 62 6f 74 74 |p + (bou|nds.bott|
|00000c90| 6f 6d 20 2d 20 62 6f 75 | 6e 64 73 2e 74 6f 70 20 |om - bou|nds.top |
|00000ca0| 2d 20 75 6e 69 74 20 2a | 20 79 73 69 7a 65 29 20 |- unit *| ysize) |
|00000cb0| 2f 20 32 3b 0d 09 0d 09 | 67 72 69 64 20 3d 20 42 |/ 2;....|grid = B|
|00000cc0| 65 73 74 4e 65 77 48 61 | 6e 64 6c 65 20 28 67 72 |estNewHa|ndle (gr|
|00000cd0| 69 64 73 69 7a 65 20 3d | 20 78 73 69 7a 65 20 2a |idsize =| xsize *|
|00000ce0| 20 79 73 69 7a 65 29 3b | 0d 09 69 66 20 28 21 28 | ysize);|..if (!(|
|00000cf0| 67 72 69 64 29 29 09 09 | 09 09 2f 2f 20 61 6c 6c |grid))..|..// all|
|00000d00| 6f 63 61 74 65 20 6d 65 | 6d 6f 72 79 20 66 6f 72 |ocate me|mory for|
|00000d10| 20 74 68 65 20 67 72 69 | 64 0d 09 09 72 65 74 75 | the gri|d...retu|
|00000d20| 72 6e 20 6d 65 6d 46 75 | 6c 6c 45 72 72 3b 0d 09 |rn memFu|llErr;..|
|00000d30| 70 6f 73 73 69 62 6c 65 | 20 3d 20 42 65 73 74 4e |possible| = BestN|
|00000d40| 65 77 48 61 6e 64 6c 65 | 20 28 34 2a 67 72 69 64 |ewHandle| (4*grid|
|00000d50| 73 69 7a 65 29 3b 0d 09 | 69 66 20 28 21 28 70 6f |size);..|if (!(po|
|00000d60| 73 73 69 62 6c 65 29 29 | 20 7b 09 09 09 09 09 09 |ssible))| {......|
|00000d70| 2f 2f 20 61 6c 6c 6f 63 | 61 74 65 20 6d 65 6d 6f |// alloc|ate memo|
|00000d80| 72 79 20 66 6f 72 20 74 | 68 65 20 27 70 6f 73 73 |ry for t|he 'poss|
|00000d90| 69 62 6c 65 27 20 61 72 | 72 61 79 0d 09 09 44 69 |ible' ar|ray...Di|
|00000da0| 73 70 6f 73 48 61 6e 64 | 6c 65 28 67 72 69 64 29 |sposHand|le(grid)|
|00000db0| 3b 0d 09 09 72 65 74 75 | 72 6e 20 6d 65 6d 46 75 |;...retu|rn memFu|
|00000dc0| 6c 6c 45 72 72 3b 0d 09 | 7d 0d 09 70 6f 69 6e 74 |llErr;..|}..point|
|00000dd0| 73 20 3d 20 42 65 73 74 | 4e 65 77 48 61 6e 64 6c |s = Best|NewHandl|
|00000de0| 65 20 28 32 2a 67 72 69 | 64 73 69 7a 65 29 3b 0d |e (2*gri|dsize);.|
|00000df0| 09 69 66 20 28 21 28 70 | 6f 69 6e 74 73 29 29 09 |.if (!(p|oints)).|
|00000e00| 7b 09 09 09 09 09 2f 2f | 20 61 6c 6c 6f 63 61 74 |{.....//| allocat|
|00000e10| 65 20 6d 65 6d 6f 72 79 | 20 66 6f 72 20 74 68 65 |e memory| for the|
|00000e20| 20 27 70 6f 69 6e 74 73 | 27 20 61 72 72 61 79 0d | 'points|' array.|
|00000e30| 09 09 44 69 73 70 6f 73 | 48 61 6e 64 6c 65 28 70 |..Dispos|Handle(p|
|00000e40| 6f 73 73 69 62 6c 65 29 | 3b 0d 09 09 44 69 73 70 |ossible)|;...Disp|
|00000e50| 6f 73 48 61 6e 64 6c 65 | 28 67 72 69 64 29 3b 0d |osHandle|(grid);.|
|00000e60| 09 09 72 65 74 75 72 6e | 20 6d 65 6d 46 75 6c 6c |..return| memFull|
|00000e70| 45 72 72 3b 0d 09 7d 0d | 09 0d 09 66 6f 72 20 28 |Err;..}.|...for (|
|00000e80| 61 20 3d 20 30 3b 20 61 | 20 3c 20 35 3b 20 61 2b |a = 0; a| < 5; a+|
|00000e90| 2b 29 09 09 09 09 09 09 | 09 09 09 09 2f 2f 20 69 |+)......|....// i|
|00000ea0| 6e 69 74 69 61 6c 69 7a | 65 20 74 68 65 20 27 76 |nitializ|e the 'v|
|00000eb0| 61 6c 75 65 27 20 61 72 | 72 61 79 0d 09 09 66 6f |alue' ar|ray...fo|
|00000ec0| 72 20 28 62 20 3d 20 30 | 3b 20 62 20 3c 20 35 3b |r (b = 0|; b < 5;|
|00000ed0| 20 62 2b 2b 29 0d 09 09 | 09 76 61 6c 75 65 20 5b | b++)...|.value [|
|00000ee0| 61 5d 5b 62 5d 20 3d 20 | 30 3b 0d 09 76 61 6c 75 |a][b] = |0;..valu|
|00000ef0| 65 20 5b 30 5d 5b 30 5d | 20 3d 20 31 30 3b 20 76 |e [0][0]| = 10; v|
|00000f00| 61 6c 75 65 20 5b 30 5d | 5b 31 5d 20 3d 20 32 30 |alue [0]|[1] = 20|
|00000f10| 3b 20 76 61 6c 75 65 20 | 5b 30 5d 5b 32 5d 20 3d |; value |[0][2] =|
|00000f20| 20 38 30 3b 20 76 61 6c | 75 65 20 5b 30 5d 5b 33 | 80; val|ue [0][3|
|00000f30| 5d 20 3d 20 33 30 30 3b | 20 76 61 6c 75 65 20 5b |] = 300;| value [|
|00000f40| 30 5d 5b 34 5d 20 3d 20 | 32 30 30 30 3b 0d 09 76 |0][4] = |2000;..v|
|00000f50| 61 6c 75 65 20 5b 31 5d | 5b 30 5d 20 3d 20 32 30 |alue [1]|[0] = 20|
|00000f60| 3b 20 76 61 6c 75 65 20 | 5b 32 5d 5b 30 5d 20 3d |; value |[2][0] =|
|00000f70| 20 37 30 3b 20 76 61 6c | 75 65 20 5b 33 5d 5b 30 | 70; val|ue [3][0|
|00000f80| 5d 20 3d 20 34 30 30 3b | 20 76 61 6c 75 65 20 5b |] = 400;| value [|
|00000f90| 34 5d 5b 30 5d 20 3d 20 | 34 30 30 30 3b 0d 09 0d |4][0] = |4000;...|
|00000fa0| 09 53 74 61 72 74 47 61 | 6d 65 28 29 3b 0d 0d 09 |.StartGa|me();...|
|00000fb0| 72 65 74 75 72 6e 20 6e | 6f 45 72 72 3b 0d 7d 0d |return n|oErr;.}.|
|00000fc0| 0d 2f 2f 20 43 61 6c 6c | 65 64 20 77 68 65 6e 20 |.// Call|ed when |
|00000fd0| 66 61 64 65 72 20 69 73 | 20 73 74 61 72 74 69 6e |fader is| startin|
|00000fe0| 67 20 75 70 2c 20 61 66 | 74 65 72 20 77 69 6e 64 |g up, af|ter wind|
|00000ff0| 6f 77 20 68 61 73 20 62 | 65 65 6e 20 63 72 65 61 |ow has b|een crea|
|00001000| 74 65 64 2e 20 57 65 20 | 75 73 75 61 6c 6c 79 20 |ted. We |usually |
|00001010| 65 72 61 73 65 20 74 68 | 65 20 73 63 72 65 65 6e |erase th|e screen|
|00001020| 73 20 68 65 72 65 2e 0d | 2f 2f 20 57 65 20 74 68 |s here..|// We th|
|00001030| 65 6e 20 64 72 61 77 20 | 74 68 65 20 67 72 69 64 |en draw |the grid|
|00001040| 2e 0d 0d 4f 53 45 72 72 | 09 49 6e 69 74 69 61 6c |...OSErr|.Initial|
|00001050| 69 7a 65 46 61 64 65 72 | 28 4d 61 63 68 69 6e 65 |izeFader|(Machine|
|00001060| 49 6e 66 6f 50 74 72 20 | 6d 61 63 68 69 6e 65 49 |InfoPtr |machineI|
|00001070| 6e 66 6f 29 0d 7b 0d 09 | 73 68 6f 72 74 09 09 73 |nfo).{..|short..s|
|00001080| 63 72 65 65 6e 49 6e 64 | 65 78 3b 0d 09 73 68 6f |creenInd|ex;..sho|
|00001090| 72 74 09 09 69 78 3b 0d | 0d 09 2f 2f 20 73 74 6f |rt..ix;.|..// sto|
|000010a0| 72 65 20 74 68 65 20 6c | 6f 63 61 6c 20 63 6f 6f |re the l|ocal coo|
|000010b0| 72 64 69 6e 61 74 65 73 | 20 6f 66 20 6f 75 72 20 |rdinates| of our |
|000010c0| 77 69 6e 64 6f 77 73 0d | 09 78 6c 6f 63 20 3d 20 |windows.|.xloc = |
|000010d0| 6d 61 63 68 69 6e 65 49 | 6e 66 6f 2d 3e 74 68 65 |machineI|nfo->the|
|000010e0| 53 63 72 65 65 6e 73 5b | 30 5d 2e 62 6f 75 6e 64 |Screens[|0].bound|
|000010f0| 73 2e 6c 65 66 74 3b 0d | 09 79 6c 6f 63 20 3d 20 |s.left;.|.yloc = |
|00001100| 6d 61 63 68 69 6e 65 49 | 6e 66 6f 2d 3e 74 68 65 |machineI|nfo->the|
|00001110| 53 63 72 65 65 6e 73 5b | 30 5d 2e 62 6f 75 6e 64 |Screens[|0].bound|
|00001120| 73 2e 74 6f 70 3b 0d 0d | 09 50 65 6e 50 61 74 28 |s.top;..|.PenPat(|
|00001130| 51 55 49 43 4b 44 52 41 | 57 42 4c 41 43 4b 29 3b |QUICKDRA|WBLACK);|
|00001140| 09 09 09 09 09 09 09 09 | 09 09 09 2f 2f 20 65 72 |........|...// er|
|00001150| 61 73 65 20 74 68 65 20 | 73 63 72 65 65 6e 73 2e |ase the |screens.|
|00001160| 0d 09 66 6f 72 20 28 73 | 63 72 65 65 6e 49 6e 64 |..for (s|creenInd|
|00001170| 65 78 20 3d 20 30 3b 20 | 73 63 72 65 65 6e 49 6e |ex = 0; |screenIn|
|00001180| 64 65 78 20 3c 20 6d 61 | 63 68 69 6e 65 49 6e 66 |dex < ma|chineInf|
|00001190| 6f 2d 3e 6e 75 6d 53 63 | 72 65 65 6e 73 3b 20 73 |o->numSc|reens; s|
|000011a0| 63 72 65 65 6e 49 6e 64 | 65 78 2b 2b 29 20 0d 09 |creenInd|ex++) ..|
|000011b0| 09 50 61 69 6e 74 52 65 | 63 74 28 26 6d 61 63 68 |.PaintRe|ct(&mach|
|000011c0| 69 6e 65 49 6e 66 6f 2d | 3e 74 68 65 53 63 72 65 |ineInfo-|>theScre|
|000011d0| 65 6e 73 5b 73 63 72 65 | 65 6e 49 6e 64 65 78 5d |ens[scre|enIndex]|
|000011e0| 2e 62 6f 75 6e 64 73 29 | 3b 0d 09 09 0d 09 50 65 |.bounds)|;.....Pe|
|000011f0| 6e 50 61 74 28 51 55 49 | 43 4b 44 52 41 57 57 48 |nPat(QUI|CKDRAWWH|
|00001200| 49 54 45 29 3b 09 09 09 | 09 09 09 09 09 09 09 09 |ITE);...|........|
|00001210| 2f 2f 20 64 72 61 77 20 | 74 68 65 20 67 72 69 64 |// draw |the grid|
|00001220| 2e 0d 09 53 65 74 4f 72 | 69 67 69 6e 28 2d 78 6c |...SetOr|igin(-xl|
|00001230| 6f 63 2c 20 2d 79 6c 6f | 63 29 3b 0d 09 66 6f 72 |oc, -ylo|c);..for|
|00001240| 20 28 69 78 20 3d 20 30 | 3b 20 69 78 20 3c 3d 20 | (ix = 0|; ix <= |
|00001250| 78 73 69 7a 65 3b 20 69 | 78 2b 2b 29 20 7b 0d 09 |xsize; i|x++) {..|
|00001260| 09 4d 6f 76 65 54 6f 20 | 28 78 63 20 2b 20 69 78 |.MoveTo |(xc + ix|
|00001270| 20 2a 20 75 6e 69 74 2c | 20 79 63 29 3b 0d 09 09 | * unit,| yc);...|
|00001280| 4c 69 6e 65 20 28 30 2c | 20 75 6e 69 74 20 2a 20 |Line (0,| unit * |
|00001290| 79 73 69 7a 65 29 3b 0d | 09 7d 0d 09 66 6f 72 20 |ysize);.|.}..for |
|000012a0| 28 69 78 20 3d 20 30 3b | 20 69 78 20 3c 3d 20 79 |(ix = 0;| ix <= y|
|000012b0| 73 69 7a 65 3b 20 69 78 | 2b 2b 29 20 7b 0d 09 09 |size; ix|++) {...|
|000012c0| 4d 6f 76 65 54 6f 20 28 | 78 63 2c 20 79 63 20 2b |MoveTo (|xc, yc +|
|000012d0| 20 69 78 20 2a 20 75 6e | 69 74 29 3b 0d 09 09 4c | ix * un|it);...L|
|000012e0| 69 6e 65 20 28 75 6e 69 | 74 20 2a 20 78 73 69 7a |ine (uni|t * xsiz|
|000012f0| 65 2c 20 30 29 3b 0d 09 | 7d 0d 09 53 65 74 4f 72 |e, 0);..|}..SetOr|
|00001300| 69 67 69 6e 28 30 2c 20 | 30 29 3b 0d 09 0d 09 6e |igin(0, |0);....n|
|00001310| 65 78 74 44 72 61 77 20 | 3d 20 30 3b 0d 09 0d 09 |extDraw |= 0;....|
|00001320| 72 65 74 75 72 6e 20 6e | 6f 45 72 72 3b 0d 7d 0d |return n|oErr;.}.|
|00001330| 0d 2f 2f 20 54 68 65 20 | 44 6f 52 6f 77 20 61 6e |.// The |DoRow an|
|00001340| 64 20 50 6c 61 79 20 72 | 6f 75 74 69 6e 65 73 20 |d Play r|outines |
|00001350| 61 72 65 20 4d 6f 72 70 | 69 6f 6e 27 73 20 49 41 |are Morp|ion's IA|
|00001360| 2e 20 54 68 65 79 20 61 | 72 65 20 6e 6f 74 20 70 |. They a|re not p|
|00001370| 61 72 74 20 6f 66 20 74 | 68 65 20 66 61 64 65 72 |art of t|he fader|
|00001380| 27 73 20 69 6e 74 65 72 | 66 61 63 65 20 77 69 74 |'s inter|face wit|
|00001390| 68 20 44 61 72 6b 53 69 | 64 65 2e 0d 0d 76 6f 69 |h DarkSi|de...voi|
|000013a0| 64 20 44 6f 52 6f 77 20 | 28 73 68 6f 72 74 20 62 |d DoRow |(short b|
|000013b0| 78 2c 20 73 68 6f 72 74 | 20 62 79 2c 20 73 68 6f |x, short| by, sho|
|000013c0| 72 74 20 64 78 2c 20 73 | 68 6f 72 74 20 64 79 29 |rt dx, s|hort dy)|
|000013d0| 0d 7b 0d 09 73 68 6f 72 | 74 20 09 69 3b 0d 09 73 |.{..shor|t .i;..s|
|000013e0| 68 6f 72 74 20 09 78 2c | 20 79 3b 0d 09 73 68 6f |hort .x,| y;..sho|
|000013f0| 72 74 20 09 6e 66 72 69 | 65 6e 64 2c 20 6e 65 6e |rt .nfri|end, nen|
|00001400| 65 6d 79 3b 0d 09 63 68 | 61 72 09 67 3b 0d 09 0d |emy;..ch|ar.g;...|
|00001410| 09 66 6f 72 20 28 6e 66 | 72 69 65 6e 64 20 3d 20 |.for (nf|riend = |
|00001420| 6e 65 6e 65 6d 79 20 3d | 20 30 2c 20 78 20 3d 20 |nenemy =| 0, x = |
|00001430| 62 78 2c 20 79 20 3d 20 | 62 79 2c 20 69 20 3d 20 |bx, y = |by, i = |
|00001440| 35 3b 20 69 3b 20 78 20 | 2b 3d 20 64 78 2c 20 79 |5; i; x |+= dx, y|
|00001450| 20 2b 3d 20 64 79 2c 20 | 69 2d 2d 29 20 7b 0d 09 | += dy, |i--) {..|
|00001460| 09 69 66 20 28 28 67 20 | 3d 20 47 72 69 64 28 78 |.if ((g |= Grid(x|
|00001470| 2c 20 79 29 29 20 3d 3d | 20 74 75 72 6e 29 09 09 |, y)) ==| turn)..|
|00001480| 09 09 09 09 09 09 2f 2f | 20 63 6f 75 6e 74 20 68 |......//| count h|
|00001490| 6f 77 20 6d 61 6e 79 20 | 65 6e 65 6d 79 2f 66 72 |ow many |enemy/fr|
|000014a0| 69 65 6e 64 6c 79 20 6d | 61 72 6b 65 72 73 0d 09 |iendly m|arkers..|
|000014b0| 09 09 6e 66 72 69 65 6e | 64 2b 2b 3b 09 09 09 09 |..nfrien|d++;....|
|000014c0| 09 09 09 09 09 09 2f 2f | 20 61 72 65 20 70 72 65 |......//| are pre|
|000014d0| 73 65 6e 74 20 69 6e 20 | 74 68 6f 73 65 20 66 69 |sent in |those fi|
|000014e0| 76 65 20 73 71 75 61 72 | 65 73 0d 09 09 65 6c 73 |ve squar|es...els|
|000014f0| 65 20 69 66 20 28 67 20 | 21 3d 20 65 6d 70 74 79 |e if (g |!= empty|
|00001500| 29 0d 09 09 09 6e 65 6e | 65 6d 79 2b 2b 3b 0d 09 |)....nen|emy++;..|
|00001510| 7d 0d 09 0d 09 66 6f 72 | 20 28 78 20 3d 20 62 78 |}....for| (x = bx|
|00001520| 2c 20 79 20 3d 20 62 79 | 2c 20 69 20 3d 20 35 3b |, y = by|, i = 5;|
|00001530| 20 69 3b 20 78 20 2b 3d | 20 64 78 2c 20 79 20 2b | i; x +=| dx, y +|
|00001540| 3d 20 64 79 2c 20 69 2d | 2d 29 09 09 09 09 09 2f |= dy, i-|-)...../|
|00001550| 2f 20 69 6e 63 72 65 6d | 65 6e 74 20 74 68 65 20 |/ increm|ent the |
|00001560| 73 74 72 61 74 65 67 69 | 63 20 76 61 6c 75 65 20 |strategi|c value |
|00001570| 6f 66 20 74 68 65 20 66 | 72 65 65 20 73 71 75 61 |of the f|ree squa|
|00001580| 72 65 73 0d 09 09 69 66 | 20 28 47 72 69 64 28 78 |res...if| (Grid(x|
|00001590| 2c 20 79 29 20 3d 3d 20 | 65 6d 70 74 79 29 09 09 |, y) == |empty)..|
|000015a0| 09 09 09 09 09 09 09 2f | 2f 20 64 65 70 65 6e 64 |......./|/ depend|
|000015b0| 69 6e 67 20 6f 6e 20 6e | 65 6e 65 6d 79 20 61 6e |ing on n|enemy an|
|000015c0| 64 20 6e 66 72 69 65 6e | 64 6c 79 0d 09 09 09 50 |d nfrien|dly....P|
|000015d0| 6f 69 6e 74 73 28 78 2c | 20 79 29 20 2b 3d 20 76 |oints(x,| y) += v|
|000015e0| 61 6c 75 65 20 5b 6e 66 | 72 69 65 6e 64 5d 5b 6e |alue [nf|riend][n|
|000015f0| 65 6e 65 6d 79 5d 3b 0d | 7d 0d 0d 50 6f 69 6e 74 |enemy];.|}..Point|
|00001600| 20 50 6c 61 79 20 28 76 | 6f 69 64 29 0d 7b 0d 09 | Play (v|oid).{..|
|00001610| 73 68 6f 72 74 09 69 78 | 2c 20 69 79 2c 20 6e 70 |short.ix|, iy, np|
|00001620| 6f 73 2c 20 6d 61 78 2c | 20 6e 2c 20 70 3b 0d 09 |os, max,| n, p;..|
|00001630| 50 6f 69 6e 74 09 7a 65 | 72 6f 3b 0d 09 0d 09 7a |Point.ze|ro;....z|
|00001640| 65 72 6f 2e 68 20 3d 20 | 7a 65 72 6f 2e 76 20 3d |ero.h = |zero.v =|
|00001650| 20 30 3b 0d 09 66 6f 72 | 20 28 69 78 20 3d 20 30 | 0;..for| (ix = 0|
|00001660| 3b 20 69 78 20 3c 20 78 | 73 69 7a 65 3b 20 69 78 |; ix < x|size; ix|
|00001670| 2b 2b 29 09 09 09 09 09 | 09 09 09 09 2f 2f 20 4f |++).....|....// O|
|00001680| 6e 6c 79 20 61 6c 6c 6f | 77 20 65 6d 70 74 79 20 |nly allo|w empty |
|00001690| 73 70 6f 74 73 20 74 6f | 20 62 65 20 70 6c 61 79 |spots to| be play|
|000016a0| 65 64 0d 09 09 66 6f 72 | 20 28 69 79 20 3d 20 30 |ed...for| (iy = 0|
|000016b0| 3b 20 69 79 20 3c 20 79 | 73 69 7a 65 3b 20 69 79 |; iy < y|size; iy|
|000016c0| 2b 2b 29 0d 09 09 09 50 | 6f 69 6e 74 73 28 69 78 |++)....P|oints(ix|
|000016d0| 2c 20 69 79 29 20 3d 20 | 47 72 69 64 28 69 78 2c |, iy) = |Grid(ix,|
|000016e0| 20 69 79 29 20 3d 3d 20 | 65 6d 70 74 79 20 3f 20 | iy) == |empty ? |
|000016f0| 30 20 3a 20 2d 31 3b 0d | 09 09 09 09 0d 09 66 6f |0 : -1;.|......fo|
|00001700| 72 20 28 69 78 20 3d 20 | 30 3b 20 69 78 20 3c 20 |r (ix = |0; ix < |
|00001710| 78 73 69 7a 65 2d 34 3b | 20 69 78 2b 2b 29 09 09 |xsize-4;| ix++)..|
|00001720| 09 09 09 09 09 09 09 2f | 2f 20 57 61 6c 6b 20 74 |......./|/ Walk t|
|00001730| 68 65 20 77 68 6f 6c 65 | 20 67 72 69 64 2c 20 67 |he whole| grid, g|
|00001740| 69 76 69 6e 67 20 6d 6f | 72 65 20 70 6f 69 6e 74 |iving mo|re point|
|00001750| 73 20 74 6f 20 65 61 63 | 68 0d 09 09 66 6f 72 20 |s to eac|h...for |
|00001760| 28 69 79 20 3d 20 30 3b | 20 69 79 20 3c 20 79 73 |(iy = 0;| iy < ys|
|00001770| 69 7a 65 3b 20 69 79 2b | 2b 29 09 09 09 09 09 09 |ize; iy+|+)......|
|00001780| 09 09 2f 2f 20 69 6e 74 | 65 72 65 73 74 69 6e 67 |..// int|eresting|
|00001790| 20 73 70 6f 74 0d 09 09 | 09 44 6f 52 6f 77 20 28 | spot...|.DoRow (|
|000017a0| 69 78 2c 20 69 79 2c 20 | 31 2c 20 30 29 3b 0d 09 |ix, iy, |1, 0);..|
|000017b0| 66 6f 72 20 28 69 78 20 | 3d 20 30 3b 20 69 78 20 |for (ix |= 0; ix |
|000017c0| 3c 20 78 73 69 7a 65 3b | 20 69 78 2b 2b 29 0d 09 |< xsize;| ix++)..|
|000017d0| 09 66 6f 72 20 28 69 79 | 20 3d 20 30 3b 20 69 79 |.for (iy| = 0; iy|
|000017e0| 20 3c 20 79 73 69 7a 65 | 2d 34 3b 20 69 79 2b 2b | < ysize|-4; iy++|
|000017f0| 29 0d 09 09 09 44 6f 52 | 6f 77 20 28 69 78 2c 20 |)....DoR|ow (ix, |
|00001800| 69 79 2c 20 30 2c 20 31 | 29 3b 0d 09 66 6f 72 20 |iy, 0, 1|);..for |
|00001810| 28 69 78 20 3d 20 30 3b | 20 69 78 20 3c 20 78 73 |(ix = 0;| ix < xs|
|00001820| 69 7a 65 2d 34 3b 20 69 | 78 2b 2b 29 0d 09 09 66 |ize-4; i|x++)...f|
|00001830| 6f 72 20 28 69 79 20 3d | 20 30 3b 20 69 79 20 3c |or (iy =| 0; iy <|
|00001840| 20 79 73 69 7a 65 2d 34 | 3b 20 69 79 2b 2b 29 0d | ysize-4|; iy++).|
|00001850| 09 09 09 44 6f 52 6f 77 | 20 28 69 78 2c 20 69 79 |...DoRow| (ix, iy|
|00001860| 2c 20 31 2c 20 31 29 3b | 0d 09 66 6f 72 20 28 69 |, 1, 1);|..for (i|
|00001870| 78 20 3d 20 30 3b 20 69 | 78 20 3c 20 78 73 69 7a |x = 0; i|x < xsiz|
|00001880| 65 2d 34 3b 20 69 78 2b | 2b 29 0d 09 09 66 6f 72 |e-4; ix+|+)...for|
|00001890| 20 28 69 79 20 3d 20 34 | 3b 20 69 79 20 3c 20 79 | (iy = 4|; iy < y|
|000018a0| 73 69 7a 65 3b 20 69 79 | 2b 2b 29 0d 09 09 09 44 |size; iy|++)....D|
|000018b0| 6f 52 6f 77 20 28 69 78 | 2c 20 69 79 2c 20 31 2c |oRow (ix|, iy, 1,|
|000018c0| 20 2d 31 29 3b 0d 0d 09 | 66 6f 72 20 28 6e 70 6f | -1);...|for (npo|
|000018d0| 73 20 3d 20 30 2c 20 6d | 61 78 20 3d 20 2d 31 2c |s = 0, m|ax = -1,|
|000018e0| 20 69 78 20 3d 20 30 3b | 20 69 78 20 3c 20 78 73 | ix = 0;| ix < xs|
|000018f0| 69 7a 65 3b 20 69 78 2b | 2b 29 09 09 09 09 09 2f |ize; ix+|+)...../|
|00001900| 2f 20 4c 6f 6f 6b 20 66 | 6f 72 20 74 68 65 20 6d |/ Look f|or the m|
|00001910| 6f 73 74 20 69 6e 74 65 | 72 65 73 74 69 6e 67 20 |ost inte|resting |
|00001920| 73 70 6f 74 0d 09 09 66 | 6f 72 20 28 69 79 20 3d |spot...f|or (iy =|
|00001930| 20 30 3b 20 69 79 20 3c | 20 79 73 69 7a 65 3b 20 | 0; iy <| ysize; |
|00001940| 69 79 2b 2b 29 20 7b 0d | 09 09 09 70 20 3d 20 50 |iy++) {.|...p = P|
|00001950| 6f 69 6e 74 73 28 69 78 | 2c 20 69 79 29 3b 0d 09 |oints(ix|, iy);..|
|00001960| 09 09 69 66 20 28 70 20 | 3e 20 6d 61 78 29 20 7b |..if (p |> max) {|
|00001970| 09 09 09 09 09 09 09 09 | 09 09 2f 2f 20 49 66 20 |........|..// If |
|00001980| 74 68 69 73 20 73 71 75 | 61 72 65 20 69 73 20 6d |this squ|are is m|
|00001990| 6f 72 65 20 69 6e 74 65 | 72 65 73 74 69 6e 67 20 |ore inte|resting |
|000019a0| 74 68 61 6e 20 61 6c 6c | 20 74 68 6f 73 65 0d 09 |than all| those..|
|000019b0| 09 09 09 6d 61 78 20 3d | 20 70 3b 20 6e 70 6f 73 |...max =| p; npos|
|000019c0| 20 3d 20 31 3b 09 09 09 | 09 09 09 09 09 2f 2f 20 | = 1;...|.....// |
|000019d0| 70 72 65 76 69 6f 75 73 | 6c 79 20 76 69 73 69 74 |previous|ly visit|
|000019e0| 65 64 2c 20 66 6f 72 67 | 65 74 20 61 62 6f 75 74 |ed, forg|et about|
|000019f0| 20 74 68 65 6d 0d 09 09 | 09 09 50 6f 73 73 69 62 | them...|..Possib|
|00001a00| 6c 65 20 28 30 29 2e 68 | 20 3d 20 69 78 3b 0d 09 |le (0).h| = ix;..|
|00001a10| 09 09 09 50 6f 73 73 69 | 62 6c 65 20 28 30 29 2e |...Possi|ble (0).|
|00001a20| 76 20 3d 20 69 79 3b 0d | 09 09 09 7d 0d 09 09 09 |v = iy;.|...}....|
|00001a30| 65 6c 73 65 20 69 66 20 | 28 70 20 3d 3d 20 6d 61 |else if |(p == ma|
|00001a40| 78 29 20 7b 09 09 09 09 | 09 09 09 09 09 2f 2f 20 |x) {....|.....// |
|00001a50| 49 66 20 69 74 20 69 73 | 20 65 71 75 61 6c 6c 79 |If it is| equally|
|00001a60| 20 69 6e 74 65 72 65 73 | 74 69 6e 67 20 74 68 61 | interes|ting tha|
|00001a70| 6e 20 74 68 65 20 62 65 | 73 74 20 70 72 65 76 69 |n the be|st previ|
|00001a80| 6f 75 73 6c 79 0d 09 09 | 09 09 6e 70 6f 73 2b 2b |ously...|..npos++|
|00001a90| 3b 09 09 09 09 09 09 09 | 09 09 09 2f 2f 20 76 69 |;.......|...// vi|
|00001aa0| 73 69 74 65 64 20 73 71 | 75 61 72 65 73 2c 20 61 |sited sq|uares, a|
|00001ab0| 64 64 20 69 74 20 74 6f | 20 74 68 65 20 61 72 72 |dd it to| the arr|
|00001ac0| 61 79 20 6f 66 20 70 6f | 73 73 69 62 6c 65 0d 09 |ay of po|ssible..|
|00001ad0| 09 09 09 50 6f 73 73 69 | 62 6c 65 20 28 6e 70 6f |...Possi|ble (npo|
|00001ae0| 73 2d 31 29 2e 68 20 3d | 20 69 78 3b 09 09 09 09 |s-1).h =| ix;....|
|00001af0| 09 09 09 2f 2f 20 6d 6f | 76 65 73 2e 0d 09 09 09 |...// mo|ves.....|
|00001b00| 09 50 6f 73 73 69 62 6c | 65 20 28 6e 70 6f 73 2d |.Possibl|e (npos-|
|00001b10| 31 29 2e 76 20 3d 20 69 | 79 3b 0d 09 09 09 7d 0d |1).v = i|y;....}.|
|00001b20| 09 09 7d 0d 09 0d 09 69 | 66 20 28 6d 61 78 20 3d |..}....i|f (max =|
|00001b30| 3d 20 30 29 09 09 09 09 | 09 09 09 09 09 09 09 09 |= 0)....|........|
|00001b40| 2f 2f 20 4e 6f 74 68 69 | 6e 67 20 69 6e 74 65 72 |// Nothi|ng inter|
|00001b50| 65 73 74 69 6e 67 20 3a | 20 74 68 69 73 20 69 73 |esting :| this is|
|00001b60| 20 61 20 64 72 61 77 0d | 09 09 64 72 61 77 20 3d | a draw.|..draw =|
|00001b70| 20 74 72 75 65 3b 0d 09 | 65 6c 73 65 20 69 66 20 | true;..|else if |
|00001b80| 28 6e 70 6f 73 29 20 7b | 09 09 09 09 09 09 09 09 |(npos) {|........|
|00001b90| 09 09 09 09 0d 09 09 6e | 20 3d 20 52 61 6e 64 6f |.......n| = Rando|
|00001ba0| 6d 28 29 3b 09 09 09 09 | 09 09 09 09 09 09 09 2f |m();....|......./|
|00001bb0| 2f 20 52 61 6e 64 6f 6d | 6c 79 20 63 68 6f 6f 73 |/ Random|ly choos|
|00001bc0| 65 20 61 20 73 71 75 61 | 72 65 20 66 72 6f 6d 20 |e a squa|re from |
|00001bd0| 74 68 65 20 6c 69 73 74 | 0d 09 09 69 66 20 28 6e |the list|...if (n|
|00001be0| 20 3c 20 30 29 20 6e 20 | 3d 20 2d 6e 3b 09 09 09 | < 0) n |= -n;...|
|00001bf0| 09 09 09 09 09 09 09 2f | 2f 20 6f 66 20 62 65 73 |......./|/ of bes|
|00001c00| 74 20 70 6f 73 73 69 62 | 6c 65 20 73 71 75 61 72 |t possib|le squar|
|00001c10| 65 73 0d 09 09 6e 20 3d | 20 6e 20 25 20 6e 70 6f |es...n =| n % npo|
|00001c20| 73 3b 0d 0d 09 09 69 66 | 20 28 6d 61 78 20 3e 3d |s;....if| (max >=|
|00001c30| 20 76 61 6c 75 65 20 5b | 34 5d 5b 30 5d 29 09 09 | value [|4][0])..|
|00001c40| 09 09 09 09 09 09 09 2f | 2f 20 54 68 69 73 20 6d |......./|/ This m|
|00001c50| 65 61 6e 73 20 77 65 20 | 6a 75 73 74 20 77 6f 6e |eans we |just won|
|00001c60| 0d 09 09 09 77 69 6e 6e | 65 72 20 3d 20 74 72 75 |....winn|er = tru|
|00001c70| 65 3b 0d 0d 09 09 72 65 | 74 75 72 6e 20 50 6f 73 |e;....re|turn Pos|
|00001c80| 73 69 62 6c 65 20 28 6e | 29 3b 09 09 09 09 09 09 |sible (n|);......|
|00001c90| 09 09 09 09 2f 2f 20 50 | 69 63 6b 20 75 70 20 61 |....// P|ick up a|
|00001ca0| 20 73 6f 6c 75 74 69 6f | 6e 20 72 61 6e 64 6f 6d | solutio|n random|
|00001cb0| 6c 79 20 66 72 6f 6d 20 | 74 68 65 20 73 65 74 20 |ly from |the set |
|00001cc0| 6f 66 0d 09 7d 09 09 09 | 09 09 09 09 09 09 09 09 |of..}...|........|
|00001cd0| 09 09 09 2f 2f 20 74 68 | 65 20 62 65 73 74 20 73 |...// th|e best s|
|00001ce0| 6f 6c 75 74 69 6f 6e 73 | 0d 09 65 6c 73 65 0d 09 |olutions|..else..|
|00001cf0| 09 64 72 61 77 20 3d 20 | 74 72 75 65 3b 09 09 09 |.draw = |true;...|
|00001d00| 09 09 09 09 09 09 09 09 | 2f 2f 20 54 68 65 20 67 |........|// The g|
|00001d10| 72 69 64 20 69 73 20 66 | 75 6c 6c 0d 09 09 0d 09 |rid is f|ull.....|
|00001d20| 72 65 74 75 72 6e 20 7a | 65 72 6f 3b 0d 7d 0d 0d |return z|ero;.}..|
|00001d30| 2f 2f 20 43 61 6c 6c 65 | 64 20 72 65 67 75 6c 61 |// Calle|d regula|
|00001d40| 72 6c 79 2e 20 54 68 69 | 73 20 69 73 20 74 68 65 |rly. Thi|s is the|
|00001d50| 20 68 65 61 72 74 20 6f | 66 20 74 68 65 20 66 61 | heart o|f the fa|
|00001d60| 64 65 72 2e 20 48 65 72 | 65 20 77 65 20 64 6f 20 |der. Her|e we do |
|00001d70| 77 68 61 74 65 76 65 72 | 20 77 65 20 70 6c 65 61 |whatever| we plea|
|00001d80| 73 65 2e 2e 2e 0d 0d 4f | 53 45 72 72 09 49 64 6c |se.....O|SErr.Idl|
|00001d90| 65 46 61 64 65 72 28 4d | 61 63 68 69 6e 65 49 6e |eFader(M|achineIn|
|00001da0| 66 6f 50 74 72 20 6d 61 | 63 68 69 6e 65 49 6e 66 |foPtr ma|chineInf|
|00001db0| 6f 29 0d 7b 0d 09 50 6f | 69 6e 74 09 09 09 6c 6f |o).{..Po|int...lo|
|00001dc0| 63 61 74 69 6f 6e 3b 0d | 09 52 65 63 74 09 09 09 |cation;.|.Rect...|
|00001dd0| 72 3b 0d 09 6c 6f 6e 67 | 09 09 09 66 69 6e 61 6c |r;..long|...final|
|00001de0| 54 69 63 6b 73 3b 0d 09 | 73 68 6f 72 74 09 09 61 |Ticks;..|short..a|
|00001df0| 3b 0d 09 0d 09 2f 2f 20 | 69 66 20 69 74 20 69 73 |;....// |if it is|
|00001e00| 6e 27 74 20 74 69 6d 65 | 20 74 6f 20 64 72 61 77 |n't time| to draw|
|00001e10| 20 79 65 74 2c 20 77 65 | 20 72 65 74 75 72 6e 20 | yet, we| return |
|00001e20| 2d 2d 20 77 65 20 64 6f | 20 74 68 69 73 20 72 61 |-- we do| this ra|
|00001e30| 74 68 65 72 20 74 68 61 | 6e 20 64 65 6c 61 79 20 |ther tha|n delay |
|00001e40| 74 6f 20 61 76 6f 69 64 | 0d 09 2f 2f 20 6c 6f 63 |to avoid|..// loc|
|00001e50| 6b 69 6e 67 20 75 70 20 | 74 68 65 20 6d 61 63 68 |king up |the mach|
|00001e60| 69 6e 65 20 77 69 74 68 | 20 61 20 66 75 6e 63 74 |ine with| a funct|
|00001e70| 69 6f 6e 20 61 73 20 6d | 75 6e 64 61 6e 65 20 61 |ion as m|undane a|
|00001e80| 73 20 61 20 73 63 72 65 | 65 6e 73 61 76 65 72 0d |s a scre|ensaver.|
|00001e90| 09 69 66 20 28 54 69 63 | 6b 43 6f 75 6e 74 28 29 |.if (Tic|kCount()|
|00001ea0| 20 3c 20 6e 65 78 74 44 | 72 61 77 29 0d 09 09 72 | < nextD|raw)...r|
|00001eb0| 65 74 75 72 6e 28 6e 6f | 45 72 72 29 3b 0d 0d 09 |eturn(no|Err);...|
|00001ec0| 0d 09 6c 6f 63 61 74 69 | 6f 6e 20 3d 20 50 6c 61 |..locati|on = Pla|
|00001ed0| 79 28 29 3b 09 09 09 09 | 09 09 09 09 09 09 09 2f |y();....|......./|
|00001ee0| 2f 20 66 69 6e 64 20 6f | 75 74 20 77 68 65 72 65 |/ find o|ut where|
|00001ef0| 20 77 65 20 77 61 6e 74 | 20 74 6f 20 70 6c 61 79 | we want| to play|
|00001f00| 0d 0d 09 69 66 20 28 21 | 64 72 61 77 29 20 7b 09 |...if (!|draw) {.|
|00001f10| 09 09 09 09 09 09 09 09 | 09 09 09 2f 2f 20 49 66 |........|...// If|
|00001f20| 20 74 68 65 20 70 6c 61 | 79 65 72 20 61 63 74 75 | the pla|yer actu|
|00001f30| 61 6c 6c 79 20 70 6c 61 | 79 65 64 20 73 6f 6d 65 |ally pla|yed some|
|00001f40| 74 68 69 6e 67 0d 09 09 | 53 65 74 4f 72 69 67 69 |thing...|SetOrigi|
|00001f50| 6e 28 2d 78 6c 6f 63 2c | 20 2d 79 6c 6f 63 29 3b |n(-xloc,| -yloc);|
|00001f60| 0d 09 09 72 2e 6c 65 66 | 74 20 3d 20 78 63 20 2b |...r.lef|t = xc +|
|00001f70| 20 62 6f 72 64 65 72 20 | 2b 20 75 6e 69 74 20 2a | border |+ unit *|
|00001f80| 20 6c 6f 63 61 74 69 6f | 6e 2e 68 3b 0d 09 09 72 | locatio|n.h;...r|
|00001f90| 2e 74 6f 70 20 3d 20 79 | 63 20 2b 20 62 6f 72 64 |.top = y|c + bord|
|00001fa0| 65 72 20 2b 20 75 6e 69 | 74 20 2a 20 6c 6f 63 61 |er + uni|t * loca|
|00001fb0| 74 69 6f 6e 2e 76 3b 0d | 09 09 72 2e 72 69 67 68 |tion.v;.|..r.righ|
|00001fc0| 74 20 3d 20 72 2e 6c 65 | 66 74 20 2b 20 75 6e 69 |t = r.le|ft + uni|
|00001fd0| 74 20 2d 20 32 20 2a 20 | 62 6f 72 64 65 72 20 2b |t - 2 * |border +|
|00001fe0| 20 31 3b 0d 09 09 72 2e | 62 6f 74 74 6f 6d 20 3d | 1;...r.|bottom =|
|00001ff0| 20 72 2e 74 6f 70 20 2b | 20 75 6e 69 74 20 2d 20 | r.top +| unit - |
|00002000| 32 20 2a 20 62 6f 72 64 | 65 72 20 2b 20 31 3b 0d |2 * bord|er + 1;.|
|00002010| 09 09 69 66 20 28 74 75 | 72 6e 20 3d 3d 20 70 6c |..if (tu|rn == pl|
|00002020| 61 79 65 72 31 29 0d 09 | 09 09 45 72 61 73 65 4f |ayer1)..|..EraseO|
|00002030| 76 61 6c 20 28 26 72 29 | 3b 09 09 09 09 09 09 09 |val (&r)|;.......|
|00002040| 09 09 2f 2f 20 64 72 61 | 77 20 74 68 65 20 6e 65 |..// dra|w the ne|
|00002050| 77 20 6d 61 72 6b 65 72 | 20 69 6e 20 74 68 65 20 |w marker| in the |
|00002060| 70 72 6f 70 65 72 20 63 | 6f 6c 6f 72 0d 09 09 65 |proper c|olor...e|
|00002070| 6c 73 65 20 7b 0d 09 09 | 09 50 65 6e 50 61 74 20 |lse {...|.PenPat |
|00002080| 28 51 55 49 43 4b 44 52 | 41 57 57 48 49 54 45 29 |(QUICKDR|AWWHITE)|
|00002090| 3b 0d 09 09 09 46 72 61 | 6d 65 4f 76 61 6c 20 28 |;....Fra|meOval (|
|000020a0| 26 72 29 3b 0d 09 09 09 | 50 65 6e 50 61 74 20 28 |&r);....|PenPat (|
|000020b0| 51 55 49 43 4b 44 52 41 | 57 42 4c 41 43 4b 29 3b |QUICKDRA|WBLACK);|
|000020c0| 0d 09 09 7d 0d 09 09 0d | 09 09 28 76 6f 69 64 29 |...}....|..(void)|
|000020d0| 20 50 6c 61 79 52 65 73 | 6f 75 72 63 65 53 6e 64 | PlayRes|ourceSnd|
|000020e0| 20 28 6d 61 63 68 69 6e | 65 49 6e 66 6f 2c 20 31 | (machin|eInfo, 1|
|000020f0| 32 38 2c 20 74 72 75 65 | 29 3b 09 09 09 09 2f 2f |28, true|);....//|
|00002100| 20 70 6c 61 79 20 73 6f | 75 6e 64 20 61 73 79 6e | play so|und asyn|
|00002110| 63 68 72 6f 6e 6f 75 73 | 6c 79 0d 09 09 66 6f 72 |chronous|ly...for|
|00002120| 20 28 61 20 3d 20 34 3b | 20 61 3b 20 61 2d 2d 29 | (a = 4;| a; a--)|
|00002130| 20 7b 09 09 09 09 09 09 | 09 09 09 09 2f 2f 20 6d | {......|....// m|
|00002140| 61 6b 65 20 69 74 20 62 | 6c 69 6e 6b 20 73 6f 20 |ake it b|link so |
|00002150| 74 68 61 74 20 74 68 65 | 20 75 73 65 72 20 73 65 |that the| user se|
|00002160| 65 73 20 69 74 0d 09 09 | 09 49 6e 76 65 72 74 52 |es it...|.InvertR|
|00002170| 65 63 74 20 28 26 72 29 | 3b 0d 09 09 09 44 65 6c |ect (&r)|;....Del|
|00002180| 61 79 20 28 32 2c 20 26 | 66 69 6e 61 6c 54 69 63 |ay (2, &|finalTic|
|00002190| 6b 73 29 3b 0d 09 09 7d | 0d 09 09 0d 09 09 53 65 |ks);...}|......Se|
|000021a0| 74 4f 72 69 67 69 6e 28 | 30 2c 20 30 29 3b 0d 09 |tOrigin(|0, 0);..|
|000021b0| 7d 0d 0d 09 2f 2f 20 63 | 61 6c 63 75 6c 61 74 65 |}...// c|alculate|
|000021c0| 20 74 68 65 20 6e 65 78 | 74 20 74 69 6d 65 20 74 | the nex|t time t|
|000021d0| 6f 20 64 72 61 77 09 0d | 09 6e 65 78 74 44 72 61 |o draw..|.nextDra|
|000021e0| 77 20 3d 20 54 69 63 6b | 43 6f 75 6e 74 28 29 20 |w = Tick|Count() |
|000021f0| 2b 20 36 30 20 2d 20 6d | 61 63 68 69 6e 65 49 6e |+ 60 - m|achineIn|
|00002200| 66 6f 2d 3e 66 61 64 65 | 72 53 65 74 74 69 6e 67 |fo->fade|rSetting|
|00002210| 73 2d 3e 74 68 65 53 68 | 6f 72 74 73 5b 30 5d 3b |s->theSh|orts[0];|
|00002220| 0d 0d 09 69 66 20 28 64 | 72 61 77 20 7c 7c 20 77 |...if (d|raw || w|
|00002230| 69 6e 6e 65 72 29 20 7b | 09 09 09 09 09 09 09 09 |inner) {|........|
|00002240| 09 09 09 2f 2f 20 69 66 | 20 74 68 65 20 67 61 6d |...// if| the gam|
|00002250| 65 27 73 20 6f 76 65 72 | 0d 09 09 53 74 72 32 35 |e's over|...Str25|
|00002260| 35 09 72 65 73 75 6c 74 | 53 74 72 69 6e 67 3b 0d |5.result|String;.|
|00002270| 09 09 0d 09 09 50 65 6e | 50 61 74 20 28 51 55 49 |.....Pen|Pat (QUI|
|00002280| 43 4b 44 52 41 57 42 4c | 41 43 4b 29 3b 0d 09 09 |CKDRAWBL|ACK);...|
|00002290| 54 65 78 74 4d 6f 64 65 | 20 28 73 72 63 58 6f 72 |TextMode| (srcXor|
|000022a0| 29 3b 0d 09 09 72 20 3d | 20 6d 61 63 68 69 6e 65 |);...r =| machine|
|000022b0| 49 6e 66 6f 2d 3e 74 68 | 65 53 63 72 65 65 6e 73 |Info->th|eScreens|
|000022c0| 5b 30 5d 2e 62 6f 75 6e | 64 73 3b 0d 09 09 4d 6f |[0].boun|ds;...Mo|
|000022d0| 76 65 54 6f 20 28 72 2e | 6c 65 66 74 2b 32 2a 75 |veTo (r.|left+2*u|
|000022e0| 6e 69 74 2c 20 72 2e 74 | 6f 70 20 2b 20 32 2a 75 |nit, r.t|op + 2*u|
|000022f0| 6e 69 74 29 3b 09 09 09 | 09 09 09 2f 2f 20 70 72 |nit);...|...// pr|
|00002300| 69 6e 74 20 61 20 6d 65 | 73 73 61 67 65 20 65 78 |int a me|ssage ex|
|00002310| 70 6c 61 69 6e 69 6e 67 | 20 77 68 79 0d 09 09 69 |plaining| why...i|
|00002320| 66 20 28 64 72 61 77 29 | 0d 09 09 09 7b 0d 09 09 |f (draw)|....{...|
|00002330| 09 47 65 74 49 6e 64 53 | 74 72 69 6e 67 28 72 65 |.GetIndS|tring(re|
|00002340| 73 75 6c 74 53 74 72 69 | 6e 67 2c 20 35 30 30 30 |sultStri|ng, 5000|
|00002350| 2c 20 31 29 3b 0d 09 09 | 09 7d 0d 09 09 65 6c 73 |, 1);...|.}...els|
|00002360| 65 20 0d 09 09 09 7b 0d | 09 09 09 69 66 20 28 74 |e ....{.|...if (t|
|00002370| 75 72 6e 20 3d 3d 20 70 | 6c 61 79 65 72 31 29 0d |urn == p|layer1).|
|00002380| 09 09 09 09 47 65 74 49 | 6e 64 53 74 72 69 6e 67 |....GetI|ndString|
|00002390| 28 72 65 73 75 6c 74 53 | 74 72 69 6e 67 2c 20 35 |(resultS|tring, 5|
|000023a0| 30 30 30 2c 20 32 29 3b | 0d 09 09 09 65 6c 73 65 |000, 2);|....else|
|000023b0| 0d 09 09 09 09 47 65 74 | 49 6e 64 53 74 72 69 6e |.....Get|IndStrin|
|000023c0| 67 28 72 65 73 75 6c 74 | 53 74 72 69 6e 67 2c 20 |g(result|String, |
|000023d0| 35 30 30 30 2c 20 33 29 | 3b 0d 09 09 09 7d 0d 09 |5000, 3)|;....}..|
|000023e0| 09 44 72 61 77 53 74 72 | 69 6e 67 28 72 65 73 75 |.DrawStr|ing(resu|
|000023f0| 6c 74 53 74 72 69 6e 67 | 29 3b 0d 09 09 50 65 6e |ltString|);...Pen|
|00002400| 4e 6f 72 6d 61 6c 28 29 | 3b 0d 09 09 0d 09 09 44 |Normal()|;......D|
|00002410| 65 6c 61 79 20 28 32 34 | 30 2c 20 26 66 69 6e 61 |elay (24|0, &fina|
|00002420| 6c 54 69 63 6b 73 29 3b | 09 09 09 09 09 09 09 09 |lTicks);|........|
|00002430| 09 2f 2f 20 77 61 69 74 | 20 61 20 66 65 77 20 73 |.// wait| a few s|
|00002440| 65 63 6f 6e 64 73 0d 09 | 09 53 74 61 72 74 47 61 |econds..|.StartGa|
|00002450| 6d 65 28 29 3b 09 09 09 | 09 09 09 09 09 09 09 09 |me();...|........|
|00002460| 2f 2f 20 61 6e 64 20 73 | 74 61 72 74 20 61 20 6e |// and s|tart a n|
|00002470| 65 77 20 67 61 6d 65 0d | 09 09 49 6e 69 74 69 61 |ew game.|..Initia|
|00002480| 6c 69 7a 65 46 61 64 65 | 72 28 6d 61 63 68 69 6e |lizeFade|r(machin|
|00002490| 65 49 6e 66 6f 29 3b 0d | 09 09 72 65 74 75 72 6e |eInfo);.|..return|
|000024a0| 20 6e 6f 45 72 72 3b 0d | 09 7d 0d 09 0d 0d 09 47 | noErr;.|.}.....G|
|000024b0| 72 69 64 28 6c 6f 63 61 | 74 69 6f 6e 2e 68 2c 20 |rid(loca|tion.h, |
|000024c0| 6c 6f 63 61 74 69 6f 6e | 2e 76 29 20 3d 20 74 75 |location|.v) = tu|
|000024d0| 72 6e 3b 09 09 09 09 09 | 09 09 09 2f 2f 20 75 70 |rn;.....|...// up|
|000024e0| 64 61 74 65 20 74 68 65 | 20 67 72 69 64 20 69 6e |date the| grid in|
|000024f0| 20 6d 65 6d 6f 72 79 0d | 09 74 75 72 6e 20 3d 20 | memory.|.turn = |
|00002500| 28 74 75 72 6e 20 3d 3d | 20 70 6c 61 79 65 72 31 |(turn ==| player1|
|00002510| 29 20 3f 20 70 6c 61 79 | 65 72 32 20 3a 20 70 6c |) ? play|er2 : pl|
|00002520| 61 79 65 72 31 3b 09 09 | 09 09 09 09 2f 2f 20 63 |ayer1;..|....// c|
|00002530| 68 61 6e 67 65 20 74 75 | 72 6e 0d 09 09 0d 09 72 |hange tu|rn.....r|
|00002540| 65 74 75 72 6e 20 6e 6f | 45 72 72 3b 0d 7d 0d 0d |eturn no|Err;.}..|
|00002550| 2f 2f 20 43 61 6c 6c 65 | 64 20 77 68 65 6e 20 74 |// Calle|d when t|
|00002560| 68 65 20 66 61 64 65 20 | 69 73 20 74 65 61 72 69 |he fade |is teari|
|00002570| 6e 67 20 64 6f 77 6e 0d | 0d 4f 53 45 72 72 09 44 |ng down.|.OSErr.D|
|00002580| 69 73 70 6f 73 65 46 61 | 64 65 72 28 4d 61 63 68 |isposeFa|der(Mach|
|00002590| 69 6e 65 49 6e 66 6f 50 | 74 72 20 6d 61 63 68 69 |ineInfoP|tr machi|
|000025a0| 6e 65 49 6e 66 6f 29 0d | 7b 0d 23 70 72 61 67 6d |neInfo).|{.#pragm|
|000025b0| 61 20 75 6e 75 73 65 64 | 20 28 6d 61 63 68 69 6e |a unused| (machin|
|000025c0| 65 49 6e 66 6f 29 0d 0d | 09 44 69 73 70 6f 73 48 |eInfo)..|.DisposH|
|000025d0| 61 6e 64 6c 65 20 28 67 | 72 69 64 29 3b 09 09 09 |andle (g|rid);...|
|000025e0| 09 09 09 09 09 09 09 09 | 2f 2f 20 72 65 6c 65 61 |........|// relea|
|000025f0| 73 65 20 61 6c 6c 20 74 | 68 65 20 6d 65 6d 6f 72 |se all t|he memor|
|00002600| 79 20 77 65 20 72 65 73 | 65 72 76 65 64 0d 09 44 |y we res|erved..D|
|00002610| 69 73 70 6f 73 48 61 6e | 64 6c 65 20 28 70 6f 69 |isposHan|dle (poi|
|00002620| 6e 74 73 29 3b 0d 09 44 | 69 73 70 6f 73 48 61 6e |nts);..D|isposHan|
|00002630| 64 6c 65 20 28 70 6f 73 | 73 69 62 6c 65 29 3b 0d |dle (pos|sible);.|
|00002640| 09 72 65 74 75 72 6e 20 | 6e 6f 45 72 72 3b 0d 7d |.return |noErr;.}|
|00002650| 0d 0d 2f 2f 20 43 61 6c | 6c 65 64 20 77 68 65 6e |..// Cal|led when|
|00002660| 20 74 68 65 72 65 20 69 | 73 20 61 6e 20 75 70 64 | there i|s an upd|
|00002670| 61 74 65 20 65 76 65 6e | 74 20 66 6f 72 20 6f 75 |ate even|t for ou|
|00002680| 72 20 66 61 64 65 20 77 | 69 6e 64 6f 77 2e 0d 0d |r fade w|indow...|
|00002690| 4f 53 45 72 72 09 55 70 | 64 61 74 65 46 61 64 65 |OSErr.Up|dateFade|
|000026a0| 72 28 4d 61 63 68 69 6e | 65 49 6e 66 6f 50 74 72 |r(Machin|eInfoPtr|
|000026b0| 20 6d 61 63 68 69 6e 65 | 49 6e 66 6f 29 0d 7b 0d | machine|Info).{.|
|000026c0| 09 49 6e 69 74 69 61 6c | 69 7a 65 46 61 64 65 72 |.Initial|izeFader|
|000026d0| 28 6d 61 63 68 69 6e 65 | 49 6e 66 6f 29 3b 09 09 |(machine|Info);..|
|000026e0| 09 09 09 09 09 09 09 2f | 2f 20 65 72 61 73 65 20 |......./|/ erase |
|000026f0| 74 68 65 20 73 63 72 65 | 65 6e 2c 20 64 72 61 77 |the scre|en, draw|
|00002700| 20 74 68 65 20 67 72 69 | 64 0d 09 72 65 74 75 72 | the gri|d..retur|
|00002710| 6e 20 6e 6f 45 72 72 3b | 0d 7d 0d 0d 2f 2f 20 43 |n noErr;|.}..// C|
|00002720| 61 6c 6c 65 64 20 77 68 | 65 6e 20 74 68 65 72 65 |alled wh|en there|
|00002730| 20 69 73 20 61 6e 20 65 | 76 65 6e 74 73 20 69 6e | is an e|vents in|
|00002740| 20 74 68 65 20 73 65 74 | 74 69 6e 67 73 20 64 69 | the set|tings di|
|00002750| 61 6c 6f 67 2e 20 69 74 | 65 6d 48 69 74 20 77 69 |alog. it|emHit wi|
|00002760| 6c 6c 20 62 65 20 74 68 | 65 20 69 74 65 6d 20 74 |ll be th|e item t|
|00002770| 68 65 20 75 73 65 72 20 | 68 61 73 20 73 65 6c 65 |he user |has sele|
|00002780| 63 74 65 64 2c 20 6f 72 | 20 30 20 77 68 65 6e 20 |cted, or| 0 when |
|00002790| 74 68 65 20 64 69 61 6c | 6f 67 0d 2f 2f 20 69 73 |the dial|og.// is|
|000027a0| 20 62 65 69 6e 67 20 73 | 65 74 20 75 70 2e 20 0d | being s|et up. .|
|000027b0| 2f 2f 20 69 74 65 6d 48 | 69 74 20 2d 20 69 74 65 |// itemH|it - ite|
|000027c0| 6d 4f 66 66 73 65 74 20 | 77 69 6c 6c 20 61 6c 6c |mOffset |will all|
|000027d0| 6f 77 20 79 6f 75 20 74 | 6f 20 64 65 74 65 72 6d |ow you t|o determ|
|000027e0| 69 6e 65 20 77 68 69 63 | 68 20 69 74 65 6d 20 69 |ine whic|h item i|
|000027f0| 6e 20 79 6f 75 72 20 64 | 69 61 6c 6f 67 20 6c 69 |n your d|ialog li|
|00002800| 73 74 20 74 68 69 73 20 | 63 6f 72 72 65 73 70 6f |st this |correspo|
|00002810| 6e 64 73 20 74 6f 2e 0d | 2f 2f 20 49 66 20 79 6f |nds to..|// If yo|
|00002820| 75 20 64 6f 6e 27 74 20 | 77 69 73 68 20 74 6f 20 |u don't |wish to |
|00002830| 64 6f 20 61 6e 79 20 73 | 70 65 63 69 61 6c 20 70 |do any s|pecial p|
|00002840| 72 6f 63 65 73 73 69 6e | 67 20 6f 66 20 74 68 69 |rocessin|g of thi|
|00002850| 73 20 65 76 65 6e 74 2c | 20 73 69 6d 70 6c 79 20 |s event,| simply |
|00002860| 72 65 74 75 72 6e 20 66 | 6e 66 45 72 72 20 61 6e |return f|nfErr an|
|00002870| 64 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 65 |d the st|andard e|
|00002880| 66 66 65 63 74 20 77 69 | 6c 6c 20 74 61 6b 65 20 |ffect wi|ll take |
|00002890| 70 6c 61 63 65 2e 0d 0d | 4f 53 45 72 72 09 48 69 |place...|OSErr.Hi|
|000028a0| 74 46 61 64 65 72 28 4d | 61 63 68 69 6e 65 49 6e |tFader(M|achineIn|
|000028b0| 66 6f 50 74 72 20 6d 61 | 63 68 69 6e 65 49 6e 66 |foPtr ma|chineInf|
|000028c0| 6f 2c 20 44 69 61 6c 6f | 67 50 74 72 20 64 50 74 |o, Dialo|gPtr dPt|
|000028d0| 72 2c 20 73 68 6f 72 74 | 20 69 74 65 6d 48 69 74 |r, short| itemHit|
|000028e0| 2c 20 73 68 6f 72 74 20 | 69 74 65 6d 4f 66 66 73 |, short |itemOffs|
|000028f0| 65 74 29 0d 7b 0d 23 70 | 72 61 67 6d 61 20 75 6e |et).{.#p|ragma un|
|00002900| 75 73 65 64 20 28 6d 61 | 63 68 69 6e 65 49 6e 66 |used (ma|chineInf|
|00002910| 6f 2c 20 64 50 74 72 2c | 20 69 74 65 6d 48 69 74 |o, dPtr,| itemHit|
|00002920| 2c 20 69 74 65 6d 4f 66 | 66 73 65 74 29 0d 0d 09 |, itemOf|fset)...|
|00002930| 72 65 74 75 72 6e 20 66 | 6e 66 45 72 72 3b 0d 7d |return f|nfErr;.}|
|00002940| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002980| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00002990| 20 74 68 65 20 75 73 65 | 72 20 64 69 64 20 73 6f | the use|r did so|
|000029a0| 6d 65 74 68 69 6e 67 09 | 0d 09 69 66 20 28 0d 09 |mething.|..if (..|
|000029b0| 09 4d 6f 72 70 69 6f 6e | 2e 63 72 6f 30 73 79 6e |.Morpion|.cro0syn|
|000029c0| 61 6c 73 61 6e 74 73 2e | 68 65 69 63 74 73 73 29 |alsants.|heictss)|
|000029d0| 00 00 54 45 58 54 4b 41 | 48 4c 01 06 01 18 00 60 |..TEXTKA|HL.....`|
|000029e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029f0| 00 00 a5 2e bd 33 00 00 | 28 c1 00 00 01 ac 2e 77 |.....3..|(......w|
|00002a00| 68 65 72 65 29 20 7c 7c | 0d 09 09 09 09 0d 09 09 |here) |||........|
|00002a10| 2f 2f 20 69 73 20 74 68 | 65 20 6d 6f 75 73 65 20 |// is th|e mouse |
|00002a20| 63 75 72 72 65 6e 74 6c | 79 20 64 6f 77 6e 3f 0d |currentl|y down?.|
|00002a30| 09 09 28 42 75 74 74 6f | 6e 28 29 29 20 0d 09 20 |..(Butto|n()) .. |
|00002a40| 20 20 29 0d 09 09 75 73 | 65 72 41 63 74 69 6f 6e | )...us|erAction|
|00002a50| 20 3d 20 74 72 75 65 3b | 0d 09 09 09 09 09 0d 09 | = true;|........|
|00002a60| 2f 2f 20 61 6e 79 20 6b | 65 79 73 74 72 6f 6b 65 |// any k|eystroke|
|00002a70| 73 20 69 6e 20 74 68 65 | 20 56 42 4c 3f 0d 09 69 |s in the| VBL?..i|
|00002a80| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 03 c4 |...H..Mo|naco....|
|00002a90| 05 2b f7 90 00 00 03 bc | 65 6e 20 73 61 76 65 72 |.+......|en saver|
|00002aa0| 2e 0d 09 0d 09 63 00 06 | 00 04 00 64 00 1c 02 fd |.....c..|...d....|
|00002ab0| 03 ad 00 64 00 1c 02 fd | 03 ad b2 52 17 1e 00 00 |...d....|...R....|
|00002ac0| 15 bb 00 00 15 bb 00 00 | 13 53 01 00 00 00 00 1e |........|.S......|
|00002ad0| 00 64 00 1c 02 fd 03 ad | 00 64 00 1c 02 fd 03 ad |.d......|.d......|
|00002ae0| 00 00 13 53 00 00 00 00 | 00 00 00 00 00 00 00 00 |...S....|........|
|00002af0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 05 15 |.....n..|.n...>..|
|00002b00| bd a8 19 b6 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |........|.>..MPSR|
|00002b10| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00002b20| 03 f0 ff ff 00 00 00 4c | 05 21 dd 80 00 00 00 00 |.......L|.!......|
|00002b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+