home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / games / new / 920110.6 < prev    next >
SHell self-extracting ARchive  |  1992-01-10  |  53.6 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 75 75 | 6e 65 74 21 7a 65 70 68 |Path: uu|net!zeph|
|00000010| 79 72 2e 65 6e 73 2e 74 | 65 6b 2e 63 6f 6d 21 6d |yr.ens.t|ek.com!m|
|00000020| 61 73 74 65 72 21 73 61 | 61 62 21 62 69 6c 6c 72 |aster!sa|ab!billr|
|00000030| 0a 46 72 6f 6d 3a 20 62 | 69 6c 6c 72 40 73 61 61 |.From: b|illr@saa|
|00000040| 62 2e 43 4e 41 2e 54 45 | 4b 2e 43 4f 4d 20 28 42 |b.CNA.TE|K.COM (B|
|00000050| 69 6c 6c 20 52 61 6e 64 | 6c 65 29 0a 4e 65 77 73 |ill Rand|le).News|
|00000060| 67 72 6f 75 70 73 3a 20 | 63 6f 6d 70 2e 73 6f 75 |groups: |comp.sou|
|00000070| 72 63 65 73 2e 67 61 6d | 65 73 0a 53 75 62 6a 65 |rces.gam|es.Subje|
|00000080| 63 74 3a 20 76 31 33 69 | 30 31 38 3a 20 20 6f 6b |ct: v13i|018: ok|
|00000090| 62 72 69 64 67 65 20 2d | 20 63 6f 6d 70 75 74 65 |bridge -| compute|
|000000a0| 72 2d 6d 65 64 69 61 74 | 65 64 20 62 72 69 64 67 |r-mediat|ed bridg|
|000000b0| 65 20 67 61 6d 65 2c 20 | 50 61 72 74 30 33 2f 30 |e game, |Part03/0|
|000000c0| 37 0a 4d 65 73 73 61 67 | 65 2d 49 44 3a 20 3c 32 |7.Messag|e-ID: <2|
|000000d0| 32 37 37 40 6d 61 73 74 | 65 72 43 4e 41 2e 54 45 |277@mast|erCNA.TE|
|000000e0| 4b 2e 43 4f 4d 3e 0a 44 | 61 74 65 3a 20 31 30 20 |K.COM>.D|ate: 10 |
|000000f0| 4a 61 6e 20 39 32 20 31 | 36 3a 34 34 3a 34 32 20 |Jan 92 1|6:44:42 |
|00000100| 47 4d 54 0a 53 65 6e 64 | 65 72 3a 20 6e 65 77 73 |GMT.Send|er: news|
|00000110| 40 6d 61 73 74 65 72 43 | 4e 41 2e 54 45 4b 2e 43 |@masterC|NA.TEK.C|
|00000120| 4f 4d 0a 4c 69 6e 65 73 | 3a 20 31 39 35 37 0a 41 |OM.Lines|: 1957.A|
|00000130| 70 70 72 6f 76 65 64 3a | 20 62 69 6c 6c 72 40 73 |pproved:| billr@s|
|00000140| 61 61 62 2e 43 4e 41 2e | 54 45 4b 2e 43 4f 4d 0a |aab.CNA.|TEK.COM.|
|00000150| 0a 53 75 62 6d 69 74 74 | 65 64 2d 62 79 3a 20 6d |.Submitt|ed-by: m|
|00000160| 63 6c 65 67 67 40 63 73 | 2e 55 43 53 44 2e 45 44 |clegg@cs|.UCSD.ED|
|00000170| 55 20 28 4d 61 74 74 68 | 65 77 20 43 6c 65 67 67 |U (Matth|ew Clegg|
|00000180| 29 0a 50 6f 73 74 69 6e | 67 2d 6e 75 6d 62 65 72 |).Postin|g-number|
|00000190| 3a 20 56 6f 6c 75 6d 65 | 20 31 33 2c 20 49 73 73 |: Volume| 13, Iss|
|000001a0| 75 65 20 31 38 0a 41 72 | 63 68 69 76 65 2d 6e 61 |ue 18.Ar|chive-na|
|000001b0| 6d 65 3a 20 6f 6b 62 72 | 69 64 67 65 2f 50 61 72 |me: okbr|idge/Par|
|000001c0| 74 30 33 0a 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |t03.Envi|ronment:|
|000001d0| 20 42 53 44 2d 64 65 72 | 69 76 65 64 20 55 6e 69 | BSD-der|ived Uni|
|000001e0| 78 2c 20 63 75 72 73 65 | 73 2c 20 73 6f 63 6b 65 |x, curse|s, socke|
|000001f0| 74 73 0a 0a 0a 0a 23 21 | 20 2f 62 69 6e 2f 73 68 |ts....#!| /bin/sh|
|00000200| 0a 23 20 54 68 69 73 20 | 69 73 20 61 20 73 68 65 |.# This |is a she|
|00000210| 6c 6c 20 61 72 63 68 69 | 76 65 2e 20 20 52 65 6d |ll archi|ve. Rem|
|00000220| 6f 76 65 20 61 6e 79 74 | 68 69 6e 67 20 62 65 66 |ove anyt|hing bef|
|00000230| 6f 72 65 20 74 68 69 73 | 20 6c 69 6e 65 2c 20 74 |ore this| line, t|
|00000240| 68 65 6e 20 75 6e 70 61 | 63 6b 0a 23 20 69 74 20 |hen unpa|ck.# it |
|00000250| 62 79 20 73 61 76 69 6e | 67 20 69 74 20 69 6e 74 |by savin|g it int|
|00000260| 6f 20 61 20 66 69 6c 65 | 20 61 6e 64 20 74 79 70 |o a file| and typ|
|00000270| 69 6e 67 20 22 73 68 20 | 66 69 6c 65 22 2e 20 20 |ing "sh |file". |
|00000280| 54 6f 20 6f 76 65 72 77 | 72 69 74 65 20 65 78 69 |To overw|rite exi|
|00000290| 73 74 69 6e 67 0a 23 20 | 66 69 6c 65 73 2c 20 74 |sting.# |files, t|
|000002a0| 79 70 65 20 22 73 68 20 | 66 69 6c 65 20 2d 63 22 |ype "sh |file -c"|
|000002b0| 2e 20 20 59 6f 75 20 63 | 61 6e 20 61 6c 73 6f 20 |. You c|an also |
|000002c0| 66 65 65 64 20 74 68 69 | 73 20 61 73 20 73 74 61 |feed thi|s as sta|
|000002d0| 6e 64 61 72 64 20 69 6e | 70 75 74 20 76 69 61 0a |ndard in|put via.|
|000002e0| 23 20 75 6e 73 68 61 72 | 2c 20 6f 72 20 62 79 20 |# unshar|, or by |
|000002f0| 74 79 70 69 6e 67 20 22 | 73 68 20 3c 66 69 6c 65 |typing "|sh <file|
|00000300| 22 2c 20 65 2e 67 2e 2e | 20 20 49 66 20 74 68 69 |", e.g..| If thi|
|00000310| 73 20 61 72 63 68 69 76 | 65 20 69 73 20 63 6f 6d |s archiv|e is com|
|00000320| 70 6c 65 74 65 2c 20 79 | 6f 75 0a 23 20 77 69 6c |plete, y|ou.# wil|
|00000330| 6c 20 73 65 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |l see th|e follow|
|00000340| 69 6e 67 20 6d 65 73 73 | 61 67 65 20 61 74 20 74 |ing mess|age at t|
|00000350| 68 65 20 65 6e 64 3a 0a | 23 09 09 22 45 6e 64 20 |he end:.|#.."End |
|00000360| 6f 66 20 61 72 63 68 69 | 76 65 20 33 20 28 6f 66 |of archi|ve 3 (of|
|00000370| 20 37 29 2e 22 0a 23 20 | 43 6f 6e 74 65 6e 74 73 | 7).".# |Contents|
|00000380| 3a 20 20 69 6e 70 75 74 | 2e 63 2e 61 61 20 73 74 |: input|.c.aa st|
|00000390| 61 72 74 75 70 2e 63 0a | 23 20 57 72 61 70 70 65 |artup.c.|# Wrappe|
|000003a0| 64 20 62 79 20 62 69 6c | 6c 72 40 73 61 61 62 20 |d by bil|lr@saab |
|000003b0| 6f 6e 20 46 72 69 20 4a | 61 6e 20 31 30 20 30 38 |on Fri J|an 10 08|
|000003c0| 3a 33 31 3a 32 38 20 31 | 39 39 32 0a 50 41 54 48 |:31:28 1|992.PATH|
|000003d0| 3d 2f 62 69 6e 3a 2f 75 | 73 72 2f 62 69 6e 3a 2f |=/bin:/u|sr/bin:/|
|000003e0| 75 73 72 2f 75 63 62 20 | 3b 20 65 78 70 6f 72 74 |usr/ucb |; export|
|000003f0| 20 50 41 54 48 0a 69 66 | 20 74 65 73 74 20 2d 66 | PATH.if| test -f|
|00000400| 20 27 69 6e 70 75 74 2e | 63 2e 61 61 27 20 2d 61 | 'input.|c.aa' -a|
|00000410| 20 22 24 7b 31 7d 22 20 | 21 3d 20 22 2d 63 22 20 | "${1}" |!= "-c" |
|00000420| 3b 20 74 68 65 6e 20 0a | 20 20 65 63 68 6f 20 73 |; then .| echo s|
|00000430| 68 61 72 3a 20 57 69 6c | 6c 20 6e 6f 74 20 63 6c |har: Wil|l not cl|
|00000440| 6f 62 62 65 72 20 65 78 | 69 73 74 69 6e 67 20 66 |obber ex|isting f|
|00000450| 69 6c 65 20 5c 22 27 69 | 6e 70 75 74 2e 63 2e 61 |ile \"'i|nput.c.a|
|00000460| 61 27 5c 22 0a 65 6c 73 | 65 0a 65 63 68 6f 20 73 |a'\".els|e.echo s|
|00000470| 68 61 72 3a 20 45 78 74 | 72 61 63 74 69 6e 67 20 |har: Ext|racting |
|00000480| 5c 22 27 69 6e 70 75 74 | 2e 63 2e 61 61 27 5c 22 |\"'input|.c.aa'\"|
|00000490| 20 5c 28 34 30 30 39 35 | 20 63 68 61 72 61 63 74 | \(40095| charact|
|000004a0| 65 72 73 5c 29 0a 73 65 | 64 20 22 73 2f 5e 58 2f |ers\).se|d "s/^X/|
|000004b0| 2f 22 20 3e 27 69 6e 70 | 75 74 2e 63 2e 61 61 27 |/" >'inp|ut.c.aa'|
|000004c0| 20 3c 3c 27 45 4e 44 5f | 4f 46 5f 46 49 4c 45 27 | <<'END_|OF_FILE'|
|000004d0| 0a 58 2f 2a 20 69 6e 70 | 75 74 2e 63 20 2d 2d 20 |.X/* inp|ut.c -- |
|000004e0| 49 6e 70 75 74 20 64 72 | 69 76 65 72 20 66 6f 72 |Input dr|iver for|
|000004f0| 20 74 68 65 20 62 72 69 | 64 67 65 20 70 72 6f 67 | the bri|dge prog|
|00000500| 72 61 6d 2e 0a 58 20 21 | 20 0a 58 20 21 20 43 6f |ram..X !| .X ! Co|
|00000510| 70 79 72 69 67 68 74 20 | 28 43 29 20 31 39 39 30 |pyright |(C) 1990|
|00000520| 2c 31 39 39 31 20 62 79 | 20 4d 61 74 74 68 65 77 |,1991 by| Matthew|
|00000530| 20 43 6c 65 67 67 0a 58 | 20 21 20 0a 58 20 21 20 | Clegg.X| ! .X ! |
|00000540| 54 68 69 73 20 70 72 6f | 67 72 61 6d 20 6d 61 79 |This pro|gram may|
|00000550| 20 62 65 20 63 6f 70 69 | 65 64 20 61 6e 64 20 64 | be copi|ed and d|
|00000560| 69 73 74 72 69 62 75 74 | 65 64 20 66 72 65 65 6c |istribut|ed freel|
|00000570| 79 2e 20 20 50 6c 65 61 | 73 65 20 64 6f 20 6e 6f |y. Plea|se do no|
|00000580| 74 0a 58 20 21 20 63 68 | 61 72 67 65 20 6d 6f 6e |t.X ! ch|arge mon|
|00000590| 65 79 20 66 6f 72 20 74 | 68 69 73 20 70 72 6f 67 |ey for t|his prog|
|000005a0| 72 61 6d 20 6f 72 20 66 | 6f 72 20 61 6e 79 20 70 |ram or f|or any p|
|000005b0| 72 6f 67 72 61 6d 20 64 | 65 72 69 76 65 64 20 66 |rogram d|erived f|
|000005c0| 72 6f 6d 20 69 74 2e 0a | 58 20 21 20 49 66 20 79 |rom it..|X ! If y|
|000005d0| 6f 75 20 6d 6f 64 69 66 | 79 20 74 68 69 73 20 70 |ou modif|y this p|
|000005e0| 72 6f 67 72 61 6d 2c 20 | 74 68 65 6e 20 69 6e 63 |rogram, |then inc|
|000005f0| 6c 75 64 65 20 61 20 6e | 6f 74 69 63 65 20 73 74 |lude a n|otice st|
|00000600| 61 74 69 6e 67 20 70 6c | 61 69 6e 6c 79 0a 58 20 |ating pl|ainly.X |
|00000610| 21 20 74 68 61 74 20 79 | 6f 75 72 20 70 72 6f 67 |! that y|our prog|
|00000620| 72 61 6d 20 69 73 20 64 | 65 72 69 76 65 64 20 66 |ram is d|erived f|
|00000630| 72 6f 6d 20 74 68 65 20 | 6f 6b 62 72 69 64 67 65 |rom the |okbridge|
|00000640| 20 70 72 6f 67 72 61 6d | 20 61 6e 64 20 69 73 20 | program| and is |
|00000650| 6e 6f 74 0a 58 20 21 20 | 74 68 65 20 73 61 6d 65 |not.X ! |the same|
|00000660| 20 61 73 20 74 68 65 20 | 6f 66 66 69 63 69 61 6c | as the |official|
|00000670| 20 6f 6b 62 72 69 64 67 | 65 20 70 72 6f 67 72 61 | okbridg|e progra|
|00000680| 6d 2e 0a 58 20 21 0a 58 | 20 21 20 49 20 77 65 6c |m..X !.X| ! I wel|
|00000690| 63 6f 6d 65 20 61 6e 79 | 20 73 75 67 67 65 73 74 |come any| suggest|
|000006a0| 69 6f 6e 73 20 66 6f 72 | 20 69 6d 70 72 6f 76 65 |ions for| improve|
|000006b0| 6d 65 6e 74 20 74 6f 20 | 6f 6b 62 72 69 64 67 65 |ment to |okbridge|
|000006c0| 2c 20 61 6e 64 20 0a 58 | 20 21 20 49 20 77 6f 75 |, and .X| ! I wou|
|000006d0| 6c 64 20 62 65 20 65 73 | 70 65 63 69 61 6c 6c 79 |ld be es|pecially|
|000006e0| 20 68 61 70 70 79 20 74 | 6f 20 72 65 63 65 69 76 | happy t|o receiv|
|000006f0| 65 20 69 6d 70 72 6f 76 | 65 64 20 73 6f 75 72 63 |e improv|ed sourc|
|00000700| 65 20 63 6f 64 65 2e 0a | 58 20 21 20 49 66 20 79 |e code..|X ! If y|
|00000710| 6f 75 20 68 61 76 65 20 | 63 6f 6d 6d 65 6e 74 73 |ou have |comments|
|00000720| 20 6f 72 20 73 75 67 67 | 65 73 74 69 6f 6e 73 2c | or sugg|estions,|
|00000730| 20 6f 72 20 69 66 20 79 | 6f 75 20 77 6f 75 6c 64 | or if y|ou would|
|00000740| 20 6c 69 6b 65 20 74 6f | 0a 58 20 21 20 6a 6f 69 | like to|.X ! joi|
|00000750| 6e 20 74 68 65 20 6f 6b | 62 72 69 64 67 65 20 6d |n the ok|bridge m|
|00000760| 61 69 6c 69 6e 67 20 6c | 69 73 74 2c 20 74 68 65 |ailing l|ist, the|
|00000770| 6e 20 77 72 69 74 65 20 | 74 6f 0a 58 20 21 0a 58 |n write |to.X !.X|
|00000780| 20 21 20 20 20 6d 63 6c | 65 67 67 40 63 73 2e 75 | ! mcl|egg@cs.u|
|00000790| 63 73 64 2e 65 64 75 0a | 58 20 21 0a 58 2a 2f 0a |csd.edu.|X !.X*/.|
|000007a0| 58 20 0a 58 23 64 65 66 | 69 6e 65 20 5f 49 4e 50 |X .X#def|ine _INP|
|000007b0| 55 54 5f 0a 58 20 0a 58 | 23 69 66 64 65 66 20 5f |UT_.X .X|#ifdef _|
|000007c0| 5f 54 55 52 42 4f 43 5f | 5f 0a 58 23 69 6e 63 6c |_TURBOC_|_.X#incl|
|000007d0| 75 64 65 20 3c 61 6c 6c | 6f 63 2e 68 3e 0a 58 23 |ude <all|oc.h>.X#|
|000007e0| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 6c 69 62 2e |include |<stdlib.|
|000007f0| 68 3e 0a 58 23 65 6c 73 | 65 0a 58 20 20 65 78 74 |h>.X#els|e.X ext|
|00000800| 65 72 6e 20 69 6e 74 20 | 65 72 72 6e 6f 3b 0a 58 |ern int |errno;.X|
|00000810| 20 20 65 78 74 65 72 6e | 20 63 68 61 72 20 2a 73 | extern| char *s|
|00000820| 79 73 5f 65 72 72 6c 69 | 73 74 5b 5d 3b 0a 58 20 |ys_errli|st[];.X |
|00000830| 20 65 78 74 65 72 6e 20 | 63 68 61 72 20 2a 73 74 | extern |char *st|
|00000840| 72 64 75 70 28 29 3b 0a | 58 23 64 65 66 69 6e 65 |rdup();.|X#define|
|00000850| 20 72 61 6e 64 6f 6d 28 | 6e 29 20 28 28 72 61 6e | random(|n) ((ran|
|00000860| 64 28 29 2f 36 34 29 20 | 25 20 28 6e 29 29 0a 58 |d()/64) |% (n)).X|
|00000870| 23 65 6e 64 69 66 0a 58 | 20 0a 58 23 69 6e 63 6c |#endif.X| .X#incl|
|00000880| 75 64 65 20 3c 63 74 79 | 70 65 2e 68 3e 0a 58 23 |ude <cty|pe.h>.X#|
|00000890| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 69 6f 2e 68 |include |<stdio.h|
|000008a0| 3e 0a 58 23 69 6e 63 6c | 75 64 65 20 3c 73 74 72 |>.X#incl|ude <str|
|000008b0| 69 6e 67 2e 68 3e 0a 58 | 2f 2a 20 23 69 6e 63 6c |ing.h>.X|/* #incl|
|000008c0| 75 64 65 20 3c 74 69 6d | 65 2e 68 3e 20 2a 2f 0a |ude <tim|e.h> */.|
|000008d0| 58 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 74 |X#includ|e <sys/t|
|000008e0| 69 6d 65 2e 68 3e 0a 58 | 20 0a 58 23 69 6e 63 6c |ime.h>.X| .X#incl|
|000008f0| 75 64 65 20 22 67 6c 6f | 62 61 6c 73 2e 68 22 0a |ude "glo|bals.h".|
|00000900| 58 23 69 6e 63 6c 75 64 | 65 20 22 70 73 2e 68 22 |X#includ|e "ps.h"|
|00000910| 0a 58 23 69 6e 63 6c 75 | 64 65 20 22 6e 65 74 77 |.X#inclu|de "netw|
|00000920| 6f 72 6b 2e 68 22 0a 58 | 23 69 6e 63 6c 75 64 65 |ork.h".X|#include|
|00000930| 20 22 74 65 72 6d 69 6e | 61 6c 2e 68 22 0a 58 23 | "termin|al.h".X#|
|00000940| 69 6e 63 6c 75 64 65 20 | 22 64 69 73 70 6c 61 79 |include |"display|
|00000950| 2e 68 22 0a 58 23 69 6e | 63 6c 75 64 65 20 22 68 |.h".X#in|clude "h|
|00000960| 65 6c 70 2e 68 22 0a 58 | 23 69 6e 63 6c 75 64 65 |elp.h".X|#include|
|00000970| 20 22 69 6e 70 75 74 2e | 68 22 0a 58 23 69 6e 63 | "input.|h".X#inc|
|00000980| 6c 75 64 65 20 22 65 6d | 61 69 6c 2e 68 22 0a 58 |lude "em|ail.h".X|
|00000990| 20 0a 58 0a 58 65 78 74 | 65 72 6e 20 46 49 4c 45 | .X.Xext|ern FILE|
|000009a0| 20 2a 6c 6f 67 66 69 6c | 65 3b 0a 58 0a 58 65 78 | *logfil|e;.X.Xex|
|000009b0| 74 65 72 6e 20 69 6e 74 | 20 63 6f 64 65 66 69 6c |tern int| codefil|
|000009c0| 65 5f 6c 69 6e 65 5f 6e | 6f 3b 0a 58 65 78 74 65 |e_line_n|o;.Xexte|
|000009d0| 72 6e 20 69 6e 74 20 73 | 65 72 76 65 72 5f 6d 6f |rn int s|erver_mo|
|000009e0| 64 65 3b 0a 58 65 78 74 | 65 72 6e 20 63 68 61 72 |de;.Xext|ern char|
|000009f0| 20 2a 65 6d 61 69 6c 5f | 65 72 72 6f 72 5f 6d 65 | *email_|error_me|
|00000a00| 73 73 61 67 65 3b 0a 58 | 0a 58 73 74 61 74 69 63 |ssage;.X|.Xstatic|
|00000a10| 20 63 68 61 72 20 2a 70 | 61 72 73 69 6e 67 5f 65 | char *p|arsing_e|
|00000a20| 72 72 6d 73 67 3b 0a 58 | 20 0a 58 73 74 61 74 69 |rrmsg;.X| .Xstati|
|00000a30| 63 20 63 68 61 72 20 2a | 6b 65 79 77 6f 72 64 5f |c char *|keyword_|
|00000a40| 65 72 72 6f 72 20 3d 20 | 22 45 52 52 4f 52 20 49 |error = |"ERROR I|
|00000a50| 4e 20 43 4f 4d 4d 41 4e | 44 20 4b 45 59 57 4f 52 |N COMMAN|D KEYWOR|
|00000a60| 44 22 3b 0a 58 73 74 61 | 74 69 63 20 63 68 61 72 |D";.Xsta|tic char|
|00000a70| 20 2a 6e 75 6d 62 65 72 | 5f 65 72 72 6f 72 20 20 | *number|_error |
|00000a80| 3d 20 22 41 20 4e 55 4d | 45 52 49 43 20 41 52 47 |= "A NUM|ERIC ARG|
|00000a90| 55 4d 45 4e 54 20 49 53 | 20 52 45 51 55 49 52 45 |UMENT IS| REQUIRE|
|00000aa0| 44 22 3b 0a 58 73 74 61 | 74 69 63 20 63 68 61 72 |D";.Xsta|tic char|
|00000ab0| 20 2a 6c 65 76 65 6c 5f | 65 72 72 6f 72 20 20 20 | *level_|error |
|00000ac0| 3d 20 22 45 52 52 4f 52 | 20 49 4e 20 42 49 44 44 |= "ERROR| IN BIDD|
|00000ad0| 49 4e 47 20 4c 45 56 45 | 4c 22 3b 0a 58 73 74 61 |ING LEVE|L";.Xsta|
|00000ae0| 74 69 63 20 63 68 61 72 | 20 2a 73 75 69 74 5f 65 |tic char| *suit_e|
|00000af0| 72 72 6f 72 20 20 20 20 | 3d 20 22 45 52 52 4f 52 |rror |= "ERROR|
|00000b00| 20 49 4e 20 53 55 49 54 | 22 3b 0a 58 73 74 61 74 | IN SUIT|";.Xstat|
|00000b10| 69 63 20 63 68 61 72 20 | 2a 72 61 6e 6b 5f 65 72 |ic char |*rank_er|
|00000b20| 72 6f 72 20 20 20 20 3d | 20 22 45 52 52 4f 52 20 |ror =| "ERROR |
|00000b30| 49 4e 20 52 41 4e 4b 22 | 3b 0a 58 73 74 61 74 69 |IN RANK"|;.Xstati|
|00000b40| 63 20 63 68 61 72 20 2a | 64 65 61 6c 5f 65 72 72 |c char *|deal_err|
|00000b50| 6f 72 20 20 20 20 3d 20 | 22 45 52 52 4f 52 20 49 |or = |"ERROR I|
|00000b60| 4e 20 44 45 41 4c 20 4f | 46 20 43 41 52 44 53 22 |N DEAL O|F CARDS"|
|00000b70| 3b 0a 58 73 74 61 74 69 | 63 20 63 68 61 72 20 2a |;.Xstati|c char *|
|00000b80| 62 69 64 5f 65 72 72 6f | 72 3d 20 0a 58 20 20 22 |bid_erro|r= .X "|
|00000b90| 54 48 45 20 46 4f 52 4d | 41 54 20 4f 46 20 41 20 |THE FORM|AT OF A |
|00000ba0| 43 4f 52 52 45 43 54 20 | 42 49 44 20 49 53 20 3c |CORRECT |BID IS <|
|00000bb0| 4c 45 56 45 4c 3e 20 3c | 54 52 55 4d 50 53 55 49 |LEVEL> <|TRUMPSUI|
|00000bc0| 54 3e 20 4f 52 20 50 20 | 4f 52 20 58 20 4f 52 20 |T> OR P |OR X OR |
|00000bd0| 58 58 22 3b 0a 58 73 74 | 61 74 69 63 20 63 68 61 |XX";.Xst|atic cha|
|00000be0| 72 20 2a 70 6c 61 79 5f | 65 72 72 6f 72 20 20 20 |r *play_|error |
|00000bf0| 20 3d 0a 58 20 20 22 45 | 52 52 4f 52 20 2d 20 54 | =.X "E|RROR - T|
|00000c00| 48 45 20 46 4f 52 4d 41 | 54 20 4f 46 20 41 20 43 |HE FORMA|T OF A C|
|00000c10| 4f 52 52 45 43 54 20 50 | 4c 41 59 20 49 53 20 3c |ORRECT P|LAY IS <|
|00000c20| 53 55 49 54 3e 20 3c 52 | 41 4e 4b 3e 22 3b 0a 58 |SUIT> <R|ANK>";.X|
|00000c30| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 65 6e 64 |static c|har *end|
|00000c40| 69 6e 67 5f 65 72 72 6f | 72 20 20 3d 20 22 45 58 |ing_erro|r = "EX|
|00000c50| 54 52 41 20 4a 55 4e 4b | 20 41 54 20 45 4e 44 20 |TRA JUNK| AT END |
|00000c60| 4f 46 20 49 4e 50 55 54 | 22 3b 0a 58 73 74 61 74 |OF INPUT|";.Xstat|
|00000c70| 69 63 20 63 68 61 72 20 | 2a 62 65 6c 6c 5f 65 72 |ic char |*bell_er|
|00000c80| 72 6f 72 20 20 20 20 3d | 20 22 46 4f 52 4d 41 54 |ror =| "FORMAT|
|00000c90| 20 4f 46 20 2f 42 45 4c | 4c 20 43 4f 4d 4d 41 4e | OF /BEL|L COMMAN|
|00000ca0| 44 20 49 53 20 2f 42 45 | 4c 4c 20 5b 4f 4e 7c 4f |D IS /BE|LL [ON|O|
|00000cb0| 46 46 5d 22 3b 0a 58 73 | 74 61 74 69 63 20 63 68 |FF]";.Xs|tatic ch|
|00000cc0| 61 72 20 2a 70 72 6f 6d | 70 74 5f 65 72 72 6f 72 |ar *prom|pt_error|
|00000cd0| 20 20 3d 20 22 46 4f 52 | 4d 41 54 20 4f 46 20 2f | = "FOR|MAT OF /|
|00000ce0| 50 52 4f 4d 50 54 20 43 | 4f 4d 4d 41 4e 44 20 49 |PROMPT C|OMMAND I|
|00000cf0| 53 20 2f 50 52 4f 4d 50 | 54 20 5b 4f 4e 7c 4f 46 |S /PROMP|T [ON|OF|
|00000d00| 46 5d 22 3b 0a 58 73 74 | 61 74 69 63 20 63 68 61 |F]";.Xst|atic cha|
|00000d10| 72 20 2a 65 63 68 6f 5f | 65 72 72 6f 72 09 20 20 |r *echo_|error. |
|00000d20| 20 3d 20 22 45 52 52 4f | 52 20 49 4e 20 45 43 48 | = "ERRO|R IN ECH|
|00000d30| 4f 20 52 45 53 50 4f 4e | 53 45 22 3b 0a 58 73 74 |O RESPON|SE";.Xst|
|00000d40| 61 74 69 63 20 63 68 61 | 72 20 2a 72 65 73 70 5f |atic cha|r *resp_|
|00000d50| 65 72 72 6f 72 20 20 20 | 20 3d 20 22 45 52 52 4f |error | = "ERRO|
|00000d60| 52 20 49 4e 20 52 45 53 | 50 20 43 4f 4d 4d 41 4e |R IN RES|P COMMAN|
|00000d70| 44 22 3b 0a 58 73 74 61 | 74 69 63 20 63 68 61 72 |D";.Xsta|tic char|
|00000d80| 20 2a 73 63 6f 72 65 5f | 65 72 72 6f 72 20 20 20 | *score_|error |
|00000d90| 3d 20 22 45 52 52 4f 52 | 20 49 4e 20 53 43 4f 52 |= "ERROR| IN SCOR|
|00000da0| 45 20 43 4f 4d 4d 41 4e | 44 22 3b 0a 58 73 74 61 |E COMMAN|D";.Xsta|
|00000db0| 74 69 63 20 63 68 61 72 | 20 2a 76 75 6c 6e 5f 65 |tic char| *vuln_e|
|00000dc0| 72 72 6f 72 20 20 20 20 | 3d 20 22 45 52 52 4f 52 |rror |= "ERROR|
|00000dd0| 20 49 4e 20 56 55 4c 4e | 20 43 4f 4d 4d 41 4e 44 | IN VULN| COMMAND|
|00000de0| 22 3b 0a 58 73 74 61 74 | 69 63 20 63 68 61 72 20 |";.Xstat|ic char |
|00000df0| 2a 73 61 76 65 5f 65 72 | 72 6f 72 20 20 20 20 3d |*save_er|ror =|
|00000e00| 20 22 53 41 56 45 20 43 | 4f 4d 4d 41 4e 44 20 52 | "SAVE C|OMMAND R|
|00000e10| 45 51 55 49 52 45 53 20 | 41 20 66 69 6c 65 6e 61 |EQUIRES |A filena|
|00000e20| 6d 65 20 54 4f 20 42 45 | 20 47 49 56 45 4e 22 3b |me TO BE| GIVEN";|
|00000e30| 0a 58 73 74 61 74 69 63 | 20 63 68 61 72 20 2a 6c |.Xstatic| char *l|
|00000e40| 6f 61 64 5f 65 72 72 6f | 72 20 20 20 20 3d 20 22 |oad_erro|r = "|
|00000e50| 4c 4f 41 44 20 43 4f 4d | 4d 41 4e 44 20 52 45 51 |LOAD COM|MAND REQ|
|00000e60| 55 49 52 45 53 20 41 20 | 66 69 6c 65 6e 61 6d 65 |UIRES A |filename|
|00000e70| 20 54 4f 20 42 45 20 47 | 49 56 45 4e 22 3b 0a 58 | TO BE G|IVEN";.X|
|00000e80| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 72 65 70 |static c|har *rep|
|00000e90| 6c 61 79 5f 65 72 72 6f | 72 20 20 3d 20 22 52 45 |lay_erro|r = "RE|
|00000ea0| 50 4c 41 59 20 43 4f 4d | 4d 41 4e 44 20 52 45 51 |PLAY COM|MAND REQ|
|00000eb0| 55 49 52 45 53 20 41 20 | 66 69 6c 65 6e 61 6d 65 |UIRES A |filename|
|00000ec0| 20 54 4f 20 42 45 20 47 | 49 56 45 4e 22 3b 0a 58 | TO BE G|IVEN";.X|
|00000ed0| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 64 65 66 |static c|har *def|
|00000ee0| 61 75 6c 74 5f 65 72 72 | 6f 72 20 3d 20 22 46 4f |ault_err|or = "FO|
|00000ef0| 52 4d 41 54 20 4f 46 20 | 2f 44 45 46 41 55 4c 54 |RMAT OF |/DEFAULT|
|00000f00| 20 43 4f 4d 4d 41 4e 44 | 20 49 53 20 2f 44 45 46 | COMMAND| IS /DEF|
|00000f10| 41 55 4c 54 20 5b 4f 4e | 7c 4f 46 46 5d 22 3b 0a |AULT [ON||OFF]";.|
|00000f20| 58 0a 58 2f 2a 20 4d 6f | 73 74 20 6f 66 20 74 68 |X.X/* Mo|st of th|
|00000f30| 65 20 63 6f 6d 6d 61 6e | 64 73 20 74 68 65 20 77 |e comman|ds the w|
|00000f40| 65 20 72 65 63 65 69 76 | 65 20 66 72 6f 6d 20 74 |e receiv|e from t|
|00000f50| 68 65 20 6f 74 68 65 72 | 20 70 6c 61 79 65 72 73 |he other| players|
|00000f60| 0a 58 20 2e 20 77 65 20 | 70 72 6f 63 65 73 73 20 |.X . we |process |
|00000f70| 69 6d 6d 65 64 69 61 74 | 65 6c 79 20 61 66 74 65 |immediat|ely afte|
|00000f80| 72 20 72 65 63 65 69 76 | 69 6e 67 20 74 68 65 6d |r receiv|ing them|
|00000f90| 2e 20 20 48 6f 77 65 76 | 65 72 2c 20 74 68 65 0a |. Howev|er, the.|
|00000fa0| 58 20 2e 20 62 69 64 73 | 20 61 6e 64 20 70 6c 61 |X . bids| and pla|
|00000fb0| 79 73 20 77 65 20 73 74 | 6f 72 65 20 69 6e 20 61 |ys we st|ore in a|
|00000fc0| 20 71 75 65 75 65 20 75 | 6e 74 69 6c 20 77 65 20 | queue u|ntil we |
|00000fd0| 61 72 65 20 72 65 61 64 | 79 20 74 6f 0a 58 20 2e |are read|y to.X .|
|00000fe0| 20 61 63 63 65 70 74 20 | 74 68 65 6d 2e 20 20 57 | accept |them. W|
|00000ff0| 65 20 69 6d 70 6c 65 6d | 65 6e 74 20 74 68 69 73 |e implem|ent this|
|00001000| 20 71 75 65 75 65 20 61 | 73 20 61 20 63 69 72 63 | queue a|s a circ|
|00001010| 75 6c 61 72 20 61 72 72 | 61 79 2e 0a 58 20 2e 20 |ular arr|ay..X . |
|00001020| 53 69 6e 63 65 20 74 68 | 65 20 71 75 65 75 65 20 |Since th|e queue |
|00001030| 66 6f 72 20 61 20 67 69 | 76 65 6e 20 70 6c 61 79 |for a gi|ven play|
|00001040| 65 72 20 69 73 20 6e 65 | 76 65 72 20 65 78 70 65 |er is ne|ver expe|
|00001050| 63 74 65 64 20 74 6f 0a | 58 20 2e 20 63 6f 6e 74 |cted to.|X . cont|
|00001060| 61 69 6e 20 6d 6f 72 65 | 20 74 68 61 6e 20 6f 6e |ain more| than on|
|00001070| 65 20 69 74 65 6d 2c 20 | 77 65 20 73 65 65 20 6e |e item, |we see n|
|00001080| 6f 20 6e 65 65 64 20 74 | 6f 20 69 6d 70 6c 65 6d |o need t|o implem|
|00001090| 65 6e 74 0a 58 20 2e 20 | 61 20 64 79 6e 61 6d 69 |ent.X . |a dynami|
|000010a0| 63 61 6c 6c 79 20 61 6c | 6c 6f 63 61 74 65 64 20 |cally al|located |
|000010b0| 71 75 65 75 65 2e 0a 58 | 20 2e 0a 58 20 2a 2f 0a |queue..X| ..X */.|
|000010c0| 58 0a 58 0a 58 23 64 65 | 66 69 6e 65 20 51 55 45 |X.X.X#de|fine QUE|
|000010d0| 55 45 5f 4c 45 4e 47 54 | 48 20 35 30 0a 58 74 79 |UE_LENGT|H 50.Xty|
|000010e0| 70 65 64 65 66 20 73 74 | 72 75 63 74 20 70 6c 61 |pedef st|ruct pla|
|000010f0| 79 65 72 5f 63 6f 6d 6d | 61 6e 64 5f 73 74 72 75 |yer_comm|and_stru|
|00001100| 63 74 20 70 6c 61 79 65 | 72 5f 71 75 65 75 65 20 |ct playe|r_queue |
|00001110| 5b 51 55 45 55 45 5f 4c | 45 4e 47 54 48 5d 3b 0a |[QUEUE_L|ENGTH];.|
|00001120| 58 0a 58 73 74 61 74 69 | 63 20 70 6c 61 79 65 72 |X.Xstati|c player|
|00001130| 5f 71 75 65 75 65 20 63 | 6f 6d 6d 61 6e 64 5f 71 |_queue c|ommand_q|
|00001140| 75 65 75 65 20 5b 34 5d | 3b 0a 58 73 74 61 74 69 |ueue [4]|;.Xstati|
|00001150| 63 20 69 6e 74 20 20 20 | 20 20 20 20 20 20 20 71 |c int | q|
|00001160| 75 65 75 65 5f 69 6e 20 | 20 5b 34 5d 20 3d 20 7b |ueue_in | [4] = {|
|00001170| 30 2c 20 30 2c 20 30 2c | 20 30 7d 3b 0a 58 73 74 |0, 0, 0,| 0};.Xst|
|00001180| 61 74 69 63 20 69 6e 74 | 20 20 20 20 20 20 20 20 |atic int| |
|00001190| 20 20 71 75 65 75 65 5f | 6f 75 74 20 5b 34 5d 20 | queue_|out [4] |
|000011a0| 3d 20 7b 30 2c 20 30 2c | 20 30 2c 20 30 7d 3b 0a |= {0, 0,| 0, 0};.|
|000011b0| 58 0a 58 23 64 65 66 69 | 6e 65 20 51 55 45 55 45 |X.X#defi|ne QUEUE|
|000011c0| 5f 45 4d 50 54 59 28 6e | 29 20 28 71 75 65 75 65 |_EMPTY(n|) (queue|
|000011d0| 5f 69 6e 5b 6e 5d 20 3d | 3d 20 71 75 65 75 65 5f |_in[n] =|= queue_|
|000011e0| 6f 75 74 5b 6e 5d 29 0a | 58 23 64 65 66 69 6e 65 |out[n]).|X#define|
|000011f0| 20 51 55 45 55 45 5f 46 | 55 4c 4c 28 6e 29 20 20 | QUEUE_F|ULL(n) |
|00001200| 28 28 28 71 75 65 75 65 | 5f 69 6e 5b 6e 5d 2b 31 |(((queue|_in[n]+1|
|00001210| 29 20 25 20 51 55 45 55 | 45 5f 4c 45 4e 47 54 48 |) % QUEU|E_LENGTH|
|00001220| 29 20 3d 3d 20 71 75 65 | 75 65 5f 6f 75 74 5b 6e |) == que|ue_out[n|
|00001230| 5d 29 0a 58 0a 58 73 74 | 61 74 69 63 20 63 68 61 |]).X.Xst|atic cha|
|00001240| 72 20 2a 6c 6f 63 61 6c | 5f 70 6c 61 79 65 72 5f |r *local|_player_|
|00001250| 6e 61 6d 65 73 20 5b 5d | 20 3d 20 7b 22 4e 4f 52 |names []| = {"NOR|
|00001260| 54 48 22 2c 20 22 45 41 | 53 54 22 2c 20 22 53 4f |TH", "EA|ST", "SO|
|00001270| 55 54 48 22 2c 20 22 57 | 45 53 54 22 7d 3b 0a 58 |UTH", "W|EST"};.X|
|00001280| 69 6e 74 20 20 20 20 20 | 20 20 20 20 70 6c 61 79 |int | play|
|00001290| 65 72 73 5f 68 65 72 65 | 20 20 20 20 20 20 20 20 |ers_here| |
|000012a0| 5b 5d 20 3d 20 7b 30 2c | 20 30 2c 20 30 2c 20 30 |[] = {0,| 0, 0, 0|
|000012b0| 7d 3b 0a 58 20 20 2f 2a | 20 70 6c 61 79 65 72 73 |};.X /*| players|
|000012c0| 5f 68 65 72 65 20 69 73 | 20 75 73 65 64 20 74 6f |_here is| used to|
|000012d0| 20 72 65 63 6f 72 64 20 | 77 68 69 63 68 20 70 6c | record |which pl|
|000012e0| 61 79 65 72 73 20 68 61 | 76 65 20 67 69 76 65 6e |ayers ha|ve given|
|000012f0| 20 61 6e 0a 58 20 20 20 | 2e 20 61 63 6b 6e 6f 77 | an.X |. acknow|
|00001300| 6c 65 64 67 6d 65 6e 74 | 20 6f 76 65 72 20 74 68 |ledgment| over th|
|00001310| 65 20 6e 65 74 77 6f 72 | 6b 20 74 68 61 74 20 74 |e networ|k that t|
|00001320| 68 65 79 20 61 72 65 20 | 72 65 61 64 79 20 74 6f |hey are |ready to|
|00001330| 20 70 6c 61 79 2e 0a 58 | 20 20 20 2a 2f 0a 58 73 | play..X| */.Xs|
|00001340| 74 61 74 69 63 20 70 61 | 72 73 65 5f 73 74 72 69 |tatic pa|rse_stri|
|00001350| 6e 67 20 63 6f 6d 6d 61 | 6e 64 5f 73 74 72 69 6e |ng comma|nd_strin|
|00001360| 67 20 3d 20 4e 55 4c 4c | 3b 0a 58 73 74 61 74 69 |g = NULL|;.Xstati|
|00001370| 63 20 69 6e 70 75 74 5f | 62 75 66 66 65 72 20 74 |c input_|buffer t|
|00001380| 61 6c 6b 5f 62 75 66 66 | 65 72 20 20 20 20 3d 20 |alk_buff|er = |
|00001390| 4e 55 4c 4c 3b 0a 58 73 | 74 61 74 69 63 20 69 6e |NULL;.Xs|tatic in|
|000013a0| 70 75 74 5f 62 75 66 66 | 65 72 20 70 6c 61 79 5f |put_buff|er play_|
|000013b0| 62 75 66 66 65 72 20 20 | 20 20 3d 20 4e 55 4c 4c |buffer | = NULL|
|000013c0| 3b 0a 58 73 74 61 74 69 | 63 20 69 6e 70 75 74 5f |;.Xstati|c input_|
|000013d0| 62 75 66 66 65 72 20 61 | 73 6b 5f 62 75 66 66 65 |buffer a|sk_buffe|
|000013e0| 72 20 20 20 20 20 3d 20 | 4e 55 4c 4c 3b 0a 58 0a |r = |NULL;.X.|
|000013f0| 58 63 68 61 72 20 2a 61 | 75 74 6f 6c 6f 61 64 5f |Xchar *a|utoload_|
|00001400| 66 69 6c 65 20 3d 20 4e | 55 4c 4c 3b 20 20 20 20 |file = N|ULL; |
|00001410| 20 2f 2a 20 54 68 65 20 | 6e 61 6d 65 20 6f 66 20 | /* The |name of |
|00001420| 74 68 65 20 66 69 6c 65 | 20 66 72 6f 6d 20 77 68 |the file| from wh|
|00001430| 69 63 68 20 77 65 0a 58 | 09 09 09 09 20 20 20 77 |ich we.X|.... w|
|00001440| 69 6c 6c 20 69 6e 69 74 | 69 61 6c 6c 79 20 74 72 |ill init|ially tr|
|00001450| 79 20 74 6f 20 6c 6f 61 | 64 20 61 20 73 65 71 75 |y to loa|d a sequ|
|00001460| 65 6e 63 65 0a 58 09 09 | 09 09 20 20 20 6f 66 20 |ence.X..|.. of |
|00001470| 62 6f 61 72 64 73 2c 20 | 69 66 20 77 65 20 61 72 |boards, |if we ar|
|00001480| 65 20 6e 6f 72 74 68 20 | 69 6e 20 65 6d 61 69 6c |e north |in email|
|00001490| 20 6d 6f 64 65 2e 20 2a | 2f 0a 58 63 68 61 72 20 | mode. *|/.Xchar |
|000014a0| 2a 61 75 74 6f 73 61 76 | 65 5f 66 69 6c 65 20 3d |*autosav|e_file =|
|000014b0| 20 4e 55 4c 4c 3b 20 20 | 20 20 20 2f 2a 20 54 68 | NULL; | /* Th|
|000014c0| 65 20 6e 61 6d 65 20 6f | 66 20 74 68 65 20 66 69 |e name o|f the fi|
|000014d0| 6c 65 20 74 6f 20 77 68 | 69 63 68 20 77 65 20 77 |le to wh|ich we w|
|000014e0| 69 6c 6c 0a 58 09 09 09 | 09 20 20 20 61 75 74 6f |ill.X...|. auto|
|000014f0| 6d 61 74 69 63 61 6c 6c | 79 20 73 61 76 65 20 74 |maticall|y save t|
|00001500| 68 65 20 62 6f 61 72 64 | 73 20 74 68 61 74 20 77 |he board|s that w|
|00001510| 65 0a 58 09 09 09 09 20 | 20 20 68 61 76 65 20 70 |e.X.... | have p|
|00001520| 6c 61 79 65 64 2e 20 2a | 2f 0a 58 0a 58 69 6e 74 |layed. *|/.X.Xint|
|00001530| 20 72 69 6e 67 5f 6d 79 | 5f 62 65 6c 6c 20 3d 20 | ring_my|_bell = |
|00001540| 31 3b 09 09 2f 2a 20 41 | 20 62 6f 6f 6c 65 61 6e |1;../* A| boolean|
|00001550| 20 76 61 72 69 61 62 6c | 65 20 74 68 61 74 20 77 | variabl|e that w|
|00001560| 68 65 6e 20 74 72 75 65 | 20 63 61 75 73 65 73 0a |hen true| causes.|
|00001570| 58 09 09 09 09 20 20 20 | 74 68 65 20 74 65 72 6d |X.... |the term|
|00001580| 69 6e 61 6c 20 62 65 6c | 6c 20 74 6f 20 62 65 20 |inal bel|l to be |
|00001590| 72 75 6e 67 20 62 65 66 | 6f 72 65 20 61 73 6b 69 |rung bef|ore aski|
|000015a0| 6e 67 0a 58 09 09 09 09 | 20 20 20 66 6f 72 20 61 |ng.X....| for a|
|000015b0| 20 62 69 64 20 6f 72 20 | 70 6c 61 79 2e 20 2a 2f | bid or |play. */|
|000015c0| 0a 58 0a 58 73 74 61 74 | 69 63 20 63 68 61 72 20 |.X.Xstat|ic char |
|000015d0| 2a 64 65 66 61 75 6c 74 | 5f 69 6e 70 75 74 20 3d |*default|_input =|
|000015e0| 20 4e 55 4c 4c 3b 20 2f | 2a 20 54 68 65 20 69 6e | NULL; /|* The in|
|000015f0| 70 75 74 20 77 68 69 63 | 68 20 77 69 6c 6c 20 62 |put whic|h will b|
|00001600| 65 20 67 69 76 65 6e 20 | 74 6f 20 74 68 65 0a 58 |e given |to the.X|
|00001610| 09 09 09 09 20 20 20 20 | 20 20 70 72 6f 67 72 61 |.... | progra|
|00001620| 6d 20 69 66 20 74 68 65 | 20 75 73 65 72 20 61 73 |m if the| user as|
|00001630| 6b 73 20 66 6f 72 20 64 | 65 66 61 75 6c 74 2e 20 |ks for d|efault. |
|00001640| 2a 2f 0a 58 73 74 61 74 | 69 63 20 69 6e 74 20 20 |*/.Xstat|ic int |
|00001650| 64 65 66 61 75 6c 74 5f | 73 75 69 74 20 3d 20 2d |default_|suit = -|
|00001660| 31 3b 20 20 2f 2a 20 54 | 68 65 20 64 65 66 61 75 |1; /* T|he defau|
|00001670| 6c 74 20 73 75 69 74 20 | 74 68 61 74 20 77 69 6c |lt suit |that wil|
|00001680| 6c 20 62 65 20 75 73 65 | 64 20 69 66 20 61 0a 58 |l be use|d if a.X|
|00001690| 09 09 09 09 20 20 20 70 | 6c 61 79 65 72 20 73 70 |.... p|layer sp|
|000016a0| 65 63 69 66 69 65 73 20 | 6f 6e 6c 79 20 74 68 65 |ecifies |only the|
|000016b0| 20 72 61 6e 6b 20 6f 66 | 20 74 68 65 0a 58 09 09 | rank of| the.X..|
|000016c0| 09 09 20 20 20 63 61 72 | 64 20 74 6f 20 62 65 20 |.. car|d to be |
|000016d0| 70 6c 61 79 65 64 2e 20 | 20 2d 31 20 3d 3d 20 6e |played. | -1 == n|
|000016e0| 6f 20 64 65 66 61 75 6c | 74 2e 20 2a 2f 0a 58 73 |o defaul|t. */.Xs|
|000016f0| 74 61 74 69 63 20 6c 6f | 6e 67 20 63 6f 6d 6d 61 |tatic lo|ng comma|
|00001700| 6e 64 5f 64 69 73 61 62 | 6c 65 64 3b 0a 58 09 09 |nd_disab|led;.X..|
|00001710| 09 09 20 20 20 2f 2a 20 | 57 65 20 6f 6e 6c 79 20 |.. /* |We only |
|00001720| 61 6c 6c 6f 77 20 74 68 | 65 20 6c 6f 63 61 6c 20 |allow th|e local |
|00001730| 70 6c 61 79 65 72 20 74 | 6f 0a 58 09 09 09 09 20 |player t|o.X.... |
|00001740| 20 20 20 2e 20 75 73 65 | 20 61 20 73 75 62 73 65 | . use| a subse|
|00001750| 74 20 6f 66 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 |t of the| command|
|00001760| 73 20 77 68 69 63 68 0a | 58 09 09 09 09 20 20 20 |s which.|X.... |
|00001770| 20 2e 20 74 68 65 20 69 | 6e 74 65 72 6e 61 6c 20 | . the i|nternal |
|00001780| 69 6e 74 65 72 70 72 65 | 74 65 72 20 68 61 6e 64 |interpre|ter hand|
|00001790| 6c 65 73 20 2d 2d 0a 58 | 09 09 09 09 20 20 20 20 |les --.X|.... |
|000017a0| 2e 20 74 68 65 20 72 65 | 6d 61 69 6e 69 6e 67 20 |. the re|maining |
|000017b0| 63 6f 6d 6d 61 6e 64 73 | 20 61 72 65 20 75 73 65 |commands| are use|
|000017c0| 64 0a 58 09 09 09 09 20 | 20 20 20 2e 20 66 6f 72 |d.X.... | . for|
|000017d0| 20 69 6e 74 65 72 6e 61 | 6c 20 63 6f 6d 6d 75 6e | interna|l commun|
|000017e0| 69 63 61 74 69 6f 6e 73 | 2e 20 2a 2f 0a 58 0a 58 |ications|. */.X.X|
|000017f0| 73 74 61 74 69 63 20 69 | 6e 74 20 66 6f 72 63 65 |static i|nt force|
|00001800| 64 5f 74 61 6c 6b 5f 6d | 6f 64 65 20 3d 30 3b 20 |d_talk_m|ode =0; |
|00001810| 2f 2a 20 54 72 75 65 20 | 69 66 20 74 68 65 20 70 |/* True |if the p|
|00001820| 6c 61 79 65 72 20 68 61 | 73 20 66 6f 72 63 65 64 |layer ha|s forced|
|00001830| 20 74 68 65 20 70 72 6f | 67 72 61 6d 0a 58 09 09 | the pro|gram.X..|
|00001840| 09 09 20 20 20 69 6e 74 | 6f 20 74 61 6c 6b 20 6d |.. int|o talk m|
|00001850| 6f 64 65 2c 20 65 76 65 | 6e 20 74 68 6f 75 67 68 |ode, eve|n though|
|00001860| 20 61 20 62 69 64 20 6f | 72 0a 58 09 09 09 09 20 | a bid o|r.X.... |
|00001870| 20 20 70 6c 61 79 20 69 | 73 20 72 65 71 75 69 72 | play i|s requir|
|00001880| 65 64 2e 20 2a 2f 0a 58 | 0a 58 23 64 65 66 69 6e |ed. */.X|.X#defin|
|00001890| 65 20 64 69 73 61 62 6c | 65 28 78 29 20 20 63 6f |e disabl|e(x) co|
|000018a0| 6d 6d 61 6e 64 5f 64 69 | 73 61 62 6c 65 64 20 7c |mmand_di|sabled ||
|000018b0| 3d 20 28 78 29 0a 58 23 | 64 65 66 69 6e 65 20 65 |= (x).X#|define e|
|000018c0| 6e 61 62 6c 65 28 78 29 | 20 20 20 63 6f 6d 6d 61 |nable(x)| comma|
|000018d0| 6e 64 5f 64 69 73 61 62 | 6c 65 64 20 20 26 3d 20 |nd_disab|led &= |
|000018e0| 7e 28 78 29 0a 58 23 64 | 65 66 69 6e 65 20 64 69 |~(x).X#d|efine di|
|000018f0| 73 61 62 6c 65 64 28 78 | 29 20 28 63 6f 6d 6d 61 |sabled(x|) (comma|
|00001900| 6e 64 5f 64 69 73 61 62 | 6c 65 64 20 26 20 28 78 |nd_disab|led & (x|
|00001910| 29 29 0a 58 23 64 65 66 | 69 6e 65 20 65 6e 61 62 |)).X#def|ine enab|
|00001920| 6c 65 64 28 78 29 20 20 | 21 64 69 73 61 62 6c 65 |led(x) |!disable|
|00001930| 64 20 28 78 29 0a 58 0a | 58 0a 58 73 74 61 74 69 |d (x).X.|X.Xstati|
|00001940| 63 20 73 74 72 75 63 74 | 20 74 69 6d 65 76 61 6c |c struct| timeval|
|00001950| 20 70 69 6e 67 5f 73 74 | 61 72 74 3b 20 20 2f 2a | ping_st|art; /*|
|00001960| 20 74 69 6d 65 20 61 74 | 20 77 68 69 63 68 20 6c | time at| which l|
|00001970| 61 73 74 20 70 69 6e 67 | 20 63 6f 6d 6d 61 6e 64 |ast ping| command|
|00001980| 0a 58 09 09 09 09 20 20 | 20 20 2e 20 77 61 73 20 |.X.... | . was |
|00001990| 69 73 73 75 65 64 2e 20 | 2a 2f 0a 58 0a 58 73 74 |issued. |*/.X.Xst|
|000019a0| 61 74 69 63 20 69 6e 74 | 20 77 61 69 74 69 6e 67 |atic int| waiting|
|000019b0| 5f 66 6f 72 5f 61 63 6b | 6e 6f 77 6c 65 64 67 6d |_for_ack|nowledgm|
|000019c0| 65 6e 74 20 3d 20 30 3b | 0a 58 20 20 20 20 20 20 |ent = 0;|.X |
|000019d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000019e0| 20 20 20 20 20 20 20 20 | 2f 2a 20 74 72 75 65 20 | |/* true |
|000019f0| 69 66 20 77 65 20 61 72 | 65 20 77 61 69 74 69 6e |if we ar|e waitin|
|00001a00| 67 20 66 6f 72 20 74 68 | 65 20 75 73 65 72 0a 58 |g for th|e user.X|
|00001a10| 09 09 09 09 20 74 6f 20 | 70 72 65 73 73 20 52 45 |.... to |press RE|
|00001a20| 54 55 52 4e 2e 20 20 54 | 68 69 73 20 6d 6f 64 65 |TURN. T|his mode|
|00001a30| 20 63 61 6e 20 62 65 0a | 58 09 09 09 09 20 69 6e | can be.|X.... in|
|00001a40| 74 65 72 72 75 70 74 65 | 64 20 62 79 20 61 20 63 |terrupte|d by a c|
|00001a50| 6c 61 69 6d 20 72 65 71 | 75 65 73 74 2e 20 2a 2f |laim req|uest. */|
|00001a60| 0a 58 0a 58 73 74 61 74 | 69 63 20 69 6e 74 20 63 |.X.Xstat|ic int c|
|00001a70| 6c 61 69 6d 5f 72 65 73 | 70 6f 6e 73 65 73 3b 20 |laim_res|ponses; |
|00001a80| 20 20 2f 2a 20 6e 75 6d | 62 65 72 20 6f 66 20 72 | /* num|ber of r|
|00001a90| 65 73 70 6f 6e 73 65 73 | 20 72 65 63 65 69 76 65 |esponses| receive|
|00001aa0| 64 20 73 6f 20 66 61 72 | 20 74 6f 0a 58 09 09 09 |d so far| to.X...|
|00001ab0| 09 20 74 68 65 20 6d 6f | 73 74 20 72 65 63 65 6e |. the mo|st recen|
|00001ac0| 74 20 63 6c 61 69 6d 20 | 63 6f 6d 6d 61 6e 64 2e |t claim |command.|
|00001ad0| 20 2a 2f 0a 58 73 74 61 | 74 69 63 20 69 6e 74 20 | */.Xsta|tic int |
|00001ae0| 63 6c 61 69 6d 5f 72 65 | 6a 65 63 74 65 64 3b 20 |claim_re|jected; |
|00001af0| 20 20 20 2f 2a 20 74 72 | 75 65 20 69 66 20 74 68 | /* tr|ue if th|
|00001b00| 65 20 63 6c 61 69 6d 20 | 6f 66 66 65 72 20 77 61 |e claim |offer wa|
|00001b10| 73 20 72 65 6a 65 63 74 | 65 64 2e 20 2a 2f 0a 58 |s reject|ed. */.X|
|00001b20| 0a 58 73 74 61 74 69 63 | 20 69 6e 74 20 73 63 6f |.Xstatic| int sco|
|00001b30| 72 69 6e 67 5f 6d 6f 64 | 65 5f 6b 6e 6f 77 6e 20 |ring_mod|e_known |
|00001b40| 3d 20 30 3b 20 2f 2a 20 | 74 72 75 65 20 77 68 65 |= 0; /* |true whe|
|00001b50| 6e 20 77 65 20 6b 6e 6f | 77 20 77 68 61 74 20 73 |n we kno|w what s|
|00001b60| 63 6f 72 69 6e 67 20 6d | 6f 64 65 0a 58 09 09 09 |coring m|ode.X...|
|00001b70| 09 20 20 20 20 20 20 77 | 69 6c 6c 20 62 65 20 75 |. w|ill be u|
|00001b80| 73 65 64 2e 20 2a 2f 0a | 58 0a 58 0a 58 73 74 61 |sed. */.|X.X.Xsta|
|00001b90| 74 69 63 20 69 6e 69 74 | 69 61 6c 69 7a 65 5f 63 |tic init|ialize_c|
|00001ba0| 6f 6d 6d 61 6e 64 5f 71 | 75 65 75 65 20 28 29 0a |ommand_q|ueue ().|
|00001bb0| 58 7b 0a 58 09 69 6e 74 | 20 69 3b 0a 58 0a 58 09 |X{.X.int| i;.X.X.|
|00001bc0| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 69 20 3c 20 |for (i =| 0; i < |
|00001bd0| 34 3b 20 69 2b 2b 29 0a | 58 09 09 71 75 65 75 65 |4; i++).|X..queue|
|00001be0| 5f 69 6e 5b 69 5d 20 3d | 20 71 75 65 75 65 5f 6f |_in[i] =| queue_o|
|00001bf0| 75 74 5b 69 5d 20 3d 20 | 30 3b 0a 58 7d 3b 0a 58 |ut[i] = |0;.X};.X|
|00001c00| 20 0a 58 73 74 61 74 69 | 63 20 69 6e 74 20 63 6f | .Xstati|c int co|
|00001c10| 6d 6d 61 6e 64 5f 61 76 | 61 69 6c 61 62 6c 65 20 |mmand_av|ailable |
|00001c20| 28 70 6c 61 79 65 72 5f | 6e 6f 29 0a 58 09 69 6e |(player_|no).X.in|
|00001c30| 74 20 70 6c 61 79 65 72 | 5f 6e 6f 3b 0a 58 2f 2a |t player|_no;.X/*|
|00001c40| 20 52 65 74 75 72 6e 73 | 20 74 72 75 65 20 69 66 | Returns| true if|
|00001c50| 20 74 68 65 72 65 20 69 | 73 20 61 20 63 6f 6d 6d | there i|s a comm|
|00001c60| 61 6e 64 20 61 76 61 69 | 6c 61 62 6c 65 20 66 72 |and avai|lable fr|
|00001c70| 6f 6d 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |om the s|pecified|
|00001c80| 20 70 6c 61 79 65 72 2e | 20 2a 2f 0a 58 7b 0a 58 | player.| */.X{.X|
|00001c90| 09 72 65 74 75 72 6e 20 | 28 21 51 55 45 55 45 5f |.return |(!QUEUE_|
|00001ca0| 45 4d 50 54 59 28 70 6c | 61 79 65 72 5f 6e 6f 29 |EMPTY(pl|ayer_no)|
|00001cb0| 29 3b 0a 58 7d 3b 0a 58 | 20 0a 58 73 74 61 74 69 |);.X};.X| .Xstati|
|00001cc0| 63 20 63 6f 70 79 5f 70 | 6c 61 79 65 72 5f 63 6f |c copy_p|layer_co|
|00001cd0| 6d 6d 61 6e 64 20 28 64 | 65 73 74 2c 20 73 6f 75 |mmand (d|est, sou|
|00001ce0| 72 63 65 29 0a 58 09 70 | 6c 61 79 65 72 5f 63 6f |rce).X.p|layer_co|
|00001cf0| 6d 6d 61 6e 64 20 64 65 | 73 74 2c 20 73 6f 75 72 |mmand de|st, sour|
|00001d00| 63 65 3b 0a 58 7b 0a 58 | 09 6d 65 6d 63 70 79 20 |ce;.X{.X|.memcpy |
|00001d10| 28 64 65 73 74 2c 20 73 | 6f 75 72 63 65 2c 20 73 |(dest, s|ource, s|
|00001d20| 69 7a 65 6f 66 28 73 74 | 72 75 63 74 20 70 6c 61 |izeof(st|ruct pla|
|00001d30| 79 65 72 5f 63 6f 6d 6d | 61 6e 64 5f 73 74 72 75 |yer_comm|and_stru|
|00001d40| 63 74 29 29 3b 0a 58 7d | 3b 0a 58 0a 58 73 74 61 |ct));.X}|;.X.Xsta|
|00001d50| 74 69 63 20 65 6e 71 75 | 65 75 65 5f 63 6f 6d 6d |tic enqu|eue_comm|
|00001d60| 61 6e 64 20 28 70 63 29 | 0a 58 09 70 6c 61 79 65 |and (pc)|.X.playe|
|00001d70| 72 5f 63 6f 6d 6d 61 6e | 64 20 70 63 3b 0a 58 2f |r_comman|d pc;.X/|
|00001d80| 2a 20 41 64 64 73 20 74 | 68 65 20 70 6c 61 79 65 |* Adds t|he playe|
|00001d90| 72 5f 63 6f 6d 6d 61 6e | 64 20 70 63 20 74 6f 20 |r_comman|d pc to |
|00001da0| 74 68 65 20 71 75 65 75 | 65 20 66 6f 72 20 70 6c |the queu|e for pl|
|00001db0| 61 79 65 72 5f 6e 6f 2e | 20 2a 2f 0a 58 7b 0a 58 |ayer_no.| */.X{.X|
|00001dc0| 09 70 6c 61 79 65 72 5f | 63 6f 6d 6d 61 6e 64 20 |.player_|command |
|00001dd0| 64 65 73 74 3b 0a 58 09 | 69 6e 74 20 6e 3b 0a 58 |dest;.X.|int n;.X|
|00001de0| 0a 58 09 69 66 20 28 51 | 55 45 55 45 5f 46 55 4c |.X.if (Q|UEUE_FUL|
|00001df0| 4c 28 70 63 2d 3e 70 6c | 61 79 65 72 5f 6e 6f 29 |L(pc->pl|ayer_no)|
|00001e00| 29 20 7b 0a 58 09 09 44 | 69 73 70 6c 61 79 5f 50 |) {.X..D|isplay_P|
|00001e10| 6c 61 79 65 72 5f 43 6f | 6d 6d 65 6e 74 20 28 22 |layer_Co|mment ("|
|00001e20| 49 4e 54 45 52 4e 41 4c | 20 45 52 52 4f 52 21 22 |INTERNAL| ERROR!"|
|00001e30| 2c 0a 58 09 09 09 22 43 | 4f 4d 4d 41 4e 44 20 51 |,.X..."C|OMMAND Q|
|00001e40| 55 45 55 45 20 4f 56 45 | 52 46 4c 4f 57 22 29 3b |UEUE OVE|RFLOW");|
|00001e50| 0a 58 09 7d 20 65 6c 73 | 65 20 7b 0a 58 09 20 20 |.X.} els|e {.X. |
|00001e60| 09 6e 20 3d 20 70 63 2d | 3e 70 6c 61 79 65 72 5f |.n = pc-|>player_|
|00001e70| 6e 6f 3b 0a 58 09 20 20 | 09 64 65 73 74 20 3d 20 |no;.X. |.dest = |
|00001e80| 26 28 63 6f 6d 6d 61 6e | 64 5f 71 75 65 75 65 5b |&(comman|d_queue[|
|00001e90| 6e 5d 5b 71 75 65 75 65 | 5f 69 6e 5b 6e 5d 5d 29 |n][queue|_in[n]])|
|00001ea0| 3b 0a 58 09 20 20 09 63 | 6f 70 79 5f 70 6c 61 79 |;.X. .c|opy_play|
|00001eb0| 65 72 5f 63 6f 6d 6d 61 | 6e 64 20 28 64 65 73 74 |er_comma|nd (dest|
|00001ec0| 2c 20 70 63 29 3b 0a 58 | 09 09 71 75 65 75 65 5f |, pc);.X|..queue_|
|00001ed0| 69 6e 5b 6e 5d 20 3d 20 | 28 71 75 65 75 65 5f 69 |in[n] = |(queue_i|
|00001ee0| 6e 5b 6e 5d 20 2b 20 31 | 29 20 25 20 51 55 45 55 |n[n] + 1|) % QUEU|
|00001ef0| 45 5f 4c 45 4e 47 54 48 | 3b 0a 58 09 7d 0a 58 7d |E_LENGTH|;.X.}.X}|
|00001f00| 3b 0a 58 20 0a 58 20 0a | 58 73 74 61 74 69 63 20 |;.X .X .|Xstatic |
|00001f10| 64 65 71 75 65 75 65 5f | 63 6f 6d 6d 61 6e 64 20 |dequeue_|command |
|00001f20| 28 6e 2c 20 70 63 29 0a | 58 09 69 6e 74 20 6e 3b |(n, pc).|X.int n;|
|00001f30| 20 70 6c 61 79 65 72 5f | 63 6f 6d 6d 61 6e 64 20 | player_|command |
|00001f40| 70 63 3b 0a 58 2f 2a 20 | 52 65 6d 6f 76 65 73 20 |pc;.X/* |Removes |
|00001f50| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 61 74 20 74 |the comm|and at t|
|00001f60| 68 65 20 68 65 61 64 20 | 6f 66 20 74 68 65 20 71 |he head |of the q|
|00001f70| 75 65 75 65 20 66 6f 72 | 20 74 68 65 20 67 69 76 |ueue for| the giv|
|00001f80| 65 6e 20 70 6c 61 79 65 | 72 2e 20 2a 2f 0a 58 7b |en playe|r. */.X{|
|00001f90| 0a 58 09 70 6c 61 79 65 | 72 5f 63 6f 6d 6d 61 6e |.X.playe|r_comman|
|00001fa0| 64 20 73 6f 75 72 63 65 | 3b 0a 58 0a 58 09 69 66 |d source|;.X.X.if|
|00001fb0| 20 28 51 55 45 55 45 5f | 45 4d 50 54 59 28 6e 29 | (QUEUE_|EMPTY(n)|
|00001fc0| 29 20 7b 0a 58 09 09 44 | 69 73 70 6c 61 79 5f 50 |) {.X..D|isplay_P|
|00001fd0| 6c 61 79 65 72 5f 43 6f | 6d 6d 65 6e 74 20 28 22 |layer_Co|mment ("|
|00001fe0| 49 4e 54 45 52 4e 41 4c | 20 45 52 52 4f 52 21 22 |INTERNAL| ERROR!"|
|00001ff0| 2c 0a 58 09 09 09 22 43 | 4f 4d 4d 41 4e 44 20 51 |,.X..."C|OMMAND Q|
|00002000| 55 45 55 45 20 49 53 20 | 45 4d 50 54 59 22 29 3b |UEUE IS |EMPTY");|
|00002010| 0a 58 09 7d 20 65 6c 73 | 65 20 7b 0a 58 09 20 20 |.X.} els|e {.X. |
|00002020| 09 73 6f 75 72 63 65 20 | 3d 20 26 28 63 6f 6d 6d |.source |= &(comm|
|00002030| 61 6e 64 5f 71 75 65 75 | 65 5b 6e 5d 5b 71 75 65 |and_queu|e[n][que|
|00002040| 75 65 5f 6f 75 74 5b 6e | 5d 5d 29 3b 0a 58 09 20 |ue_out[n|]]);.X. |
|00002050| 20 09 63 6f 70 79 5f 70 | 6c 61 79 65 72 5f 63 6f | .copy_p|layer_co|
|00002060| 6d 6d 61 6e 64 20 28 70 | 63 2c 20 73 6f 75 72 63 |mmand (p|c, sourc|
|00002070| 65 29 3b 0a 58 09 09 71 | 75 65 75 65 5f 6f 75 74 |e);.X..q|ueue_out|
|00002080| 5b 6e 5d 20 3d 20 28 71 | 75 65 75 65 5f 6f 75 74 |[n] = (q|ueue_out|
|00002090| 5b 6e 5d 20 2b 20 31 29 | 20 25 20 51 55 45 55 45 |[n] + 1)| % QUEUE|
|000020a0| 5f 4c 45 4e 47 54 48 3b | 0a 58 09 7d 0a 58 7d 3b |_LENGTH;|.X.}.X};|
|000020b0| 0a 58 20 0a 58 20 0a 58 | 20 0a 58 73 74 61 74 69 |.X .X .X| .Xstati|
|000020c0| 63 20 73 6b 69 70 5f 73 | 70 61 63 65 73 20 28 70 |c skip_s|paces (p|
|000020d0| 73 29 0a 58 09 70 61 72 | 73 65 5f 73 74 72 69 6e |s).X.par|se_strin|
|000020e0| 67 20 70 73 3b 0a 58 2f | 2a 20 53 6b 69 70 73 20 |g ps;.X/|* Skips |
|000020f0| 63 68 61 72 61 63 74 65 | 72 73 20 69 6e 20 74 68 |characte|rs in th|
|00002100| 65 20 70 61 72 73 65 5f | 73 74 72 69 6e 67 20 70 |e parse_|string p|
|00002110| 73 20 75 6e 74 69 6c 20 | 61 20 6e 6f 6e 62 6c 61 |s until |a nonbla|
|00002120| 6e 6b 20 63 68 61 72 61 | 63 74 65 72 0a 58 20 2e |nk chara|cter.X .|
|00002130| 20 69 73 20 66 6f 75 6e | 64 2e 0a 58 20 2a 2f 0a | is foun|d..X */.|
|00002140| 58 7b 0a 58 09 77 68 69 | 6c 65 20 28 70 73 5f 73 |X{.X.whi|le (ps_s|
|00002150| 63 61 6e 28 70 73 29 20 | 3d 3d 20 27 20 27 29 0a |can(ps) |== ' ').|
|00002160| 58 09 09 70 73 5f 6e 65 | 78 74 28 70 73 29 3b 0a |X..ps_ne|xt(ps);.|
|00002170| 58 7d 3b 0a 58 20 0a 58 | 73 74 61 74 69 63 20 69 |X};.X .X|static i|
|00002180| 6e 74 20 70 61 72 73 65 | 5f 6e 61 74 75 72 61 6c |nt parse|_natural|
|00002190| 20 28 70 73 29 0a 58 09 | 70 61 72 73 65 5f 73 74 | (ps).X.|parse_st|
|000021a0| 72 69 6e 67 20 70 73 3b | 0a 58 2f 2a 20 50 61 72 |ring ps;|.X/* Par|
|000021b0| 73 65 73 20 61 20 6e 61 | 74 75 72 61 6c 20 6e 75 |ses a na|tural nu|
|000021c0| 6d 62 65 72 2e 20 20 49 | 66 20 73 75 63 63 65 73 |mber. I|f succes|
|000021d0| 73 66 75 6c 2c 20 72 65 | 74 75 72 6e 73 20 74 68 |sful, re|turns th|
|000021e0| 65 20 6e 6f 6e 2d 6e 65 | 67 61 74 69 76 65 0a 58 |e non-ne|gative.X|
|000021f0| 20 2e 20 69 6e 74 65 67 | 65 72 20 77 68 69 63 68 | . integ|er which|
|00002200| 20 69 73 20 70 61 72 73 | 65 64 2e 20 20 4f 74 68 | is pars|ed. Oth|
|00002210| 65 72 77 69 73 65 2c 20 | 72 65 74 75 72 6e 73 20 |erwise, |returns |
|00002220| 2d 31 20 61 6e 64 20 73 | 65 74 73 20 65 72 72 6f |-1 and s|ets erro|
|00002230| 72 0a 58 20 2e 20 6d 65 | 73 73 61 67 65 20 61 63 |r.X . me|ssage ac|
|00002240| 63 6f 72 64 69 6e 67 6c | 79 2e 20 0a 58 20 2a 2f |cordingl|y. .X */|
|00002250| 0a 58 7b 0a 58 09 69 6e | 74 20 63 68 2c 20 6e 2c |.X{.X.in|t ch, n,|
|00002260| 20 64 69 67 69 74 73 3b | 0a 58 0a 58 09 6e 20 3d | digits;|.X.X.n =|
|00002270| 20 64 69 67 69 74 73 20 | 3d 20 30 3b 0a 58 20 20 | digits |= 0;.X |
|00002280| 20 20 20 20 20 20 73 6b | 69 70 5f 73 70 61 63 65 | sk|ip_space|
|00002290| 73 20 28 70 73 29 3b 0a | 58 09 63 68 20 3d 20 70 |s (ps);.|X.ch = p|
|000022a0| 73 5f 73 63 61 6e 20 28 | 70 73 29 3b 0a 58 09 77 |s_scan (|ps);.X.w|
|000022b0| 68 69 6c 65 20 28 28 27 | 30 27 20 3c 3d 20 63 68 |hile (('|0' <= ch|
|000022c0| 29 20 26 26 20 28 63 68 | 20 3c 3d 20 27 39 27 29 |) && (ch| <= '9')|
|000022d0| 29 20 7b 0a 58 09 09 70 | 73 5f 6e 65 78 74 20 28 |) {.X..p|s_next (|
|000022e0| 70 73 29 3b 0a 58 09 09 | 64 69 67 69 74 73 2b 2b |ps);.X..|digits++|
|000022f0| 3b 0a 58 09 09 6e 20 3d | 20 31 30 2a 6e 20 2b 20 |;.X..n =| 10*n + |
|00002300| 28 63 68 20 2d 20 27 30 | 27 29 3b 0a 58 09 09 63 |(ch - '0|');.X..c|
|00002310| 68 20 3d 20 70 73 5f 73 | 63 61 6e 20 28 70 73 29 |h = ps_s|can (ps)|
|00002320| 3b 0a 58 09 7d 3b 0a 58 | 09 69 66 20 28 64 69 67 |;.X.};.X|.if (dig|
|00002330| 69 74 73 20 3d 3d 20 30 | 29 20 7b 0a 58 09 09 70 |its == 0|) {.X..p|
|00002340| 61 72 73 69 6e 67 5f 65 | 72 72 6d 73 67 20 3d 20 |arsing_e|rrmsg = |
|00002350| 6e 75 6d 62 65 72 5f 65 | 72 72 6f 72 3b 0a 58 09 |number_e|rror;.X.|
|00002360| 09 72 65 74 75 72 6e 20 | 28 2d 31 29 3b 0a 58 09 |.return |(-1);.X.|
|00002370| 7d 20 65 6c 73 65 0a 58 | 09 09 72 65 74 75 72 6e |} else.X|..return|
|00002380| 20 28 6e 29 3b 0a 58 7d | 3b 0a 58 0a 58 73 74 61 | (n);.X}|;.X.Xsta|
|00002390| 74 69 63 20 69 6e 74 20 | 70 61 72 73 65 5f 6c 65 |tic int |parse_le|
|000023a0| 76 65 6c 20 28 70 73 29 | 0a 58 09 70 61 72 73 65 |vel (ps)|.X.parse|
|000023b0| 5f 73 74 72 69 6e 67 20 | 70 73 3b 0a 58 2f 2a 20 |_string |ps;.X/* |
|000023c0| 50 61 72 73 65 73 20 74 | 68 65 20 62 69 64 64 69 |Parses t|he biddi|
|000023d0| 6e 67 20 6c 65 76 65 6c | 2e 0a 58 20 2e 20 3c 6c |ng level|..X . <l|
|000023e0| 65 76 65 6c 3e 20 3d 20 | 31 20 7c 20 32 20 7c 20 |evel> = |1 | 2 | |
|000023f0| 33 20 7c 20 34 20 7c 20 | 35 20 7c 20 36 20 7c 20 |3 | 4 | |5 | 6 | |
|00002400| 37 0a 58 20 2e 20 49 66 | 20 73 75 63 63 65 73 73 |7.X . If| success|
|00002410| 66 75 6c 2c 20 72 65 74 | 75 72 6e 73 20 74 68 65 |ful, ret|urns the|
|00002420| 20 6c 65 76 65 6c 20 61 | 73 20 61 6e 20 69 6e 74 | level a|s an int|
|00002430| 65 67 65 72 2e 20 20 4f | 74 68 65 72 77 69 73 65 |eger. O|therwise|
|00002440| 2c 0a 58 20 2e 20 72 65 | 74 75 72 6e 73 20 2d 31 |,.X . re|turns -1|
|00002450| 2c 20 61 6e 64 20 73 65 | 74 73 20 65 72 72 6f 72 |, and se|ts error|
|00002460| 20 6d 65 73 73 61 67 65 | 20 61 63 63 6f 72 64 69 | message| accordi|
|00002470| 6e 67 6c 79 2e 0a 58 20 | 2a 2f 0a 58 7b 0a 58 09 |ngly..X |*/.X{.X.|
|00002480| 69 6e 74 20 6e 3b 0a 58 | 20 0a 58 09 6e 20 3d 20 |int n;.X| .X.n = |
|00002490| 70 61 72 73 65 5f 6e 61 | 74 75 72 61 6c 20 28 70 |parse_na|tural (p|
|000024a0| 73 29 3b 0a 58 09 69 66 | 20 28 28 31 20 3c 3d 20 |s);.X.if| ((1 <= |
|000024b0| 6e 29 20 26 26 20 28 6e | 20 3c 3d 20 37 29 29 0a |n) && (n| <= 7)).|
|000024c0| 58 09 09 72 65 74 75 72 | 6e 20 28 6e 29 3b 0a 58 |X..retur|n (n);.X|
|000024d0| 09 65 6c 73 65 20 69 66 | 20 28 6e 20 3e 3d 20 30 |.else if| (n >= 0|
|000024e0| 29 0a 58 09 09 70 61 72 | 73 69 6e 67 5f 65 72 72 |).X..par|sing_err|
|000024f0| 6d 73 67 20 3d 20 6c 65 | 76 65 6c 5f 65 72 72 6f |msg = le|vel_erro|
|00002500| 72 3b 0a 58 09 72 65 74 | 75 72 6e 20 28 2d 31 29 |r;.X.ret|urn (-1)|
|00002510| 3b 0a 58 09 0a 58 7d 3b | 0a 58 20 0a 58 73 74 61 |;.X..X};|.X .Xsta|
|00002520| 74 69 63 20 69 6e 74 20 | 70 61 72 73 65 5f 73 75 |tic int |parse_su|
|00002530| 69 74 20 28 70 73 29 0a | 58 09 70 61 72 73 65 5f |it (ps).|X.parse_|
|00002540| 73 74 72 69 6e 67 20 70 | 73 3b 0a 58 2f 2a 20 50 |string p|s;.X/* P|
|00002550| 61 72 73 65 73 20 61 20 | 73 75 69 74 20 6e 61 6d |arses a |suit nam|
|00002560| 65 2e 0a 58 20 2e 20 3c | 73 75 69 74 3e 20 3d 20 |e..X . <|suit> = |
|00002570| 43 20 7c 20 44 20 7c 20 | 48 20 7c 20 53 20 7c 20 |C | D | |H | S | |
|00002580| 43 4c 55 42 5b 53 5d 20 | 7c 20 44 49 41 4d 4f 4e |CLUB[S] || DIAMON|
|00002590| 44 5b 53 5d 20 7c 20 48 | 45 41 52 54 5b 53 5d 20 |D[S] | H|EART[S] |
|000025a0| 7c 20 53 50 41 44 45 5b | 53 5d 0a 58 20 2e 20 49 || SPADE[|S].X . I|
|000025b0| 66 20 73 75 63 63 65 73 | 73 66 75 6c 2c 20 74 68 |f succes|sful, th|
|000025c0| 65 6e 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 73 |en retur|ns the s|
|000025d0| 75 69 74 20 69 6e 64 65 | 78 2e 20 20 4f 74 68 65 |uit inde|x. Othe|
|000025e0| 72 77 69 73 65 2c 20 72 | 65 74 75 72 6e 73 0a 58 |rwise, r|eturns.X|
|000025f0| 20 2e 20 2d 31 20 61 6e | 64 20 73 65 74 73 20 70 | . -1 an|d sets p|
|00002600| 61 72 73 69 6e 67 5f 65 | 72 72 6f 72 20 61 63 63 |arsing_e|rror acc|
|00002610| 6f 72 64 69 6e 67 6c 79 | 2e 0a 58 20 2a 2f 0a 58 |ordingly|..X */.X|
|00002620| 7b 0a 58 09 73 6b 69 70 | 5f 73 70 61 63 65 73 20 |{.X.skip|_spaces |
|00002630| 28 70 73 29 3b 0a 58 09 | 69 66 20 28 70 73 5f 6d |(ps);.X.|if (ps_m|
|00002640| 61 74 63 68 65 73 5f 69 | 63 28 70 73 2c 20 22 43 |atches_i|c(ps, "C|
|00002650| 4c 55 42 22 29 29 20 7b | 0a 58 09 09 70 73 5f 6d |LUB")) {|.X..ps_m|
|00002660| 61 74 63 68 65 73 5f 69 | 63 28 70 73 2c 20 22 53 |atches_i|c(ps, "S|
|00002670| 22 29 3b 0a 58 09 09 72 | 65 74 75 72 6e 20 28 53 |");.X..r|eturn (S|
|00002680| 55 49 54 5f 43 4c 55 42 | 53 29 3b 0a 58 09 7d 20 |UIT_CLUB|S);.X.} |
|00002690| 65 6c 73 65 20 69 66 20 | 28 70 73 5f 6d 61 74 63 |else if |(ps_matc|
|000026a0| 68 65 73 5f 69 63 28 70 | 73 2c 20 22 44 49 41 4d |hes_ic(p|s, "DIAM|
|000026b0| 4f 4e 44 22 29 29 20 7b | 0a 58 09 09 70 73 5f 6d |OND")) {|.X..ps_m|
|000026c0| 61 74 63 68 65 73 5f 69 | 63 28 70 73 2c 20 22 53 |atches_i|c(ps, "S|
|000026d0| 22 29 3b 0a 58 09 09 72 | 65 74 75 72 6e 20 28 53 |");.X..r|eturn (S|
|000026e0| 55 49 54 5f 44 49 41 4d | 4f 4e 44 53 29 3b 0a 58 |UIT_DIAM|ONDS);.X|
|000026f0| 09 7d 20 65 6c 73 65 20 | 69 66 20 28 70 73 5f 6d |.} else |if (ps_m|
|00002700| 61 74 63 68 65 73 5f 69 | 63 28 70 73 2c 20 22 48 |atches_i|c(ps, "H|
|00002710| 45 41 52 54 22 29 29 20 | 7b 0a 58 09 09 70 73 5f |EART")) |{.X..ps_|
|00002720| 6d 61 74 63 68 65 73 5f | 69 63 28 70 73 2c 20 22 |matches_|ic(ps, "|
|00002730| 53 22 29 3b 0a 58 09 09 | 72 65 74 75 72 6e 20 28 |S");.X..|return (|
|00002740| 53 55 49 54 5f 48 45 41 | 52 54 53 29 3b 0a 58 09 |SUIT_HEA|RTS);.X.|
|00002750| 7d 20 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |} else i|f (ps_ma|
|00002760| 74 63 68 65 73 5f 69 63 | 28 70 73 2c 20 22 53 50 |tches_ic|(ps, "SP|
|00002770| 41 44 45 22 29 29 20 7b | 0a 58 09 09 70 73 5f 6d |ADE")) {|.X..ps_m|
|00002780| 61 74 63 68 65 73 5f 69 | 63 28 70 73 2c 20 22 53 |atches_i|c(ps, "S|
|00002790| 22 29 3b 0a 58 09 09 72 | 65 74 75 72 6e 20 28 53 |");.X..r|eturn (S|
|000027a0| 55 49 54 5f 53 50 41 44 | 45 53 29 3b 0a 58 09 7d |UIT_SPAD|ES);.X.}|
|000027b0| 20 65 6c 73 65 20 69 66 | 20 28 70 73 5f 6d 61 74 | else if| (ps_mat|
|000027c0| 63 68 65 73 5f 69 63 28 | 70 73 2c 20 22 43 22 29 |ches_ic(|ps, "C")|
|000027d0| 29 0a 58 09 09 72 65 74 | 75 72 6e 20 28 53 55 49 |).X..ret|urn (SUI|
|000027e0| 54 5f 43 4c 55 42 53 29 | 3b 0a 58 09 65 6c 73 65 |T_CLUBS)|;.X.else|
|000027f0| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|00002800| 69 63 28 70 73 2c 20 22 | 44 22 29 29 0a 58 09 09 |ic(ps, "|D")).X..|
|00002810| 72 65 74 75 72 6e 20 28 | 53 55 49 54 5f 44 49 41 |return (|SUIT_DIA|
|00002820| 4d 4f 4e 44 53 29 3b 0a | 58 09 65 6c 73 65 20 69 |MONDS);.|X.else i|
|00002830| 66 20 28 70 73 5f 6d 61 | 74 63 68 65 73 5f 69 63 |f (ps_ma|tches_ic|
|00002840| 28 70 73 2c 20 22 48 22 | 29 29 0a 58 09 09 72 65 |(ps, "H"|)).X..re|
|00002850| 74 75 72 6e 20 28 53 55 | 49 54 5f 48 45 41 52 54 |turn (SU|IT_HEART|
|00002860| 53 29 3b 0a 58 09 65 6c | 73 65 20 69 66 20 28 70 |S);.X.el|se if (p|
|00002870| 73 5f 6d 61 74 63 68 65 | 73 5f 69 63 28 70 73 2c |s_matche|s_ic(ps,|
|00002880| 20 22 53 22 29 29 0a 58 | 09 09 72 65 74 75 72 6e | "S")).X|..return|
|00002890| 20 28 53 55 49 54 5f 53 | 50 41 44 45 53 29 3b 0a | (SUIT_S|PADES);.|
|000028a0| 58 09 70 61 72 73 69 6e | 67 5f 65 72 72 6d 73 67 |X.parsin|g_errmsg|
|000028b0| 20 3d 20 73 75 69 74 5f | 65 72 72 6f 72 3b 0a 58 | = suit_|error;.X|
|000028c0| 09 72 65 74 75 72 6e 20 | 28 2d 31 29 3b 0a 58 7d |.return |(-1);.X}|
|000028d0| 3b 0a 58 20 0a 58 73 74 | 61 74 69 63 20 69 6e 74 |;.X .Xst|atic int|
|000028e0| 20 70 61 72 73 65 5f 72 | 61 6e 6b 20 28 70 73 29 | parse_r|ank (ps)|
|000028f0| 0a 58 09 70 61 72 73 65 | 5f 73 74 72 69 6e 67 20 |.X.parse|_string |
|00002900| 70 73 3b 0a 58 2f 2a 20 | 50 61 72 73 65 73 20 74 |ps;.X/* |Parses t|
|00002910| 68 65 20 72 61 6e 6b 20 | 6f 66 20 61 20 63 61 72 |he rank |of a car|
|00002920| 64 2e 0a 58 20 2e 20 3c | 72 61 6e 6b 3e 20 3d 20 |d..X . <|rank> = |
|00002930| 32 20 7c 20 33 20 7c 20 | 34 20 7c 20 35 20 7c 20 |2 | 3 | |4 | 5 | |
|00002940| 36 20 7c 20 37 20 7c 20 | 38 20 7c 20 39 20 7c 20 |6 | 7 | |8 | 9 | |
|00002950| 31 30 20 7c 20 54 20 7c | 20 4a 20 7c 20 51 20 7c |10 | T || J | Q ||
|00002960| 20 4b 20 7c 20 41 0a 58 | 20 2e 20 20 20 20 20 20 | K | A.X| . |
|00002970| 20 20 20 20 20 20 7c 20 | 4a 41 43 4b 20 7c 20 51 | | |JACK | Q|
|00002980| 55 45 45 4e 20 7c 20 4b | 49 4e 47 20 7c 20 41 43 |UEEN | K|ING | AC|
|00002990| 45 0a 58 20 2e 20 52 65 | 74 75 72 6e 73 20 74 68 |E.X . Re|turns th|
|000029a0| 65 20 72 61 6e 6b 20 6f | 66 20 74 68 65 20 63 61 |e rank o|f the ca|
|000029b0| 72 64 2c 20 77 68 65 72 | 65 20 32 20 68 61 73 20 |rd, wher|e 2 has |
|000029c0| 72 61 6e 6b 20 30 20 61 | 6e 64 20 41 20 68 61 73 |rank 0 a|nd A has|
|000029d0| 20 72 61 6e 6b 20 31 32 | 2e 0a 58 20 2e 20 49 66 | rank 12|..X . If|
|000029e0| 20 61 6e 20 65 72 72 6f | 72 2c 20 73 65 74 73 20 | an erro|r, sets |
|000029f0| 70 61 72 73 69 6e 67 5f | 65 72 72 6d 73 67 20 61 |parsing_|errmsg a|
|00002a00| 63 63 6f 72 64 69 6e 67 | 6c 79 20 61 6e 64 20 72 |ccording|ly and r|
|00002a10| 65 74 75 72 6e 73 20 2d | 31 2e 0a 58 20 2a 2f 0a |eturns -|1..X */.|
|00002a20| 58 7b 0a 58 09 73 6b 69 | 70 5f 73 70 61 63 65 73 |X{.X.ski|p_spaces|
|00002a30| 20 28 70 73 29 3b 0a 58 | 09 69 66 20 28 70 73 5f | (ps);.X|.if (ps_|
|00002a40| 6d 61 74 63 68 65 73 28 | 70 73 2c 20 22 32 22 29 |matches(|ps, "2")|
|00002a50| 29 0a 58 09 09 72 65 74 | 75 72 6e 20 28 30 29 3b |).X..ret|urn (0);|
|00002a60| 0a 58 09 65 6c 73 65 20 | 69 66 20 28 70 73 5f 6d |.X.else |if (ps_m|
|00002a70| 61 74 63 68 65 73 28 70 | 73 2c 20 22 33 22 29 29 |atches(p|s, "3"))|
|00002a80| 0a 58 09 09 72 65 74 75 | 72 6e 20 28 31 29 3b 0a |.X..retu|rn (1);.|
|00002a90| 58 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |X.else i|f (ps_ma|
|00002aa0| 74 63 68 65 73 28 70 73 | 2c 20 22 34 22 29 29 0a |tches(ps|, "4")).|
|00002ab0| 58 09 09 72 65 74 75 72 | 6e 20 28 32 29 3b 0a 58 |X..retur|n (2);.X|
|00002ac0| 09 65 6c 73 65 20 69 66 | 20 28 70 73 5f 6d 61 74 |.else if| (ps_mat|
|00002ad0| 63 68 65 73 28 70 73 2c | 20 22 35 22 29 29 0a 58 |ches(ps,| "5")).X|
|00002ae0| 09 09 72 65 74 75 72 6e | 20 28 33 29 3b 0a 58 09 |..return| (3);.X.|
|00002af0| 65 6c 73 65 20 69 66 20 | 28 70 73 5f 6d 61 74 63 |else if |(ps_matc|
|00002b00| 68 65 73 28 70 73 2c 20 | 22 36 22 29 29 0a 58 09 |hes(ps, |"6")).X.|
|00002b10| 09 72 65 74 75 72 6e 20 | 28 34 29 3b 0a 58 09 65 |.return |(4);.X.e|
|00002b20| 6c 73 65 20 69 66 20 28 | 70 73 5f 6d 61 74 63 68 |lse if (|ps_match|
|00002b30| 65 73 28 70 73 2c 20 22 | 37 22 29 29 0a 58 09 09 |es(ps, "|7")).X..|
|00002b40| 72 65 74 75 72 6e 20 28 | 35 29 3b 0a 58 09 65 6c |return (|5);.X.el|
|00002b50| 73 65 20 69 66 20 28 70 | 73 5f 6d 61 74 63 68 65 |se if (p|s_matche|
|00002b60| 73 28 70 73 2c 20 22 38 | 22 29 29 0a 58 09 09 72 |s(ps, "8|")).X..r|
|00002b70| 65 74 75 72 6e 20 28 36 | 29 3b 0a 58 09 65 6c 73 |eturn (6|);.X.els|
|00002b80| 65 20 69 66 20 28 70 73 | 5f 6d 61 74 63 68 65 73 |e if (ps|_matches|
|00002b90| 28 70 73 2c 20 22 39 22 | 29 29 0a 58 09 09 72 65 |(ps, "9"|)).X..re|
|00002ba0| 74 75 72 6e 20 28 37 29 | 3b 0a 58 09 65 6c 73 65 |turn (7)|;.X.else|
|00002bb0| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 28 | if (ps_|matches(|
|00002bc0| 70 73 2c 20 22 31 30 22 | 29 29 0a 58 09 09 72 65 |ps, "10"|)).X..re|
|00002bd0| 74 75 72 6e 20 28 38 29 | 3b 0a 58 09 65 6c 73 65 |turn (8)|;.X.else|
|00002be0| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|00002bf0| 69 63 28 70 73 2c 20 22 | 54 45 4e 22 29 29 0a 58 |ic(ps, "|TEN")).X|
|00002c00| 09 09 72 65 74 75 72 6e | 20 28 38 29 3b 0a 58 09 |..return| (8);.X.|
|00002c10| 65 6c 73 65 20 69 66 20 | 28 70 73 5f 6d 61 74 63 |else if |(ps_matc|
|00002c20| 68 65 73 5f 69 63 28 70 | 73 2c 20 22 4a 41 43 4b |hes_ic(p|s, "JACK|
|00002c30| 22 29 29 0a 58 09 09 72 | 65 74 75 72 6e 20 28 39 |")).X..r|eturn (9|
|00002c40| 29 3b 0a 58 09 65 6c 73 | 65 20 69 66 20 28 70 73 |);.X.els|e if (ps|
|00002c50| 5f 6d 61 74 63 68 65 73 | 5f 69 63 28 70 73 2c 20 |_matches|_ic(ps, |
|00002c60| 22 51 55 45 45 4e 22 29 | 29 0a 58 09 09 72 65 74 |"QUEEN")|).X..ret|
|00002c70| 75 72 6e 20 28 31 30 29 | 3b 0a 58 09 65 6c 73 65 |urn (10)|;.X.else|
|00002c80| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|00002c90| 69 63 28 70 73 2c 20 22 | 4b 49 4e 47 22 29 29 0a |ic(ps, "|KING")).|
|00002ca0| 58 09 09 72 65 74 75 72 | 6e 20 28 31 31 29 3b 0a |X..retur|n (11);.|
|00002cb0| 58 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |X.else i|f (ps_ma|
|00002cc0| 74 63 68 65 73 5f 69 63 | 28 70 73 2c 20 22 41 43 |tches_ic|(ps, "AC|
|00002cd0| 45 22 29 29 0a 58 09 09 | 72 65 74 75 72 6e 20 28 |E")).X..|return (|
|00002ce0| 31 32 29 3b 0a 58 09 65 | 6c 73 65 20 69 66 20 28 |12);.X.e|lse if (|
|00002cf0| 70 73 5f 6d 61 74 63 68 | 65 73 5f 69 63 28 70 73 |ps_match|es_ic(ps|
|00002d00| 2c 20 22 54 22 29 29 0a | 58 09 09 72 65 74 75 72 |, "T")).|X..retur|
|00002d10| 6e 20 28 38 29 3b 0a 58 | 09 65 6c 73 65 20 69 66 |n (8);.X|.else if|
|00002d20| 20 28 70 73 5f 6d 61 74 | 63 68 65 73 5f 69 63 28 | (ps_mat|ches_ic(|
|00002d30| 70 73 2c 20 22 4a 22 29 | 29 0a 58 09 09 72 65 74 |ps, "J")|).X..ret|
|00002d40| 75 72 6e 20 28 39 29 3b | 0a 58 09 65 6c 73 65 20 |urn (9);|.X.else |
|00002d50| 69 66 20 28 70 73 5f 6d | 61 74 63 68 65 73 5f 69 |if (ps_m|atches_i|
|00002d60| 63 28 70 73 2c 20 22 51 | 22 29 29 0a 58 09 09 72 |c(ps, "Q|")).X..r|
|00002d70| 65 74 75 72 6e 20 28 31 | 30 29 3b 0a 58 09 65 6c |eturn (1|0);.X.el|
|00002d80| 73 65 20 69 66 20 28 70 | 73 5f 6d 61 74 63 68 65 |se if (p|s_matche|
|00002d90| 73 5f 69 63 28 70 73 2c | 20 22 4b 22 29 29 0a 58 |s_ic(ps,| "K")).X|
|00002da0| 09 09 72 65 74 75 72 6e | 20 28 31 31 29 3b 0a 58 |..return| (11);.X|
|00002db0| 09 65 6c 73 65 20 69 66 | 20 28 70 73 5f 6d 61 74 |.else if| (ps_mat|
|00002dc0| 63 68 65 73 5f 69 63 28 | 70 73 2c 20 22 41 22 29 |ches_ic(|ps, "A")|
|00002dd0| 29 0a 58 09 09 72 65 74 | 75 72 6e 20 28 31 32 29 |).X..ret|urn (12)|
|00002de0| 3b 0a 58 09 70 61 72 73 | 69 6e 67 5f 65 72 72 6d |;.X.pars|ing_errm|
|00002df0| 73 67 20 3d 20 72 61 6e | 6b 5f 65 72 72 6f 72 3b |sg = ran|k_error;|
|00002e00| 0a 58 09 72 65 74 75 72 | 6e 20 28 2d 31 29 3b 0a |.X.retur|n (-1);.|
|00002e10| 58 7d 3b 0a 58 20 0a 58 | 20 0a 58 73 74 61 74 69 |X};.X .X| .Xstati|
|00002e20| 63 20 70 61 72 73 65 5f | 72 64 65 61 6c 5f 63 6f |c parse_|rdeal_co|
|00002e30| 6d 6d 61 6e 64 20 28 70 | 73 2c 20 70 63 29 0a 58 |mmand (p|s, pc).X|
|00002e40| 09 70 61 72 73 65 5f 73 | 74 72 69 6e 67 20 70 73 |.parse_s|tring ps|
|00002e50| 3b 20 70 6c 61 79 65 72 | 5f 63 6f 6d 6d 61 6e 64 |; player|_command|
|00002e60| 20 70 63 3b 0a 58 2f 2a | 20 50 61 72 73 65 73 20 | pc;.X/*| Parses |
|00002e70| 61 20 72 64 65 61 6c 20 | 63 6f 6d 6d 61 6e 64 2c |a rdeal |command,|
|00002e80| 20 77 68 69 63 68 20 69 | 73 20 6f 66 20 74 68 65 | which i|s of the|
|00002e90| 20 66 6f 72 6d 61 74 3a | 0a 58 20 2e 20 52 44 45 | format:|.X . RDE|
|00002ea0| 41 4c 20 3c 63 61 72 64 | 73 3e 0a 58 20 2e 20 77 |AL <card|s>.X . w|
|00002eb0| 68 65 72 65 20 3c 63 61 | 72 64 73 3e 20 69 73 20 |here <ca|rds> is |
|00002ec0| 74 68 65 20 27 73 68 75 | 66 66 6c 65 64 27 20 64 |the 'shu|ffled' d|
|00002ed0| 65 63 6b 20 6f 66 20 63 | 61 72 64 73 2e 20 20 54 |eck of c|ards. T|
|00002ee0| 68 61 74 20 69 73 2c 0a | 58 20 2e 20 63 61 72 64 |hat is,.|X . card|
|00002ef0| 73 20 69 73 20 61 20 73 | 74 72 69 6e 67 20 6f 66 |s is a s|tring of|
|00002f00| 20 35 32 20 63 68 61 72 | 61 63 74 65 72 73 2c 20 | 52 char|acters, |
|00002f10| 65 61 63 68 20 6f 66 20 | 77 68 69 63 68 20 69 73 |each of |which is|
|00002f20| 20 61 20 30 2c 20 31 2c | 20 32 20 6f 72 20 33 2e | a 0, 1,| 2 or 3.|
|00002f30| 0a 58 20 2e 20 54 68 65 | 20 69 6e 74 65 72 70 72 |.X . The| interpr|
|00002f40| 65 74 61 74 69 6f 6e 20 | 6f 66 20 74 68 69 73 20 |etation |of this |
|00002f50| 69 73 20 74 68 61 74 20 | 69 66 20 74 68 65 20 6a |is that |if the j|
|00002f60| 27 74 68 20 63 68 61 72 | 61 63 74 65 72 20 69 73 |'th char|acter is|
|00002f70| 20 69 2c 0a 58 20 2e 20 | 74 68 65 6e 20 70 6c 61 | i,.X . |then pla|
|00002f80| 79 65 72 20 69 20 69 73 | 20 64 65 61 6c 74 20 63 |yer i is| dealt c|
|00002f90| 61 72 64 20 6a 2e 0a 58 | 20 2a 2f 0a 58 7b 0a 58 |ard j..X| */.X{.X|
|00002fa0| 09 69 6e 74 20 69 2c 20 | 63 68 3b 0a 58 20 0a 58 |.int i, |ch;.X .X|
|00002fb0| 09 73 6b 69 70 5f 73 70 | 61 63 65 73 20 28 70 73 |.skip_sp|aces (ps|
|00002fc0| 29 3b 0a 58 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |);.X.pc-|>command|
|00002fd0| 20 3d 20 43 4d 44 5f 52 | 44 45 41 4c 3b 0a 58 09 | = CMD_R|DEAL;.X.|
|00002fe0| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 69 20 3c 20 |for (i =| 0; i < |
|00002ff0| 35 32 3b 20 69 2b 2b 29 | 20 7b 0a 58 09 09 63 68 |52; i++)| {.X..ch|
|00003000| 20 3d 20 70 73 5f 73 63 | 61 6e 20 28 70 73 29 3b | = ps_sc|an (ps);|
|00003010| 0a 58 09 09 69 66 20 28 | 28 27 30 27 20 3c 3d 20 |.X..if (|('0' <= |
|00003020| 63 68 29 20 26 26 20 28 | 63 68 20 3c 3d 20 27 33 |ch) && (|ch <= '3|
|00003030| 27 29 29 0a 58 09 09 09 | 70 63 2d 3e 64 61 74 61 |')).X...|pc->data|
|00003040| 2e 64 65 61 6c 5b 69 5d | 20 3d 20 63 68 20 2d 20 |.deal[i]| = ch - |
|00003050| 27 30 27 3b 0a 58 09 09 | 65 6c 73 65 20 7b 0a 58 |'0';.X..|else {.X|
|00003060| 09 09 09 70 63 2d 3e 63 | 6f 6d 6d 61 6e 64 20 3d |...pc->c|ommand =|
|00003070| 20 43 4d 44 5f 45 52 52 | 4f 52 3b 0a 58 09 09 09 | CMD_ERR|OR;.X...|
|00003080| 70 61 72 73 69 6e 67 5f | 65 72 72 6d 73 67 20 3d |parsing_|errmsg =|
|00003090| 20 64 65 61 6c 5f 65 72 | 72 6f 72 3b 0a 58 09 09 | deal_er|ror;.X..|
|000030a0| 09 72 65 74 75 72 6e 3b | 0a 58 09 09 7d 3b 0a 58 |.return;|.X..};.X|
|000030b0| 09 09 70 73 5f 6e 65 78 | 74 20 28 70 73 29 3b 0a |..ps_nex|t (ps);.|
|000030c0| 58 09 7d 3b 0a 58 09 72 | 65 74 75 72 6e 3b 0a 58 |X.};.X.r|eturn;.X|
|000030d0| 7d 3b 0a 58 20 0a 58 73 | 74 61 74 69 63 20 70 61 |};.X .Xs|tatic pa|
|000030e0| 72 73 65 5f 62 69 64 5f | 63 6f 6d 6d 61 6e 64 20 |rse_bid_|command |
|000030f0| 28 70 73 2c 20 70 63 29 | 0a 58 09 70 61 72 73 65 |(ps, pc)|.X.parse|
|00003100| 5f 73 74 72 69 6e 67 20 | 70 73 3b 20 70 6c 61 79 |_string |ps; play|
|00003110| 65 72 5f 63 6f 6d 6d 61 | 6e 64 20 70 63 3b 0a 58 |er_comma|nd pc;.X|
|00003120| 2f 2a 20 50 61 72 73 65 | 73 20 61 20 62 69 64 20 |/* Parse|s a bid |
|00003130| 63 6f 6d 6d 61 6e 64 2c | 20 77 68 69 63 68 20 69 |command,| which i|
|00003140| 73 20 6f 66 20 74 68 65 | 20 66 6f 72 6d 3a 0a 58 |s of the| form:.X|
|00003150| 20 2a 20 32 2e 20 42 49 | 44 20 20 28 3c 6c 65 76 | * 2. BI|D (<lev|
|00003160| 65 6c 3e 20 28 3c 73 75 | 69 74 3e 20 7c 20 3c 6e |el> (<su|it> | <n|
|00003170| 6f 74 72 75 6d 70 3e 29 | 29 20 7c 20 3c 70 61 73 |otrump>)|) | <pas|
|00003180| 73 3e 20 7c 20 3c 64 6f | 75 62 6c 65 3e 20 7c 20 |s> | <do|uble> | |
|00003190| 3c 72 65 64 6f 75 62 6c | 65 3e 0a 58 20 2a 2f 0a |<redoubl|e>.X */.|
|000031a0| 58 7b 0a 58 09 69 6e 74 | 20 6c 76 2c 20 63 64 3b |X{.X.int| lv, cd;|
|000031b0| 0a 58 20 0a 58 09 70 63 | 2d 3e 63 6f 6d 6d 61 6e |.X .X.pc|->comman|
|000031c0| 64 20 3d 20 43 4d 44 5f | 42 49 44 3b 0a 58 09 73 |d = CMD_|BID;.X.s|
|000031d0| 6b 69 70 5f 73 70 61 63 | 65 73 20 28 70 73 29 3b |kip_spac|es (ps);|
|000031e0| 0a 58 09 69 66 20 28 70 | 73 5f 6d 61 74 63 68 65 |.X.if (p|s_matche|
|000031f0| 73 5f 69 63 20 28 70 73 | 2c 20 22 50 22 29 29 20 |s_ic (ps|, "P")) |
|00003200| 7b 0a 58 09 09 70 73 5f | 6d 61 74 63 68 65 73 5f |{.X..ps_|matches_|
|00003210| 69 63 20 28 70 73 2c 20 | 22 41 53 53 22 29 3b 0a |ic (ps, |"ASS");.|
|00003220| 58 09 09 70 63 2d 3e 64 | 61 74 61 2e 62 69 64 20 |X..pc->d|ata.bid |
|00003230| 3d 20 62 69 64 64 69 6e | 67 5f 63 6f 64 65 20 28 |= biddin|g_code (|
|00003240| 42 49 44 5f 50 41 53 53 | 2c 20 30 2c 20 30 29 3b |BID_PASS|, 0, 0);|
|00003250| 0a 58 09 09 72 65 74 75 | 72 6e 3b 0a 58 09 7d 20 |.X..retu|rn;.X.} |
|00003260| 65 6c 73 65 20 69 66 20 | 28 70 73 5f 6d 61 74 63 |else if |(ps_matc|
|00003270| 68 65 73 5f 69 63 20 28 | 70 73 2c 20 22 58 58 22 |hes_ic (|ps, "XX"|
|00003280| 29 0a 58 09 09 20 20 20 | 7c 7c 20 70 73 5f 6d 61 |).X.. ||| ps_ma|
|00003290| 74 63 68 65 73 5f 69 63 | 20 28 70 73 2c 20 22 52 |tches_ic| (ps, "R|
|000032a0| 45 44 4f 55 42 4c 45 22 | 29 29 20 7b 0a 58 09 09 |EDOUBLE"|)) {.X..|
|000032b0| 70 63 2d 3e 64 61 74 61 | 2e 62 69 64 20 3d 20 62 |pc->data|.bid = b|
|000032c0| 69 64 64 69 6e 67 5f 63 | 6f 64 65 20 28 42 49 44 |idding_c|ode (BID|
|000032d0| 5f 52 45 44 4f 55 42 4c | 45 2c 20 30 2c 20 30 29 |_REDOUBL|E, 0, 0)|
|000032e0| 3b 0a 58 09 09 72 65 74 | 75 72 6e 3b 0a 58 09 7d |;.X..ret|urn;.X.}|
|000032f0| 20 65 6c 73 65 20 69 66 | 20 28 70 73 5f 6d 61 74 | else if| (ps_mat|
|00003300| 63 68 65 73 5f 69 63 20 | 28 70 73 2c 20 22 58 22 |ches_ic |(ps, "X"|
|00003310| 29 0a 58 09 09 20 20 20 | 7c 7c 20 70 73 5f 6d 61 |).X.. ||| ps_ma|
|00003320| 74 63 68 65 73 5f 69 63 | 20 28 70 73 2c 20 22 44 |tches_ic| (ps, "D|
|00003330| 4f 55 42 4c 45 22 29 29 | 20 7b 0a 58 09 09 70 63 |OUBLE"))| {.X..pc|
|00003340| 2d 3e 64 61 74 61 2e 62 | 69 64 20 3d 20 62 69 64 |->data.b|id = bid|
|00003350| 64 69 6e 67 5f 63 6f 64 | 65 20 28 42 49 44 5f 44 |ding_cod|e (BID_D|
|00003360| 4f 55 42 4c 45 2c 20 30 | 2c 20 30 29 3b 0a 58 09 |OUBLE, 0|, 0);.X.|
|00003370| 09 72 65 74 75 72 6e 3b | 0a 58 09 7d 20 65 6c 73 |.return;|.X.} els|
|00003380| 65 20 7b 0a 58 09 09 6c | 76 20 3d 20 70 61 72 73 |e {.X..l|v = pars|
|00003390| 65 5f 6c 65 76 65 6c 20 | 28 70 73 29 3b 0a 58 09 |e_level |(ps);.X.|
|000033a0| 09 69 66 20 28 6c 76 20 | 3d 3d 20 2d 31 29 20 7b |.if (lv |== -1) {|
|000033b0| 0a 58 09 09 09 70 61 72 | 73 69 6e 67 5f 65 72 72 |.X...par|sing_err|
|000033c0| 6d 73 67 20 3d 20 62 69 | 64 5f 65 72 72 6f 72 3b |msg = bi|d_error;|
|000033d0| 0a 58 09 09 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |.X...pc-|>command|
|000033e0| 20 3d 20 43 4d 44 5f 45 | 52 52 4f 52 3b 0a 58 09 | = CMD_E|RROR;.X.|
|000033f0| 09 09 72 65 74 75 72 6e | 3b 0a 58 09 09 7d 3b 0a |..return|;.X..};.|
|00003400| 58 09 09 73 6b 69 70 5f | 73 70 61 63 65 73 20 28 |X..skip_|spaces (|
|00003410| 70 73 29 3b 0a 58 09 09 | 69 66 20 20 20 20 20 20 |ps);.X..|if |
|00003420| 28 70 73 5f 6d 61 74 63 | 68 65 73 5f 69 63 20 28 |(ps_matc|hes_ic (|
|00003430| 70 73 2c 20 22 4e 4f 54 | 52 55 4d 50 22 29 29 20 |ps, "NOT|RUMP")) |
|00003440| 63 64 20 3d 20 53 55 49 | 54 5f 4e 4f 54 52 55 4d |cd = SUI|T_NOTRUM|
|00003450| 50 3b 0a 58 09 09 65 6c | 73 65 20 69 66 20 28 70 |P;.X..el|se if (p|
|00003460| 73 5f 6d 61 74 63 68 65 | 73 5f 69 63 20 28 70 73 |s_matche|s_ic (ps|
|00003470| 2c 20 22 4e 54 22 29 29 | 20 20 20 09 63 64 20 3d |, "NT"))| .cd =|
|00003480| 20 53 55 49 54 5f 4e 4f | 54 52 55 4d 50 3b 0a 58 | SUIT_NO|TRUMP;.X|
|00003490| 09 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |..else i|f (ps_ma|
|000034a0| 74 63 68 65 73 5f 69 63 | 20 28 70 73 2c 20 22 4e |tches_ic| (ps, "N|
|000034b0| 22 29 29 09 63 64 20 3d | 20 53 55 49 54 5f 4e 4f |")).cd =| SUIT_NO|
|000034c0| 54 52 55 4d 50 3b 0a 58 | 09 09 65 6c 73 65 20 7b |TRUMP;.X|..else {|
|000034d0| 0a 58 09 09 09 63 64 20 | 3d 20 70 61 72 73 65 5f |.X...cd |= parse_|
|000034e0| 73 75 69 74 20 28 70 73 | 29 3b 0a 58 09 09 09 69 |suit (ps|);.X...i|
|000034f0| 66 20 28 63 64 20 3d 3d | 20 2d 31 29 20 7b 0a 58 |f (cd ==| -1) {.X|
|00003500| 09 09 09 09 70 61 72 73 | 69 6e 67 5f 65 72 72 6d |....pars|ing_errm|
|00003510| 73 67 20 3d 20 62 69 64 | 5f 65 72 72 6f 72 3b 0a |sg = bid|_error;.|
|00003520| 58 09 09 09 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |X....pc-|>command|
|00003530| 20 3d 20 43 4d 44 5f 45 | 52 52 4f 52 3b 0a 58 09 | = CMD_E|RROR;.X.|
|00003540| 09 09 09 72 65 74 75 72 | 6e 3b 0a 58 09 09 09 7d |...retur|n;.X...}|
|00003550| 3b 0a 58 09 09 7d 3b 0a | 58 09 09 70 63 2d 3e 64 |;.X..};.|X..pc->d|
|00003560| 61 74 61 2e 62 69 64 20 | 3d 20 62 69 64 64 69 6e |ata.bid |= biddin|
|00003570| 67 5f 63 6f 64 65 20 28 | 42 49 44 5f 53 55 49 54 |g_code (|BID_SUIT|
|00003580| 2c 20 6c 76 2c 20 63 64 | 29 3b 0a 58 09 09 72 65 |, lv, cd|);.X..re|
|00003590| 74 75 72 6e 3b 0a 58 09 | 7d 3b 0a 58 7d 3b 0a 58 |turn;.X.|};.X};.X|
|000035a0| 20 0a 58 73 74 61 74 69 | 63 20 70 61 72 73 65 5f | .Xstati|c parse_|
|000035b0| 70 6c 61 79 5f 63 6f 6d | 6d 61 6e 64 20 28 70 73 |play_com|mand (ps|
|000035c0| 2c 20 70 63 29 0a 58 09 | 70 61 72 73 65 5f 73 74 |, pc).X.|parse_st|
|000035d0| 72 69 6e 67 20 70 73 3b | 20 70 6c 61 79 65 72 5f |ring ps;| player_|
|000035e0| 63 6f 6d 6d 61 6e 64 20 | 70 63 3b 0a 58 2f 2a 20 |command |pc;.X/* |
|000035f0| 50 61 72 73 65 73 20 61 | 20 70 6c 61 79 20 63 6f |Parses a| play co|
|00003600| 6d 6d 61 6e 64 3a 0a 58 | 20 2e 20 70 6c 61 79 20 |mmand:.X| . play |
|00003610| 3c 73 75 69 74 3e 20 3c | 72 61 6e 6b 3e 0a 58 20 |<suit> <|rank>.X |
|00003620| 2a 2f 0a 58 7b 0a 58 09 | 69 6e 74 20 73 2c 20 72 |*/.X{.X.|int s, r|
|00003630| 3b 0a 58 20 0a 58 09 70 | 63 2d 3e 63 6f 6d 6d 61 |;.X .X.p|c->comma|
|00003640| 6e 64 20 3d 20 43 4d 44 | 5f 50 4c 41 59 3b 0a 58 |nd = CMD|_PLAY;.X|
|00003650| 09 73 6b 69 70 5f 73 70 | 61 63 65 73 20 28 70 73 |.skip_sp|aces (ps|
|00003660| 29 3b 0a 58 09 73 20 3d | 20 70 61 72 73 65 5f 73 |);.X.s =| parse_s|
|00003670| 75 69 74 20 28 70 73 29 | 3b 0a 58 09 69 66 20 28 |uit (ps)|;.X.if (|
|00003680| 73 20 3d 3d 20 2d 31 29 | 20 7b 0a 58 09 09 70 61 |s == -1)| {.X..pa|
|00003690| 72 73 69 6e 67 5f 65 72 | 72 6d 73 67 20 3d 20 70 |rsing_er|rmsg = p|
|000036a0| 6c 61 79 5f 65 72 72 6f | 72 3b 0a 58 09 09 70 63 |lay_erro|r;.X..pc|
|000036b0| 2d 3e 63 6f 6d 6d 61 6e | 64 20 3d 20 43 4d 44 5f |->comman|d = CMD_|
|000036c0| 45 52 52 4f 52 3b 0a 58 | 09 09 72 65 74 75 72 6e |ERROR;.X|..return|
|000036d0| 3b 0a 58 09 7d 3b 0a 58 | 09 72 20 3d 20 70 61 72 |;.X.};.X|.r = par|
|000036e0| 73 65 5f 72 61 6e 6b 20 | 28 70 73 29 3b 0a 58 09 |se_rank |(ps);.X.|
|000036f0| 69 66 20 28 72 20 3d 3d | 20 2d 31 29 20 7b 0a 58 |if (r ==| -1) {.X|
|00003700| 09 09 70 61 72 73 69 6e | 67 5f 65 72 72 6d 73 67 |..parsin|g_errmsg|
|00003710| 20 3d 20 70 6c 61 79 5f | 65 72 72 6f 72 3b 0a 58 | = play_|error;.X|
|00003720| 09 09 70 63 2d 3e 63 6f | 6d 6d 61 6e 64 20 3d 20 |..pc->co|mmand = |
|00003730| 43 4d 44 5f 45 52 52 4f | 52 3b 0a 58 09 09 72 65 |CMD_ERRO|R;.X..re|
|00003740| 74 75 72 6e 3b 0a 58 09 | 7d 3b 0a 58 09 70 63 2d |turn;.X.|};.X.pc-|
|00003750| 3e 64 61 74 61 2e 63 61 | 72 64 20 3d 20 63 61 72 |>data.ca|rd = car|
|00003760| 64 5f 63 6f 64 65 20 28 | 73 2c 20 72 29 3b 0a 58 |d_code (|s, r);.X|
|00003770| 7d 3b 0a 58 0a 58 73 74 | 61 74 69 63 20 70 61 72 |};.X.Xst|atic par|
|00003780| 73 65 5f 6c 6f 63 61 6c | 5f 70 6c 61 79 5f 63 6f |se_local|_play_co|
|00003790| 6d 6d 61 6e 64 20 28 70 | 73 2c 20 70 63 29 0a 58 |mmand (p|s, pc).X|
|000037a0| 09 70 61 72 73 65 5f 73 | 74 72 69 6e 67 20 70 73 |.parse_s|tring ps|
|000037b0| 3b 20 70 6c 61 79 65 72 | 5f 63 6f 6d 6d 61 6e 64 |; player|_command|
|000037c0| 20 70 63 3b 0a 58 2f 2a | 20 50 61 72 73 65 73 20 | pc;.X/*| Parses |
|000037d0| 61 20 70 6c 61 79 20 63 | 6f 6d 6d 61 6e 64 3a 0a |a play c|ommand:.|
|000037e0| 58 20 2e 20 20 20 70 6c | 61 79 20 5b 3c 73 75 69 |X . pl|ay [<sui|
|000037f0| 74 3e 5d 20 3c 72 61 6e | 6b 3e 0a 58 20 2e 20 49 |t>] <ran|k>.X . I|
|00003800| 66 20 64 65 66 61 75 6c | 74 5f 73 75 69 74 20 3e |f defaul|t_suit >|
|00003810| 3d 20 30 2c 20 74 68 65 | 6e 20 3c 73 75 69 74 3e |= 0, the|n <suit>|
|00003820| 20 6d 61 79 20 62 65 20 | 6f 6d 69 74 74 65 64 2e | may be |omitted.|
|00003830| 0a 58 20 2a 2f 0a 58 7b | 0a 58 09 69 6e 74 20 73 |.X */.X{|.X.int s|
|00003840| 2c 20 72 3b 0a 58 20 0a | 58 09 70 63 2d 3e 63 6f |, r;.X .|X.pc->co|
|00003850| 6d 6d 61 6e 64 20 3d 20 | 43 4d 44 5f 50 4c 41 59 |mmand = |CMD_PLAY|
|00003860| 3b 0a 58 09 73 6b 69 70 | 5f 73 70 61 63 65 73 20 |;.X.skip|_spaces |
|00003870| 28 70 73 29 3b 0a 58 09 | 73 20 3d 20 70 61 72 73 |(ps);.X.|s = pars|
|00003880| 65 5f 73 75 69 74 20 28 | 70 73 29 3b 0a 58 09 69 |e_suit (|ps);.X.i|
|00003890| 66 20 28 28 73 20 3d 3d | 20 2d 31 29 20 26 26 20 |f ((s ==| -1) && |
|000038a0| 28 64 65 66 61 75 6c 74 | 5f 73 75 69 74 20 3c 20 |(default|_suit < |
|000038b0| 30 29 29 20 7b 0a 58 09 | 09 70 61 72 73 69 6e 67 |0)) {.X.|.parsing|
|000038c0| 5f 65 72 72 6d 73 67 20 | 3d 20 70 6c 61 79 5f 65 |_errmsg |= play_e|
|000038d0| 72 72 6f 72 3b 0a 58 09 | 09 70 63 2d 3e 63 6f 6d |rror;.X.|.pc->com|
|000038e0| 6d 61 6e 64 20 3d 20 43 | 4d 44 5f 45 52 52 4f 52 |mand = C|MD_ERROR|
|000038f0| 3b 0a 58 09 09 72 65 74 | 75 72 6e 3b 0a 58 09 7d |;.X..ret|urn;.X.}|
|00003900| 20 65 6c 73 65 20 69 66 | 20 28 73 20 3d 3d 20 2d | else if| (s == -|
|00003910| 31 29 0a 58 09 20 20 20 | 20 20 20 20 20 73 20 3d |1).X. | s =|
|00003920| 20 64 65 66 61 75 6c 74 | 5f 73 75 69 74 3b 0a 58 | default|_suit;.X|
|00003930| 0a 58 09 72 20 3d 20 70 | 61 72 73 65 5f 72 61 6e |.X.r = p|arse_ran|
|00003940| 6b 20 28 70 73 29 3b 0a | 58 09 69 66 20 28 72 20 |k (ps);.|X.if (r |
|00003950| 3d 3d 20 2d 31 29 20 7b | 0a 58 09 09 70 61 72 73 |== -1) {|.X..pars|
|00003960| 69 6e 67 5f 65 72 72 6d | 73 67 20 3d 20 70 6c 61 |ing_errm|sg = pla|
|00003970| 79 5f 65 72 72 6f 72 3b | 0a 58 09 09 70 63 2d 3e |y_error;|.X..pc->|
|00003980| 63 6f 6d 6d 61 6e 64 20 | 3d 20 43 4d 44 5f 45 52 |command |= CMD_ER|
|00003990| 52 4f 52 3b 0a 58 09 09 | 72 65 74 75 72 6e 3b 0a |ROR;.X..|return;.|
|000039a0| 58 09 7d 3b 0a 58 09 70 | 63 2d 3e 64 61 74 61 2e |X.};.X.p|c->data.|
|000039b0| 63 61 72 64 20 3d 20 63 | 61 72 64 5f 63 6f 64 65 |card = c|ard_code|
|000039c0| 20 28 73 2c 20 72 29 3b | 0a 58 7d 3b 0a 58 20 0a | (s, r);|.X};.X .|
|000039d0| 58 73 74 61 74 69 63 20 | 70 61 72 73 65 5f 74 61 |Xstatic |parse_ta|
|000039e0| 6c 6b 5f 63 6f 6d 6d 61 | 6e 64 20 28 70 73 2c 20 |lk_comma|nd (ps, |
|000039f0| 70 63 29 0a 58 09 70 61 | 72 73 65 5f 73 74 72 69 |pc).X.pa|rse_stri|
|00003a00| 6e 67 20 70 73 3b 20 70 | 6c 61 79 65 72 5f 63 6f |ng ps; p|layer_co|
|00003a10| 6d 6d 61 6e 64 20 70 63 | 3b 0a 58 2f 2a 20 54 68 |mmand pc|;.X/* Th|
|00003a20| 65 20 74 61 6c 6b 20 63 | 6f 6d 6d 61 6e 64 20 69 |e talk c|ommand i|
|00003a30| 73 20 75 73 65 64 20 74 | 6f 20 63 6f 6d 6d 75 6e |s used t|o commun|
|00003a40| 69 63 61 74 65 20 6d 65 | 73 73 61 67 65 73 20 62 |icate me|ssages b|
|00003a50| 65 74 77 65 65 6e 20 74 | 68 65 20 70 6c 61 79 65 |etween t|he playe|
|00003a60| 72 73 2e 0a 58 20 2e 20 | 54 68 65 20 66 6f 72 6d |rs..X . |The form|
|00003a70| 61 74 20 6f 66 20 74 68 | 65 20 74 61 6c 6b 20 63 |at of th|e talk c|
|00003a80| 6f 6d 6d 61 6e 64 20 69 | 73 3a 0a 58 20 2e 20 20 |ommand i|s:.X . |
|00003a90| 74 61 6c 6b 20 3c 6d 65 | 73 73 61 67 65 3e 0a 58 |talk <me|ssage>.X|
|00003aa0| 20 2e 20 57 68 65 72 65 | 20 3c 6d 65 73 73 61 67 | . Where| <messag|
|00003ab0| 65 3e 20 69 73 20 61 6e | 79 20 73 65 71 75 65 6e |e> is an|y sequen|
|00003ac0| 63 65 20 6f 66 20 28 70 | 72 69 6e 74 61 62 6c 65 |ce of (p|rintable|
|00003ad0| 29 20 63 68 61 72 61 63 | 74 65 72 73 2e 0a 58 20 |) charac|ters..X |
|00003ae0| 2a 2f 0a 58 7b 0a 58 09 | 69 6e 74 20 63 68 2c 20 |*/.X{.X.|int ch, |
|00003af0| 6e 3b 0a 58 20 0a 58 09 | 70 63 2d 3e 63 6f 6d 6d |n;.X .X.|pc->comm|
|00003b00| 61 6e 64 20 3d 20 43 4d | 44 5f 54 41 4c 4b 3b 0a |and = CM|D_TALK;.|
|00003b10| 58 09 73 6b 69 70 5f 73 | 70 61 63 65 73 20 28 70 |X.skip_s|paces (p|
|00003b20| 73 29 3b 0a 58 09 6e 20 | 3d 20 30 3b 0a 58 09 63 |s);.X.n |= 0;.X.c|
|00003b30| 68 20 3d 20 70 73 5f 73 | 63 61 6e 20 28 70 73 29 |h = ps_s|can (ps)|
|00003b40| 3b 0a 58 09 77 68 69 6c | 65 20 28 63 68 20 21 3d |;.X.whil|e (ch !=|
|00003b50| 20 27 5c 30 27 29 20 7b | 0a 58 09 20 20 20 20 20 | '\0') {|.X. |
|00003b60| 20 20 20 69 66 20 28 6e | 20 3c 20 4d 45 53 53 41 | if (n| < MESSA|
|00003b70| 47 45 5f 4c 45 4e 47 54 | 48 2d 31 29 0a 58 09 09 |GE_LENGT|H-1).X..|
|00003b80| 20 20 70 63 2d 3e 64 61 | 74 61 2e 6d 65 73 73 61 | pc->da|ta.messa|
|00003b90| 67 65 5b 6e 2b 2b 5d 20 | 3d 20 63 68 3b 0a 58 09 |ge[n++] |= ch;.X.|
|00003ba0| 09 70 73 5f 6e 65 78 74 | 20 28 70 73 29 3b 0a 58 |.ps_next| (ps);.X|
|00003bb0| 09 09 63 68 20 3d 20 70 | 73 5f 73 63 61 6e 20 28 |..ch = p|s_scan (|
|00003bc0| 70 73 29 3b 0a 58 09 7d | 3b 0a 58 09 70 63 2d 3e |ps);.X.}|;.X.pc->|
|00003bd0| 64 61 74 61 2e 6d 65 73 | 73 61 67 65 5b 6e 5d 20 |data.mes|sage[n] |
|00003be0| 3d 20 27 5c 30 27 3b 0a | 58 7d 3b 0a 58 20 0a 58 |= '\0';.|X};.X .X|
|00003bf0| 73 74 61 74 69 63 20 70 | 61 72 73 65 5f 63 6f 6d |static p|arse_com|
|00003c00| 6d 65 6e 74 5f 63 6f 6d | 6d 61 6e 64 20 28 70 73 |ment_com|mand (ps|
|00003c10| 2c 20 70 63 29 0a 58 09 | 70 61 72 73 65 5f 73 74 |, pc).X.|parse_st|
|00003c20| 72 69 6e 67 20 70 73 3b | 20 70 6c 61 79 65 72 5f |ring ps;| player_|
|00003c30| 63 6f 6d 6d 61 6e 64 20 | 70 63 3b 0a 58 2f 2a 20 |command |pc;.X/* |
|00003c40| 54 68 65 20 63 6f 6d 6d | 65 6e 74 20 63 6f 6d 6d |The comm|ent comm|
|00003c50| 61 6e 64 20 69 73 20 75 | 73 65 64 20 74 6f 20 63 |and is u|sed to c|
|00003c60| 6f 6d 6d 75 6e 69 63 61 | 74 65 20 61 20 6d 65 73 |ommunica|te a mes|
|00003c70| 73 61 67 65 20 74 6f 20 | 61 6c 6c 20 6f 66 20 74 |sage to |all of t|
|00003c80| 68 65 0a 58 20 2e 20 70 | 6c 61 79 65 72 73 2c 20 |he.X . p|layers, |
|00003c90| 77 68 65 72 65 20 74 68 | 65 20 6f 72 69 67 69 6e |where th|e origin|
|00003ca0| 20 6f 66 20 74 68 65 20 | 6d 65 73 73 61 67 65 20 | of the |message |
|00003cb0| 69 73 20 74 68 65 20 6f | 6b 62 72 69 64 67 65 20 |is the o|kbridge |
|00003cc0| 70 72 6f 67 72 61 6d 2e | 20 0a 58 20 2e 20 54 68 |program.| .X . Th|
|00003cd0| 65 20 66 6f 72 6d 61 74 | 20 6f 66 20 74 68 65 20 |e format| of the |
|00003ce0| 63 6f 6d 6d 65 6e 74 20 | 63 6f 6d 6d 61 6e 64 20 |comment |command |
|00003cf0| 69 73 3a 0a 58 20 2e 20 | 20 63 6f 6d 6d 65 6e 74 |is:.X . | comment|
|00003d00| 20 3c 6d 65 73 73 61 67 | 65 3e 0a 58 20 2e 20 57 | <messag|e>.X . W|
|00003d10| 68 65 72 65 20 3c 6d 65 | 73 73 61 67 65 3e 20 69 |here <me|ssage> i|
|00003d20| 73 20 61 6e 79 20 73 65 | 71 75 65 6e 63 65 20 6f |s any se|quence o|
|00003d30| 66 20 28 70 72 69 6e 74 | 61 62 6c 65 29 20 63 68 |f (print|able) ch|
|00003d40| 61 72 61 63 74 65 72 73 | 2e 0a 58 20 2a 2f 0a 58 |aracters|..X */.X|
|00003d50| 7b 0a 58 09 69 6e 74 20 | 63 68 2c 20 6e 3b 0a 58 |{.X.int |ch, n;.X|
|00003d60| 20 0a 58 09 70 63 2d 3e | 63 6f 6d 6d 61 6e 64 20 | .X.pc->|command |
|00003d70| 3d 20 43 4d 44 5f 43 4f | 4d 4d 45 4e 54 3b 0a 58 |= CMD_CO|MMENT;.X|
|00003d80| 09 73 6b 69 70 5f 73 70 | 61 63 65 73 20 28 70 73 |.skip_sp|aces (ps|
|00003d90| 29 3b 0a 58 09 6e 20 3d | 20 30 3b 0a 58 09 63 68 |);.X.n =| 0;.X.ch|
|00003da0| 20 3d 20 70 73 5f 73 63 | 61 6e 20 28 70 73 29 3b | = ps_sc|an (ps);|
|00003db0| 0a 58 09 77 68 69 6c 65 | 20 28 63 68 20 21 3d 20 |.X.while| (ch != |
|00003dc0| 27 5c 30 27 29 20 7b 0a | 58 09 20 20 20 20 20 20 |'\0') {.|X. |
|00003dd0| 20 20 69 66 20 28 6e 20 | 3c 20 4d 45 53 53 41 47 | if (n |< MESSAG|
|00003de0| 45 5f 4c 45 4e 47 54 48 | 2d 31 29 0a 58 09 09 20 |E_LENGTH|-1).X.. |
|00003df0| 20 70 63 2d 3e 64 61 74 | 61 2e 6d 65 73 73 61 67 | pc->dat|a.messag|
|00003e00| 65 5b 6e 2b 2b 5d 20 3d | 20 63 68 3b 0a 58 09 09 |e[n++] =| ch;.X..|
|00003e10| 70 73 5f 6e 65 78 74 20 | 28 70 73 29 3b 0a 58 09 |ps_next |(ps);.X.|
|00003e20| 09 63 68 20 3d 20 70 73 | 5f 73 63 61 6e 20 28 70 |.ch = ps|_scan (p|
|00003e30| 73 29 3b 0a 58 09 7d 3b | 0a 58 09 70 63 2d 3e 64 |s);.X.};|.X.pc->d|
|00003e40| 61 74 61 2e 6d 65 73 73 | 61 67 65 5b 6e 5d 20 3d |ata.mess|age[n] =|
|00003e50| 20 27 5c 30 27 3b 0a 58 | 7d 3b 0a 58 20 0a 58 73 | '\0';.X|};.X .Xs|
|00003e60| 74 61 74 69 63 20 70 61 | 72 73 65 5f 68 65 6c 6c |tatic pa|rse_hell|
|00003e70| 6f 5f 63 6f 6d 6d 61 6e | 64 20 28 70 73 2c 20 70 |o_comman|d (ps, p|
|00003e80| 63 29 0a 58 09 70 61 72 | 73 65 5f 73 74 72 69 6e |c).X.par|se_strin|
|00003e90| 67 20 70 73 3b 20 70 6c | 61 79 65 72 5f 63 6f 6d |g ps; pl|ayer_com|
|00003ea0| 6d 61 6e 64 20 70 63 3b | 0a 58 2f 2a 20 54 68 65 |mand pc;|.X/* The|
|00003eb0| 20 68 65 6c 6c 6f 20 63 | 6f 6d 6d 61 6e 64 20 69 | hello c|ommand i|
|00003ec0| 73 20 75 73 65 64 20 66 | 6f 72 20 68 61 6e 64 73 |s used f|or hands|
|00003ed0| 68 61 6b 69 6e 67 20 61 | 66 74 65 72 20 77 68 65 |haking a|fter whe|
|00003ee0| 6e 20 74 68 65 20 70 72 | 6f 67 72 61 6d 0a 58 20 |n the pr|ogram.X |
|00003ef0| 2e 20 69 73 20 66 69 72 | 73 74 20 73 74 61 72 74 |. is fir|st start|
|00003f00| 69 6e 67 2e 20 20 54 68 | 65 20 70 72 6f 67 72 61 |ing. Th|e progra|
|00003f10| 6d 20 73 65 6e 64 73 20 | 61 6e 20 69 6e 69 74 69 |m sends |an initi|
|00003f20| 61 6c 20 27 68 65 6c 6c | 6f 27 20 74 6f 20 69 6e |al 'hell|o' to in|
|00003f30| 64 69 63 61 74 65 0a 58 | 20 2e 20 74 68 61 74 20 |dicate.X| . that |
|00003f40| 69 74 20 68 61 73 20 6a | 6f 69 6e 65 64 20 74 68 |it has j|oined th|
|00003f50| 65 20 67 61 6d 65 2e 20 | 20 54 68 65 20 66 6f 72 |e game. | The for|
|00003f60| 6d 61 74 20 6f 66 20 74 | 68 65 20 27 68 65 6c 6c |mat of t|he 'hell|
|00003f70| 6f 27 20 63 6f 6d 6d 61 | 6e 64 20 69 73 0a 58 20 |o' comma|nd is.X |
|00003f80| 2e 20 20 20 48 45 4c 4c | 4f 20 3c 76 65 72 73 69 |. HELL|O <versi|
|00003f90| 6f 6e 3e 20 3c 6e 61 6d | 65 3e 0a 58 20 2e 20 77 |on> <nam|e>.X . w|
|00003fa0| 68 65 72 65 20 0a 58 20 | 2e 20 20 20 3c 76 65 72 |here .X |. <ver|
|00003fb0| 73 69 6f 6e 3e 20 69 73 | 20 74 68 65 20 6d 61 6a |sion> is| the maj|
|00003fc0| 6f 72 20 72 65 76 69 73 | 69 6f 6e 20 6c 65 76 65 |or revis|ion leve|
|00003fd0| 6c 20 6f 66 20 74 68 69 | 73 20 70 72 6f 67 72 61 |l of thi|s progra|
|00003fe0| 6d 0a 58 20 2e 20 20 20 | 3c 6e 61 6d 65 3e 20 20 |m.X . |<name> |
|00003ff0| 20 20 69 73 20 74 68 65 | 20 6e 61 6d 65 20 6f 66 | is the| name of|
|00004000| 20 74 68 65 20 70 6c 61 | 79 65 72 0a 58 20 2a 2f | the pla|yer.X */|
|00004010| 0a 58 7b 0a 58 20 20 20 | 20 20 20 20 20 69 6e 74 |.X{.X | int|
|00004020| 20 6e 2c 20 63 68 3b 0a | 58 0a 58 09 70 63 2d 3e | n, ch;.|X.X.pc->|
|00004030| 63 6f 6d 6d 61 6e 64 20 | 3d 20 43 4d 44 5f 48 45 |command |= CMD_HE|
|00004040| 4c 4c 4f 3b 0a 58 09 73 | 6b 69 70 5f 73 70 61 63 |LLO;.X.s|kip_spac|
|00004050| 65 73 20 28 70 73 29 3b | 0a 58 09 6e 20 3d 20 30 |es (ps);|.X.n = 0|
|00004060| 3b 0a 58 09 63 68 20 3d | 20 70 73 5f 73 63 61 6e |;.X.ch =| ps_scan|
|00004070| 20 28 70 73 29 3b 0a 58 | 09 77 68 69 6c 65 20 28 | (ps);.X|.while (|
|00004080| 28 63 68 20 21 3d 20 27 | 5c 30 27 29 20 26 26 20 |(ch != '|\0') && |
|00004090| 28 63 68 20 21 3d 20 27 | 20 27 29 20 26 26 20 28 |(ch != '| ') && (|
|000040a0| 6e 20 3c 20 56 45 52 53 | 49 4f 4e 5f 4c 45 4e 47 |n < VERS|ION_LENG|
|000040b0| 54 48 2d 31 29 29 20 7b | 0a 58 09 09 70 63 2d 3e |TH-1)) {|.X..pc->|
|000040c0| 64 61 74 61 2e 76 65 72 | 73 69 6f 6e 5f 6e 61 6d |data.ver|sion_nam|
|000040d0| 65 5b 6e 2b 2b 5d 20 3d | 20 63 68 3b 0a 58 09 09 |e[n++] =| ch;.X..|
|000040e0| 70 73 5f 6e 65 78 74 20 | 28 70 73 29 3b 0a 58 09 |ps_next |(ps);.X.|
|000040f0| 09 63 68 20 3d 20 70 73 | 5f 73 63 61 6e 20 28 70 |.ch = ps|_scan (p|
|00004100| 73 29 3b 0a 58 09 7d 3b | 0a 58 09 70 63 2d 3e 64 |s);.X.};|.X.pc->d|
|00004110| 61 74 61 2e 76 65 72 73 | 69 6f 6e 5f 6e 61 6d 65 |ata.vers|ion_name|
|00004120| 5b 6e 5d 20 3d 20 27 5c | 30 27 3b 0a 58 09 73 6b |[n] = '\|0';.X.sk|
|00004130| 69 70 5f 73 70 61 63 65 | 73 20 28 70 73 29 3b 0a |ip_space|s (ps);.|
|00004140| 58 09 6e 20 3d 20 56 45 | 52 53 49 4f 4e 5f 4c 45 |X.n = VE|RSION_LE|
|00004150| 4e 47 54 48 3b 0a 58 09 | 63 68 20 3d 20 70 73 5f |NGTH;.X.|ch = ps_|
|00004160| 73 63 61 6e 20 28 70 73 | 29 3b 0a 58 09 77 68 69 |scan (ps|);.X.whi|
|00004170| 6c 65 20 28 28 63 68 20 | 21 3d 20 27 5c 30 27 29 |le ((ch |!= '\0')|
|00004180| 20 26 26 20 28 63 68 20 | 21 3d 20 27 20 27 29 29 | && (ch |!= ' '))|
|00004190| 20 7b 0a 58 09 20 20 69 | 66 20 28 6e 20 3c 20 56 | {.X. i|f (n < V|
|000041a0| 45 52 53 49 4f 4e 5f 4e | 41 4d 45 5f 4c 45 4e 47 |ERSION_N|AME_LENG|
|000041b0| 54 48 2d 31 29 0a 58 09 | 20 20 20 20 70 63 2d 3e |TH-1).X.| pc->|
|000041c0| 64 61 74 61 2e 76 65 72 | 73 69 6f 6e 5f 6e 61 6d |data.ver|sion_nam|
|000041d0| 65 5b 6e 2b 2b 5d 20 3d | 20 63 68 3b 0a 58 09 20 |e[n++] =| ch;.X. |
|000041e0| 20 70 73 5f 6e 65 78 74 | 20 28 70 73 29 3b 0a 58 | ps_next| (ps);.X|
|000041f0| 09 20 20 63 68 20 3d 20 | 70 73 5f 73 63 61 6e 20 |. ch = |ps_scan |
|00004200| 28 70 73 29 3b 0a 58 09 | 7d 3b 0a 58 09 70 63 2d |(ps);.X.|};.X.pc-|
|00004210| 3e 64 61 74 61 2e 76 65 | 72 73 69 6f 6e 5f 6e 61 |>data.ve|rsion_na|
|00004220| 6d 65 5b 6e 5d 20 3d 20 | 27 5c 30 27 3b 0a 58 7d |me[n] = |'\0';.X}|
|00004230| 3b 0a 58 20 0a 58 73 74 | 61 74 69 63 20 70 61 72 |;.X .Xst|atic par|
|00004240| 73 65 5f 61 63 6b 5f 63 | 6f 6d 6d 61 6e 64 20 28 |se_ack_c|ommand (|
|00004250| 70 73 2c 20 70 63 29 0a | 58 09 70 61 72 73 65 5f |ps, pc).|X.parse_|
|00004260| 73 74 72 69 6e 67 20 70 | 73 3b 20 70 6c 61 79 65 |string p|s; playe|
|00004270| 72 5f 63 6f 6d 6d 61 6e | 64 20 70 63 3b 0a 58 2f |r_comman|d pc;.X/|
|00004280| 2a 20 54 68 65 20 27 61 | 63 6b 27 20 63 6f 6d 6d |* The 'a|ck' comm|
|00004290| 61 6e 64 20 69 73 20 75 | 73 65 64 20 74 6f 20 61 |and is u|sed to a|
|000042a0| 63 6b 6e 6f 77 6c 65 64 | 67 65 20 61 6e 6f 74 68 |cknowled|ge anoth|
|000042b0| 65 72 20 70 6c 61 79 65 | 72 27 73 20 27 68 65 6c |er playe|r's 'hel|
|000042c0| 6c 6f 27 0a 58 20 2e 20 | 63 6f 6d 6d 61 6e 64 2e |lo'.X . |command.|
|000042d0| 20 20 45 61 63 68 20 74 | 69 6d 65 20 77 65 20 72 | Each t|ime we r|
|000042e0| 65 63 65 69 76 65 20 61 | 20 68 65 6c 6c 6f 2c 20 |eceive a| hello, |
|000042f0| 77 65 20 72 65 74 75 72 | 6e 20 61 6e 20 27 61 63 |we retur|n an 'ac|
|00004300| 6b 27 2e 0a 58 20 2e 20 | 54 68 65 20 66 6f 72 6d |k'..X . |The form|
|00004310| 61 74 20 6f 66 20 74 68 | 65 20 27 61 63 6b 27 20 |at of th|e 'ack' |
|00004320| 63 6f 6d 6d 61 6e 64 20 | 69 73 0a 58 20 2e 20 20 |command |is.X . |
|00004330| 20 41 43 4b 20 3c 76 65 | 72 73 69 6f 6e 3e 20 3c | ACK <ve|rsion> <|
|00004340| 6e 61 6d 65 3e 0a 58 20 | 2e 20 77 68 65 72 65 20 |name>.X |. where |
|00004350| 0a 58 20 2e 20 20 20 3c | 76 65 72 73 69 6f 6e 3e |.X . <|version>|
|00004360| 20 69 73 20 74 68 65 20 | 6d 61 6a 6f 72 20 72 65 | is the |major re|
|00004370| 76 69 73 69 6f 6e 20 6c | 65 76 65 6c 20 6f 66 20 |vision l|evel of |
|00004380| 74 68 69 73 20 70 72 6f | 67 72 61 6d 0a 58 20 2e |this pro|gram.X .|
|00004390| 20 20 20 3c 6e 61 6d 65 | 3e 20 20 20 20 69 73 20 | <name|> is |
|000043a0| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 20 |the name| of the |
|000043b0| 70 6c 61 79 65 72 0a 58 | 20 2a 2f 0a 58 7b 0a 58 |player.X| */.X{.X|
|000043c0| 20 20 20 20 20 20 20 20 | 69 6e 74 20 6e 2c 20 63 | |int n, c|
|000043d0| 68 3b 0a 58 0a 58 09 70 | 63 2d 3e 63 6f 6d 6d 61 |h;.X.X.p|c->comma|
|000043e0| 6e 64 20 3d 20 43 4d 44 | 5f 41 43 4b 3b 0a 58 09 |nd = CMD|_ACK;.X.|
|000043f0| 73 6b 69 70 5f 73 70 61 | 63 65 73 20 28 70 73 29 |skip_spa|ces (ps)|
|00004400| 3b 0a 58 09 6e 20 3d 20 | 30 3b 0a 58 09 63 68 20 |;.X.n = |0;.X.ch |
|00004410| 3d 20 70 73 5f 73 63 61 | 6e 20 28 70 73 29 3b 0a |= ps_sca|n (ps);.|
|00004420| 58 09 77 68 69 6c 65 20 | 28 28 63 68 20 21 3d 20 |X.while |((ch != |
|00004430| 27 5c 30 27 29 20 26 26 | 20 28 63 68 20 21 3d 20 |'\0') &&| (ch != |
|00004440| 27 20 27 29 20 26 26 20 | 28 6e 20 3c 20 56 45 52 |' ') && |(n < VER|
|00004450| 53 49 4f 4e 5f 4c 45 4e | 47 54 48 2d 31 29 29 20 |SION_LEN|GTH-1)) |
|00004460| 7b 0a 58 09 09 70 63 2d | 3e 64 61 74 61 2e 76 65 |{.X..pc-|>data.ve|
|00004470| 72 73 69 6f 6e 5f 6e 61 | 6d 65 5b 6e 2b 2b 5d 20 |rsion_na|me[n++] |
|00004480| 3d 20 63 68 3b 0a 58 09 | 09 70 73 5f 6e 65 78 74 |= ch;.X.|.ps_next|
|00004490| 20 28 70 73 29 3b 0a 58 | 09 09 63 68 20 3d 20 70 | (ps);.X|..ch = p|
|000044a0| 73 5f 73 63 61 6e 20 28 | 70 73 29 3b 0a 58 09 7d |s_scan (|ps);.X.}|
|000044b0| 3b 0a 58 09 70 63 2d 3e | 64 61 74 61 2e 76 65 72 |;.X.pc->|data.ver|
|000044c0| 73 69 6f 6e 5f 6e 61 6d | 65 5b 6e 5d 20 3d 20 27 |sion_nam|e[n] = '|
|000044d0| 5c 30 27 3b 0a 58 09 73 | 6b 69 70 5f 73 70 61 63 |\0';.X.s|kip_spac|
|000044e0| 65 73 20 28 70 73 29 3b | 0a 58 09 6e 20 3d 20 56 |es (ps);|.X.n = V|
|000044f0| 45 52 53 49 4f 4e 5f 4c | 45 4e 47 54 48 3b 0a 58 |ERSION_L|ENGTH;.X|
|00004500| 09 63 68 20 3d 20 70 73 | 5f 73 63 61 6e 20 28 70 |.ch = ps|_scan (p|
|00004510| 73 29 3b 0a 58 09 77 68 | 69 6c 65 20 28 28 63 68 |s);.X.wh|ile ((ch|
|00004520| 20 21 3d 20 27 5c 30 27 | 29 20 26 26 20 28 63 68 | != '\0'|) && (ch|
|00004530| 20 21 3d 20 27 20 27 29 | 20 26 26 20 28 6e 20 3c | != ' ')| && (n <|
|00004540| 20 56 45 52 53 49 4f 4e | 5f 4e 41 4d 45 5f 4c 45 | VERSION|_NAME_LE|
|00004550| 4e 47 54 48 2d 31 29 29 | 20 7b 0a 58 09 09 70 63 |NGTH-1))| {.X..pc|
|00004560| 2d 3e 64 61 74 61 2e 76 | 65 72 73 69 6f 6e 5f 6e |->data.v|ersion_n|
|00004570| 61 6d 65 5b 6e 2b 2b 5d | 20 3d 20 63 68 3b 0a 58 |ame[n++]| = ch;.X|
|00004580| 09 09 70 73 5f 6e 65 78 | 74 20 28 70 73 29 3b 0a |..ps_nex|t (ps);.|
|00004590| 58 09 09 63 68 20 3d 20 | 70 73 5f 73 63 61 6e 20 |X..ch = |ps_scan |
|000045a0| 28 70 73 29 3b 0a 58 09 | 7d 3b 0a 58 09 70 63 2d |(ps);.X.|};.X.pc-|
|000045b0| 3e 64 61 74 61 2e 76 65 | 72 73 69 6f 6e 5f 6e 61 |>data.ve|rsion_na|
|000045c0| 6d 65 5b 6e 5d 20 3d 20 | 27 5c 30 27 3b 0a 58 7d |me[n] = |'\0';.X}|
|000045d0| 3b 0a 58 20 0a 58 73 74 | 61 74 69 63 20 70 61 72 |;.X .Xst|atic par|
|000045e0| 73 65 5f 71 75 69 74 5f | 63 6f 6d 6d 61 6e 64 20 |se_quit_|command |
|000045f0| 28 70 73 2c 20 70 63 29 | 0a 58 09 70 61 72 73 65 |(ps, pc)|.X.parse|
|00004600| 5f 73 74 72 69 6e 67 20 | 70 73 3b 20 70 6c 61 79 |_string |ps; play|
|00004610| 65 72 5f 63 6f 6d 6d 61 | 6e 64 20 70 63 3b 0a 58 |er_comma|nd pc;.X|
|00004620| 2f 2a 20 54 68 65 20 27 | 71 75 69 74 27 20 63 6f |/* The '|quit' co|
|00004630| 6d 6d 61 6e 64 20 69 6e | 64 69 63 61 74 65 73 20 |mmand in|dicates |
|00004640| 74 68 61 74 20 61 20 70 | 6c 61 79 65 72 20 68 61 |that a p|layer ha|
|00004650| 73 20 64 65 63 69 64 65 | 64 20 74 6f 20 71 75 69 |s decide|d to qui|
|00004660| 74 20 74 68 65 0a 58 20 | 2e 20 67 61 6d 65 2e 0a |t the.X |. game..|
|00004670| 58 20 2a 2f 0a 58 7b 0a | 58 09 70 63 2d 3e 63 6f |X */.X{.|X.pc->co|
|00004680| 6d 6d 61 6e 64 20 3d 20 | 43 4d 44 5f 51 55 49 54 |mmand = |CMD_QUIT|
|00004690| 3b 0a 58 7d 3b 0a 58 20 | 0a 58 73 74 61 74 69 63 |;.X};.X |.Xstatic|
|000046a0| 20 70 61 72 73 65 5f 68 | 65 6c 70 5f 63 6f 6d 6d | parse_h|elp_comm|
|000046b0| 61 6e 64 20 28 70 73 2c | 20 70 63 29 0a 58 09 70 |and (ps,| pc).X.p|
|000046c0| 61 72 73 65 5f 73 74 72 | 69 6e 67 20 70 73 3b 20 |arse_str|ing ps; |
|000046d0| 70 6c 61 79 65 72 5f 63 | 6f 6d 6d 61 6e 64 20 70 |player_c|ommand p|
|000046e0| 63 3b 0a 58 2f 2a 20 54 | 68 65 20 68 65 6c 70 20 |c;.X/* T|he help |
|000046f0| 63 6f 6d 6d 61 6e 64 20 | 72 65 71 75 65 73 74 73 |command |requests|
|00004700| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|00004710| 75 74 20 74 68 65 20 70 | 72 6f 67 72 61 6d 2e 0a |ut the p|rogram..|
|00004720| 58 20 2e 20 54 68 65 20 | 66 6f 72 6d 61 74 20 6f |X . The |format o|
|00004730| 66 20 74 68 65 20 63 6f | 6d 6d 61 6e 64 20 69 73 |f the co|mmand is|
|00004740| 3a 0a 58 20 2e 20 20 68 | 65 6c 70 20 3c 74 6f 70 |:.X . h|elp <top|
|00004750| 69 63 3e 0a 58 20 2e 20 | 77 68 65 72 65 20 3c 74 |ic>.X . |where <t|
|00004760| 6f 70 69 63 3e 20 69 73 | 20 61 6e 20 6f 70 74 69 |opic> is| an opti|
|00004770| 6f 6e 61 6c 20 77 6f 72 | 64 20 69 64 65 6e 74 69 |onal wor|d identi|
|00004780| 66 79 69 6e 67 20 74 68 | 65 20 6e 61 6d 65 20 6f |fying th|e name o|
|00004790| 66 20 61 20 74 6f 70 69 | 63 0a 58 20 2e 20 61 62 |f a topi|c.X . ab|
|000047a0| 6f 75 74 20 77 68 69 63 | 68 20 74 68 65 20 70 6c |out whic|h the pl|
|000047b0| 61 79 65 72 20 73 65 65 | 6b 73 20 68 65 6c 70 2e |ayer see|ks help.|
|000047c0| 0a 58 20 2a 2f 0a 58 7b | 0a 58 09 69 6e 74 20 63 |.X */.X{|.X.int c|
|000047d0| 68 2c 20 6e 3b 0a 58 20 | 0a 58 09 70 63 2d 3e 63 |h, n;.X |.X.pc->c|
|000047e0| 6f 6d 6d 61 6e 64 20 3d | 20 43 4d 44 5f 48 45 4c |ommand =| CMD_HEL|
|000047f0| 50 3b 0a 58 09 73 6b 69 | 70 5f 73 70 61 63 65 73 |P;.X.ski|p_spaces|
|00004800| 20 28 70 73 29 3b 0a 58 | 09 6e 20 3d 20 30 3b 0a | (ps);.X|.n = 0;.|
|00004810| 58 09 63 68 20 3d 20 70 | 73 5f 73 63 61 6e 20 28 |X.ch = p|s_scan (|
|00004820| 70 73 29 3b 0a 58 09 77 | 68 69 6c 65 20 28 63 68 |ps);.X.w|hile (ch|
|00004830| 20 21 3d 20 27 5c 30 27 | 29 20 7b 0a 58 09 20 20 | != '\0'|) {.X. |
|00004840| 20 20 20 20 20 20 69 66 | 20 28 6e 20 3c 20 54 4f | if| (n < TO|
|00004850| 50 49 43 5f 4c 45 4e 47 | 54 48 2d 31 29 0a 58 09 |PIC_LENG|TH-1).X.|
|00004860| 09 20 20 70 63 2d 3e 64 | 61 74 61 2e 74 6f 70 69 |. pc->d|ata.topi|
|00004870| 63 5b 6e 2b 2b 5d 20 3d | 20 63 68 3b 0a 58 09 09 |c[n++] =| ch;.X..|
|00004880| 70 73 5f 6e 65 78 74 20 | 28 70 73 29 3b 0a 58 09 |ps_next |(ps);.X.|
|00004890| 09 63 68 20 3d 20 70 73 | 5f 73 63 61 6e 20 28 70 |.ch = ps|_scan (p|
|000048a0| 73 29 3b 0a 58 09 7d 3b | 0a 58 09 70 63 2d 3e 64 |s);.X.};|.X.pc->d|
|000048b0| 61 74 61 2e 74 6f 70 69 | 63 5b 6e 5d 20 3d 20 27 |ata.topi|c[n] = '|
|000048c0| 5c 30 27 3b 0a 58 7d 3b | 0a 58 20 0a 58 73 74 61 |\0';.X};|.X .Xsta|
|000048d0| 74 69 63 20 70 61 72 73 | 65 5f 70 69 6e 67 5f 63 |tic pars|e_ping_c|
|000048e0| 6f 6d 6d 61 6e 64 20 28 | 70 73 2c 20 70 63 29 0a |ommand (|ps, pc).|
|000048f0| 58 09 70 61 72 73 65 5f | 73 74 72 69 6e 67 20 70 |X.parse_|string p|
|00004900| 73 3b 20 70 6c 61 79 65 | 72 5f 63 6f 6d 6d 61 6e |s; playe|r_comman|
|00004910| 64 20 70 63 3b 0a 58 2f | 2a 20 54 68 65 20 70 69 |d pc;.X/|* The pi|
|00004920| 6e 67 20 63 6f 6d 6d 61 | 6e 64 20 74 65 73 74 73 |ng comma|nd tests|
|00004930| 20 74 68 65 20 6e 65 74 | 77 6f 72 6b 20 63 6f 6e | the net|work con|
|00004940| 6e 65 63 74 69 6f 6e 73 | 2e 0a 58 20 2e 20 57 68 |nections|..X . Wh|
|00004950| 65 6e 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 72 |en the p|rogram r|
|00004960| 65 63 65 69 76 65 73 20 | 61 20 70 69 6e 67 20 63 |eceives |a ping c|
|00004970| 6f 6d 6d 61 6e 64 2c 20 | 69 74 20 61 75 74 6f 6d |ommand, |it autom|
|00004980| 61 74 69 63 61 6c 6c 79 | 0a 58 20 2e 20 69 73 73 |atically|.X . iss|
|00004990| 75 65 73 20 61 6e 20 22 | 65 63 68 6f 22 20 63 6f |ues an "|echo" co|
|000049a0| 6d 6d 61 6e 64 20 74 6f | 20 74 68 65 20 70 65 72 |mmand to| the per|
|000049b0| 73 6f 6e 20 77 68 6f 20 | 73 65 6e 74 20 74 68 65 |son who |sent the|
|000049c0| 20 22 70 69 6e 67 22 2e | 0a 58 20 2e 20 54 68 65 | "ping".|.X . The|
|000049d0| 20 72 6f 75 6e 64 2d 74 | 72 69 70 20 74 69 6d 65 | round-t|rip time|
|000049e0| 20 69 73 20 6d 65 61 73 | 75 72 65 64 2e 20 20 54 | is meas|ured. T|
|000049f0| 68 65 20 70 69 6e 67 20 | 63 6f 6d 6d 61 6e 64 20 |he ping |command |
|00004a00| 68 61 73 20 6e 6f 0a 58 | 20 2e 20 70 61 72 61 6d |has no.X| . param|
|00004a10| 65 74 65 72 73 2e 0a 58 | 20 2a 2f 0a 58 7b 0a 58 |eters..X| */.X{.X|
|00004a20| 09 70 63 2d 3e 63 6f 6d | 6d 61 6e 64 20 3d 20 43 |.pc->com|mand = C|
|00004a30| 4d 44 5f 50 49 4e 47 3b | 0a 58 7d 3b 0a 58 0a 58 |MD_PING;|.X};.X.X|
|00004a40| 73 74 61 74 69 63 20 70 | 61 72 73 65 5f 65 63 68 |static p|arse_ech|
|00004a50| 6f 5f 63 6f 6d 6d 61 6e | 64 20 28 70 73 2c 20 70 |o_comman|d (ps, p|
|00004a60| 63 29 0a 58 09 70 61 72 | 73 65 5f 73 74 72 69 6e |c).X.par|se_strin|
|00004a70| 67 20 70 73 3b 20 70 6c | 61 79 65 72 5f 63 6f 6d |g ps; pl|ayer_com|
|00004a80| 6d 61 6e 64 20 70 63 3b | 0a 58 2f 2a 20 54 68 65 |mand pc;|.X/* The|
|00004a90| 20 65 63 68 6f 20 63 6f | 6d 6d 61 6e 64 20 69 73 | echo co|mmand is|
|00004aa0| 20 69 73 73 75 65 64 20 | 69 6e 20 72 65 73 70 6f | issued |in respo|
|00004ab0| 6e 73 65 20 74 6f 20 74 | 68 65 20 70 69 6e 67 20 |nse to t|he ping |
|00004ac0| 63 6f 6d 6d 61 6e 64 2e | 0a 58 20 2e 20 54 68 65 |command.|.X . The|
|00004ad0| 20 66 6f 72 6d 61 74 20 | 6f 66 20 74 68 65 20 65 | format |of the e|
|00004ae0| 63 68 6f 20 63 6f 6d 6d | 61 6e 64 20 69 73 3a 0a |cho comm|and is:.|
|00004af0| 58 20 2e 20 20 65 63 68 | 6f 20 50 4c 41 59 45 52 |X . ech|o PLAYER|
|00004b00| 0a 58 20 2e 20 77 68 65 | 72 65 20 50 4c 41 59 45 |.X . whe|re PLAYE|
|00004b10| 52 20 69 73 20 74 68 65 | 20 70 6c 61 79 65 72 20 |R is the| player |
|00004b20| 77 68 6f 20 69 73 73 75 | 65 64 20 74 68 65 20 70 |who issu|ed the p|
|00004b30| 69 6e 67 20 63 6f 6d 6d | 61 6e 64 2e 0a 58 20 2a |ing comm|and..X *|
|00004b40| 2f 0a 58 7b 0a 58 09 69 | 6e 74 20 63 68 2c 20 6e |/.X{.X.i|nt ch, n|
|00004b50| 3b 0a 58 20 0a 58 09 73 | 6b 69 70 5f 73 70 61 63 |;.X .X.s|kip_spac|
|00004b60| 65 73 20 28 70 73 29 3b | 0a 58 09 70 63 2d 3e 64 |es (ps);|.X.pc->d|
|00004b70| 61 74 61 2e 70 69 6e 67 | 5f 73 6f 75 72 63 65 20 |ata.ping|_source |
|00004b80| 3d 20 2d 31 3b 0a 58 09 | 66 6f 72 20 28 6e 20 3d |= -1;.X.|for (n =|
|00004b90| 20 30 3b 20 6e 20 3c 20 | 34 3b 20 6e 2b 2b 29 20 | 0; n < |4; n++) |
|00004ba0| 0a 58 09 09 69 66 20 28 | 70 73 5f 6d 61 74 63 68 |.X..if (|ps_match|
|00004bb0| 65 73 5f 69 63 28 70 73 | 2c 20 6c 6f 63 61 6c 5f |es_ic(ps|, local_|
|00004bc0| 70 6c 61 79 65 72 5f 6e | 61 6d 65 73 5b 6e 5d 29 |player_n|ames[n])|
|00004bd0| 29 0a 58 09 09 09 70 63 | 2d 3e 64 61 74 61 2e 70 |).X...pc|->data.p|
|00004be0| 69 6e 67 5f 73 6f 75 72 | 63 65 20 3d 20 6e 3b 0a |ing_sour|ce = n;.|
|00004bf0| 58 09 69 66 20 28 70 63 | 2d 3e 64 61 74 61 2e 70 |X.if (pc|->data.p|
|00004c00| 69 6e 67 5f 73 6f 75 72 | 63 65 20 3d 3d 20 2d 31 |ing_sour|ce == -1|
|00004c10| 29 0a 58 09 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |).X..pc-|>command|
|00004c20| 20 3d 20 43 4d 44 5f 45 | 52 52 4f 52 3b 0a 58 09 | = CMD_E|RROR;.X.|
|00004c30| 65 6c 73 65 0a 58 09 09 | 70 63 2d 3e 63 6f 6d 6d |else.X..|pc->comm|
|00004c40| 61 6e 64 20 3d 20 43 4d | 44 5f 45 43 48 4f 3b 0a |and = CM|D_ECHO;.|
|00004c50| 58 09 70 61 72 73 69 6e | 67 5f 65 72 72 6d 73 67 |X.parsin|g_errmsg|
|00004c60| 20 3d 20 65 63 68 6f 5f | 65 72 72 6f 72 3b 0a 58 | = echo_|error;.X|
|00004c70| 7d 3b 0a 58 20 0a 58 20 | 0a 58 20 0a 58 73 74 61 |};.X .X |.X .Xsta|
|00004c80| 74 69 63 20 70 61 72 73 | 65 5f 62 65 6c 6c 5f 63 |tic pars|e_bell_c|
|00004c90| 6f 6d 6d 61 6e 64 20 28 | 70 73 2c 20 70 63 29 0a |ommand (|ps, pc).|
|00004ca0| 58 2f 2a 20 54 68 65 20 | 42 45 4c 4c 20 63 6f 6d |X/* The |BELL com|
|00004cb0| 6d 61 6e 64 73 20 63 6f | 6e 74 72 6f 6c 73 20 77 |mands co|ntrols w|
|00004cc0| 68 65 74 68 65 72 20 6f | 72 20 6e 6f 74 20 74 68 |hether o|r not th|
|00004cd0| 65 20 74 65 72 6d 69 6e | 61 6c 27 73 20 62 65 6c |e termin|al's bel|
|00004ce0| 6c 0a 58 20 2e 20 77 69 | 6c 6c 20 62 65 20 72 75 |l.X . wi|ll be ru|
|00004cf0| 6e 67 20 65 61 63 68 20 | 74 69 6d 65 20 69 74 20 |ng each |time it |
|00004d00| 69 73 20 74 68 65 20 6c | 6f 63 61 6c 20 70 6c 61 |is the l|ocal pla|
|00004d10| 79 65 72 27 73 20 74 75 | 72 6e 20 74 6f 20 65 6e |yer's tu|rn to en|
|00004d20| 74 65 72 0a 58 20 2e 20 | 61 20 62 69 64 20 6f 72 |ter.X . |a bid or|
|00004d30| 20 70 6c 61 79 2e 20 20 | 54 68 65 20 66 6f 72 6d | play. |The form|
|00004d40| 61 74 20 6f 66 20 74 68 | 65 20 42 45 4c 4c 20 63 |at of th|e BELL c|
|00004d50| 6f 6d 6d 61 6e 64 20 69 | 73 0a 58 20 2e 20 20 20 |ommand i|s.X . |
|00004d60| 42 45 4c 4c 20 5b 4f 4e | 20 7c 20 4f 46 46 5d 0a |BELL [ON| | OFF].|
|00004d70| 58 20 2a 2f 0a 58 09 70 | 61 72 73 65 5f 73 74 72 |X */.X.p|arse_str|
|00004d80| 69 6e 67 20 70 73 3b 20 | 70 6c 61 79 65 72 5f 63 |ing ps; |player_c|
|00004d90| 6f 6d 6d 61 6e 64 20 70 | 63 3b 0a 58 7b 0a 58 09 |ommand p|c;.X{.X.|
|00004da0| 69 6e 74 20 63 68 3b 0a | 58 0a 58 09 70 63 2d 3e |int ch;.|X.X.pc->|
|00004db0| 63 6f 6d 6d 61 6e 64 20 | 3d 20 43 4d 44 5f 42 45 |command |= CMD_BE|
|00004dc0| 4c 4c 3b 0a 58 09 73 6b | 69 70 5f 73 70 61 63 65 |LL;.X.sk|ip_space|
|00004dd0| 73 20 28 70 73 29 3b 0a | 58 09 63 68 20 3d 20 70 |s (ps);.|X.ch = p|
|00004de0| 73 5f 73 63 61 6e 20 28 | 70 73 29 3b 0a 58 09 69 |s_scan (|ps);.X.i|
|00004df0| 66 20 28 63 68 20 3d 3d | 20 27 5c 30 27 29 0a 58 |f (ch ==| '\0').X|
|00004e00| 09 09 70 63 2d 3e 64 61 | 74 61 2e 62 65 6c 6c 20 |..pc->da|ta.bell |
|00004e10| 3d 20 2d 31 3b 0a 58 09 | 65 6c 73 65 20 69 66 20 |= -1;.X.|else if |
|00004e20| 28 70 73 5f 6d 61 74 63 | 68 65 73 5f 69 63 20 28 |(ps_matc|hes_ic (|
|00004e30| 70 73 2c 20 22 4f 4e 22 | 29 29 0a 58 09 09 70 63 |ps, "ON"|)).X..pc|
|00004e40| 2d 3e 64 61 74 61 2e 62 | 65 6c 6c 20 3d 20 31 3b |->data.b|ell = 1;|
|00004e50| 0a 58 09 65 6c 73 65 20 | 69 66 20 28 70 73 5f 6d |.X.else |if (ps_m|
|00004e60| 61 74 63 68 65 73 5f 69 | 63 20 28 70 73 2c 20 22 |atches_i|c (ps, "|
|00004e70| 4f 46 46 22 29 29 0a 58 | 09 09 70 63 2d 3e 64 61 |OFF")).X|..pc->da|
|00004e80| 74 61 2e 62 65 6c 6c 20 | 3d 20 30 3b 0a 58 09 65 |ta.bell |= 0;.X.e|
|00004e90| 6c 73 65 20 7b 0a 58 09 | 09 70 61 72 73 69 6e 67 |lse {.X.|.parsing|
|00004ea0| 5f 65 72 72 6d 73 67 20 | 3d 20 62 65 6c 6c 5f 65 |_errmsg |= bell_e|
|00004eb0| 72 72 6f 72 3b 0a 58 09 | 09 70 63 2d 3e 63 6f 6d |rror;.X.|.pc->com|
|00004ec0| 6d 61 6e 64 20 3d 20 43 | 4d 44 5f 45 52 52 4f 52 |mand = C|MD_ERROR|
|00004ed0| 3b 0a 58 09 7d 3b 0a 58 | 7d 3b 0a 58 0a 58 73 74 |;.X.};.X|};.X.Xst|
|00004ee0| 61 74 69 63 20 70 61 72 | 73 65 5f 64 65 66 61 75 |atic par|se_defau|
|00004ef0| 6c 74 5f 63 6f 6d 6d 61 | 6e 64 20 28 70 73 2c 20 |lt_comma|nd (ps, |
|00004f00| 70 63 29 0a 58 2f 2a 20 | 54 68 65 20 44 45 46 41 |pc).X/* |The DEFA|
|00004f10| 55 4c 54 20 63 6f 6d 6d | 61 6e 64 20 63 6f 6e 74 |ULT comm|and cont|
|00004f20| 72 6f 6c 73 20 77 68 65 | 74 68 65 72 20 6f 72 20 |rols whe|ther or |
|00004f30| 6e 6f 74 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |not the |program |
|00004f40| 77 69 6c 6c 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |will aut|omatical|
|00004f50| 6c 79 0a 58 20 2e 20 70 | 72 6f 76 69 64 65 20 64 |ly.X . p|rovide d|
|00004f60| 65 66 61 75 6c 74 20 69 | 6e 70 75 74 73 2e 20 20 |efault i|nputs. |
|00004f70| 54 68 65 20 66 6f 72 6d | 61 74 20 6f 66 20 74 68 |The form|at of th|
|00004f80| 65 20 44 45 46 41 55 4c | 54 20 63 6f 6d 6d 61 6e |e DEFAUL|T comman|
|00004f90| 64 20 69 73 0a 58 20 2e | 20 20 20 44 45 46 41 55 |d is.X .| DEFAU|
|00004fa0| 4c 54 20 5b 4f 4e 20 7c | 20 4f 46 46 5d 0a 58 20 |LT [ON || OFF].X |
|00004fb0| 2a 2f 20 0a 58 09 70 61 | 72 73 65 5f 73 74 72 69 |*/ .X.pa|rse_stri|
|00004fc0| 6e 67 20 70 73 3b 20 70 | 6c 61 79 65 72 5f 63 6f |ng ps; p|layer_co|
|00004fd0| 6d 6d 61 6e 64 20 70 63 | 3b 0a 58 7b 0a 58 09 69 |mmand pc|;.X{.X.i|
|00004fe0| 6e 74 20 63 68 3b 0a 58 | 0a 58 09 70 63 2d 3e 63 |nt ch;.X|.X.pc->c|
|00004ff0| 6f 6d 6d 61 6e 64 20 3d | 20 43 4d 44 5f 44 45 46 |ommand =| CMD_DEF|
|00005000| 41 55 4c 54 3b 0a 58 09 | 73 6b 69 70 5f 73 70 61 |AULT;.X.|skip_spa|
|00005010| 63 65 73 20 28 70 73 29 | 3b 0a 58 09 63 68 20 3d |ces (ps)|;.X.ch =|
|00005020| 20 70 73 5f 73 63 61 6e | 20 28 70 73 29 3b 0a 58 | ps_scan| (ps);.X|
|00005030| 09 69 66 20 28 63 68 20 | 3d 3d 20 27 5c 30 27 29 |.if (ch |== '\0')|
|00005040| 0a 58 09 09 70 63 2d 3e | 64 61 74 61 2e 64 65 66 |.X..pc->|data.def|
|00005050| 61 61 6c 74 20 3d 20 2d | 31 3b 0a 58 09 65 6c 73 |aalt = -|1;.X.els|
|00005060| 65 20 69 66 20 28 70 73 | 5f 6d 61 74 63 68 65 73 |e if (ps|_matches|
|00005070| 5f 69 63 20 28 70 73 2c | 20 22 4f 4e 22 29 29 0a |_ic (ps,| "ON")).|
|00005080| 58 09 09 70 63 2d 3e 64 | 61 74 61 2e 64 65 66 61 |X..pc->d|ata.defa|
|00005090| 61 6c 74 20 3d 20 31 3b | 0a 58 09 65 6c 73 65 20 |alt = 1;|.X.else |
|000050a0| 69 66 20 28 70 73 5f 6d | 61 74 63 68 65 73 5f 69 |if (ps_m|atches_i|
|000050b0| 63 20 28 70 73 2c 20 22 | 4f 46 46 22 29 29 0a 58 |c (ps, "|OFF")).X|
|000050c0| 09 09 70 63 2d 3e 64 61 | 74 61 2e 64 65 66 61 61 |..pc->da|ta.defaa|
|000050d0| 6c 74 20 3d 20 30 3b 0a | 58 09 65 6c 73 65 20 7b |lt = 0;.|X.else {|
|000050e0| 0a 58 09 09 70 61 72 73 | 69 6e 67 5f 65 72 72 6d |.X..pars|ing_errm|
|000050f0| 73 67 20 3d 20 64 65 66 | 61 75 6c 74 5f 65 72 72 |sg = def|ault_err|
|00005100| 6f 72 3b 0a 58 09 09 70 | 63 2d 3e 63 6f 6d 6d 61 |or;.X..p|c->comma|
|00005110| 6e 64 20 3d 20 43 4d 44 | 5f 45 52 52 4f 52 3b 0a |nd = CMD|_ERROR;.|
|00005120| 58 09 7d 3b 0a 58 7d 3b | 0a 58 0a 58 73 74 61 74 |X.};.X};|.X.Xstat|
|00005130| 69 63 20 70 61 72 73 65 | 5f 72 65 76 69 65 77 5f |ic parse|_review_|
|00005140| 63 6f 6d 6d 61 6e 64 20 | 28 70 73 2c 20 70 63 29 |command |(ps, pc)|
|00005150| 0a 58 20 20 20 20 20 20 | 20 20 70 61 72 73 65 5f |.X | parse_|
|00005160| 73 74 72 69 6e 67 20 70 | 73 3b 20 70 6c 61 79 65 |string p|s; playe|
|00005170| 72 5f 63 6f 6d 6d 61 6e | 64 20 70 63 3b 0a 58 2f |r_comman|d pc;.X/|
|00005180| 2a 20 49 66 20 77 65 20 | 61 72 65 20 69 6e 20 74 |* If we |are in t|
|00005190| 68 65 20 70 6c 61 79 69 | 6e 67 20 70 68 61 73 65 |he playi|ng phase|
|000051a0| 20 6f 66 20 74 68 65 20 | 67 61 6d 65 2c 20 74 68 | of the |game, th|
|000051b0| 65 6e 20 74 68 69 73 20 | 63 6f 6d 6d 61 6e 64 20 |en this |command |
|000051c0| 64 69 73 70 6c 61 79 73 | 0a 58 20 20 20 74 68 65 |displays|.X the|
|000051d0| 20 62 69 64 73 20 77 68 | 69 63 68 20 77 65 72 65 | bids wh|ich were|
|000051e0| 20 6d 61 64 65 20 69 6e | 20 74 68 65 20 62 69 64 | made in| the bid|
|000051f0| 64 69 6e 67 20 70 68 61 | 73 65 2e 20 20 4f 74 68 |ding pha|se. Oth|
|00005200| 65 72 77 69 73 65 2c 20 | 69 74 20 64 6f 65 73 0a |erwise, |it does.|
|00005210| 58 20 20 20 6e 6f 74 68 | 69 6e 67 2e 0a 58 20 2a |X noth|ing..X *|
|00005220| 2f 0a 58 7b 0a 58 20 20 | 70 63 2d 3e 63 6f 6d 6d |/.X{.X |pc->comm|
|00005230| 61 6e 64 20 3d 20 43 4d | 44 5f 52 45 56 49 45 57 |and = CM|D_REVIEW|
|00005240| 3b 0a 58 7d 3b 0a 58 0a | 58 73 74 61 74 69 63 20 |;.X};.X.|Xstatic |
|00005250| 70 61 72 73 65 5f 63 6c | 61 69 6d 5f 63 6f 6d 6d |parse_cl|aim_comm|
|00005260| 61 6e 64 20 28 70 73 2c | 20 70 63 29 0a 58 09 70 |and (ps,| pc).X.p|
|00005270| 61 72 73 65 5f 73 74 72 | 69 6e 67 20 70 73 3b 20 |arse_str|ing ps; |
|00005280| 70 6c 61 79 65 72 5f 63 | 6f 6d 6d 61 6e 64 20 70 |player_c|ommand p|
|00005290| 63 3b 0a 58 2f 2a 20 54 | 68 65 20 63 6c 61 69 6d |c;.X/* T|he claim|
|000052a0| 20 63 6f 6d 6d 61 6e 64 | 20 69 73 20 75 73 65 64 | command| is used|
|000052b0| 20 62 79 20 74 68 65 20 | 64 65 63 6c 61 72 65 72 | by the |declarer|
|000052c0| 20 74 6f 20 63 6c 61 69 | 6d 20 61 20 70 6f 72 74 | to clai|m a port|
|000052d0| 69 6f 6e 20 6f 66 0a 58 | 20 2e 20 74 68 65 20 72 |ion of.X| . the r|
|000052e0| 65 6d 61 69 6e 69 6e 67 | 20 74 72 69 63 6b 73 2e |emaining| tricks.|
|000052f0| 20 20 54 68 65 20 64 65 | 66 65 6e 64 69 6e 67 20 | The de|fending |
|00005300| 70 6c 61 79 65 72 73 20 | 61 72 65 20 61 73 6b 65 |players |are aske|
|00005310| 64 20 69 66 20 74 68 65 | 79 0a 58 20 2e 20 61 67 |d if the|y.X . ag|
|00005320| 72 65 65 20 77 69 74 68 | 20 74 68 65 20 63 6c 61 |ree with| the cla|
|00005330| 69 6d 2c 20 61 6e 64 20 | 69 66 20 73 6f 2c 20 74 |im, and |if so, t|
|00005340| 68 65 20 68 61 6e 64 20 | 69 73 20 74 65 72 6d 69 |he hand |is termi|
|00005350| 6e 61 74 65 64 20 65 61 | 72 6c 79 2e 0a 58 20 2e |nated ea|rly..X .|
|00005360| 20 54 68 65 20 66 6f 72 | 6d 61 74 20 6f 66 20 74 | The for|mat of t|
|00005370| 68 65 20 63 6c 61 69 6d | 20 63 6f 6d 6d 61 6e 64 |he claim| command|
|00005380| 20 69 73 3a 0a 58 20 2e | 20 20 20 43 4c 41 49 4d | is:.X .| CLAIM|
|00005390| 20 6e 0a 58 20 2e 20 77 | 68 65 72 65 20 6e 20 69 | n.X . w|here n i|
|000053a0| 73 20 61 6e 20 69 6e 74 | 65 67 65 72 20 69 6e 20 |s an int|eger in |
|000053b0| 74 68 65 20 72 61 6e 67 | 65 20 30 2d 31 33 2e 0a |the rang|e 0-13..|
|000053c0| 58 20 2a 2f 0a 58 7b 20 | 0a 58 09 69 6e 74 20 6e |X */.X{ |.X.int n|
|000053d0| 3b 0a 58 0a 58 09 70 63 | 2d 3e 63 6f 6d 6d 61 6e |;.X.X.pc|->comman|
|000053e0| 64 20 3d 20 43 4d 44 5f | 43 4c 41 49 4d 3b 0a 58 |d = CMD_|CLAIM;.X|
|000053f0| 09 73 6b 69 70 5f 73 70 | 61 63 65 73 20 28 70 73 |.skip_sp|aces (ps|
|00005400| 29 3b 0a 58 09 69 66 20 | 28 70 73 5f 73 63 61 6e |);.X.if |(ps_scan|
|00005410| 28 70 73 29 20 3d 3d 20 | 27 5c 30 27 29 0a 58 09 |(ps) == |'\0').X.|
|00005420| 20 20 6e 20 3d 20 31 34 | 20 2d 20 74 72 69 63 6b | n = 14| - trick|
|00005430| 3b 0a 58 09 65 6c 73 65 | 0a 58 09 20 20 6e 20 3d |;.X.else|.X. n =|
|00005440| 20 70 61 72 73 65 5f 6e | 61 74 75 72 61 6c 20 28 | parse_n|atural (|
|00005450| 70 73 2c 20 70 63 29 3b | 0a 58 0a 58 09 69 66 20 |ps, pc);|.X.X.if |
|00005460| 28 6e 20 3c 20 30 29 0a | 58 09 20 20 70 63 2d 3e |(n < 0).|X. pc->|
|00005470| 63 6f 6d 6d 61 6e 64 20 | 3d 20 43 4d 44 5f 45 52 |command |= CMD_ER|
|00005480| 52 4f 52 3b 0a 58 09 65 | 6c 73 65 0a 58 09 20 20 |ROR;.X.e|lse.X. |
|00005490| 70 63 2d 3e 64 61 74 61 | 2e 74 72 69 63 6b 73 20 |pc->data|.tricks |
|000054a0| 3d 20 6e 3b 0a 58 7d 3b | 0a 58 0a 58 73 74 61 74 |= n;.X};|.X.Xstat|
|000054b0| 69 63 20 70 61 72 73 65 | 5f 72 65 73 70 6f 6e 64 |ic parse|_respond|
|000054c0| 5f 63 6f 6d 6d 61 6e 64 | 20 28 70 73 2c 20 70 63 |_command| (ps, pc|
|000054d0| 29 0a 58 09 70 61 72 73 | 65 5f 73 74 72 69 6e 67 |).X.pars|e_string|
|000054e0| 20 70 73 3b 20 70 6c 61 | 79 65 72 5f 63 6f 6d 6d | ps; pla|yer_comm|
|000054f0| 61 6e 64 20 70 63 3b 0a | 58 2f 2a 20 54 68 65 20 |and pc;.|X/* The |
|00005500| 72 65 73 70 6f 6e 64 20 | 63 6f 6d 6d 61 6e 64 20 |respond |command |
|00005510| 69 73 20 75 73 65 64 20 | 62 79 20 74 68 65 20 64 |is used |by the d|
|00005520| 65 66 65 6e 64 69 6e 67 | 20 70 6c 61 79 65 72 20 |efending| player |
|00005530| 74 6f 20 69 6e 64 69 63 | 61 74 65 0a 58 20 2e 20 |to indic|ate.X . |
|00005540| 68 69 73 2f 68 65 72 20 | 72 65 73 70 6f 6e 73 65 |his/her |response|
|00005550| 20 74 6f 20 74 68 65 20 | 64 65 63 6c 61 72 65 72 | to the |declarer|
|00005560| 27 73 20 63 6c 61 69 6d | 2e 20 20 54 68 65 20 66 |'s claim|. The f|
|00005570| 6f 72 6d 61 74 20 6f 66 | 20 74 68 65 0a 58 20 2e |ormat of| the.X .|
|00005580| 20 72 65 73 70 6f 6e 64 | 20 63 6f 6d 6d 61 6e 64 | respond| command|
|00005590| 20 69 73 0a 58 20 2e 20 | 20 20 52 45 53 50 20 5b | is.X . | RESP [|
|000055a0| 41 43 43 45 50 54 20 7c | 20 52 45 4a 45 43 54 5d |ACCEPT || REJECT]|
|000055b0| 0a 58 20 2a 2f 0a 58 7b | 0a 58 09 70 63 2d 3e 63 |.X */.X{|.X.pc->c|
|000055c0| 6f 6d 6d 61 6e 64 20 3d | 20 43 4d 44 5f 52 45 53 |ommand =| CMD_RES|
|000055d0| 50 3b 0a 58 09 73 6b 69 | 70 5f 73 70 61 63 65 73 |P;.X.ski|p_spaces|
|000055e0| 20 28 70 73 29 3b 0a 58 | 09 69 66 20 28 70 73 5f | (ps);.X|.if (ps_|
|000055f0| 6d 61 74 63 68 65 73 5f | 69 63 20 28 70 73 2c 20 |matches_|ic (ps, |
|00005600| 22 41 43 43 45 50 54 22 | 29 29 0a 58 09 09 70 63 |"ACCEPT"|)).X..pc|
|00005610| 2d 3e 64 61 74 61 2e 72 | 65 73 70 6f 6e 73 65 20 |->data.r|esponse |
|00005620| 3d 20 31 3b 0a 58 09 65 | 6c 73 65 20 69 66 20 28 |= 1;.X.e|lse if (|
|00005630| 70 73 5f 6d 61 74 63 68 | 65 73 5f 69 63 20 28 70 |ps_match|es_ic (p|
|00005640| 73 2c 20 22 52 45 4a 45 | 43 54 22 29 29 0a 58 09 |s, "REJE|CT")).X.|
|00005650| 09 70 63 2d 3e 64 61 74 | 61 2e 72 65 73 70 6f 6e |.pc->dat|a.respon|
|00005660| 73 65 20 3d 20 30 3b 0a | 58 09 65 6c 73 65 20 7b |se = 0;.|X.else {|
|00005670| 0a 58 09 09 70 61 72 73 | 69 6e 67 5f 65 72 72 6d |.X..pars|ing_errm|
|00005680| 73 67 20 3d 20 72 65 73 | 70 5f 65 72 72 6f 72 3b |sg = res|p_error;|
|00005690| 0a 58 09 09 70 63 2d 3e | 63 6f 6d 6d 61 6e 64 20 |.X..pc->|command |
|000056a0| 3d 20 43 4d 44 5f 45 52 | 52 4f 52 3b 0a 58 09 7d |= CMD_ER|ROR;.X.}|
|000056b0| 3b 0a 58 7d 3b 0a 58 0a | 58 73 74 61 74 69 63 20 |;.X};.X.|Xstatic |
|000056c0| 70 61 72 73 65 5f 66 69 | 6e 69 73 68 5f 63 6f 6d |parse_fi|nish_com|
|000056d0| 6d 61 6e 64 20 28 70 73 | 2c 20 70 63 29 0a 58 09 |mand (ps|, pc).X.|
|000056e0| 70 61 72 73 65 5f 73 74 | 72 69 6e 67 20 70 73 3b |parse_st|ring ps;|
|000056f0| 20 70 6c 61 79 65 72 5f | 63 6f 6d 6d 61 6e 64 20 | player_|command |
|00005700| 70 63 3b 0a 58 2f 2a 20 | 54 68 65 20 66 69 6e 69 |pc;.X/* |The fini|
|00005710| 73 68 20 63 6f 6d 6d 61 | 6e 64 20 62 72 69 6e 67 |sh comma|nd bring|
|00005720| 73 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 68 61 |s the cu|rrent ha|
|00005730| 6e 64 20 74 6f 20 61 6e | 20 65 61 72 6c 79 20 63 |nd to an| early c|
|00005740| 6f 6e 63 6c 75 73 69 6f | 6e 0a 58 20 2e 20 61 66 |onclusio|n.X . af|
|00005750| 74 65 72 20 74 68 65 20 | 64 65 66 65 6e 64 65 72 |ter the |defender|
|00005760| 73 20 68 61 76 65 20 61 | 67 72 65 65 64 20 74 6f |s have a|greed to|
|00005770| 20 63 6f 6e 63 65 64 65 | 20 61 20 6e 75 6d 62 65 | concede| a numbe|
|00005780| 72 20 6f 66 20 74 72 69 | 63 6b 73 20 74 6f 20 74 |r of tri|cks to t|
|00005790| 68 65 0a 58 20 2e 20 64 | 65 63 6c 61 72 65 72 2e |he.X . d|eclarer.|
|000057a0| 20 20 54 68 65 20 66 6f | 72 6d 61 74 20 6f 66 20 | The fo|rmat of |
|000057b0| 74 68 65 20 66 69 6e 69 | 73 68 20 63 6f 6d 6d 61 |the fini|sh comma|
|000057c0| 6e 64 20 69 73 3a 0a 58 | 20 2e 20 20 20 46 49 4e |nd is:.X| . FIN|
|000057d0| 49 53 48 20 6e 0a 58 20 | 2e 20 77 68 65 72 65 20 |ISH n.X |. where |
|000057e0| 6e 20 69 73 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |n is the| number |
|000057f0| 6f 66 20 61 64 64 69 74 | 69 6f 6e 61 6c 20 74 72 |of addit|ional tr|
|00005800| 69 63 6b 73 20 63 6f 6e | 63 65 64 65 64 20 74 6f |icks con|ceded to|
|00005810| 20 74 68 65 20 64 65 63 | 6c 61 72 65 72 2e 0a 58 | the dec|larer..X|
|00005820| 20 2a 2f 0a 58 7b 20 0a | 58 09 69 6e 74 20 6e 3b | */.X{ .|X.int n;|
|00005830| 0a 58 0a 58 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |.X.X.pc-|>command|
|00005840| 20 3d 20 43 4d 44 5f 46 | 49 4e 49 53 48 3b 20 0a | = CMD_F|INISH; .|
|00005850| 58 09 6e 20 3d 20 70 61 | 72 73 65 5f 6e 61 74 75 |X.n = pa|rse_natu|
|00005860| 72 61 6c 20 28 70 73 2c | 20 70 63 29 3b 20 0a 58 |ral (ps,| pc); .X|
|00005870| 09 69 66 20 28 6e 20 3c | 20 30 29 20 0a 58 09 09 |.if (n <| 0) .X..|
|00005880| 70 63 2d 3e 63 6f 6d 6d | 61 6e 64 20 3d 20 43 4d |pc->comm|and = CM|
|00005890| 44 5f 45 52 52 4f 52 3b | 0a 58 09 65 6c 73 65 0a |D_ERROR;|.X.else.|
|000058a0| 58 09 09 70 63 2d 3e 64 | 61 74 61 2e 74 72 69 63 |X..pc->d|ata.tric|
|000058b0| 6b 73 20 3d 20 6e 3b 0a | 58 7d 3b 0a 58 0a 58 0a |ks = n;.|X};.X.X.|
|000058c0| 58 73 74 61 74 69 63 20 | 70 61 72 73 65 5f 70 72 |Xstatic |parse_pr|
|000058d0| 6f 6d 70 74 5f 63 6f 6d | 6d 61 6e 64 20 28 70 73 |ompt_com|mand (ps|
|000058e0| 2c 20 70 63 29 0a 58 09 | 70 61 72 73 65 5f 73 74 |, pc).X.|parse_st|
|000058f0| 72 69 6e 67 20 70 73 3b | 20 70 6c 61 79 65 72 5f |ring ps;| player_|
|00005900| 63 6f 6d 6d 61 6e 64 20 | 70 63 3b 0a 58 2f 2a 20 |command |pc;.X/* |
|00005910| 54 68 65 20 70 72 6f 6d | 70 74 20 63 6f 6d 6d 61 |The prom|pt comma|
|00005920| 6e 64 20 63 6f 6e 74 72 | 6f 6c 73 20 74 68 65 20 |nd contr|ols the |
|00005930| 70 72 6f 6d 70 74 69 6e | 67 20 6f 66 20 74 68 65 |promptin|g of the|
|00005940| 20 6c 6f 63 61 6c 20 70 | 6c 61 79 65 72 20 77 68 | local p|layer wh|
|00005950| 65 6e 0a 58 20 2e 20 68 | 65 2f 73 68 65 20 69 73 |en.X . h|e/she is|
|00005960| 20 74 68 65 20 64 75 6d | 6d 79 2e 20 20 49 66 20 | the dum|my. If |
|00005970| 70 72 6f 6d 70 74 69 6e | 67 20 69 73 20 6f 6e 2c |promptin|g is on,|
|00005980| 20 74 68 65 6e 20 74 68 | 65 20 6c 6f 63 61 6c 20 | then th|e local |
|00005990| 70 6c 61 79 65 72 0a 58 | 20 2e 20 69 73 20 72 65 |player.X| . is re|
|000059a0| 71 75 69 72 65 64 20 74 | 6f 20 70 72 65 73 73 20 |quired t|o press |
|000059b0| 52 45 54 55 52 4e 20 61 | 74 20 74 68 65 20 65 6e |RETURN a|t the en|
|000059c0| 64 20 6f 66 20 65 61 63 | 68 20 74 72 69 63 6b 2e |d of eac|h trick.|
|000059d0| 20 20 49 66 20 70 72 6f | 6d 70 74 69 6e 67 0a 58 | If pro|mpting.X|
|000059e0| 20 2e 20 69 73 20 6f 66 | 66 2c 20 74 68 65 6e 20 | . is of|f, then |
|000059f0| 74 68 65 20 6c 6f 63 61 | 6c 20 70 6c 61 79 65 72 |the loca|l player|
|00005a00| 20 6d 61 79 20 6e 6f 74 | 20 73 65 65 20 61 6c 6c | may not| see all|
|00005a10| 20 6f 66 20 74 68 65 20 | 63 61 72 64 73 20 74 68 | of the |cards th|
|00005a20| 61 74 0a 58 20 2e 20 61 | 72 65 20 70 6c 61 79 65 |at.X . a|re playe|
|00005a30| 64 20 62 79 20 74 68 65 | 20 6f 74 68 65 72 73 2e |d by the| others.|
|00005a40| 20 20 54 68 65 20 66 6f | 72 6d 61 74 20 6f 66 20 | The fo|rmat of |
|00005a50| 74 68 65 20 50 52 4f 4d | 50 54 20 63 6f 6d 6d 61 |the PROM|PT comma|
|00005a60| 6e 64 20 69 73 3a 0a 58 | 20 2e 20 20 20 50 52 4f |nd is:.X| . PRO|
|00005a70| 4d 50 54 20 5b 4f 4e 20 | 7c 20 4f 46 46 5d 0a 58 |MPT [ON || OFF].X|
|00005a80| 20 2a 2f 0a 58 7b 0a 58 | 09 69 6e 74 20 63 68 3b | */.X{.X|.int ch;|
|00005a90| 0a 58 0a 58 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |.X.X.pc-|>command|
|00005aa0| 20 3d 20 43 4d 44 5f 50 | 52 4f 4d 50 54 3b 0a 58 | = CMD_P|ROMPT;.X|
|00005ab0| 09 73 6b 69 70 5f 73 70 | 61 63 65 73 20 28 70 73 |.skip_sp|aces (ps|
|00005ac0| 29 3b 0a 58 09 63 68 20 | 3d 20 70 73 5f 73 63 61 |);.X.ch |= ps_sca|
|00005ad0| 6e 20 28 70 73 29 3b 0a | 58 09 69 66 20 28 63 68 |n (ps);.|X.if (ch|
|00005ae0| 20 3d 3d 20 27 5c 30 27 | 29 0a 58 09 09 70 63 2d | == '\0'|).X..pc-|
|00005af0| 3e 64 61 74 61 2e 70 72 | 6f 6d 70 74 20 3d 20 2d |>data.pr|ompt = -|
|00005b00| 31 3b 0a 58 09 65 6c 73 | 65 20 69 66 20 28 70 73 |1;.X.els|e if (ps|
|00005b10| 5f 6d 61 74 63 68 65 73 | 5f 69 63 20 28 70 73 2c |_matches|_ic (ps,|
|00005b20| 20 22 4f 4e 22 29 29 0a | 58 09 09 70 63 2d 3e 64 | "ON")).|X..pc->d|
|00005b30| 61 74 61 2e 70 72 6f 6d | 70 74 20 3d 20 31 3b 0a |ata.prom|pt = 1;.|
|00005b40| 58 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |X.else i|f (ps_ma|
|00005b50| 74 63 68 65 73 5f 69 63 | 20 28 70 73 2c 20 22 4f |tches_ic| (ps, "O|
|00005b60| 46 46 22 29 29 0a 58 09 | 09 70 63 2d 3e 64 61 74 |FF")).X.|.pc->dat|
|00005b70| 61 2e 70 72 6f 6d 70 74 | 20 3d 20 30 3b 0a 58 09 |a.prompt| = 0;.X.|
|00005b80| 65 6c 73 65 20 7b 0a 58 | 09 09 70 61 72 73 69 6e |else {.X|..parsin|
|00005b90| 67 5f 65 72 72 6d 73 67 | 20 3d 20 70 72 6f 6d 70 |g_errmsg| = promp|
|00005ba0| 74 5f 65 72 72 6f 72 3b | 0a 58 09 09 70 63 2d 3e |t_error;|.X..pc->|
|00005bb0| 63 6f 6d 6d 61 6e 64 20 | 3d 20 43 4d 44 5f 45 52 |command |= CMD_ER|
|00005bc0| 52 4f 52 3b 0a 58 09 7d | 3b 0a 58 7d 3b 0a 58 0a |ROR;.X.}|;.X};.X.|
|00005bd0| 58 73 74 61 74 69 63 20 | 70 61 72 73 65 5f 73 63 |Xstatic |parse_sc|
|00005be0| 6f 72 65 5f 63 6f 6d 6d | 61 6e 64 20 28 70 73 2c |ore_comm|and (ps,|
|00005bf0| 20 70 63 29 0a 58 09 70 | 61 72 73 65 5f 73 74 72 | pc).X.p|arse_str|
|00005c00| 69 6e 67 20 70 73 3b 20 | 70 6c 61 79 65 72 5f 63 |ing ps; |player_c|
|00005c10| 6f 6d 6d 61 6e 64 20 70 | 63 3b 0a 58 2f 2a 20 54 |ommand p|c;.X/* T|
|00005c20| 68 65 20 73 63 6f 72 65 | 20 63 6f 6d 6d 61 6e 64 |he score| command|
|00005c30| 20 69 73 20 75 73 65 64 | 20 61 74 20 74 68 65 20 | is used| at the |
|00005c40| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 74 68 65 |beginnin|g of the|
|00005c50| 20 67 61 6d 65 20 69 6e | 20 6f 72 64 65 72 0a 58 | game in| order.X|
|00005c60| 20 2e 20 74 6f 20 65 73 | 74 61 62 6c 69 73 68 20 | . to es|tablish |
|00005c70| 74 68 65 20 73 63 6f 72 | 69 6e 67 20 63 6f 6e 76 |the scor|ing conv|
|00005c80| 65 6e 74 69 6f 6e 73 20 | 66 6f 72 20 74 68 69 73 |entions |for this|
|00005c90| 20 67 61 6d 65 2e 20 20 | 54 68 65 20 66 6f 72 6d | game. |The form|
|00005ca0| 61 74 0a 58 20 2e 20 6f | 66 20 74 68 65 20 73 63 |at.X . o|f the sc|
|00005cb0| 6f 72 65 20 63 6f 6d 6d | 61 6e 64 20 69 73 0a 58 |ore comm|and is.X|
|00005cc0| 20 2e 20 20 53 43 4f 52 | 45 20 5b 52 55 42 42 45 | . SCOR|E [RUBBE|
|00005cd0| 52 20 7c 20 43 48 49 43 | 41 47 4f 20 7c 20 44 55 |R | CHIC|AGO | DU|
|00005ce0| 50 4c 49 43 41 54 45 20 | 7c 20 49 4d 50 5d 0a 58 |PLICATE || IMP].X|
|00005cf0| 20 2a 2f 0a 58 7b 0a 58 | 09 70 63 2d 3e 63 6f 6d | */.X{.X|.pc->com|
|00005d00| 6d 61 6e 64 20 3d 20 43 | 4d 44 5f 53 43 4f 52 45 |mand = C|MD_SCORE|
|00005d10| 3b 0a 58 09 73 6b 69 70 | 5f 73 70 61 63 65 73 20 |;.X.skip|_spaces |
|00005d20| 28 70 73 29 3b 0a 58 09 | 69 66 20 28 70 73 5f 6d |(ps);.X.|if (ps_m|
|00005d30| 61 74 63 68 65 73 5f 69 | 63 20 28 70 73 2c 20 22 |atches_i|c (ps, "|
|00005d40| 52 55 42 42 45 52 22 29 | 29 0a 58 09 09 70 63 2d |RUBBER")|).X..pc-|
|00005d50| 3e 64 61 74 61 2e 73 63 | 6f 72 69 6e 67 20 3d 20 |>data.sc|oring = |
|00005d60| 52 55 42 42 45 52 5f 53 | 43 4f 52 49 4e 47 3b 0a |RUBBER_S|CORING;.|
|00005d70| 58 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |X.else i|f (ps_ma|
|00005d80| 74 63 68 65 73 5f 69 63 | 20 28 70 73 2c 20 22 43 |tches_ic| (ps, "C|
|00005d90| 48 49 43 41 47 4f 22 29 | 29 0a 58 09 09 70 63 2d |HICAGO")|).X..pc-|
|00005da0| 3e 64 61 74 61 2e 73 63 | 6f 72 69 6e 67 20 3d 20 |>data.sc|oring = |
|00005db0| 43 48 49 43 41 47 4f 5f | 53 43 4f 52 49 4e 47 3b |CHICAGO_|SCORING;|
|00005dc0| 0a 58 09 65 6c 73 65 20 | 69 66 20 28 70 73 5f 6d |.X.else |if (ps_m|
|00005dd0| 61 74 63 68 65 73 5f 69 | 63 20 28 70 73 2c 20 22 |atches_i|c (ps, "|
|00005de0| 44 55 50 4c 49 43 41 54 | 45 22 29 29 0a 58 09 20 |DUPLICAT|E")).X. |
|00005df0| 20 20 20 20 20 20 20 70 | 63 2d 3e 64 61 74 61 2e | p|c->data.|
|00005e00| 73 63 6f 72 69 6e 67 20 | 3d 20 44 55 50 4c 49 43 |scoring |= DUPLIC|
|00005e10| 41 54 45 5f 53 43 4f 52 | 49 4e 47 3b 0a 58 09 65 |ATE_SCOR|ING;.X.e|
|00005e20| 6c 73 65 20 69 66 20 28 | 70 73 5f 6d 61 74 63 68 |lse if (|ps_match|
|00005e30| 65 73 5f 69 63 20 28 70 | 73 2c 20 22 45 4d 41 49 |es_ic (p|s, "EMAI|
|00005e40| 4c 22 29 29 0a 58 09 09 | 70 63 2d 3e 64 61 74 61 |L")).X..|pc->data|
|00005e50| 2e 73 63 6f 72 69 6e 67 | 20 3d 20 45 4d 41 49 4c |.scoring| = EMAIL|
|00005e60| 5f 53 43 4f 52 49 4e 47 | 3b 0a 58 09 65 6c 73 65 |_SCORING|;.X.else|
|00005e70| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|00005e80| 69 63 20 28 70 73 2c 20 | 22 49 4d 50 22 29 29 0a |ic (ps, |"IMP")).|
|00005e90| 58 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |X | |
|00005ea0| 20 70 63 2d 3e 64 61 74 | 61 2e 73 63 6f 72 69 6e | pc->dat|a.scorin|
|00005eb0| 67 20 3d 20 49 4d 50 5f | 53 43 4f 52 49 4e 47 3b |g = IMP_|SCORING;|
|00005ec0| 0a 58 20 20 20 20 20 20 | 20 20 65 6c 73 65 20 7b |.X | else {|
|00005ed0| 0a 58 09 09 70 61 72 73 | 69 6e 67 5f 65 72 72 6d |.X..pars|ing_errm|
|00005ee0| 73 67 20 3d 20 73 63 6f | 72 65 5f 65 72 72 6f 72 |sg = sco|re_error|
|00005ef0| 3b 0a 58 09 09 70 63 2d | 3e 63 6f 6d 6d 61 6e 64 |;.X..pc-|>command|
|00005f00| 20 3d 20 43 4d 44 5f 45 | 52 52 4f 52 3b 0a 58 09 | = CMD_E|RROR;.X.|
|00005f10| 7d 3b 0a 58 7d 3b 0a 58 | 0a 58 73 74 61 74 69 63 |};.X};.X|.Xstatic|
|00005f20| 20 70 61 72 73 65 5f 76 | 75 6c 6e 5f 63 6f 6d 6d | parse_v|uln_comm|
|00005f30| 61 6e 64 20 28 70 73 2c | 20 70 63 29 0a 58 09 70 |and (ps,| pc).X.p|
|00005f40| 61 72 73 65 5f 73 74 72 | 69 6e 67 20 70 73 3b 20 |arse_str|ing ps; |
|00005f50| 70 6c 61 79 65 72 5f 63 | 6f 6d 6d 61 6e 64 20 70 |player_c|ommand p|
|00005f60| 63 3b 0a 58 2f 2a 20 54 | 68 65 20 76 75 6c 6e 20 |c;.X/* T|he vuln |
|00005f70| 63 6f 6d 6d 61 6e 64 20 | 69 73 20 75 73 65 64 20 |command |is used |
|00005f80| 74 6f 20 69 6e 64 69 63 | 61 74 65 20 74 68 65 20 |to indic|ate the |
|00005f90| 76 75 6c 6e 65 72 61 62 | 69 6c 69 74 69 65 73 20 |vulnerab|ilities |
|00005fa0| 6f 66 0a 58 20 2e 20 65 | 61 63 68 20 73 69 64 65 |of.X . e|ach side|
|00005fb0| 2e 20 20 49 74 20 69 73 | 20 75 73 65 64 20 64 75 |. It is| used du|
|00005fc0| 72 69 6e 67 20 65 6d 61 | 69 6c 20 64 75 70 6c 69 |ring ema|il dupli|
|00005fd0| 63 61 74 65 20 70 6c 61 | 79 2e 20 20 54 68 65 20 |cate pla|y. The |
|00005fe0| 66 6f 72 6d 61 74 0a 58 | 20 2e 20 6f 66 20 74 68 |format.X| . of th|
|00005ff0| 65 20 76 75 6c 6e 20 63 | 6f 6d 6d 61 6e 64 20 69 |e vuln c|ommand i|
|00006000| 73 3a 0a 58 20 2e 20 20 | 56 55 4c 4e 20 5b 4e 4f |s:.X . |VULN [NO|
|00006010| 4e 45 20 7c 20 4e 53 20 | 7c 20 45 57 20 7c 20 42 |NE | NS || EW | B|
|00006020| 4f 54 48 5d 0a 58 20 2a | 2f 0a 58 7b 0a 58 09 70 |OTH].X *|/.X{.X.p|
|00006030| 63 2d 3e 63 6f 6d 6d 61 | 6e 64 20 3d 20 43 4d 44 |c->comma|nd = CMD|
|00006040| 5f 56 55 4c 4e 3b 0a 58 | 09 73 6b 69 70 5f 73 70 |_VULN;.X|.skip_sp|
|00006050| 61 63 65 73 20 28 70 73 | 29 3b 0a 58 09 69 66 20 |aces (ps|);.X.if |
|00006060| 28 70 73 5f 6d 61 74 63 | 68 65 73 5f 69 63 28 70 |(ps_matc|hes_ic(p|
|00006070| 73 2c 20 22 4e 4f 52 54 | 48 22 29 29 0a 58 09 20 |s, "NORT|H")).X. |
|00006080| 20 70 63 2d 3e 64 61 74 | 61 2e 76 75 6c 6e 65 72 | pc->dat|a.vulner|
|00006090| 61 62 6c 65 20 3d 20 50 | 4c 41 59 45 52 5f 4e 4f |able = P|LAYER_NO|
|000060a0| 52 54 48 20 3c 3c 20 32 | 3b 0a 58 09 65 6c 73 65 |RTH << 2|;.X.else|
|000060b0| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|000060c0| 69 63 28 70 73 2c 20 22 | 45 41 53 54 22 29 29 0a |ic(ps, "|EAST")).|
|000060d0| 58 09 20 20 70 63 2d 3e | 64 61 74 61 2e 76 75 6c |X. pc->|data.vul|
|000060e0| 6e 65 72 61 62 6c 65 20 | 3d 20 50 4c 41 59 45 52 |nerable |= PLAYER|
|000060f0| 5f 45 41 53 54 20 3c 3c | 20 32 3b 0a 58 09 65 6c |_EAST <<| 2;.X.el|
|00006100| 73 65 20 69 66 20 28 70 | 73 5f 6d 61 74 63 68 65 |se if (p|s_matche|
|00006110| 73 5f 69 63 28 70 73 2c | 20 22 53 4f 55 54 48 22 |s_ic(ps,| "SOUTH"|
|00006120| 29 29 0a 58 09 20 20 70 | 63 2d 3e 64 61 74 61 2e |)).X. p|c->data.|
|00006130| 76 75 6c 6e 65 72 61 62 | 6c 65 20 3d 20 50 4c 41 |vulnerab|le = PLA|
|00006140| 59 45 52 5f 53 4f 55 54 | 48 20 3c 3c 20 32 3b 0a |YER_SOUT|H << 2;.|
|00006150| 58 09 65 6c 73 65 20 69 | 66 20 28 70 73 5f 6d 61 |X.else i|f (ps_ma|
|00006160| 74 63 68 65 73 5f 69 63 | 28 70 73 2c 20 22 57 45 |tches_ic|(ps, "WE|
|00006170| 53 54 22 29 29 0a 58 09 | 20 20 70 63 2d 3e 64 61 |ST")).X.| pc->da|
|00006180| 74 61 2e 76 75 6c 6e 65 | 72 61 62 6c 65 20 3d 20 |ta.vulne|rable = |
|00006190| 50 4c 41 59 45 52 5f 57 | 45 53 54 20 3c 3c 20 32 |PLAYER_W|EST << 2|
|000061a0| 3b 0a 58 09 65 6c 73 65 | 20 7b 0a 58 09 09 70 61 |;.X.else| {.X..pa|
|000061b0| 72 73 69 6e 67 5f 65 72 | 72 6d 73 67 20 3d 20 76 |rsing_er|rmsg = v|
|000061c0| 75 6c 6e 5f 65 72 72 6f | 72 3b 0a 58 09 09 70 63 |uln_erro|r;.X..pc|
|000061d0| 2d 3e 63 6f 6d 6d 61 6e | 64 20 3d 20 43 4d 44 5f |->comman|d = CMD_|
|000061e0| 45 52 52 4f 52 3b 0a 58 | 09 7d 3b 0a 58 09 73 6b |ERROR;.X|.};.X.sk|
|000061f0| 69 70 5f 73 70 61 63 65 | 73 20 28 70 73 29 3b 0a |ip_space|s (ps);.|
|00006200| 58 09 69 66 20 28 70 73 | 5f 6d 61 74 63 68 65 73 |X.if (ps|_matches|
|00006210| 5f 69 63 28 70 73 2c 20 | 22 4e 4f 4e 45 22 29 29 |_ic(ps, |"NONE"))|
|00006220| 0a 58 09 09 70 63 2d 3e | 64 61 74 61 2e 76 75 6c |.X..pc->|data.vul|
|00006230| 6e 65 72 61 62 6c 65 20 | 7c 3d 20 30 3b 0a 58 09 |nerable ||= 0;.X.|
|00006240| 65 6c 73 65 20 69 66 20 | 28 70 73 5f 6d 61 74 63 |else if |(ps_matc|
|00006250| 68 65 73 5f 69 63 28 70 | 73 2c 20 22 4e 53 22 29 |hes_ic(p|s, "NS")|
|00006260| 29 0a 58 09 09 70 63 2d | 3e 64 61 74 61 2e 76 75 |).X..pc-|>data.vu|
|00006270| 6c 6e 65 72 61 62 6c 65 | 20 7c 3d 20 31 20 3c 3c |lnerable| |= 1 <<|
|00006280| 20 53 49 44 45 5f 4e 53 | 3b 0a 58 09 65 6c 73 65 | SIDE_NS|;.X.else|
|00006290| 20 69 66 20 28 70 73 5f | 6d 61 74 63 68 65 73 5f | if (ps_|matches_|
|000062a0| 69 63 28 70 73 2c 20 22 | 45 57 22 29 29 0a 58 09 |ic(ps, "|EW")).X.|
|000062b0| 09 70 63 2d 3e 64 61 74 | 61 2e 76 75 6c 6e 65 72 |.pc->dat|a.vulner|
|000062c0| 61 62 6c 65 20 7c 3d 20 | 31 20 3c 3c 20 53 49 44 |able |= |1 << SID|
|000062d0| 45 5f 45 57 3b 0a 58 09 | 65 6c 73 65 20 69 66 20 |E_EW;.X.|else if |
|000062e0| 28 70 73 5f 6d 61 74 63 | 68 65 73 5f 69 63 28 70 |(ps_matc|hes_ic(p|
|000062f0| 73 2c 20 22 42 4f 54 48 | 22 29 29 0a 58 09 09 70 |s, "BOTH|")).X..p|
|00006300| 63 2d 3e 64 61 74 61 2e | 76 75 6c 6e 65 72 61 62 |c->data.|vulnerab|
|00006310| 6c 65 20 7c 3d 20 28 31 | 20 3c 3c 20 53 49 44 45 |le |= (1| << SIDE|
|00006320| 5f 4e 53 29 20 2b 20 28 | 31 20 3c 3c 20 53 49 44 |_NS) + (|1 << SID|
|00006330| 45 5f 45 57 29 3b 0a 58 | 09 65 6c 73 65 20 7b 0a |E_EW);.X|.else {.|
|00006340| 58 09 09 70 61 72 73 69 | 6e 67 5f 65 72 72 6d 73 |X..parsi|ng_errms|
|00006350| 67 20 3d 20 76 75 6c 6e | 5f 65 72 72 6f 72 3b 0a |g = vuln|_error;.|
|00006360| 58 09 09 70 63 2d 3e 63 | 6f 6d 6d 61 6e 64 20 3d |X..pc->c|ommand =|
|00006370| 20 43 4d 44 5f 45 52 52 | 4f 52 3b 0a 58 09 7d 3b | CMD_ERR|OR;.X.};|
|00006380| 0a 58 7d 3b 0a 58 0a 58 | 73 74 61 74 69 63 20 70 |.X};.X.X|static p|
|00006390| 61 72 73 65 5f 6c 6f 67 | 5f 63 6f 6d 6d 61 6e 64 |arse_log|_command|
|000063a0| 20 28 70 73 2c 20 70 63 | 29 0a 58 20 20 20 20 20 | (ps, pc|).X |
|000063b0| 70 61 72 73 65 5f 73 74 | 72 69 6e 67 20 70 73 3b |parse_st|ring ps;|
|000063c0| 20 70 6c 61 79 65 72 5f | 63 6f 6d 6d 61 6e 64 20 | player_|command |
|000063d0| 70 63 3b 0a 58 2f 2a 20 | 54 68 65 20 6c 6f 67 20 |pc;.X/* |The log |
|000063e0| 63 6f 6d 6d 61 6e 64 20 | 65 73 74 61 62 6c 69 73 |command |establis|
|000063f0| 68 65 73 20 61 20 6c 6f | 67 20 66 69 6c 65 20 74 |hes a lo|g file t|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.