home *** CD-ROM | disk | FTP | other *** search
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).
Confidence | Program | Detection | Match Type | Support
|
---|
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 37 3a 20 20 6f 6b |ct: v13i|017: 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 32 2f 30 |e game, |Part02/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 36 40 6d 61 73 74 | 65 72 43 4e 41 2e 54 45 |276@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 33 35 20 |Jan 92 1|6:44:35 |
|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 37 30 38 0a 41 |OM.Lines|: 1708.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 37 0a 41 72 | 63 68 69 76 65 2d 6e 61 |ue 17.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 32 0a 45 6e 76 69 | 72 6f 6e 6d 65 6e 74 3a |t02.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 32 20 28 6f 66 |of archi|ve 2 (of|
|00000370| 20 37 29 2e 22 0a 23 20 | 43 6f 6e 74 65 6e 74 73 | 7).".# |Contents|
|00000380| 3a 20 20 4d 61 6b 65 44 | 69 73 74 72 69 62 20 62 |: MakeD|istrib b|
|00000390| 72 69 64 67 65 2e 63 20 | 68 65 6c 70 66 69 6c 65 |ridge.c |helpfile|
|000003a0| 2e 68 0a 23 20 57 72 61 | 70 70 65 64 20 62 79 20 |.h.# Wra|pped by |
|000003b0| 62 69 6c 6c 72 40 73 61 | 61 62 20 6f 6e 20 46 72 |billr@sa|ab on Fr|
|000003c0| 69 20 4a 61 6e 20 31 30 | 20 30 38 3a 33 31 3a 32 |i Jan 10| 08:31:2|
|000003d0| 38 20 31 39 39 32 0a 50 | 41 54 48 3d 2f 62 69 6e |8 1992.P|ATH=/bin|
|000003e0| 3a 2f 75 73 72 2f 62 69 | 6e 3a 2f 75 73 72 2f 75 |:/usr/bi|n:/usr/u|
|000003f0| 63 62 20 3b 20 65 78 70 | 6f 72 74 20 50 41 54 48 |cb ; exp|ort PATH|
|00000400| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 27 4d 61 6b |.if test| -f 'Mak|
|00000410| 65 44 69 73 74 72 69 62 | 27 20 2d 61 20 22 24 7b |eDistrib|' -a "${|
|00000420| 31 7d 22 20 21 3d 20 22 | 2d 63 22 20 3b 20 74 68 |1}" != "|-c" ; th|
|00000430| 65 6e 20 0a 20 20 65 63 | 68 6f 20 73 68 61 72 3a |en . ec|ho shar:|
|00000440| 20 57 69 6c 6c 20 6e 6f | 74 20 63 6c 6f 62 62 65 | Will no|t clobbe|
|00000450| 72 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |r existi|ng file |
|00000460| 5c 22 27 4d 61 6b 65 44 | 69 73 74 72 69 62 27 5c |\"'MakeD|istrib'\|
|00000470| 22 0a 65 6c 73 65 0a 65 | 63 68 6f 20 73 68 61 72 |".else.e|cho shar|
|00000480| 3a 20 45 78 74 72 61 63 | 74 69 6e 67 20 5c 22 27 |: Extrac|ting \"'|
|00000490| 4d 61 6b 65 44 69 73 74 | 72 69 62 27 5c 22 20 5c |MakeDist|rib'\" \|
|000004a0| 28 35 37 38 20 63 68 61 | 72 61 63 74 65 72 73 5c |(578 cha|racters\|
|000004b0| 29 0a 73 65 64 20 22 73 | 2f 5e 58 2f 2f 22 20 3e |).sed "s|/^X//" >|
|000004c0| 27 4d 61 6b 65 44 69 73 | 74 72 69 62 27 20 3c 3c |'MakeDis|trib' <<|
|000004d0| 27 45 4e 44 5f 4f 46 5f | 46 49 4c 45 27 0a 58 23 |'END_OF_|FILE'.X#|
|000004e0| 2f 62 69 6e 2f 63 73 68 | 20 2d 66 0a 58 23 0a 58 |/bin/csh| -f.X#.X|
|000004f0| 23 20 54 68 69 73 20 73 | 68 65 6c 6c 20 73 63 72 |# This s|hell scr|
|00000500| 69 70 74 20 63 72 65 61 | 74 65 73 20 74 68 65 20 |ipt crea|tes the |
|00000510| 63 6f 6d 70 72 65 73 73 | 20 6f 6b 62 72 69 64 67 |compress| okbridg|
|00000520| 65 20 74 61 72 20 66 69 | 6c 65 20 77 68 69 63 68 |e tar fi|le which|
|00000530| 0a 58 23 20 69 73 20 64 | 69 73 74 72 69 62 75 74 |.X# is d|istribut|
|00000540| 65 64 2e 20 20 55 6e 66 | 6f 72 74 75 6e 61 74 65 |ed. Unf|ortunate|
|00000550| 6c 79 2c 20 69 74 20 73 | 65 65 6d 73 20 74 68 61 |ly, it s|eems tha|
|00000560| 74 20 74 68 65 20 22 6d | 61 6b 65 22 20 63 6f 6d |t the "m|ake" com|
|00000570| 6d 61 6e 64 0a 58 23 20 | 6f 6e 20 73 6f 6d 65 20 |mand.X# |on some |
|00000580| 73 79 73 74 65 6d 73 20 | 69 73 20 6e 6f 74 20 73 |systems |is not s|
|00000590| 6d 61 72 74 20 65 6e 6f | 75 67 68 20 74 6f 20 68 |mart eno|ugh to h|
|000005a0| 61 6e 64 6c 65 20 74 68 | 65 20 77 6f 72 6b 20 77 |andle th|e work w|
|000005b0| 68 69 63 68 20 69 73 0a | 58 23 20 64 6f 6e 65 20 |hich is.|X# done |
|000005c0| 62 79 20 74 68 69 73 20 | 66 69 6c 65 2e 0a 58 23 |by this |file..X#|
|000005d0| 0a 58 73 65 74 65 6e 76 | 20 4d 41 4a 4f 52 20 60 |.Xsetenv| MAJOR `|
|000005e0| 67 72 65 70 20 27 6d 61 | 6a 6f 72 5f 72 65 76 2e |grep 'ma|jor_rev.|
|000005f0| 2a 3d 27 20 67 6c 6f 62 | 61 6c 73 2e 68 20 7c 20 |*=' glob|als.h | |
|00000600| 73 65 64 20 27 73 40 2e | 2a 22 5c 28 2e 2a 5c 29 |sed 's@.|*"\(.*\)|
|00000610| 22 2e 2a 40 5c 31 40 27 | 60 0a 58 73 65 74 65 6e |".*@\1@'|`.Xseten|
|00000620| 76 20 4d 49 4e 4f 52 20 | 60 67 72 65 70 20 27 6d |v MINOR |`grep 'm|
|00000630| 69 6e 6f 72 5f 72 65 76 | 2e 2a 3d 27 20 67 6c 6f |inor_rev|.*=' glo|
|00000640| 62 61 6c 73 2e 68 20 7c | 20 73 65 64 20 27 73 40 |bals.h || sed 's@|
|00000650| 2e 2a 22 5c 28 2e 2a 5c | 29 22 2e 2a 40 5c 31 40 |.*"\(.*\|)".*@\1@|
|00000660| 27 60 0a 58 73 65 74 65 | 6e 76 20 4f 4b 46 49 4c |'`.Xsete|nv OKFIL|
|00000670| 45 4e 41 4d 45 20 6f 6b | 62 72 69 64 67 65 2d 24 |ENAME ok|bridge-$|
|00000680| 4d 41 4a 4f 52 24 4d 49 | 4e 4f 52 0a 58 73 65 74 |MAJOR$MI|NOR.Xset|
|00000690| 65 6e 76 20 4f 4b 42 44 | 49 52 20 60 70 77 64 20 |env OKBD|IR `pwd |
|000006a0| 7c 20 73 65 64 20 22 73 | 40 2e 2a 2f 5c 28 5b 5e || sed "s|@.*/\([^|
|000006b0| 2f 5d 2a 5c 29 40 5c 31 | 40 22 60 0a 58 63 64 20 |/]*\)@\1|@"`.Xcd |
|000006c0| 2e 2e 20 0a 58 65 63 68 | 6f 20 5a 74 61 72 5c 27 |.. .Xech|o Ztar\'|
|000006d0| 69 6e 67 20 24 4f 4b 42 | 44 49 52 20 69 6e 74 6f |ing $OKB|DIR into|
|000006e0| 20 24 4f 4b 46 49 4c 45 | 4e 41 4d 45 2e 74 61 72 | $OKFILE|NAME.tar|
|000006f0| 2e 5a 0a 58 74 61 72 20 | 2d 63 66 20 24 4f 4b 46 |.Z.Xtar |-cf $OKF|
|00000700| 49 4c 45 4e 41 4d 45 2e | 74 61 72 20 24 4f 4b 42 |ILENAME.|tar $OKB|
|00000710| 44 49 52 0a 58 63 6f 6d | 70 72 65 73 73 20 24 4f |DIR.Xcom|press $O|
|00000720| 4b 46 49 4c 45 4e 41 4d | 45 2e 74 61 72 0a 58 20 |KFILENAM|E.tar.X |
|00000730| 45 4e 44 5f 4f 46 5f 46 | 49 4c 45 0a 69 66 20 74 |END_OF_F|ILE.if t|
|00000740| 65 73 74 20 35 37 38 20 | 2d 6e 65 20 60 77 63 20 |est 578 |-ne `wc |
|00000750| 2d 63 20 3c 27 4d 61 6b | 65 44 69 73 74 72 69 62 |-c <'Mak|eDistrib|
|00000760| 27 60 3b 20 74 68 65 6e | 0a 20 20 20 20 65 63 68 |'`; then|. ech|
|00000770| 6f 20 73 68 61 72 3a 20 | 5c 22 27 4d 61 6b 65 44 |o shar: |\"'MakeD|
|00000780| 69 73 74 72 69 62 27 5c | 22 20 75 6e 70 61 63 6b |istrib'\|" unpack|
|00000790| 65 64 20 77 69 74 68 20 | 77 72 6f 6e 67 20 73 69 |ed with |wrong si|
|000007a0| 7a 65 21 0a 66 69 0a 63 | 68 6d 6f 64 20 2b 78 20 |ze!.fi.c|hmod +x |
|000007b0| 27 4d 61 6b 65 44 69 73 | 74 72 69 62 27 0a 23 20 |'MakeDis|trib'.# |
|000007c0| 65 6e 64 20 6f 66 20 27 | 4d 61 6b 65 44 69 73 74 |end of '|MakeDist|
|000007d0| 72 69 62 27 0a 66 69 0a | 69 66 20 74 65 73 74 20 |rib'.fi.|if test |
|000007e0| 2d 66 20 27 62 72 69 64 | 67 65 2e 63 27 20 2d 61 |-f 'brid|ge.c' -a|
|000007f0| 20 22 24 7b 31 7d 22 20 | 21 3d 20 22 2d 63 22 20 | "${1}" |!= "-c" |
|00000800| 3b 20 74 68 65 6e 20 0a | 20 20 65 63 68 6f 20 73 |; then .| echo s|
|00000810| 68 61 72 3a 20 57 69 6c | 6c 20 6e 6f 74 20 63 6c |har: Wil|l not cl|
|00000820| 6f 62 62 65 72 20 65 78 | 69 73 74 69 6e 67 20 66 |obber ex|isting f|
|00000830| 69 6c 65 20 5c 22 27 62 | 72 69 64 67 65 2e 63 27 |ile \"'b|ridge.c'|
|00000840| 5c 22 0a 65 6c 73 65 0a | 65 63 68 6f 20 73 68 61 |\".else.|echo sha|
|00000850| 72 3a 20 45 78 74 72 61 | 63 74 69 6e 67 20 5c 22 |r: Extra|cting \"|
|00000860| 27 62 72 69 64 67 65 2e | 63 27 5c 22 20 5c 28 34 |'bridge.|c'\" \(4|
|00000870| 39 37 38 33 20 63 68 61 | 72 61 63 74 65 72 73 5c |9783 cha|racters\|
|00000880| 29 0a 73 65 64 20 22 73 | 2f 5e 58 2f 2f 22 20 3e |).sed "s|/^X//" >|
|00000890| 27 62 72 69 64 67 65 2e | 63 27 20 3c 3c 27 45 4e |'bridge.|c' <<'EN|
|000008a0| 44 5f 4f 46 5f 46 49 4c | 45 27 0a 58 2f 2a 20 62 |D_OF_FIL|E'.X/* b|
|000008b0| 72 69 64 67 65 2e 63 0a | 58 20 21 20 0a 58 20 21 |ridge.c.|X ! .X !|
|000008c0| 20 43 6f 70 79 72 69 67 | 68 74 20 28 43 29 20 31 | Copyrig|ht (C) 1|
|000008d0| 39 39 30 2c 31 39 39 31 | 20 62 79 20 4d 61 74 74 |990,1991| by Matt|
|000008e0| 68 65 77 20 43 6c 65 67 | 67 0a 58 20 21 20 0a 58 |hew Cleg|g.X ! .X|
|000008f0| 20 21 20 54 68 69 73 20 | 70 72 6f 67 72 61 6d 20 | ! This |program |
|00000900| 6d 61 79 20 62 65 20 63 | 6f 70 69 65 64 20 61 6e |may be c|opied an|
|00000910| 64 20 64 69 73 74 72 69 | 62 75 74 65 64 20 66 72 |d distri|buted fr|
|00000920| 65 65 6c 79 2e 20 20 50 | 6c 65 61 73 65 20 64 6f |eely. P|lease do|
|00000930| 20 6e 6f 74 0a 58 20 21 | 20 63 68 61 72 67 65 20 | not.X !| charge |
|00000940| 6d 6f 6e 65 79 20 66 6f | 72 20 74 68 69 73 20 70 |money fo|r this p|
|00000950| 72 6f 67 72 61 6d 20 6f | 72 20 66 6f 72 20 61 6e |rogram o|r for an|
|00000960| 79 20 70 72 6f 67 72 61 | 6d 20 64 65 72 69 76 65 |y progra|m derive|
|00000970| 64 20 66 72 6f 6d 20 69 | 74 2e 0a 58 20 21 20 49 |d from i|t..X ! I|
|00000980| 66 20 79 6f 75 20 6d 6f | 64 69 66 79 20 74 68 69 |f you mo|dify thi|
|00000990| 73 20 70 72 6f 67 72 61 | 6d 2c 20 74 68 65 6e 20 |s progra|m, then |
|000009a0| 69 6e 63 6c 75 64 65 20 | 61 20 6e 6f 74 69 63 65 |include |a notice|
|000009b0| 20 73 74 61 74 69 6e 67 | 20 70 6c 61 69 6e 6c 79 | stating| plainly|
|000009c0| 0a 58 20 21 20 74 68 61 | 74 20 79 6f 75 72 20 70 |.X ! tha|t your p|
|000009d0| 72 6f 67 72 61 6d 20 69 | 73 20 64 65 72 69 76 65 |rogram i|s derive|
|000009e0| 64 20 66 72 6f 6d 20 74 | 68 65 20 6f 6b 62 72 69 |d from t|he okbri|
|000009f0| 64 67 65 20 70 72 6f 67 | 72 61 6d 20 61 6e 64 20 |dge prog|ram and |
|00000a00| 69 73 20 6e 6f 74 0a 58 | 20 21 20 74 68 65 20 73 |is not.X| ! the s|
|00000a10| 61 6d 65 20 61 73 20 74 | 68 65 20 6f 66 66 69 63 |ame as t|he offic|
|00000a20| 69 61 6c 20 6f 6b 62 72 | 69 64 67 65 20 70 72 6f |ial okbr|idge pro|
|00000a30| 67 72 61 6d 2e 0a 58 20 | 21 0a 58 20 21 20 49 20 |gram..X |!.X ! I |
|00000a40| 77 65 6c 63 6f 6d 65 20 | 61 6e 79 20 73 75 67 67 |welcome |any sugg|
|00000a50| 65 73 74 69 6f 6e 73 20 | 66 6f 72 20 69 6d 70 72 |estions |for impr|
|00000a60| 6f 76 65 6d 65 6e 74 20 | 74 6f 20 6f 6b 62 72 69 |ovement |to okbri|
|00000a70| 64 67 65 2c 20 61 6e 64 | 20 0a 58 20 21 20 49 20 |dge, and| .X ! I |
|00000a80| 77 6f 75 6c 64 20 62 65 | 20 65 73 70 65 63 69 61 |would be| especia|
|00000a90| 6c 6c 79 20 68 61 70 70 | 79 20 74 6f 20 72 65 63 |lly happ|y to rec|
|00000aa0| 65 69 76 65 20 69 6d 70 | 72 6f 76 65 64 20 73 6f |eive imp|roved so|
|00000ab0| 75 72 63 65 20 63 6f 64 | 65 2e 0a 58 20 21 20 49 |urce cod|e..X ! I|
|00000ac0| 66 20 79 6f 75 20 68 61 | 76 65 20 63 6f 6d 6d 65 |f you ha|ve comme|
|00000ad0| 6e 74 73 20 6f 72 20 73 | 75 67 67 65 73 74 69 6f |nts or s|uggestio|
|00000ae0| 6e 73 2c 20 6f 72 20 69 | 66 20 79 6f 75 20 77 6f |ns, or i|f you wo|
|00000af0| 75 6c 64 20 6c 69 6b 65 | 20 74 6f 0a 58 20 21 20 |uld like| to.X ! |
|00000b00| 6a 6f 69 6e 20 74 68 65 | 20 6f 6b 62 72 69 64 67 |join the| okbridg|
|00000b10| 65 20 6d 61 69 6c 69 6e | 67 20 6c 69 73 74 2c 20 |e mailin|g list, |
|00000b20| 74 68 65 6e 20 77 72 69 | 74 65 20 74 6f 0a 58 20 |then wri|te to.X |
|00000b30| 21 0a 58 20 21 20 20 20 | 6d 63 6c 65 67 67 40 63 |!.X ! |mclegg@c|
|00000b40| 73 2e 75 63 73 64 2e 65 | 64 75 0a 58 20 21 0a 58 |s.ucsd.e|du.X !.X|
|00000b50| 20 2a 0a 58 20 2a 20 47 | 65 6e 65 72 61 6c 20 44 | *.X * G|eneral D|
|00000b60| 65 73 63 72 69 70 74 69 | 6f 6e 3a 0a 58 20 2a 0a |escripti|on:.X *.|
|00000b70| 58 20 2a 20 54 68 69 73 | 20 66 69 6c 65 20 63 6f |X * This| file co|
|00000b80| 6e 74 61 69 6e 73 20 61 | 6e 20 69 6d 70 6c 65 6d |ntains a|n implem|
|00000b90| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 61 20 63 6f |entation| of a co|
|00000ba0| 6d 70 75 74 65 72 2d 6d | 6f 64 65 72 61 74 65 64 |mputer-m|oderated|
|00000bb0| 0a 58 20 2a 20 62 72 69 | 64 67 65 20 70 72 6f 67 |.X * bri|dge prog|
|00000bc0| 72 61 6d 2e 20 20 54 68 | 65 20 70 72 6f 67 72 61 |ram. Th|e progra|
|00000bd0| 6d 20 73 65 72 76 65 73 | 20 61 73 20 61 20 6d 65 |m serves| as a me|
|00000be0| 64 69 61 74 6f 72 20 61 | 6c 6c 6f 77 69 6e 67 0a |diator a|llowing.|
|00000bf0| 58 20 2a 20 66 6f 75 72 | 20 70 65 6f 70 6c 65 20 |X * four| people |
|00000c00| 6f 6e 20 73 65 70 61 72 | 61 74 65 20 73 79 73 74 |on separ|ate syst|
|00000c10| 65 6d 73 20 74 6f 20 63 | 6f 6f 70 65 72 61 74 65 |ems to c|ooperate|
|00000c20| 20 69 6e 20 61 20 62 72 | 69 64 67 65 20 67 61 6d | in a br|idge gam|
|00000c30| 65 2e 0a 58 20 2a 20 54 | 68 65 20 67 61 6d 65 20 |e..X * T|he game |
|00000c40| 69 73 20 73 63 72 65 65 | 6e 20 6f 72 69 65 6e 74 |is scree|n orient|
|00000c50| 65 64 20 61 6e 64 20 69 | 6e 74 65 72 61 63 74 69 |ed and i|nteracti|
|00000c60| 76 65 2c 20 61 6c 74 68 | 6f 75 67 68 20 74 68 65 |ve, alth|ough the|
|00000c70| 20 64 69 73 70 6c 61 79 | 0a 58 20 2a 20 69 73 20 | display|.X * is |
|00000c80| 76 65 72 79 20 73 69 6d | 70 6c 65 2e 20 20 54 68 |very sim|ple. Th|
|00000c90| 65 20 70 72 6f 67 72 61 | 6d 20 68 61 6e 64 6c 65 |e progra|m handle|
|00000ca0| 73 20 74 68 65 20 73 68 | 75 66 66 6c 69 6e 67 20 |s the sh|uffling |
|00000cb0| 61 6e 64 20 64 65 61 6c | 69 6e 67 0a 58 20 2a 20 |and deal|ing.X * |
|00000cc0| 6f 66 20 74 68 65 20 63 | 61 72 64 73 2c 20 61 6e |of the c|ards, an|
|00000cd0| 64 20 69 74 20 70 72 6f | 6d 70 74 73 20 65 61 63 |d it pro|mpts eac|
|00000ce0| 68 20 70 6c 61 79 65 72 | 20 66 6f 72 20 69 6e 70 |h player| for inp|
|00000cf0| 75 74 20 77 68 65 6e 20 | 69 74 20 69 73 0a 58 20 |ut when |it is.X |
|00000d00| 2a 20 68 69 73 20 74 75 | 72 6e 2e 20 20 54 68 65 |* his tu|rn. The|
|00000d10| 20 6c 6f 77 65 72 20 61 | 72 65 61 20 6f 66 20 74 | lower a|rea of t|
|00000d20| 68 65 20 73 63 72 65 65 | 6e 20 69 73 20 61 20 64 |he scree|n is a d|
|00000d30| 69 61 6c 6f 67 20 62 6f | 78 2c 20 77 68 65 72 65 |ialog bo|x, where|
|00000d40| 0a 58 20 2a 20 70 6c 61 | 79 65 72 73 20 6d 61 79 |.X * pla|yers may|
|00000d50| 20 65 6e 74 65 72 20 63 | 6f 6d 6d 65 6e 74 73 20 | enter c|omments |
|00000d60| 74 68 61 74 20 77 69 6c | 6c 20 62 65 20 73 65 65 |that wil|l be see|
|00000d70| 6e 20 62 79 20 74 68 65 | 20 6f 74 68 65 72 73 2e |n by the| others.|
|00000d80| 0a 58 20 2a 0a 58 20 2a | 20 43 6f 6d 6d 61 6e 64 |.X *.X *| Command|
|00000d90| 20 4c 69 6e 65 3a 0a 58 | 20 2a 0a 58 20 2a 20 20 | Line:.X| *.X * |
|00000da0| 20 20 20 20 20 20 20 6f | 6b 62 72 69 64 67 65 20 | o|kbridge |
|00000db0| 70 20 5b 6e 61 6d 65 20 | 5b 72 65 6d 6f 74 65 2d |p [name |[remote-|
|00000dc0| 73 65 72 76 65 72 5d 5d | 0a 58 20 2a 0a 58 20 2a |server]]|.X *.X *|
|00000dd0| 20 57 68 65 72 65 0a 58 | 20 2a 0a 58 20 2a 20 70 | Where.X| *.X * p|
|00000de0| 20 20 20 20 69 73 20 6f | 6e 65 20 6f 66 20 74 68 | is o|ne of th|
|00000df0| 65 20 63 68 61 72 61 63 | 74 65 72 73 3a 20 27 6e |e charac|ters: 'n|
|00000e00| 27 2c 20 27 73 27 2c 20 | 27 65 27 2c 20 6f 72 20 |', 's', |'e', or |
|00000e10| 27 77 27 2e 20 20 54 68 | 69 73 20 73 70 65 63 69 |'w'. Th|is speci|
|00000e20| 66 69 65 73 0a 58 20 2a | 20 20 20 20 20 20 77 68 |fies.X *| wh|
|00000e30| 69 63 68 20 70 6f 73 69 | 74 69 6f 6e 20 74 68 65 |ich posi|tion the|
|00000e40| 20 70 6c 61 79 65 72 20 | 77 69 73 68 65 73 20 74 | player |wishes t|
|00000e50| 6f 20 68 61 76 65 20 69 | 6e 20 74 68 65 20 67 61 |o have i|n the ga|
|00000e60| 6d 65 2e 20 20 54 68 65 | 20 70 6c 61 79 65 72 73 |me. The| players|
|00000e70| 0a 58 20 2a 20 20 20 20 | 20 20 73 68 6f 75 6c 64 |.X * | should|
|00000e80| 20 61 67 72 65 65 20 62 | 65 66 6f 72 65 68 61 6e | agree b|eforehan|
|00000e90| 64 20 77 68 6f 20 77 69 | 6c 6c 20 74 61 6b 65 20 |d who wi|ll take |
|00000ea0| 77 68 69 63 68 20 70 6f | 73 69 74 69 6f 6e 2e 20 |which po|sition. |
|00000eb0| 20 49 66 20 74 77 6f 0a | 58 20 2a 20 20 20 20 20 | If two.|X * |
|00000ec0| 20 70 6c 61 79 65 72 73 | 20 63 68 6f 6f 73 65 20 | players| choose |
|00000ed0| 74 68 65 20 73 61 6d 65 | 20 70 6f 73 69 74 69 6f |the same| positio|
|00000ee0| 6e 2c 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 77 |n, the p|rogram w|
|00000ef0| 69 6c 6c 20 6e 6f 74 20 | 77 6f 72 6b 0a 58 20 2a |ill not |work.X *|
|00000f00| 20 20 20 20 20 20 63 6f | 72 72 65 63 74 6c 79 2e | co|rrectly.|
|00000f10| 0a 58 20 2a 0a 58 20 2a | 20 6e 61 6d 65 20 69 73 |.X *.X *| name is|
|00000f20| 20 61 6e 20 6f 70 74 69 | 6f 6e 61 6c 20 6e 61 6d | an opti|onal nam|
|00000f30| 65 20 77 68 69 63 68 20 | 77 69 6c 6c 20 62 65 20 |e which |will be |
|00000f40| 75 73 65 64 20 74 6f 20 | 69 64 65 6e 74 69 66 79 |used to |identify|
|00000f50| 20 74 68 65 20 70 6c 61 | 79 65 72 2e 0a 58 20 2a | the pla|yer..X *|
|00000f60| 20 20 20 20 20 20 49 66 | 20 74 68 69 73 20 69 73 | If| this is|
|00000f70| 20 6f 6d 69 74 74 65 64 | 2c 20 74 68 65 6e 20 74 | omitted|, then t|
|00000f80| 68 65 20 70 6c 61 79 65 | 72 73 20 70 6f 73 69 74 |he playe|rs posit|
|00000f90| 69 6f 6e 20 70 20 77 69 | 6c 6c 20 62 65 20 75 73 |ion p wi|ll be us|
|00000fa0| 65 64 2e 0a 58 20 2a 0a | 58 20 2a 20 72 65 6d 6f |ed..X *.|X * remo|
|00000fb0| 74 65 2d 73 65 72 76 65 | 72 0a 58 20 2a 20 20 20 |te-serve|r.X * |
|00000fc0| 20 20 20 69 73 20 74 68 | 65 20 6e 61 6d 65 20 6f | is th|e name o|
|00000fd0| 66 20 74 68 65 20 72 65 | 6d 6f 74 65 20 6d 61 63 |f the re|mote mac|
|00000fe0| 68 69 6e 65 20 77 68 65 | 72 65 20 74 68 65 20 27 |hine whe|re the '|
|00000ff0| 73 65 72 76 65 72 27 20 | 77 69 6c 6c 20 62 65 0a |server' |will be.|
|00001000| 58 20 2a 20 20 20 20 20 | 20 70 6c 61 79 69 6e 67 |X * | playing|
|00001010| 2e 20 20 46 6f 72 20 74 | 68 65 20 73 61 6b 65 20 |. For t|he sake |
|00001020| 6f 66 20 65 73 74 61 62 | 6c 69 73 68 69 6e 67 20 |of estab|lishing |
|00001030| 74 68 65 20 6e 65 74 77 | 6f 72 6b 20 63 6f 6d 6d |the netw|ork comm|
|00001040| 75 6e 69 63 61 74 69 6f | 6e 73 2c 0a 58 20 2a 20 |unicatio|ns,.X * |
|00001050| 20 20 20 20 20 65 78 61 | 63 74 6c 79 20 6f 6e 65 | exa|ctly one|
|00001060| 20 6f 66 20 74 68 65 20 | 70 6c 61 79 65 72 73 20 | of the |players |
|00001070| 6d 75 73 74 20 62 65 20 | 61 20 73 65 72 76 65 72 |must be |a server|
|00001080| 2e 20 20 54 68 65 20 63 | 68 6f 69 63 65 20 6f 66 |. The c|hoice of|
|00001090| 20 74 68 65 0a 58 20 2a | 09 73 65 72 76 65 72 20 | the.X *|.server |
|000010a0| 64 6f 65 73 20 6e 6f 74 | 20 61 66 66 65 63 74 20 |does not| affect |
|000010b0| 68 6f 77 20 74 68 65 20 | 67 61 6d 65 20 70 6c 61 |how the |game pla|
|000010c0| 79 73 2e 20 20 49 66 20 | 72 65 6d 6f 74 65 2d 73 |ys. If |remote-s|
|000010d0| 65 72 76 65 72 20 69 73 | 0a 58 20 2a 20 20 20 20 |erver is|.X * |
|000010e0| 20 20 6e 6f 74 20 73 70 | 65 63 69 66 69 65 64 2c | not sp|ecified,|
|000010f0| 20 74 68 65 6e 20 74 68 | 69 73 20 70 6c 61 79 65 | then th|is playe|
|00001100| 72 20 77 69 6c 6c 20 61 | 73 73 75 6d 65 20 74 68 |r will a|ssume th|
|00001110| 65 20 72 6f 6c 65 20 6f | 66 20 74 68 65 20 73 65 |e role o|f the se|
|00001120| 72 76 65 72 2e 0a 58 20 | 2a 0a 58 20 2a 20 41 66 |rver..X |*.X * Af|
|00001130| 74 65 72 20 70 72 6f 63 | 65 73 73 69 6e 67 20 74 |ter proc|essing t|
|00001140| 68 65 20 63 6f 6d 6d 61 | 6e 64 20 6c 69 6e 65 20 |he comma|nd line |
|00001150| 70 61 72 61 6d 65 74 65 | 72 73 2c 20 74 68 65 20 |paramete|rs, the |
|00001160| 70 72 6f 67 72 61 6d 20 | 77 69 6c 6c 20 66 69 72 |program |will fir|
|00001170| 73 74 0a 58 20 2a 20 64 | 69 73 70 6c 61 79 20 61 |st.X * d|isplay a|
|00001180| 20 73 74 61 72 74 75 70 | 20 73 63 72 65 65 6e 2e | startup| screen.|
|00001190| 20 20 54 68 65 6e 2c 20 | 69 74 20 77 69 6c 6c 20 | Then, |it will |
|000011a0| 61 74 74 65 6d 70 74 20 | 74 6f 20 65 73 74 61 62 |attempt |to estab|
|000011b0| 6c 69 73 68 20 74 68 65 | 20 6e 65 74 77 6f 72 6b |lish the| network|
|000011c0| 0a 58 20 2a 20 63 6f 6e | 6e 65 63 74 69 6f 6e 73 |.X * con|nections|
|000011d0| 20 77 69 74 68 20 74 68 | 65 20 6f 74 68 65 72 20 | with th|e other |
|000011e0| 70 6c 61 79 65 72 73 2e | 20 20 41 66 74 65 72 20 |players.| After |
|000011f0| 74 68 65 20 63 6f 6e 6e | 65 63 74 69 6f 6e 73 20 |the conn|ections |
|00001200| 68 61 76 65 20 62 65 65 | 6e 0a 58 20 2a 20 65 73 |have bee|n.X * es|
|00001210| 74 61 62 6c 69 73 68 65 | 64 2c 20 74 68 65 20 63 |tablishe|d, the c|
|00001220| 61 72 64 73 20 77 69 6c | 6c 20 62 65 20 64 65 61 |ards wil|l be dea|
|00001230| 6c 74 20 61 6e 64 20 70 | 6c 61 79 20 77 69 6c 6c |lt and p|lay will|
|00001240| 20 63 6f 6d 6d 65 6e 63 | 65 2e 0a 58 20 2a 0a 58 | commenc|e..X *.X|
|00001250| 20 2a 20 54 68 65 20 70 | 72 6f 67 72 61 6d 20 61 | * The p|rogram a|
|00001260| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 70 72 6f |utomatic|ally pro|
|00001270| 6d 70 74 73 20 66 6f 72 | 20 62 69 64 73 20 61 6e |mpts for| bids an|
|00001280| 64 20 70 6c 61 79 73 20 | 61 74 20 74 68 65 20 61 |d plays |at the a|
|00001290| 70 70 72 6f 70 72 69 61 | 74 65 0a 58 20 2a 20 74 |ppropria|te.X * t|
|000012a0| 69 6d 65 73 2e 20 20 57 | 68 65 6e 20 69 74 20 69 |imes. W|hen it i|
|000012b0| 73 20 6e 6f 74 20 74 69 | 6d 65 20 66 6f 72 20 61 |s not ti|me for a|
|000012c0| 20 70 6c 61 79 65 72 20 | 74 6f 20 65 6e 74 65 72 | player |to enter|
|000012d0| 20 61 20 62 69 64 20 6f | 72 20 70 6c 61 79 2c 20 | a bid o|r play, |
|000012e0| 74 68 65 0a 58 20 2a 20 | 70 72 6f 67 72 61 6d 20 |the.X * |program |
|000012f0| 77 69 6c 6c 20 72 65 6d | 61 69 6e 20 69 6e 20 61 |will rem|ain in a|
|00001300| 20 27 74 61 6c 6b 27 20 | 6d 6f 64 65 2c 20 77 68 | 'talk' |mode, wh|
|00001310| 65 72 65 20 74 68 65 20 | 70 6c 61 79 65 72 20 63 |ere the |player c|
|00001320| 61 6e 20 74 79 70 65 20 | 6d 65 73 73 61 67 65 73 |an type |messages|
|00001330| 0a 58 20 2a 20 74 68 61 | 74 20 77 69 6c 6c 20 62 |.X * tha|t will b|
|00001340| 65 20 73 65 6e 74 20 74 | 6f 20 74 68 65 20 6f 74 |e sent t|o the ot|
|00001350| 68 65 72 20 70 6c 61 79 | 65 72 73 2e 20 20 54 68 |her play|ers. Th|
|00001360| 65 72 65 20 61 72 65 20 | 61 6c 73 6f 20 61 20 66 |ere are |also a f|
|00001370| 65 77 20 73 70 65 63 69 | 61 6c 0a 58 20 2a 20 63 |ew speci|al.X * c|
|00001380| 6f 6d 6d 61 6e 64 73 20 | 66 6f 72 20 63 6f 6e 74 |ommands |for cont|
|00001390| 72 6f 6c 6c 69 6e 67 20 | 74 68 65 20 67 61 6d 65 |rolling |the game|
|000013a0| 2e 20 20 54 68 65 73 65 | 20 63 6f 6d 6d 61 6e 64 |. These| command|
|000013b0| 73 20 61 72 65 20 61 6c | 6c 20 6f 66 20 74 68 65 |s are al|l of the|
|000013c0| 0a 58 20 2a 20 66 6f 72 | 6d 3a 0a 58 20 2a 20 20 |.X * for|m:.X * |
|000013d0| 20 20 20 20 2f 63 6f 6d | 6d 61 6e 64 20 5b 70 61 | /com|mand [pa|
|000013e0| 72 61 6d 65 74 65 72 73 | 5d 0a 58 20 2a 20 46 6f |rameters|].X * Fo|
|000013f0| 72 20 6d 6f 72 65 20 69 | 6e 66 6f 72 6d 61 74 69 |r more i|nformati|
|00001400| 6f 6e 20 6f 6e 20 74 68 | 65 20 63 6f 6d 6d 61 6e |on on th|e comman|
|00001410| 64 73 20 74 68 61 74 20 | 61 72 65 20 61 76 61 69 |ds that |are avai|
|00001420| 6c 61 62 6c 65 2c 20 73 | 65 65 20 74 68 65 0a 58 |lable, s|ee the.X|
|00001430| 20 2a 20 69 6e 70 75 74 | 2e 68 20 66 69 6c 65 2e | * input|.h file.|
|00001440| 0a 58 20 2a 0a 58 20 2a | 0a 58 20 2a 20 53 74 72 |.X *.X *|.X * Str|
|00001450| 75 63 74 75 72 65 20 6f | 66 20 74 68 65 20 70 72 |ucture o|f the pr|
|00001460| 6f 67 72 61 6d 3a 0a 58 | 20 2a 0a 58 20 2a 20 4f |ogram:.X| *.X * O|
|00001470| 6e 65 20 6f 66 20 74 68 | 65 20 63 68 69 65 66 20 |ne of th|e chief |
|00001480| 70 72 69 6e 63 69 70 6c | 65 73 20 69 6e 20 64 65 |principl|es in de|
|00001490| 73 69 67 6e 69 6e 67 20 | 74 68 69 73 20 67 61 6d |signing |this gam|
|000014a0| 65 20 77 61 73 20 70 6f | 72 74 61 62 69 6c 69 74 |e was po|rtabilit|
|000014b0| 79 2e 0a 58 20 2a 20 57 | 69 74 68 20 74 68 69 73 |y..X * W|ith this|
|000014c0| 20 70 72 69 6e 63 69 70 | 6c 65 20 69 6e 20 6d 69 | princip|le in mi|
|000014d0| 6e 64 2c 20 74 68 65 20 | 67 61 6d 65 20 68 61 73 |nd, the |game has|
|000014e0| 20 62 65 65 6e 20 64 69 | 76 69 64 65 64 20 69 6e | been di|vided in|
|000014f0| 74 6f 20 61 0a 58 20 2a | 20 6e 75 6d 62 65 72 20 |to a.X *| number |
|00001500| 6f 66 20 73 65 70 61 72 | 61 74 65 20 6d 6f 64 75 |of separ|ate modu|
|00001510| 6c 65 73 2e 20 20 52 6f | 75 67 68 6c 79 20 73 70 |les. Ro|ughly sp|
|00001520| 65 61 6b 69 6e 67 2c 20 | 74 68 65 20 6d 6f 64 75 |eaking, |the modu|
|00001530| 6c 65 73 20 69 6e 20 74 | 68 65 0a 58 20 2a 20 67 |les in t|he.X * g|
|00001540| 61 6d 65 20 63 61 6e 20 | 62 65 20 67 72 6f 75 70 |ame can |be group|
|00001550| 65 64 20 69 6e 74 6f 20 | 74 77 6f 20 70 61 72 74 |ed into |two part|
|00001560| 73 3a 20 74 68 65 20 62 | 72 69 64 67 65 20 70 72 |s: the b|ridge pr|
|00001570| 6f 67 72 61 6d 20 61 6e | 64 20 74 68 65 0a 58 20 |ogram an|d the.X |
|00001580| 2a 20 6f 70 65 72 61 74 | 69 6e 67 20 73 79 73 74 |* operat|ing syst|
|00001590| 65 6d 20 69 6e 74 65 72 | 66 61 63 65 2e 20 20 54 |em inter|face. T|
|000015a0| 68 65 20 62 72 69 64 67 | 65 20 70 72 6f 67 72 61 |he bridg|e progra|
|000015b0| 6d 20 63 6f 6e 73 69 73 | 74 73 20 6f 66 20 74 68 |m consis|ts of th|
|000015c0| 65 0a 58 20 2a 20 6d 6f | 64 75 6c 65 73 20 44 49 |e.X * mo|dules DI|
|000015d0| 53 50 4c 41 59 2c 20 49 | 4e 50 55 54 20 61 6e 64 |SPLAY, I|NPUT and|
|000015e0| 20 42 52 49 44 47 45 2e | 20 20 54 68 65 73 65 20 | BRIDGE.| These |
|000015f0| 6d 6f 64 75 6c 65 73 20 | 61 72 65 20 72 61 74 68 |modules |are rath|
|00001600| 65 72 0a 58 20 2a 20 63 | 6f 6d 70 6c 69 63 61 74 |er.X * c|omplicat|
|00001610| 65 64 20 61 6e 64 20 72 | 65 70 72 65 73 65 6e 74 |ed and r|epresent|
|00001620| 20 74 68 65 20 68 65 61 | 72 74 20 6f 66 20 74 68 | the hea|rt of th|
|00001630| 65 20 62 72 69 64 67 65 | 20 70 72 6f 67 72 61 6d |e bridge| program|
|00001640| 2e 0a 58 20 2a 20 54 68 | 65 20 6f 70 65 72 61 74 |..X * Th|e operat|
|00001650| 69 6e 67 20 73 79 73 74 | 65 6d 20 69 6e 74 65 72 |ing syst|em inter|
|00001660| 66 61 63 65 20 63 6f 6e | 73 69 73 74 73 20 6f 66 |face con|sists of|
|00001670| 20 74 68 65 20 6d 6f 64 | 75 6c 65 73 20 54 45 52 | the mod|ules TER|
|00001680| 4d 49 4e 41 4c 0a 58 20 | 2a 20 61 6e 64 20 4e 45 |MINAL.X |* and NE|
|00001690| 54 57 4f 52 4b 2e 20 20 | 54 68 65 73 65 20 6d 6f |TWORK. |These mo|
|000016a0| 64 75 6c 65 73 20 68 61 | 76 65 20 62 65 65 6e 20 |dules ha|ve been |
|000016b0| 6d 61 64 65 20 61 73 20 | 73 69 6d 70 6c 65 20 61 |made as |simple a|
|000016c0| 73 20 70 6f 73 73 69 62 | 6c 65 2e 0a 58 20 2a 20 |s possib|le..X * |
|000016d0| 54 68 65 69 72 20 70 75 | 72 70 6f 73 65 20 69 73 |Their pu|rpose is|
|000016e0| 20 73 6f 6c 65 6c 79 20 | 74 6f 20 69 6e 73 75 6c | solely |to insul|
|000016f0| 61 74 65 20 74 68 65 20 | 66 69 72 73 74 20 74 68 |ate the |first th|
|00001700| 72 65 65 20 6d 6f 64 75 | 6c 65 73 20 66 72 6f 6d |ree modu|les from|
|00001710| 0a 58 20 2a 20 74 68 65 | 20 70 61 72 74 69 63 75 |.X * the| particu|
|00001720| 6c 61 72 20 6f 70 65 72 | 61 74 69 6e 67 20 73 79 |lar oper|ating sy|
|00001730| 73 74 65 6d 20 69 6e 20 | 75 73 65 2e 0a 58 20 2a |stem in |use..X *|
|00001740| 0a 58 20 2a 20 44 49 53 | 50 4c 41 59 2e 20 20 54 |.X * DIS|PLAY. T|
|00001750| 68 69 73 20 6d 6f 64 75 | 6c 65 20 63 6f 6e 74 61 |his modu|le conta|
|00001760| 69 6e 73 20 74 68 65 20 | 70 72 69 6d 69 74 69 76 |ins the |primitiv|
|00001770| 65 73 20 66 6f 72 20 64 | 69 73 70 6c 61 79 69 6e |es for d|isplayin|
|00001780| 67 20 74 68 65 0a 58 20 | 2a 20 61 63 74 69 6f 6e |g the.X |* action|
|00001790| 73 20 6f 66 20 74 68 65 | 20 67 61 6d 65 20 6f 6e |s of the| game on|
|000017a0| 20 74 68 65 20 73 63 72 | 65 65 6e 2e 20 20 54 68 | the scr|een. Th|
|000017b0| 69 73 20 6d 6f 64 75 6c | 65 20 63 61 6c 6c 73 20 |is modul|e calls |
|000017c0| 6f 6e 6c 79 20 72 6f 75 | 74 69 6e 65 73 0a 58 20 |only rou|tines.X |
|000017d0| 2a 20 69 6e 20 74 68 65 | 20 54 45 52 4d 49 4e 41 |* in the| TERMINA|
|000017e0| 4c 20 6d 6f 64 75 6c 65 | 2c 20 61 6e 64 20 64 6f |L module|, and do|
|000017f0| 65 73 20 6e 6f 74 20 63 | 61 6c 6c 20 74 68 65 20 |es not c|all the |
|00001800| 6f 70 65 72 61 74 69 6e | 67 20 73 79 73 74 65 6d |operatin|g system|
|00001810| 0a 58 20 2a 20 64 69 72 | 65 63 74 6c 79 2e 20 20 |.X * dir|ectly. |
|00001820| 28 54 68 69 73 20 65 78 | 70 6c 61 69 6e 73 2c 20 |(This ex|plains, |
|00001830| 66 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 77 68 79 |for exam|ple, why|
|00001840| 20 74 68 65 20 64 69 73 | 70 6c 61 79 20 69 73 20 | the dis|play is |
|00001850| 73 6f 0a 58 20 2a 20 72 | 75 64 69 6d 65 6e 74 61 |so.X * r|udimenta|
|00001860| 72 79 2e 29 0a 58 20 2a | 0a 58 20 2a 20 49 4e 50 |ry.).X *|.X * INP|
|00001870| 55 54 2e 20 20 54 68 65 | 73 65 20 72 6f 75 74 69 |UT. The|se routi|
|00001880| 6e 65 73 20 61 72 65 20 | 66 6f 72 20 72 65 61 64 |nes are |for read|
|00001890| 69 6e 67 20 74 68 65 20 | 75 73 65 72 27 73 20 72 |ing the |user's r|
|000018a0| 65 73 70 6f 6e 73 65 20 | 66 72 6f 6d 0a 58 20 2a |esponse |from.X *|
|000018b0| 20 74 68 65 20 74 65 72 | 6d 69 6e 61 6c 2e 20 20 | the ter|minal. |
|000018c0| 54 68 65 72 65 20 61 72 | 65 20 74 77 6f 20 73 6f |There ar|e two so|
|000018d0| 75 72 63 65 73 20 6f 66 | 20 63 6f 6d 70 6c 65 78 |urces of| complex|
|000018e0| 69 74 69 65 73 20 69 6e | 20 74 68 69 73 20 6d 6f |ities in| this mo|
|000018f0| 64 75 6c 65 2e 0a 58 20 | 2a 20 4f 6e 65 20 69 73 |dule..X |* One is|
|00001900| 20 74 68 61 74 20 74 68 | 65 72 65 20 69 73 20 61 | that th|ere is a|
|00001910| 20 70 61 72 73 65 72 20 | 77 68 69 63 68 20 69 73 | parser |which is|
|00001920| 20 72 65 6c 61 74 69 76 | 65 6c 79 20 6c 61 72 67 | relativ|ely larg|
|00001930| 65 20 28 62 75 74 20 6e | 6f 74 0a 58 20 2a 20 76 |e (but n|ot.X * v|
|00001940| 65 72 79 20 73 6f 70 68 | 69 73 74 69 63 61 74 65 |ery soph|isticate|
|00001950| 64 29 20 66 6f 72 20 70 | 72 6f 63 65 73 73 69 6e |d) for p|rocessin|
|00001960| 67 20 69 6e 70 75 74 20 | 62 79 20 74 68 65 20 70 |g input |by the p|
|00001970| 6c 61 79 65 72 20 61 6e | 64 20 62 79 20 74 68 65 |layer an|d by the|
|00001980| 0a 58 20 2a 20 6e 65 74 | 77 6f 72 6b 2e 20 20 41 |.X * net|work. A|
|00001990| 6c 6c 20 6f 66 20 74 68 | 65 20 61 63 74 69 6f 6e |ll of th|e action|
|000019a0| 73 20 6f 66 20 74 68 65 | 20 70 72 6f 67 72 61 6d |s of the| program|
|000019b0| 20 61 72 65 20 63 6f 6d | 6d 61 6e 64 2d 64 72 69 | are com|mand-dri|
|000019c0| 76 65 6e 2e 0a 58 20 2a | 20 54 68 65 20 6f 74 68 |ven..X *| The oth|
|000019d0| 65 72 20 73 6f 75 72 63 | 65 20 6f 66 20 63 6f 6d |er sourc|e of com|
|000019e0| 70 6c 65 78 69 74 79 20 | 69 73 20 74 68 61 74 20 |plexity |is that |
|000019f0| 77 65 20 68 61 76 65 20 | 74 6f 20 6d 6f 6e 69 74 |we have |to monit|
|00001a00| 6f 72 20 62 6f 74 68 20 | 74 68 65 0a 58 20 2a 20 |or both |the.X * |
|00001a10| 6b 65 79 62 6f 61 72 64 | 20 61 6e 64 20 74 68 65 |keyboard| and the|
|00001a20| 20 6e 65 74 77 6f 72 6b | 20 73 69 6d 75 6c 74 61 | network| simulta|
|00001a30| 6e 65 6f 75 73 6c 79 20 | 61 74 20 61 6c 6c 20 74 |neously |at all t|
|00001a40| 69 6d 65 73 2c 20 61 6e | 64 20 77 65 20 68 61 76 |imes, an|d we hav|
|00001a50| 65 20 74 6f 0a 58 20 2a | 20 61 73 73 75 6d 65 20 |e to.X *| assume |
|00001a60| 74 68 61 74 20 73 6f 6d | 65 20 6f 66 20 74 68 65 |that som|e of the|
|00001a70| 20 69 6e 70 75 74 20 66 | 72 6f 6d 20 74 68 65 20 | input f|rom the |
|00001a80| 6e 65 74 77 6f 72 6b 20 | 77 69 6c 6c 20 63 6f 6d |network |will com|
|00001a90| 65 20 6f 75 74 20 6f 66 | 20 6f 72 64 65 72 2e 0a |e out of| order..|
|00001aa0| 58 20 2a 0a 58 20 2a 20 | 4d 41 49 4e 2e 20 20 54 |X *.X * |MAIN. T|
|00001ab0| 68 69 73 20 6d 6f 64 75 | 6c 65 20 63 6f 6e 74 61 |his modu|le conta|
|00001ac0| 69 6e 73 20 74 68 65 20 | 70 72 6f 63 65 64 75 72 |ins the |procedur|
|00001ad0| 65 73 20 77 68 69 63 68 | 20 72 65 70 72 65 73 65 |es which| represe|
|00001ae0| 6e 74 20 74 68 65 0a 58 | 20 2a 20 72 75 6c 65 73 |nt the.X| * rules|
|00001af0| 20 6f 66 20 74 68 65 20 | 67 61 6d 65 2e 0a 58 20 | of the |game..X |
|00001b00| 2a 0a 58 20 2a 20 54 45 | 52 4d 49 4e 41 4c 2e 20 |*.X * TE|RMINAL. |
|00001b10| 20 54 68 69 73 20 6d 6f | 64 75 6c 65 20 63 6f 6e | This mo|dule con|
|00001b20| 74 61 69 6e 73 20 65 6e | 74 72 79 2d 70 6f 69 6e |tains en|try-poin|
|00001b30| 74 73 20 66 6f 72 20 74 | 68 65 20 6d 6f 73 74 20 |ts for t|he most |
|00001b40| 70 72 69 6d 69 74 69 76 | 65 0a 58 20 2a 20 49 2f |primitiv|e.X * I/|
|00001b50| 4f 20 6f 70 65 72 61 74 | 69 6f 6e 73 20 77 69 74 |O operat|ions wit|
|00001b60| 68 20 74 68 65 20 74 65 | 72 6d 69 6e 61 6c 2e 20 |h the te|rminal. |
|00001b70| 20 57 65 20 61 73 73 75 | 6d 65 20 74 68 61 74 20 | We assu|me that |
|00001b80| 74 68 65 20 73 63 72 65 | 65 6e 20 69 73 0a 58 20 |the scre|en is.X |
|00001b90| 2a 20 28 61 74 20 6c 65 | 61 73 74 29 20 32 34 20 |* (at le|ast) 24 |
|00001ba0| 78 20 38 30 2c 20 74 68 | 61 74 20 74 68 65 20 63 |x 80, th|at the c|
|00001bb0| 75 72 73 6f 72 20 69 73 | 20 61 64 64 72 65 73 73 |ursor is| address|
|00001bc0| 61 62 6c 65 2c 20 61 6e | 64 20 74 68 61 74 0a 58 |able, an|d that.X|
|00001bd0| 20 2a 20 69 74 20 69 73 | 20 70 6f 73 73 69 62 6c | * it is| possibl|
|00001be0| 65 20 74 6f 20 63 68 65 | 63 6b 20 66 6f 72 20 74 |e to che|ck for t|
|00001bf0| 68 65 20 61 76 61 69 6c | 61 62 69 6c 69 74 79 20 |he avail|ability |
|00001c00| 6f 66 20 61 6e 20 69 6e | 70 75 74 20 63 68 61 72 |of an in|put char|
|00001c10| 61 63 74 65 72 0a 58 20 | 2a 20 77 69 74 68 6f 75 |acter.X |* withou|
|00001c20| 74 20 61 63 74 75 61 6c | 6c 79 20 72 65 61 64 69 |t actual|ly readi|
|00001c30| 6e 67 20 69 74 2e 20 20 | 41 6c 6c 20 6f 66 20 74 |ng it. |All of t|
|00001c40| 68 65 20 49 2f 4f 20 6f | 70 65 72 61 74 69 6f 6e |he I/O o|peration|
|00001c50| 73 20 74 6f 20 74 68 65 | 20 74 65 72 6d 69 6e 61 |s to the| termina|
|00001c60| 6c 0a 58 20 2a 20 61 72 | 65 20 64 69 72 65 63 74 |l.X * ar|e direct|
|00001c70| 65 64 20 74 68 72 6f 75 | 67 68 20 74 68 69 73 20 |ed throu|gh this |
|00001c80| 6d 6f 64 75 6c 65 2e 0a | 58 20 2a 0a 58 20 2a 20 |module..|X *.X * |
|00001c90| 4e 45 54 57 4f 52 4b 2e | 20 20 54 68 69 73 20 6d |NETWORK.| This m|
|00001ca0| 6f 64 75 6c 65 20 63 6f | 6e 74 61 69 6e 73 20 74 |odule co|ntains t|
|00001cb0| 68 65 20 70 72 69 6d 69 | 74 69 76 65 73 20 66 6f |he primi|tives fo|
|00001cc0| 72 20 6e 65 74 77 6f 72 | 6b 20 49 2f 4f 2e 0a 58 |r networ|k I/O..X|
|00001cd0| 20 2a 20 45 76 65 72 79 | 20 6d 65 73 73 61 67 65 | * Every| message|
|00001ce0| 20 74 68 61 74 20 69 73 | 20 73 65 6e 74 20 62 79 | that is| sent by|
|00001cf0| 20 61 20 70 6c 61 79 65 | 72 20 69 73 20 62 72 6f | a playe|r is bro|
|00001d00| 61 64 63 61 73 74 20 74 | 6f 20 74 68 65 20 6f 74 |adcast t|o the ot|
|00001d10| 68 65 72 0a 58 20 2a 20 | 74 68 72 65 65 20 70 6c |her.X * |three pl|
|00001d20| 61 79 65 72 73 2e 0a 58 | 20 2a 0a 58 20 2a 20 50 |ayers..X| *.X * P|
|00001d30| 53 2e 20 20 54 68 69 73 | 20 69 73 20 61 20 73 69 |S. This| is a si|
|00001d40| 6d 70 6c 65 20 6d 6f 64 | 75 6c 65 20 66 6f 72 20 |mple mod|ule for |
|00001d50| 62 72 65 61 6b 69 6e 67 | 20 75 70 20 61 6e 20 69 |breaking| up an i|
|00001d60| 6e 70 75 74 20 73 74 72 | 69 6e 67 20 69 6e 74 6f |nput str|ing into|
|00001d70| 0a 58 20 2a 20 61 20 73 | 65 71 75 65 6e 63 65 20 |.X * a s|equence |
|00001d80| 6f 66 20 6b 65 79 77 6f | 72 64 73 2e 20 20 49 74 |of keywo|rds. It|
|00001d90| 20 69 73 20 75 73 65 64 | 20 6f 6e 6c 79 20 62 79 | is used| only by|
|00001da0| 20 74 68 65 20 70 61 72 | 73 65 72 20 69 6e 20 74 | the par|ser in t|
|00001db0| 68 65 20 49 4e 50 55 54 | 0a 58 20 2a 20 6d 6f 64 |he INPUT|.X * mod|
|00001dc0| 75 6c 65 2e 0a 58 20 2a | 0a 58 20 2a 20 48 45 4c |ule..X *|.X * HEL|
|00001dd0| 50 2e 20 20 54 68 69 73 | 20 69 73 20 61 20 6d 6f |P. This| is a mo|
|00001de0| 64 75 6c 65 20 66 6f 72 | 20 70 72 6f 76 69 64 69 |dule for| providi|
|00001df0| 6e 67 20 6f 6e 2d 6c 69 | 6e 65 20 69 6e 73 74 72 |ng on-li|ne instr|
|00001e00| 75 63 74 69 6f 6e 73 20 | 61 62 6f 75 74 20 68 6f |uctions |about ho|
|00001e10| 77 0a 58 20 2a 20 74 6f | 20 75 73 65 20 74 68 65 |w.X * to| use the|
|00001e20| 20 70 72 6f 67 72 61 6d | 2e 20 20 54 68 65 20 68 | program|. The h|
|00001e30| 65 6c 70 20 6d 6f 64 75 | 6c 65 20 72 65 61 64 73 |elp modu|le reads|
|00001e40| 20 61 20 6c 69 73 74 20 | 6f 66 20 74 6f 70 69 63 | a list |of topic|
|00001e50| 73 20 66 72 6f 6d 20 61 | 0a 58 20 2a 20 68 65 6c |s from a|.X * hel|
|00001e60| 70 20 66 69 6c 65 2e 20 | 20 45 61 63 68 20 74 6f |p file. | Each to|
|00001e70| 70 69 63 20 74 68 65 6e | 20 72 65 66 65 72 73 20 |pic then| refers |
|00001e80| 74 6f 20 61 6e 6f 74 68 | 65 72 20 66 69 6c 65 20 |to anoth|er file |
|00001e90| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 61 6e 0a 58 20 |containi|ng an.X |
|00001ea0| 2a 20 65 78 70 6c 61 6e | 61 74 69 6f 6e 20 6f 66 |* explan|ation of|
|00001eb0| 20 74 68 61 74 20 74 6f | 70 69 63 2e 0a 58 20 2a | that to|pic..X *|
|00001ec0| 0a 58 20 2a 0a 58 20 2a | 20 46 75 74 75 72 65 20 |.X *.X *| Future |
|00001ed0| 69 6d 70 72 6f 76 65 6d | 65 6e 74 73 3a 0a 58 20 |improvem|ents:.X |
|00001ee0| 2a 0a 58 20 2a 20 31 2e | 20 20 49 74 20 77 6f 75 |*.X * 1.| It wou|
|00001ef0| 6c 64 20 62 65 20 6e 69 | 63 65 20 74 6f 20 62 65 |ld be ni|ce to be|
|00001f00| 20 61 62 6c 65 20 74 6f | 20 72 65 63 6f 76 65 72 | able to| recover|
|00001f10| 20 66 72 6f 6d 20 61 20 | 64 72 6f 70 70 65 64 20 | from a |dropped |
|00001f20| 63 6f 6e 6e 65 63 74 69 | 6f 6e 2e 0a 58 20 2a 20 |connecti|on..X * |
|00001f30| 20 20 20 20 54 68 65 20 | 6e 65 74 77 6f 72 6b 20 | The |network |
|00001f40| 70 72 6f 74 6f 63 6f 6c | 20 61 73 73 75 6d 65 73 |protocol| assumes|
|00001f50| 20 74 68 61 74 20 74 68 | 65 20 63 6f 6e 6e 65 63 | that th|e connec|
|00001f60| 74 69 6f 6e 73 20 61 72 | 65 20 73 74 61 62 6c 65 |tions ar|e stable|
|00001f70| 20 61 6e 64 20 77 69 6c | 6c 0a 58 20 2a 20 20 20 | and wil|l.X * |
|00001f80| 20 20 6c 61 73 74 20 66 | 6f 72 20 74 68 65 20 64 | last f|or the d|
|00001f90| 75 72 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 67 |uration |of the g|
|00001fa0| 61 6d 65 2e 20 20 48 6f | 77 65 76 65 72 2c 20 69 |ame. Ho|wever, i|
|00001fb0| 74 20 68 61 73 20 62 65 | 65 6e 20 6d 79 0a 58 20 |t has be|en my.X |
|00001fc0| 2a 20 20 20 20 20 6f 62 | 73 65 72 76 61 74 69 6f |* ob|servatio|
|00001fd0| 6e 20 74 68 61 74 20 77 | 69 74 68 20 73 6f 6d 65 |n that w|ith some|
|00001fe0| 20 6e 65 74 77 6f 72 6b | 73 2c 20 74 68 65 20 63 | network|s, the c|
|00001ff0| 6f 6e 6e 65 63 74 69 6f | 6e 73 20 6d 61 79 20 62 |onnectio|ns may b|
|00002000| 65 0a 58 20 2a 20 20 20 | 20 20 62 72 6f 6b 65 6e |e.X * | broken|
|00002010| 20 6f 63 63 61 73 69 6f | 6e 61 6c 6c 79 2e 20 20 | occasio|nally. |
|00002020| 57 68 65 6e 20 74 68 69 | 73 20 68 61 70 70 65 6e |When thi|s happen|
|00002030| 73 2c 20 74 68 65 20 6f | 6b 62 72 69 64 67 65 20 |s, the o|kbridge |
|00002040| 70 72 6f 67 72 61 6d 20 | 68 61 73 0a 58 20 2a 20 |program |has.X * |
|00002050| 20 20 20 20 74 6f 20 62 | 65 20 72 65 73 74 61 72 | to b|e restar|
|00002060| 74 65 64 20 66 72 6f 6d | 20 74 68 65 20 62 65 67 |ted from| the beg|
|00002070| 69 6e 6e 69 6e 67 20 62 | 79 20 61 6c 6c 20 6f 66 |inning b|y all of|
|00002080| 20 74 68 65 20 70 6c 61 | 79 65 72 73 2e 0a 58 20 | the pla|yers..X |
|00002090| 2a 0a 58 20 2a 20 32 2e | 20 20 49 74 20 77 6f 75 |*.X * 2.| It wou|
|000020a0| 6c 64 20 62 65 20 6e 69 | 63 65 20 74 6f 20 69 6d |ld be ni|ce to im|
|000020b0| 70 6c 65 6d 65 6e 74 20 | 61 20 70 72 6f 74 6f 63 |plement |a protoc|
|000020c0| 6f 6c 20 66 6f 72 20 64 | 65 61 6c 69 6e 67 20 74 |ol for d|ealing t|
|000020d0| 68 65 0a 58 20 2a 20 20 | 20 20 20 63 61 72 64 73 |he.X * | cards|
|000020e0| 20 77 68 65 72 65 20 65 | 61 63 68 20 70 6c 61 79 | where e|ach play|
|000020f0| 65 72 20 77 6f 75 6c 64 | 20 6b 6e 6f 77 20 6f 6e |er would| know on|
|00002100| 6c 79 20 68 69 73 20 6f | 77 6e 20 63 61 72 64 73 |ly his o|wn cards|
|00002110| 2e 0a 58 20 2a 0a 58 20 | 2a 0a 58 20 2a 2f 0a 58 |..X *.X |*.X */.X|
|00002120| 20 0a 58 23 64 65 66 69 | 6e 65 20 5f 42 52 49 44 | .X#defi|ne _BRID|
|00002130| 47 45 5f 0a 58 20 0a 58 | 23 69 66 64 65 66 20 5f |GE_.X .X|#ifdef _|
|00002140| 5f 54 55 52 42 4f 43 5f | 5f 0a 58 23 69 6e 63 6c |_TURBOC_|_.X#incl|
|00002150| 75 64 65 20 3c 61 6c 6c | 6f 63 2e 68 3e 0a 58 23 |ude <all|oc.h>.X#|
|00002160| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 6c 69 62 2e |include |<stdlib.|
|00002170| 68 3e 0a 58 23 65 6c 73 | 65 0a 58 23 64 65 66 69 |h>.X#els|e.X#defi|
|00002180| 6e 65 20 72 61 6e 64 6f | 6d 28 6e 29 20 28 28 72 |ne rando|m(n) ((r|
|00002190| 61 6e 64 28 29 2f 36 34 | 29 20 25 20 28 6e 29 29 |and()/64|) % (n))|
|000021a0| 0a 58 23 69 6e 63 6c 75 | 64 65 20 3c 73 79 73 2f |.X#inclu|de <sys/|
|000021b0| 74 69 6d 65 2e 68 3e 0a | 58 23 69 6e 63 6c 75 64 |time.h>.|X#includ|
|000021c0| 65 20 3c 73 79 73 2f 72 | 65 73 6f 75 72 63 65 2e |e <sys/r|esource.|
|000021d0| 68 3e 0a 58 23 65 6e 64 | 69 66 0a 58 20 0a 58 23 |h>.X#end|if.X .X#|
|000021e0| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 74 79 70 |include |<sys/typ|
|000021f0| 65 73 2e 68 3e 0a 58 23 | 69 6e 63 6c 75 64 65 20 |es.h>.X#|include |
|00002200| 3c 73 65 74 6a 6d 70 2e | 68 3e 0a 58 23 69 6e 63 |<setjmp.|h>.X#inc|
|00002210| 6c 75 64 65 20 3c 73 69 | 67 6e 61 6c 2e 68 3e 0a |lude <si|gnal.h>.|
|00002220| 58 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |X#includ|e <stdio|
|00002230| 2e 68 3e 0a 58 23 69 66 | 64 65 66 20 41 49 58 0a |.h>.X#if|def AIX.|
|00002240| 58 23 69 6e 63 6c 75 64 | 65 20 3c 74 69 6d 65 2e |X#includ|e <time.|
|00002250| 68 3e 0a 58 23 65 6e 64 | 69 66 0a 58 23 69 6e 63 |h>.X#end|if.X#inc|
|00002260| 6c 75 64 65 20 3c 73 74 | 72 69 6e 67 2e 68 3e 0a |lude <st|ring.h>.|
|00002270| 58 20 0a 58 23 69 6e 63 | 6c 75 64 65 20 22 67 6c |X .X#inc|lude "gl|
|00002280| 6f 62 61 6c 73 2e 68 22 | 0a 58 23 69 6e 63 6c 75 |obals.h"|.X#inclu|
|00002290| 64 65 20 22 70 73 2e 68 | 22 0a 58 23 69 6e 63 6c |de "ps.h|".X#incl|
|000022a0| 75 64 65 20 22 64 69 73 | 70 6c 61 79 2e 68 22 0a |ude "dis|play.h".|
|000022b0| 58 23 69 6e 63 6c 75 64 | 65 20 22 69 6e 70 75 74 |X#includ|e "input|
|000022c0| 2e 68 22 0a 58 23 69 6e | 63 6c 75 64 65 20 22 6e |.h".X#in|clude "n|
|000022d0| 65 74 77 6f 72 6b 2e 68 | 22 0a 58 23 69 6e 63 6c |etwork.h|".X#incl|
|000022e0| 75 64 65 20 22 74 65 72 | 6d 69 6e 61 6c 2e 68 22 |ude "ter|minal.h"|
|000022f0| 0a 58 23 69 6e 63 6c 75 | 64 65 20 22 68 65 6c 70 |.X#inclu|de "help|
|00002300| 2e 68 22 0a 58 23 69 6e | 63 6c 75 64 65 20 22 63 |.h".X#in|clude "c|
|00002310| 6f 64 65 2e 68 22 0a 58 | 23 69 6e 63 6c 75 64 65 |ode.h".X|#include|
|00002320| 20 22 65 6d 61 69 6c 2e | 68 22 0a 58 0a 58 65 78 | "email.|h".X.Xex|
|00002330| 74 65 72 6e 20 69 6e 74 | 20 65 72 72 6e 6f 3b 0a |tern int| errno;.|
|00002340| 58 65 78 74 65 72 6e 20 | 63 68 61 72 20 2a 73 79 |Xextern |char *sy|
|00002350| 73 5f 65 72 72 6c 69 73 | 74 5b 5d 3b 0a 58 0a 58 |s_errlis|t[];.X.X|
|00002360| 65 78 74 65 72 6e 20 69 | 6e 74 20 6e 65 74 77 6f |extern i|nt netwo|
|00002370| 72 6b 5f 70 6f 72 74 3b | 0a 58 65 78 74 65 72 6e |rk_port;|.Xextern|
|00002380| 20 69 6e 74 20 73 65 72 | 76 65 72 5f 6d 6f 64 65 | int ser|ver_mode|
|00002390| 3b 0a 58 65 78 74 65 72 | 6e 20 63 68 61 72 20 2a |;.Xexter|n char *|
|000023a0| 73 65 72 76 65 72 5f 6e | 61 6d 65 3b 0a 58 0a 58 |server_n|ame;.X.X|
|000023b0| 65 78 74 65 72 6e 20 63 | 68 61 72 20 2a 61 75 74 |extern c|har *aut|
|000023c0| 6f 6c 6f 61 64 5f 66 69 | 6c 65 2c 20 2a 61 75 74 |oload_fi|le, *aut|
|000023d0| 6f 73 61 76 65 5f 66 69 | 6c 65 3b 0a 58 0a 58 46 |osave_fi|le;.X.XF|
|000023e0| 49 4c 45 20 2a 6c 6f 67 | 66 69 6c 65 20 3d 20 4e |ILE *log|file = N|
|000023f0| 55 4c 4c 3b 20 20 2f 2a | 20 54 68 65 20 66 69 6c |ULL; /*| The fil|
|00002400| 65 20 77 68 65 72 65 20 | 77 65 20 6c 6f 67 20 74 |e where |we log t|
|00002410| 68 65 20 68 61 6e 64 73 | 20 74 68 61 74 20 68 61 |he hands| that ha|
|00002420| 76 65 0a 58 09 09 09 2e | 20 62 65 65 6e 20 70 6c |ve.X....| been pl|
|00002430| 61 79 65 64 2e 20 2a 2f | 0a 58 46 49 4c 45 20 2a |ayed. */|.XFILE *|
|00002440| 7a 68 61 6e 67 5f 6c 6f | 67 66 69 6c 65 20 3d 20 |zhang_lo|gfile = |
|00002450| 4e 55 4c 4c 3b 20 0a 58 | 20 20 20 20 20 20 20 20 |NULL; .X| |
|00002460| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00002470| 2a 20 54 68 65 20 66 69 | 6c 65 20 77 68 65 72 65 |* The fi|le where|
|00002480| 20 77 65 20 6c 6f 67 20 | 68 61 6e 64 73 20 74 68 | we log |hands th|
|00002490| 61 74 20 61 72 65 20 77 | 72 69 74 74 65 6e 0a 58 |at are w|ritten.X|
|000024a0| 09 09 09 20 20 69 6e 20 | 5a 68 61 6e 67 27 73 20 |... in |Zhang's |
|000024b0| 66 6f 72 6d 61 74 2e 20 | 2a 2f 0a 58 69 6e 74 20 |format. |*/.Xint |
|000024c0| 74 61 62 6c 65 5f 6e 6f | 20 3d 20 2d 31 3b 20 20 |table_no| = -1; |
|000024d0| 20 20 20 2f 2a 20 54 61 | 62 6c 65 20 6e 75 6d 62 | /* Ta|ble numb|
|000024e0| 65 72 20 70 72 69 6e 74 | 65 64 20 69 6e 20 53 7a |er print|ed in Sz|
|000024f0| 68 61 6e 67 20 66 6f 72 | 6d 61 74 20 6c 6f 67 20 |hang for|mat log |
|00002500| 66 69 6c 65 73 2e 20 2a | 2f 0a 58 63 68 61 72 20 |files. *|/.Xchar |
|00002510| 2a 6d 6f 6e 74 68 5f 6e | 61 6d 65 73 20 5b 5d 20 |*month_n|ames [] |
|00002520| 3d 0a 58 20 20 7b 20 22 | 4a 61 6e 22 2c 20 22 46 |=.X { "|Jan", "F|
|00002530| 65 62 22 2c 20 22 4d 61 | 72 22 2c 20 22 41 70 72 |eb", "Ma|r", "Apr|
|00002540| 22 2c 20 22 4d 61 79 22 | 2c 20 22 4a 75 6e 22 2c |", "May"|, "Jun",|
|00002550| 20 22 4a 75 6c 22 2c 20 | 22 41 75 67 22 2c 20 22 | "Jul", |"Aug", "|
|00002560| 53 65 70 74 22 2c 0a 58 | 20 20 20 20 22 4f 63 74 |Sept",.X| "Oct|
|00002570| 22 2c 20 22 4e 6f 76 22 | 2c 20 22 44 65 63 22 7d |", "Nov"|, "Dec"}|
|00002580| 3b 0a 58 68 61 6e 64 20 | 73 61 76 65 64 5f 68 61 |;.Xhand |saved_ha|
|00002590| 6e 64 73 20 5b 34 5d 3b | 20 20 2f 2a 20 54 68 65 |nds [4];| /* The|
|000025a0| 20 63 61 72 64 73 20 61 | 73 20 74 68 65 79 20 77 | cards a|s they w|
|000025b0| 65 72 65 20 64 65 61 6c | 74 2e 20 2a 2f 0a 58 68 |ere deal|t. */.Xh|
|000025c0| 61 6e 64 20 73 61 76 65 | 64 5f 70 6c 61 79 73 20 |and save|d_plays |
|000025d0| 5b 34 5d 3b 20 20 2f 2a | 20 54 68 65 20 63 61 72 |[4]; /*| The car|
|000025e0| 64 73 20 61 73 20 74 68 | 65 79 20 77 65 72 65 20 |ds as th|ey were |
|000025f0| 70 6c 61 79 65 64 2e 20 | 2a 2f 0a 58 69 6e 74 20 |played. |*/.Xint |
|00002600| 20 6c 65 61 64 69 6e 67 | 5f 70 6c 61 79 20 5b 31 | leading|_play [1|
|00002610| 34 5d 3b 2f 2a 20 54 68 | 65 20 6c 65 61 64 69 6e |4];/* Th|e leadin|
|00002620| 67 20 70 6c 61 79 65 72 | 20 66 6f 72 20 65 61 63 |g player| for eac|
|00002630| 68 20 74 72 69 63 6b 2e | 20 2a 2f 0a 58 0a 58 63 |h trick.| */.X.Xc|
|00002640| 68 61 72 20 2a 6c 6f 63 | 61 6c 5f 70 6c 61 79 65 |har *loc|al_playe|
|00002650| 72 5f 6e 61 6d 65 20 3d | 20 4e 55 4c 4c 3b 0a 58 |r_name =| NULL;.X|
|00002660| 09 2f 2a 20 54 68 69 73 | 20 76 61 72 69 61 62 6c |./* This| variabl|
|00002670| 65 20 73 74 6f 72 65 73 | 20 74 68 65 20 6e 61 6d |e stores| the nam|
|00002680| 65 20 6f 66 20 74 68 65 | 20 6c 6f 63 61 6c 20 70 |e of the| local p|
|00002690| 6c 61 79 65 72 20 75 6e | 74 69 6c 0a 58 09 20 20 |layer un|til.X. |
|000026a0| 20 77 65 20 6b 6e 6f 77 | 20 77 68 61 74 20 68 69 | we know| what hi|
|000026b0| 73 2f 68 65 72 20 73 65 | 61 74 20 70 6f 73 69 74 |s/her se|at posit|
|000026c0| 69 6f 6e 20 69 73 2e 20 | 2a 2f 0a 58 0a 58 0a 58 |ion is. |*/.X.X.X|
|000026d0| 73 74 61 74 69 63 20 6a | 6d 70 5f 62 75 66 20 65 |static j|mp_buf e|
|000026e0| 72 72 6f 72 5f 72 65 74 | 75 72 6e 3b 0a 58 73 74 |rror_ret|urn;.Xst|
|000026f0| 61 74 69 63 20 69 6e 74 | 20 20 20 20 20 61 62 6f |atic int| abo|
|00002700| 72 74 5f 66 6c 61 67 3b | 0a 58 20 0a 58 74 79 70 |rt_flag;|.X .Xtyp|
|00002710| 65 64 65 66 20 69 6e 74 | 20 64 65 63 6c 61 72 61 |edef int| declara|
|00002720| 74 69 6f 6e 73 20 5b 35 | 5d 3b 0a 58 73 74 61 74 |tions [5|];.Xstat|
|00002730| 69 63 20 20 64 65 63 6c | 61 72 61 74 69 6f 6e 73 |ic decl|arations|
|00002740| 20 64 65 63 6c 61 72 65 | 72 73 20 5b 32 5d 3b 0a | declare|rs [2];.|
|00002750| 58 0a 58 2f 2a 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |X.X/* Th|e follow|
|00002760| 69 6e 67 20 74 61 62 6c | 65 20 69 73 20 75 73 65 |ing tabl|e is use|
|00002770| 64 20 66 6f 72 20 63 6f | 6d 70 75 74 69 6e 67 20 |d for co|mputing |
|00002780| 73 63 6f 72 65 73 20 61 | 63 63 6f 72 64 69 6e 67 |scores a|ccording|
|00002790| 20 74 6f 20 61 0a 58 20 | 20 20 22 73 69 6d 75 6c | to a.X | "simul|
|000027a0| 61 74 65 64 20 49 4d 50 | 22 20 73 63 6f 72 69 6e |ated IMP|" scorin|
|000027b0| 67 20 73 79 73 74 65 6d | 2e 20 20 20 4d 75 63 68 |g system|. Much|
|000027c0| 20 6f 66 20 74 68 65 20 | 63 6f 64 65 20 66 6f 72 | of the |code for|
|000027d0| 20 74 68 69 73 20 73 63 | 6f 72 69 6e 67 0a 58 20 | this sc|oring.X |
|000027e0| 20 20 73 79 73 74 65 6d | 20 68 61 73 20 62 65 65 | system| has bee|
|000027f0| 6e 20 63 6f 6e 74 72 69 | 62 75 74 65 64 20 62 79 |n contri|buted by|
|00002800| 20 59 61 2d 58 69 61 6e | 67 20 59 75 61 6e 2e 20 | Ya-Xian|g Yuan. |
|00002810| 2a 2f 0a 58 0a 58 73 74 | 61 74 69 63 20 69 6e 74 |*/.X.Xst|atic int|
|00002820| 20 49 4d 50 5f 73 63 6f | 72 69 6e 67 5f 74 61 62 | IMP_sco|ring_tab|
|00002830| 6c 65 20 5b 5d 20 3d 20 | 7b 0a 58 20 20 32 30 2c |le [] = |{.X 20,|
|00002840| 20 35 30 2c 20 38 30 2c | 20 31 32 30 2c 20 31 36 | 50, 80,| 120, 16|
|00002850| 30 2c 20 32 31 30 2c 20 | 32 36 30 2c 20 33 31 30 |0, 210, |260, 310|
|00002860| 2c 20 33 36 30 2c 20 34 | 33 30 2c 20 35 30 30 2c |, 360, 4|30, 500,|
|00002870| 0a 58 20 20 36 30 30 2c | 20 37 35 30 2c 20 39 30 |.X 600,| 750, 90|
|00002880| 30 2c 20 31 31 30 30 2c | 20 31 33 30 30 2c 20 31 |0, 1100,| 1300, 1|
|00002890| 35 30 30 2c 20 31 37 35 | 30 2c 20 32 30 30 30 2c |500, 175|0, 2000,|
|000028a0| 20 32 35 30 30 2c 20 33 | 30 30 30 2c 0a 58 20 20 | 2500, 3|000,.X |
|000028b0| 33 35 30 30 2c 20 34 30 | 30 30 2c 20 34 35 30 30 |3500, 40|00, 4500|
|000028c0| 2c 20 39 39 39 39 7d 3b | 0a 58 0a 58 73 74 61 74 |, 9999};|.X.Xstat|
|000028d0| 69 63 20 69 6e 74 20 49 | 4d 50 5f 73 63 6f 72 65 |ic int I|MP_score|
|000028e0| 5f 63 6f 6e 76 65 72 73 | 69 6f 6e 20 28 70 74 29 |_convers|ion (pt)|
|000028f0| 0a 58 20 20 20 20 20 69 | 6e 74 20 70 74 3b 0a 58 |.X i|nt pt;.X|
|00002900| 2f 2a 20 54 68 69 73 20 | 70 72 6f 63 65 64 75 72 |/* This |procedur|
|00002910| 65 20 63 6f 6e 76 65 72 | 74 73 20 61 20 64 75 70 |e conver|ts a dup|
|00002920| 6c 69 63 61 74 65 20 73 | 63 6f 72 65 20 69 6e 74 |licate s|core int|
|00002930| 6f 20 61 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |o a corr|espondin|
|00002940| 67 20 49 4d 50 0a 58 20 | 2e 20 73 63 6f 72 65 2e |g IMP.X |. score.|
|00002950| 20 20 54 68 69 73 20 63 | 6f 64 65 20 77 61 73 20 | This c|ode was |
|00002960| 63 6f 6e 74 72 69 62 75 | 74 65 64 20 62 79 20 5a |contribu|ted by Z|
|00002970| 68 65 6e 6a 75 6e 20 57 | 75 20 6f 66 20 4f 68 69 |henjun W|u of Ohi|
|00002980| 6f 20 53 74 61 74 65 20 | 55 6e 69 76 2e 20 2a 2f |o State |Univ. */|
|00002990| 0a 58 7b 0a 58 20 20 69 | 6e 74 20 69 2c 61 70 74 |.X{.X i|nt i,apt|
|000029a0| 3b 0a 58 20 20 73 74 61 | 74 69 63 20 69 6e 74 20 |;.X sta|tic int |
|000029b0| 49 4d 50 5f 73 63 6f 72 | 69 6e 67 5f 74 61 62 6c |IMP_scor|ing_tabl|
|000029c0| 65 20 5b 5d 20 3d 20 7b | 0a 58 20 20 20 20 31 30 |e [] = {|.X 10|
|000029d0| 2c 20 34 30 2c 20 38 30 | 2c 20 31 32 30 2c 20 31 |, 40, 80|, 120, 1|
|000029e0| 36 30 2c 20 32 31 30 2c | 20 32 36 30 2c 20 33 31 |60, 210,| 260, 31|
|000029f0| 30 2c 20 33 36 30 2c 20 | 34 32 30 2c 20 34 39 30 |0, 360, |420, 490|
|00002a00| 2c 0a 58 20 20 20 20 35 | 39 30 2c 20 37 34 30 2c |,.X 5|90, 740,|
|00002a10| 20 38 39 30 2c 20 31 30 | 39 30 2c 20 31 32 39 30 | 890, 10|90, 1290|
|00002a20| 2c 20 31 34 39 30 2c 20 | 31 37 34 30 2c 20 31 39 |, 1490, |1740, 19|
|00002a30| 39 30 2c 20 32 32 34 30 | 2c 20 32 34 39 30 2c 0a |90, 2240|, 2490,.|
|00002a40| 58 20 20 20 20 32 39 39 | 30 2c 20 33 34 39 30 2c |X 299|0, 3490,|
|00002a50| 20 33 39 39 30 2c 20 39 | 39 39 39 7d 3b 0a 58 20 | 3990, 9|999};.X |
|00002a60| 20 0a 58 20 20 69 66 20 | 28 21 20 70 74 29 20 72 | .X if |(! pt) r|
|00002a70| 65 74 75 72 6e 20 30 3b | 0a 58 20 20 61 70 74 20 |eturn 0;|.X apt |
|00002a80| 3d 20 28 70 74 3e 30 29 | 3f 20 70 74 3a 2d 70 74 |= (pt>0)|? pt:-pt|
|00002a90| 20 3b 0a 58 20 20 66 6f | 72 20 28 69 20 3d 20 30 | ;.X fo|r (i = 0|
|00002aa0| 3b 20 61 70 74 20 3e 20 | 49 4d 50 5f 73 63 6f 72 |; apt > |IMP_scor|
|00002ab0| 69 6e 67 5f 74 61 62 6c | 65 5b 69 5d 3b 20 69 2b |ing_tabl|e[i]; i+|
|00002ac0| 2b 29 3b 0a 58 20 20 72 | 65 74 75 72 6e 20 28 20 |+);.X r|eturn ( |
|00002ad0| 28 70 74 3e 30 29 3f 20 | 69 3a 2d 69 20 29 3b 0a |(pt>0)? |i:-i );.|
|00002ae0| 58 7d 0a 58 0a 58 0a 58 | 63 68 61 72 20 2a 73 74 |X}.X.X.X|char *st|
|00002af0| 72 64 75 70 20 28 73 29 | 0a 58 09 63 68 61 72 20 |rdup (s)|.X.char |
|00002b00| 2a 73 3b 0a 58 7b 0a 58 | 09 63 68 61 72 20 2a 70 |*s;.X{.X|.char *p|
|00002b10| 2c 20 2a 71 3b 0a 58 0a | 58 09 71 20 3d 20 70 20 |, *q;.X.|X.q = p |
|00002b20| 3d 20 28 63 68 61 72 20 | 2a 29 20 6d 61 6c 6c 6f |= (char |*) mallo|
|00002b30| 63 20 28 73 74 72 6c 65 | 6e 28 73 29 20 2b 20 32 |c (strle|n(s) + 2|
|00002b40| 29 3b 0a 58 09 77 68 69 | 6c 65 20 28 2a 73 20 21 |);.X.whi|le (*s !|
|00002b50| 3d 20 27 5c 30 27 29 0a | 58 09 09 2a 28 71 2b 2b |= '\0').|X..*(q++|
|00002b60| 29 20 3d 20 2a 28 73 2b | 2b 29 3b 0a 58 09 2a 71 |) = *(s+|+);.X.*q|
|00002b70| 20 3d 20 27 5c 30 27 3b | 0a 58 09 72 65 74 75 72 | = '\0';|.X.retur|
|00002b80| 6e 20 28 70 29 3b 0a 58 | 7d 3b 0a 58 0a 58 23 69 |n (p);.X|};.X.X#i|
|00002b90| 66 64 65 66 20 4e 4f 5f | 49 53 53 50 41 43 45 0a |fdef NO_|ISSPACE.|
|00002ba0| 58 69 6e 74 20 69 73 73 | 70 61 63 65 20 28 63 68 |Xint iss|pace (ch|
|00002bb0| 29 0a 58 20 20 20 20 20 | 63 68 61 72 20 63 68 3b |).X |char ch;|
|00002bc0| 0a 58 7b 0a 58 20 20 72 | 65 74 75 72 6e 20 28 28 |.X{.X r|eturn ((|
|00002bd0| 63 68 20 3d 3d 20 27 20 | 27 29 20 7c 7c 20 28 63 |ch == ' |') || (c|
|00002be0| 68 20 3d 3d 20 27 5c 74 | 27 29 20 7c 7c 20 28 63 |h == '\t|') || (c|
|00002bf0| 68 20 3d 3d 20 27 5c 6e | 27 29 29 3b 0a 58 7d 3b |h == '\n|'));.X};|
|00002c00| 0a 58 23 65 6e 64 69 66 | 0a 58 0a 58 72 61 6e 64 |.X#endif|.X.Xrand|
|00002c10| 6f 6d 69 7a 65 20 28 29 | 0a 58 7b 0a 58 20 20 20 |omize ()|.X{.X |
|00002c20| 20 20 20 20 20 73 72 61 | 6e 64 20 28 74 69 6d 65 | sra|nd (time|
|00002c30| 28 4e 55 4c 4c 29 29 3b | 0a 58 7d 3b 0a 58 0a 58 |(NULL));|.X};.X.X|
|00002c40| 0a 58 0a 58 73 74 61 74 | 69 63 20 63 68 61 72 20 |.X.Xstat|ic char |
|00002c50| 2a 6c 6f 6e 67 5f 73 75 | 69 74 5f 6e 61 6d 65 73 |*long_su|it_names|
|00002c60| 20 5b 5d 20 3d 20 7b 22 | 43 4c 55 42 22 2c 20 22 | [] = {"|CLUB", "|
|00002c70| 44 49 41 4d 4f 4e 44 22 | 2c 20 22 48 45 41 52 54 |DIAMOND"|, "HEART|
|00002c80| 22 2c 20 22 53 50 41 44 | 45 22 2c 0a 58 09 09 09 |", "SPAD|E",.X...|
|00002c90| 09 20 20 20 22 4e 4f 20 | 54 52 55 4d 50 22 7d 3b |. "NO |TRUMP"};|
|00002ca0| 0a 58 0a 58 0a 58 73 74 | 61 74 69 63 20 76 6f 69 |.X.X.Xst|atic voi|
|00002cb0| 64 20 66 6f 72 6d 61 74 | 5f 73 75 69 74 20 28 62 |d format|_suit (b|
|00002cc0| 75 66 66 65 72 2c 20 68 | 2c 20 73 29 0a 58 20 20 |uffer, h|, s).X |
|00002cd0| 20 20 20 63 68 61 72 20 | 2a 62 75 66 66 65 72 3b | char |*buffer;|
|00002ce0| 20 68 61 6e 64 20 68 3b | 20 69 6e 74 20 73 3b 0a | hand h;| int s;.|
|00002cf0| 58 7b 0a 58 20 20 69 6e | 74 20 69 3b 0a 58 0a 58 |X{.X in|t i;.X.X|
|00002d00| 20 20 66 6f 72 20 28 69 | 20 3d 20 31 32 3b 20 69 | for (i| = 12; i|
|00002d10| 20 3e 3d 20 30 3b 20 69 | 2d 2d 29 0a 58 20 20 20 | >= 0; i|--).X |
|00002d20| 20 69 66 20 28 68 5b 73 | 20 2b 20 69 5d 29 0a 58 | if (h[s| + i]).X|
|00002d30| 20 20 20 20 20 20 2a 28 | 62 75 66 66 65 72 2b 2b | *(|buffer++|
|00002d40| 29 20 3d 20 2a 72 61 6e | 6b 5f 6e 61 6d 65 73 5b |) = *ran|k_names[|
|00002d50| 69 5d 3b 0a 58 20 20 2a | 62 75 66 66 65 72 20 3d |i];.X *|buffer =|
|00002d60| 20 27 5c 30 27 3b 0a 58 | 7d 3b 0a 58 0a 58 73 74 | '\0';.X|};.X.Xst|
|00002d70| 61 74 69 63 20 76 6f 69 | 64 20 6c 6f 67 5f 6c 61 |atic voi|d log_la|
|00002d80| 73 74 5f 68 61 6e 64 20 | 28 29 0a 58 2f 2a 20 57 |st_hand |().X/* W|
|00002d90| 72 69 74 65 73 20 74 68 | 65 20 6c 61 73 74 20 68 |rites th|e last h|
|00002da0| 61 6e 64 20 70 6c 61 79 | 65 64 20 74 6f 20 74 68 |and play|ed to th|
|00002db0| 65 20 6c 6f 67 66 69 6c | 65 2c 20 70 72 6f 76 69 |e logfil|e, provi|
|00002dc0| 64 65 64 20 74 68 61 74 | 20 74 68 65 20 6c 6f 67 |ded that| the log|
|00002dd0| 66 69 6c 65 0a 58 20 2e | 20 69 73 20 6f 70 65 6e |file.X .| is open|
|00002de0| 2e 20 20 49 66 20 74 68 | 65 20 6c 6f 67 66 69 6c |. If th|e logfil|
|00002df0| 65 20 69 73 20 6e 6f 74 | 20 6f 70 65 6e 2c 20 74 |e is not| open, t|
|00002e00| 68 65 6e 20 64 6f 65 73 | 20 6e 6f 74 68 69 6e 67 |hen does| nothing|
|00002e10| 2e 0a 58 20 2a 2f 0a 58 | 7b 0a 58 20 20 69 6e 74 |..X */.X|{.X int|
|00002e20| 20 69 2c 20 6a 2c 20 64 | 6f 77 6e 2c 20 65 78 63 | i, j, d|own, exc|
|00002e30| 65 73 73 2c 20 73 63 6f | 72 65 2c 20 63 6f 6e 74 |ess, sco|re, cont|
|00002e40| 72 61 63 74 6f 72 2c 20 | 70 61 73 73 65 73 2c 20 |ractor, |passes, |
|00002e50| 72 6f 75 6e 64 2c 20 6c | 65 61 64 3b 0a 58 20 20 |round, l|ead;.X |
|00002e60| 69 6e 74 20 70 6c 61 79 | 65 72 5f 6e 6f 3b 0a 58 |int play|er_no;.X|
|00002e70| 20 20 45 6d 61 69 6c 5f | 53 63 6f 72 65 20 2a 73 | Email_|Score *s|
|00002e80| 6c 69 73 74 3b 0a 58 20 | 20 45 6d 61 69 6c 5f 50 |list;.X | Email_P|
|00002e90| 61 69 72 20 20 2a 70 61 | 69 72 3b 0a 58 20 20 63 |air *pa|ir;.X c|
|00002ea0| 68 61 72 20 66 6f 72 6d | 61 74 5f 62 75 66 66 65 |har form|at_buffe|
|00002eb0| 72 20 5b 38 30 5d 3b 0a | 58 20 20 63 68 61 72 20 |r [80];.|X char |
|00002ec0| 2a 6e 6f 72 74 68 5f 6e | 61 6d 65 2c 20 2a 73 6f |*north_n|ame, *so|
|00002ed0| 75 74 68 5f 6e 61 6d 65 | 2c 20 2a 65 61 73 74 5f |uth_name|, *east_|
|00002ee0| 6e 61 6d 65 2c 20 2a 77 | 65 73 74 5f 6e 61 6d 65 |name, *w|est_name|
|00002ef0| 3b 0a 58 20 20 74 69 6d | 65 5f 74 20 63 75 72 72 |;.X tim|e_t curr|
|00002f00| 65 6e 74 5f 74 69 6d 65 | 3b 0a 58 0a 58 20 20 69 |ent_time|;.X.X i|
|00002f10| 66 20 28 6c 6f 67 66 69 | 6c 65 20 3d 3d 20 4e 55 |f (logfi|le == NU|
|00002f20| 4c 4c 29 20 72 65 74 75 | 72 6e 3b 0a 58 0a 58 20 |LL) retu|rn;.X.X |
|00002f30| 20 74 69 6d 65 20 28 26 | 63 75 72 72 65 6e 74 5f | time (&|current_|
|00002f40| 74 69 6d 65 29 3b 0a 58 | 20 20 66 70 72 69 6e 74 |time);.X| fprint|
|00002f50| 66 20 28 6c 6f 67 66 69 | 6c 65 2c 20 22 25 73 5c |f (logfi|le, "%s\|
|00002f60| 6e 22 2c 20 63 74 69 6d | 65 28 26 63 75 72 72 65 |n", ctim|e(&curre|
|00002f70| 6e 74 5f 74 69 6d 65 29 | 29 3b 0a 58 20 20 66 70 |nt_time)|);.X fp|
|00002f80| 72 69 6e 74 66 20 28 6c | 6f 67 66 69 6c 65 2c 20 |rintf (l|ogfile, |
|00002f90| 22 44 45 41 4c 45 52 3a | 20 20 25 73 5c 6e 22 2c |"DEALER:| %s\n",|
|00002fa0| 20 70 6c 61 79 65 72 5f | 6e 61 6d 65 73 5b 64 65 | player_|names[de|
|00002fb0| 61 6c 65 72 5d 29 3b 0a | 58 0a 58 20 20 69 66 20 |aler]);.|X.X if |
|00002fc0| 28 76 75 6c 6e 65 72 61 | 62 6c 65 5b 53 49 44 45 |(vulnera|ble[SIDE|
|00002fd0| 5f 4e 53 5d 20 26 26 20 | 76 75 6c 6e 65 72 61 62 |_NS] && |vulnerab|
|00002fe0| 6c 65 5b 53 49 44 45 5f | 45 57 5d 29 20 0a 58 20 |le[SIDE_|EW]) .X |
|00002ff0| 20 20 20 66 70 72 69 6e | 74 66 20 28 6c 6f 67 66 | fprin|tf (logf|
|00003000| 69 6c 65 2c 20 22 42 4f | 54 48 20 53 49 44 45 53 |ile, "BO|TH SIDES|
|00003010| 20 56 55 4c 4e 45 52 41 | 42 4c 45 5c 6e 22 29 3b | VULNERA|BLE\n");|
|00003020| 0a 58 20 20 65 6c 73 65 | 20 69 66 20 28 76 75 6c |.X else| if (vul|
|00003030| 6e 65 72 61 62 6c 65 5b | 53 49 44 45 5f 4e 53 5d |nerable[|SIDE_NS]|
|00003040| 29 0a 58 20 20 20 20 66 | 70 72 69 6e 74 66 20 28 |).X f|printf (|
|00003050| 6c 6f 67 66 69 6c 65 2c | 20 22 25 73 20 41 4e 44 |logfile,| "%s AND|
|00003060| 20 25 73 20 41 52 45 20 | 56 55 4c 4e 45 52 41 42 | %s ARE |VULNERAB|
|00003070| 4c 45 5c 6e 22 2c 0a 58 | 09 20 20 20 20 20 70 6c |LE\n",.X|. pl|
|00003080| 61 79 65 72 5f 6e 61 6d | 65 73 5b 50 4c 41 59 45 |ayer_nam|es[PLAYE|
|00003090| 52 5f 4e 4f 52 54 48 5d | 2c 20 70 6c 61 79 65 72 |R_NORTH]|, player|
|000030a0| 5f 6e 61 6d 65 73 5b 50 | 4c 41 59 45 52 5f 53 4f |_names[P|LAYER_SO|
|000030b0| 55 54 48 5d 29 3b 0a 58 | 20 20 65 6c 73 65 20 69 |UTH]);.X| else i|
|000030c0| 66 20 28 76 75 6c 6e 65 | 72 61 62 6c 65 5b 53 49 |f (vulne|rable[SI|
|000030d0| 44 45 5f 45 57 5d 29 0a | 58 20 20 20 20 66 70 72 |DE_EW]).|X fpr|
|000030e0| 69 6e 74 66 20 28 6c 6f | 67 66 69 6c 65 2c 20 22 |intf (lo|gfile, "|
|000030f0| 25 73 20 41 4e 44 20 25 | 73 20 41 52 45 20 56 55 |%s AND %|s ARE VU|
|00003100| 4c 4e 45 52 41 42 4c 45 | 5c 6e 22 2c 0a 58 09 20 |LNERABLE|\n",.X. |
|00003110| 20 20 20 20 70 6c 61 79 | 65 72 5f 6e 61 6d 65 73 | play|er_names|
|00003120| 5b 50 4c 41 59 45 52 5f | 45 41 53 54 5d 2c 20 70 |[PLAYER_|EAST], p|
|00003130| 6c 61 79 65 72 5f 6e 61 | 6d 65 73 5b 50 4c 41 59 |layer_na|mes[PLAY|
|00003140| 45 52 5f 57 45 53 54 5d | 29 3b 0a 58 20 20 65 6c |ER_WEST]|);.X el|
|00003150| 73 65 0a 58 20 20 20 20 | 66 70 72 69 6e 74 66 20 |se.X |fprintf |
|00003160| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 4e 45 49 54 48 |(logfile|, "NEITH|
|00003170| 45 52 20 53 49 44 45 20 | 49 53 20 56 55 4c 4e 45 |ER SIDE |IS VULNE|
|00003180| 52 41 42 4c 45 2e 5c 6e | 22 29 3b 0a 58 0a 58 20 |RABLE.\n|");.X.X |
|00003190| 20 66 70 72 69 6e 74 66 | 20 28 6c 6f 67 66 69 6c | fprintf| (logfil|
|000031a0| 65 2c 20 22 5c 6e 54 48 | 45 20 44 45 41 4c 3a 5c |e, "\nTH|E DEAL:\|
|000031b0| 6e 22 29 3b 0a 58 20 20 | 66 70 72 69 6e 74 66 20 |n");.X |fprintf |
|000031c0| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 5c 6e 25 31 30 |(logfile|, "\n%10|
|000031d0| 73 22 2c 22 20 22 29 3b | 0a 58 20 20 66 6f 72 20 |s"," ");|.X for |
|000031e0| 28 69 20 3d 20 30 3b 20 | 69 20 3c 20 34 3b 20 69 |(i = 0; |i < 4; i|
|000031f0| 2b 2b 29 0a 58 20 20 20 | 20 66 70 72 69 6e 74 66 |++).X | fprintf|
|00003200| 20 28 6c 6f 67 66 69 6c | 65 2c 20 22 20 20 20 20 | (logfil|e, " |
|00003210| 20 25 2d 38 73 20 20 20 | 22 2c 20 70 6c 61 79 65 | %-8s |", playe|
|00003220| 72 5f 6e 61 6d 65 73 5b | 69 5d 29 3b 0a 58 20 20 |r_names[|i]);.X |
|00003230| 66 70 72 69 6e 74 66 20 | 28 6c 6f 67 66 69 6c 65 |fprintf |(logfile|
|00003240| 2c 20 22 5c 6e 20 20 20 | 20 20 20 20 20 20 20 22 |, "\n | "|
|00003250| 29 3b 0a 58 20 20 66 6f | 72 20 28 69 20 3d 20 30 |);.X fo|r (i = 0|
|00003260| 3b 20 69 20 3c 20 34 3b | 20 69 2b 2b 29 0a 58 20 |; i < 4;| i++).X |
|00003270| 20 20 20 66 70 72 69 6e | 74 66 20 28 6c 6f 67 66 | fprin|tf (logf|
|00003280| 69 6c 65 2c 20 22 20 20 | 20 20 20 2d 2d 2d 2d 2d |ile, " | -----|
|00003290| 2d 2d 2d 20 20 20 22 29 | 3b 0a 58 20 20 66 6f 72 |--- ")|;.X for|
|000032a0| 20 28 69 20 3d 20 33 3b | 20 69 20 3e 3d 20 30 3b | (i = 3;| i >= 0;|
|000032b0| 20 69 2d 2d 29 20 7b 0a | 58 20 20 20 20 66 70 72 | i--) {.|X fpr|
|000032c0| 69 6e 74 66 20 28 6c 6f | 67 66 69 6c 65 2c 20 22 |intf (lo|gfile, "|
|000032d0| 5c 6e 25 31 30 73 53 20 | 20 20 20 22 2c 20 6c 6f |\n%10sS | ", lo|
|000032e0| 6e 67 5f 73 75 69 74 5f | 6e 61 6d 65 73 5b 69 5d |ng_suit_|names[i]|
|000032f0| 29 3b 0a 58 20 20 20 20 | 66 6f 72 20 28 6a 20 3d |);.X |for (j =|
|00003300| 20 30 3b 20 6a 20 3c 20 | 34 3b 20 6a 2b 2b 29 20 | 0; j < |4; j++) |
|00003310| 7b 0a 58 20 20 20 20 20 | 20 66 6f 72 6d 61 74 5f |{.X | format_|
|00003320| 73 75 69 74 20 28 66 6f | 72 6d 61 74 5f 62 75 66 |suit (fo|rmat_buf|
|00003330| 66 65 72 2c 20 73 61 76 | 65 64 5f 68 61 6e 64 73 |fer, sav|ed_hands|
|00003340| 5b 6a 5d 2c 20 69 20 2a | 20 31 33 29 3b 0a 58 20 |[j], i *| 13);.X |
|00003350| 20 20 20 20 20 66 70 72 | 69 6e 74 66 20 28 6c 6f | fpr|intf (lo|
|00003360| 67 66 69 6c 65 2c 20 22 | 25 2d 31 33 73 20 20 20 |gfile, "|%-13s |
|00003370| 22 2c 20 66 6f 72 6d 61 | 74 5f 62 75 66 66 65 72 |", forma|t_buffer|
|00003380| 29 3b 0a 58 20 20 20 20 | 7d 3b 0a 58 20 20 7d 3b |);.X |};.X };|
|00003390| 0a 58 0a 58 20 20 66 70 | 72 69 6e 74 66 20 28 6c |.X.X fp|rintf (l|
|000033a0| 6f 67 66 69 6c 65 2c 20 | 22 5c 6e 5c 6e 5c 6e 54 |ogfile, |"\n\n\nT|
|000033b0| 48 45 20 42 49 44 44 49 | 4e 47 3a 5c 6e 22 29 3b |HE BIDDI|NG:\n");|
|000033c0| 0a 58 20 20 66 70 72 69 | 6e 74 66 20 28 6c 6f 67 |.X fpri|ntf (log|
|000033d0| 66 69 6c 65 2c 20 22 5c | 6e 25 31 30 73 22 2c 22 |file, "\|n%10s","|
|000033e0| 20 22 29 3b 0a 58 20 20 | 66 6f 72 20 28 69 20 3d | ");.X |for (i =|
|000033f0| 20 30 3b 20 69 20 3c 20 | 34 3b 20 69 2b 2b 29 0a | 0; i < |4; i++).|
|00003400| 58 20 20 20 20 66 70 72 | 69 6e 74 66 20 28 6c 6f |X fpr|intf (lo|
|00003410| 67 66 69 6c 65 2c 20 22 | 20 20 20 20 20 25 2d 38 |gfile, "| %-8|
|00003420| 73 20 20 20 22 2c 20 70 | 6c 61 79 65 72 5f 6e 61 |s ", p|layer_na|
|00003430| 6d 65 73 5b 69 5d 29 3b | 0a 58 20 20 66 70 72 69 |mes[i]);|.X fpri|
|00003440| 6e 74 66 20 28 6c 6f 67 | 66 69 6c 65 2c 20 22 5c |ntf (log|file, "\|
|00003450| 6e 20 20 20 20 20 20 20 | 20 20 20 22 29 3b 0a 58 |n | ");.X|
|00003460| 20 20 66 6f 72 20 28 69 | 20 3d 20 30 3b 20 69 20 | for (i| = 0; i |
|00003470| 3c 20 34 3b 20 69 2b 2b | 29 0a 58 20 20 20 20 66 |< 4; i++|).X f|
|00003480| 70 72 69 6e 74 66 20 28 | 6c 6f 67 66 69 6c 65 2c |printf (|logfile,|
|00003490| 20 22 20 20 20 20 20 2d | 2d 2d 2d 2d 2d 2d 2d 20 | " -|------- |
|000034a0| 20 20 22 29 3b 0a 58 20 | 20 66 70 72 69 6e 74 66 | ");.X | fprintf|
|000034b0| 20 28 6c 6f 67 66 69 6c | 65 2c 20 22 5c 6e 25 31 | (logfil|e, "\n%1|
|000034c0| 35 73 22 2c 22 20 22 29 | 3b 0a 58 20 20 70 61 73 |5s"," ")|;.X pas|
|000034d0| 73 65 73 20 3d 20 2d 31 | 3b 0a 58 20 20 72 6f 75 |ses = -1|;.X rou|
|000034e0| 6e 64 20 3d 20 2d 31 3b | 0a 58 20 20 69 20 3d 20 |nd = -1;|.X i = |
|000034f0| 30 3b 0a 58 20 20 77 68 | 69 6c 65 20 28 70 61 73 |0;.X wh|ile (pas|
|00003500| 73 65 73 20 3c 20 33 29 | 20 7b 0a 58 20 20 20 20 |ses < 3)| {.X |
|00003510| 69 66 20 28 69 20 3d 3d | 20 64 65 61 6c 65 72 29 |if (i ==| dealer)|
|00003520| 20 72 6f 75 6e 64 2b 2b | 3b 0a 58 20 20 20 20 69 | round++|;.X i|
|00003530| 66 20 28 72 6f 75 6e 64 | 20 3e 3d 20 30 29 20 7b |f (round| >= 0) {|
|00003540| 0a 58 20 20 20 20 20 20 | 66 70 72 69 6e 74 66 20 |.X |fprintf |
|00003550| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 25 2d 38 73 25 |(logfile|, "%-8s%|
|00003560| 38 73 22 2c 20 62 69 64 | 5f 6e 61 6d 65 73 5b 62 |8s", bid|_names[b|
|00003570| 69 64 73 5b 69 5d 5b 72 | 6f 75 6e 64 5d 5d 2c 22 |ids[i][r|ound]],"|
|00003580| 20 22 29 3b 0a 58 20 20 | 20 20 20 20 69 66 20 28 | ");.X | if (|
|00003590| 62 69 64 73 5b 69 5d 5b | 72 6f 75 6e 64 5d 20 3d |bids[i][|round] =|
|000035a0| 3d 20 42 49 44 5f 50 41 | 53 53 29 20 70 61 73 73 |= BID_PA|SS) pass|
|000035b0| 65 73 2b 2b 3b 0a 58 20 | 20 20 20 20 20 65 6c 73 |es++;.X | els|
|000035c0| 65 20 70 61 73 73 65 73 | 20 3d 20 30 3b 0a 58 20 |e passes| = 0;.X |
|000035d0| 20 20 20 7d 20 65 6c 73 | 65 0a 58 20 20 20 20 20 | } els|e.X |
|000035e0| 20 66 70 72 69 6e 74 66 | 20 28 6c 6f 67 66 69 6c | fprintf| (logfil|
|000035f0| 65 2c 20 22 25 38 73 25 | 38 73 22 2c 20 22 20 22 |e, "%8s%|8s", " "|
|00003600| 2c 20 22 20 22 29 3b 0a | 58 20 20 20 20 69 20 3d |, " ");.|X i =|
|00003610| 20 70 6c 61 79 65 72 5f | 6e 65 78 74 20 5b 69 5d | player_|next [i]|
|00003620| 3b 0a 58 20 20 20 20 69 | 66 20 28 69 20 3d 3d 20 |;.X i|f (i == |
|00003630| 30 29 0a 58 20 20 20 20 | 20 20 66 70 72 69 6e 74 |0).X | fprint|
|00003640| 66 20 28 6c 6f 67 66 69 | 6c 65 2c 20 22 5c 6e 25 |f (logfi|le, "\n%|
|00003650| 31 35 73 22 2c 22 20 22 | 29 3b 0a 58 20 20 7d 3b |15s"," "|);.X };|
|00003660| 0a 58 20 20 66 70 72 69 | 6e 74 66 20 28 6c 6f 67 |.X fpri|ntf (log|
|00003670| 66 69 6c 65 2c 20 22 5c | 6e 5c 6e 25 31 35 73 43 |file, "\|n\n%15sC|
|00003680| 4f 4e 54 52 41 43 54 3a | 20 25 64 20 25 73 22 2c |ONTRACT:| %d %s",|
|00003690| 20 22 20 22 2c 20 63 6f | 6e 74 72 61 63 74 2c 20 | " ", co|ntract, |
|000036a0| 0a 58 09 20 20 20 6c 6f | 6e 67 5f 73 75 69 74 5f |.X. lo|ng_suit_|
|000036b0| 6e 61 6d 65 73 20 5b 74 | 72 75 6d 70 5f 73 75 69 |names [t|rump_sui|
|000036c0| 74 5d 29 3b 0a 58 20 20 | 69 66 20 28 28 63 6f 6e |t]);.X |if ((con|
|000036d0| 74 72 61 63 74 20 3e 20 | 31 29 20 26 26 20 28 74 |tract > |1) && (t|
|000036e0| 72 75 6d 70 5f 73 75 69 | 74 20 21 3d 20 53 55 49 |rump_sui|t != SUI|
|000036f0| 54 5f 4e 4f 54 52 55 4d | 50 29 29 0a 58 20 20 20 |T_NOTRUM|P)).X |
|00003700| 20 66 70 72 69 6e 74 66 | 20 28 6c 6f 67 66 69 6c | fprintf| (logfil|
|00003710| 65 2c 20 22 53 22 29 3b | 0a 58 20 20 69 66 20 28 |e, "S");|.X if (|
|00003720| 72 65 64 6f 75 62 6c 65 | 64 29 0a 58 20 20 20 20 |redouble|d).X |
|00003730| 66 70 72 69 6e 74 66 20 | 28 6c 6f 67 66 69 6c 65 |fprintf |(logfile|
|00003740| 2c 20 22 20 28 52 45 44 | 4f 55 42 4c 45 44 29 22 |, " (RED|OUBLED)"|
|00003750| 29 3b 0a 58 20 20 65 6c | 73 65 20 69 66 20 28 64 |);.X el|se if (d|
|00003760| 6f 75 62 6c 65 64 29 0a | 58 20 20 20 20 66 70 72 |oubled).|X fpr|
|00003770| 69 6e 74 66 20 28 6c 6f | 67 66 69 6c 65 2c 20 22 |intf (lo|gfile, "|
|00003780| 20 28 44 4f 55 42 4c 45 | 44 29 22 29 3b 0a 58 20 | (DOUBLE|D)");.X |
|00003790| 20 66 70 72 69 6e 74 66 | 20 28 6c 6f 67 66 69 6c | fprintf| (logfil|
|000037a0| 65 2c 22 20 42 59 20 25 | 73 5c 6e 22 2c 20 70 6c |e," BY %|s\n", pl|
|000037b0| 61 79 65 72 5f 6e 61 6d | 65 73 5b 64 65 63 6c 61 |ayer_nam|es[decla|
|000037c0| 72 65 72 5d 29 3b 0a 58 | 0a 58 20 20 66 70 72 69 |rer]);.X|.X fpri|
|000037d0| 6e 74 66 20 28 6c 6f 67 | 66 69 6c 65 2c 20 22 5c |ntf (log|file, "\|
|000037e0| 6e 5c 6e 5c 6e 54 48 45 | 20 50 4c 41 59 49 4e 47 |n\n\nTHE| PLAYING|
|000037f0| 3a 5c 6e 22 29 3b 0a 58 | 20 20 66 70 72 69 6e 74 |:\n");.X| fprint|
|00003800| 66 20 28 6c 6f 67 66 69 | 6c 65 2c 20 22 5c 6e 20 |f (logfi|le, "\n |
|00003810| 20 20 20 20 20 20 20 20 | 20 22 29 3b 0a 58 20 20 | | ");.X |
|00003820| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 69 20 3c 20 |for (i =| 0; i < |
|00003830| 31 33 3b 20 69 2b 2b 29 | 0a 58 20 20 20 20 66 70 |13; i++)|.X fp|
|00003840| 72 69 6e 74 66 20 28 6c | 6f 67 66 69 6c 65 2c 20 |rintf (l|ogfile, |
|00003850| 22 25 32 64 20 20 22 2c | 20 69 2b 31 29 3b 0a 58 |"%2d ",| i+1);.X|
|00003860| 20 20 66 70 72 69 6e 74 | 66 20 28 6c 6f 67 66 69 | fprint|f (logfi|
|00003870| 6c 65 2c 20 22 5c 6e 20 | 20 20 20 20 20 20 20 20 |le, "\n | |
|00003880| 20 22 29 3b 0a 58 20 20 | 66 6f 72 20 28 69 20 3d | ");.X |for (i =|
|00003890| 20 30 3b 20 69 20 3c 20 | 34 2a 31 33 2d 32 3b 20 | 0; i < |4*13-2; |
|000038a0| 69 2b 2b 29 20 66 70 72 | 69 6e 74 66 20 28 6c 6f |i++) fpr|intf (lo|
|000038b0| 67 66 69 6c 65 2c 20 22 | 2d 22 29 3b 0a 58 20 20 |gfile, "|-");.X |
|000038c0| 66 6f 72 20 28 69 20 3d | 20 30 3b 20 69 20 3c 20 |for (i =| 0; i < |
|000038d0| 34 3b 20 69 2b 2b 29 20 | 7b 0a 58 20 20 20 20 66 |4; i++) |{.X f|
|000038e0| 70 72 69 6e 74 66 20 28 | 6c 6f 67 66 69 6c 65 2c |printf (|logfile,|
|000038f0| 20 22 5c 6e 25 38 73 20 | 20 22 2c 20 70 6c 61 79 | "\n%8s | ", play|
|00003900| 65 72 5f 6e 61 6d 65 73 | 5b 69 5d 29 3b 0a 58 20 |er_names|[i]);.X |
|00003910| 20 20 20 66 6f 72 20 28 | 6a 20 3d 20 31 3b 20 6a | for (|j = 1; j|
|00003920| 20 3c 20 31 34 3b 20 6a | 2b 2b 29 20 7b 0a 58 20 | < 14; j|++) {.X |
|00003930| 20 20 20 20 20 69 66 20 | 28 73 61 76 65 64 5f 70 | if |(saved_p|
|00003940| 6c 61 79 73 5b 69 5d 5b | 6a 5d 20 21 3d 20 28 63 |lays[i][|j] != (c|
|00003950| 68 61 72 29 20 28 2d 31 | 29 29 20 7b 0a 58 09 6c |har) (-1|)) {.X.l|
|00003960| 65 61 64 20 3d 20 28 6c | 65 61 64 69 6e 67 5f 70 |ead = (l|eading_p|
|00003970| 6c 61 79 5b 6a 5d 20 3d | 3d 20 69 29 3f 20 27 2a |lay[j] =|= i)? '*|
|00003980| 27 3a 20 27 20 27 3b 0a | 58 09 66 70 72 69 6e 74 |': ' ';.|X.fprint|
|00003990| 66 20 28 6c 6f 67 66 69 | 6c 65 2c 20 22 25 32 73 |f (logfi|le, "%2s|
|000039a0| 25 63 20 22 2c 20 63 61 | 72 64 5f 6e 61 6d 65 73 |%c ", ca|rd_names|
|000039b0| 5b 73 61 76 65 64 5f 70 | 6c 61 79 73 5b 69 5d 5b |[saved_p|lays[i][|
|000039c0| 6a 5d 5d 2c 20 6c 65 61 | 64 29 3b 0a 58 20 20 20 |j]], lea|d);.X |
|000039d0| 20 20 20 7d 20 65 6c 73 | 65 0a 58 09 66 70 72 69 | } els|e.X.fpri|
|000039e0| 6e 74 66 20 28 6c 6f 67 | 66 69 6c 65 2c 20 22 20 |ntf (log|file, " |
|000039f0| 20 20 20 22 29 3b 0a 58 | 20 20 20 20 7d 3b 0a 58 | ");.X| };.X|
|00003a00| 20 20 7d 3b 0a 58 20 20 | 66 70 72 69 6e 74 66 20 | };.X |fprintf |
|00003a10| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 5c 6e 5c 6e 20 |(logfile|, "\n\n |
|00003a20| 20 20 20 20 20 20 20 20 | 20 2a 20 49 4e 44 49 43 | | * INDIC|
|00003a30| 41 54 45 53 20 54 48 45 | 20 4c 45 41 44 5c 6e 22 |ATES THE| LEAD\n"|
|00003a40| 29 3b 0a 58 0a 58 20 20 | 63 6f 6e 74 72 61 63 74 |);.X.X |contract|
|00003a50| 6f 72 20 3d 20 73 69 64 | 65 5f 6f 66 28 64 65 63 |or = sid|e_of(dec|
|00003a60| 6c 61 72 65 72 29 3b 0a | 58 2f 2a 0a 58 20 20 66 |larer);.|X/*.X f|
|00003a70| 70 72 69 6e 74 66 20 28 | 6c 6f 67 66 69 6c 65 2c |printf (|logfile,|
|00003a80| 20 22 5c 6e 5c 6e 5c 6e | 54 48 45 20 53 43 4f 52 | "\n\n\n|THE SCOR|
|00003a90| 45 53 3a 5c 6e 5c 6e 22 | 29 3b 0a 58 20 20 66 70 |ES:\n\n"|);.X fp|
|00003aa0| 72 69 6e 74 66 20 28 6c | 6f 67 66 69 6c 65 2c 20 |rintf (l|ogfile, |
|00003ab0| 22 20 20 54 52 49 43 4b | 53 20 57 4f 4e 3a 20 20 |" TRICK|S WON: |
|00003ac0| 25 32 64 5c 6e 22 2c 20 | 74 72 69 63 6b 73 5b 63 |%2d\n", |tricks[c|
|00003ad0| 6f 6e 74 72 61 63 74 6f | 72 5d 29 3b 0a 58 20 20 |ontracto|r]);.X |
|00003ae0| 66 70 72 69 6e 74 66 20 | 28 6c 6f 67 66 69 6c 65 |fprintf |(logfile|
|00003af0| 2c 20 22 20 20 54 52 49 | 43 4b 53 20 4c 4f 53 54 |, " TRI|CKS LOST|
|00003b00| 3a 20 25 32 64 5c 6e 22 | 2c 20 74 72 69 63 6b 73 |: %2d\n"|, tricks|
|00003b10| 5b 31 2d 63 6f 6e 74 72 | 61 63 74 6f 72 5d 29 3b |[1-contr|actor]);|
|00003b20| 0a 58 20 20 66 70 72 69 | 6e 74 66 20 28 6c 6f 67 |.X fpri|ntf (log|
|00003b30| 66 69 6c 65 2c 20 22 5c | 6e 22 29 3b 0a 58 2a 2f |file, "\|n");.X*/|
|00003b40| 0a 58 20 20 66 70 72 69 | 6e 74 66 20 28 6c 6f 67 |.X fpri|ntf (log|
|00003b50| 66 69 6c 65 2c 20 22 5c | 6e 20 20 42 49 44 20 25 |file, "\|n BID %|
|00003b60| 32 64 2c 20 22 2c 20 63 | 6f 6e 74 72 61 63 74 29 |2d, ", c|ontract)|
|00003b70| 3b 0a 58 20 20 69 66 20 | 28 74 72 69 63 6b 73 5b |;.X if |(tricks[|
|00003b80| 63 6f 6e 74 72 61 63 74 | 6f 72 5d 20 3e 3d 20 63 |contract|or] >= c|
|00003b90| 6f 6e 74 72 61 63 74 2b | 36 29 20 7b 0a 58 20 20 |ontract+|6) {.X |
|00003ba0| 20 20 66 70 72 69 6e 74 | 66 20 28 6c 6f 67 66 69 | fprint|f (logfi|
|00003bb0| 6c 65 2c 20 22 20 4d 41 | 44 45 20 25 32 64 22 2c |le, " MA|DE %2d",|
|00003bc0| 20 74 72 69 63 6b 73 5b | 63 6f 6e 74 72 61 63 74 | tricks[|contract|
|00003bd0| 6f 72 5d 2d 36 29 3b 0a | 58 20 20 20 20 65 78 63 |or]-6);.|X exc|
|00003be0| 65 73 73 20 3d 20 74 72 | 69 63 6b 73 5b 63 6f 6e |ess = tr|icks[con|
|00003bf0| 74 72 61 63 74 6f 72 5d | 20 2d 20 63 6f 6e 74 72 |tractor]| - contr|
|00003c00| 61 63 74 20 2d 20 36 3b | 0a 58 20 20 20 20 73 77 |act - 6;|.X sw|
|00003c10| 69 74 63 68 20 28 73 63 | 6f 72 69 6e 67 5f 6d 6f |itch (sc|oring_mo|
|00003c20| 64 65 29 20 7b 0a 58 20 | 20 20 20 20 20 20 09 63 |de) {.X | .c|
|00003c30| 61 73 65 20 52 55 42 42 | 45 52 5f 53 43 4f 52 49 |ase RUBB|ER_SCORI|
|00003c40| 4e 47 3a 0a 58 20 20 20 | 20 20 20 20 20 20 20 66 |NG:.X | f|
|00003c50| 70 72 69 6e 74 66 20 28 | 6c 6f 67 66 69 6c 65 2c |printf (|logfile,|
|00003c60| 20 22 5c 6e 5c 6e 20 20 | 50 4f 49 4e 54 53 20 41 | "\n\n |POINTS A|
|00003c70| 42 4f 56 45 20 54 48 45 | 20 4c 49 4e 45 3a 20 20 |BOVE THE| LINE: |
|00003c80| 25 35 64 5c 6e 22 2c 0a | 58 09 20 20 20 20 20 20 |%5d\n",.|X. |
|00003c90| 20 20 20 20 20 52 75 62 | 62 65 72 5f 73 63 6f 72 | Rub|ber_scor|
|00003ca0| 65 5f 61 62 6f 76 65 20 | 28 65 78 63 65 73 73 29 |e_above |(excess)|
|00003cb0| 29 3b 0a 58 20 20 20 20 | 20 20 20 20 20 20 66 70 |);.X | fp|
|00003cc0| 72 69 6e 74 66 20 28 6c | 6f 67 66 69 6c 65 2c 20 |rintf (l|ogfile, |
|00003cd0| 20 20 20 20 22 20 20 50 | 4f 49 4e 54 53 20 42 45 | " P|OINTS BE|
|00003ce0| 4c 4f 57 20 54 48 45 20 | 4c 49 4e 45 3a 20 20 25 |LOW THE |LINE: %|
|00003cf0| 35 64 5c 6e 22 2c 0a 58 | 09 20 20 20 20 20 20 20 |5d\n",.X|. |
|00003d00| 20 20 20 20 52 75 62 62 | 65 72 5f 73 63 6f 72 65 | Rubb|er_score|
|00003d10| 5f 62 65 6c 6f 77 20 28 | 29 29 3b 0a 58 09 20 20 |_below (|));.X. |
|00003d20| 62 72 65 61 6b 3b 0a 58 | 09 63 61 73 65 20 43 48 |break;.X|.case CH|
|00003d30| 49 43 41 47 4f 5f 53 43 | 4f 52 49 4e 47 3a 0a 58 |ICAGO_SC|ORING:.X|
|00003d40| 20 20 20 20 20 20 09 20 | 20 73 63 6f 72 65 20 3d | . | score =|
|00003d50| 20 43 68 69 63 61 67 6f | 5f 73 63 6f 72 65 5f 6d | Chicago|_score_m|
|00003d60| 61 64 65 20 28 65 78 63 | 65 73 73 2c 20 76 75 6c |ade (exc|ess, vul|
|00003d70| 6e 65 72 61 62 6c 65 5b | 63 6f 6e 74 72 61 63 74 |nerable[|contract|
|00003d80| 6f 72 5d 29 3b 0a 58 20 | 20 20 20 20 20 09 20 20 |or]);.X | . |
|00003d90| 69 66 20 28 28 73 63 6f | 72 65 20 3c 20 31 30 30 |if ((sco|re < 100|
|00003da0| 29 20 26 26 20 28 68 61 | 6e 64 73 5f 70 6c 61 79 |) && (ha|nds_play|
|00003db0| 65 64 25 34 20 3d 3d 20 | 30 29 29 0a 58 09 09 73 |ed%4 == |0)).X..s|
|00003dc0| 63 6f 72 65 20 2b 3d 20 | 31 30 30 3b 0a 58 20 20 |core += |100;.X |
|00003dd0| 20 20 20 20 09 20 20 66 | 70 72 69 6e 74 66 20 28 | . f|printf (|
|00003de0| 6c 6f 67 66 69 6c 65 2c | 20 22 2c 20 46 4f 52 20 |logfile,| ", FOR |
|00003df0| 41 20 53 43 4f 52 45 20 | 4f 46 20 25 35 64 5c 6e |A SCORE |OF %5d\n|
|00003e00| 22 2c 20 73 63 6f 72 65 | 29 3b 0a 58 09 20 20 62 |", score|);.X. b|
|00003e10| 72 65 61 6b 3b 0a 58 09 | 63 61 73 65 20 44 55 50 |reak;.X.|case DUP|
|00003e20| 4c 49 43 41 54 45 5f 53 | 43 4f 52 49 4e 47 3a 0a |LICATE_S|CORING:.|
|00003e30| 58 09 63 61 73 65 20 45 | 4d 41 49 4c 5f 53 43 4f |X.case E|MAIL_SCO|
|00003e40| 52 49 4e 47 3a 0a 58 09 | 63 61 73 65 20 49 4d 50 |RING:.X.|case IMP|
|00003e50| 5f 53 43 4f 52 49 4e 47 | 3a 0a 58 20 20 20 20 20 |_SCORING|:.X |
|00003e60| 20 09 20 20 66 70 72 69 | 6e 74 66 20 28 6c 6f 67 | . fpri|ntf (log|
|00003e70| 66 69 6c 65 2c 20 22 2c | 20 46 4f 52 20 41 20 53 |file, ",| FOR A S|
|00003e80| 43 4f 52 45 20 4f 46 20 | 25 35 64 5c 6e 22 2c 20 |CORE OF |%5d\n", |
|00003e90| 0a 58 09 20 20 20 20 20 | 20 20 09 20 20 20 44 75 |.X. | . Du|
|00003ea0| 70 6c 69 63 61 74 65 5f | 73 63 6f 72 65 5f 6d 61 |plicate_|score_ma|
|00003eb0| 64 65 20 28 65 78 63 65 | 73 73 2c 20 76 75 6c 6e |de (exce|ss, vuln|
|00003ec0| 65 72 61 62 6c 65 5b 63 | 6f 6e 74 72 61 63 74 6f |erable[c|ontracto|
|00003ed0| 72 5d 29 29 3b 0a 58 09 | 20 20 62 72 65 61 6b 3b |r]));.X.| break;|
|00003ee0| 0a 58 20 20 20 20 7d 0a | 58 20 20 7d 20 65 6c 73 |.X }.|X } els|
|00003ef0| 65 20 7b 0a 58 20 20 20 | 20 64 6f 77 6e 20 3d 20 |e {.X | down = |
|00003f00| 63 6f 6e 74 72 61 63 74 | 20 2b 20 36 20 2d 20 74 |contract| + 6 - t|
|00003f10| 72 69 63 6b 73 5b 63 6f | 6e 74 72 61 63 74 6f 72 |ricks[co|ntractor|
|00003f20| 5d 3b 0a 58 20 20 20 20 | 66 70 72 69 6e 74 66 20 |];.X |fprintf |
|00003f30| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 20 44 4f 57 4e |(logfile|, " DOWN|
|00003f40| 20 25 32 64 2c 20 22 2c | 20 64 6f 77 6e 29 3b 0a | %2d, ",| down);.|
|00003f50| 58 20 20 20 20 66 70 72 | 69 6e 74 66 20 28 6c 6f |X fpr|intf (lo|
|00003f60| 67 66 69 6c 65 2c 20 22 | 20 46 4f 52 20 41 20 4c |gfile, "| FOR A L|
|00003f70| 4f 53 53 20 4f 46 20 22 | 29 3b 0a 58 20 20 20 20 |OSS OF "|);.X |
|00003f80| 73 77 69 74 63 68 20 28 | 73 63 6f 72 69 6e 67 5f |switch (|scoring_|
|00003f90| 6d 6f 64 65 29 20 7b 0a | 58 20 20 20 20 20 20 20 |mode) {.|X |
|00003fa0| 09 63 61 73 65 20 52 55 | 42 42 45 52 5f 53 43 4f |.case RU|BBER_SCO|
|00003fb0| 52 49 4e 47 3a 0a 58 20 | 20 20 20 20 20 09 20 20 |RING:.X | . |
|00003fc0| 66 70 72 69 6e 74 66 20 | 28 6c 6f 67 66 69 6c 65 |fprintf |(logfile|
|00003fd0| 2c 20 22 25 35 64 5c 6e | 22 2c 20 52 75 62 62 65 |, "%5d\n|", Rubbe|
|00003fe0| 72 5f 73 63 6f 72 65 5f | 73 65 74 20 28 64 6f 77 |r_score_|set (dow|
|00003ff0| 6e 29 29 3b 0a 58 09 20 | 20 62 72 65 61 6b 3b 0a |n));.X. | break;.|
|00004000| 58 09 63 61 73 65 20 43 | 48 49 43 41 47 4f 5f 53 |X.case C|HICAGO_S|
|00004010| 43 4f 52 49 4e 47 3a 0a | 58 20 20 20 20 20 20 09 |CORING:.|X .|
|00004020| 20 20 66 70 72 69 6e 74 | 66 20 28 6c 6f 67 66 69 | fprint|f (logfi|
|00004030| 6c 65 2c 20 22 25 35 64 | 5c 6e 22 2c 20 0a 58 09 |le, "%5d|\n", .X.|
|00004040| 09 20 20 20 43 68 69 63 | 61 67 6f 5f 73 63 6f 72 |. Chic|ago_scor|
|00004050| 65 5f 73 65 74 20 28 64 | 6f 77 6e 2c 20 76 75 6c |e_set (d|own, vul|
|00004060| 6e 65 72 61 62 6c 65 5b | 63 6f 6e 74 72 61 63 74 |nerable[|contract|
|00004070| 6f 72 5d 29 29 3b 0a 58 | 09 20 20 62 72 65 61 6b |or]));.X|. break|
|00004080| 3b 0a 58 09 63 61 73 65 | 20 44 55 50 4c 49 43 41 |;.X.case| DUPLICA|
|00004090| 54 45 5f 53 43 4f 52 49 | 4e 47 3a 0a 58 09 63 61 |TE_SCORI|NG:.X.ca|
|000040a0| 73 65 20 45 4d 41 49 4c | 5f 53 43 4f 52 49 4e 47 |se EMAIL|_SCORING|
|000040b0| 3a 0a 58 09 63 61 73 65 | 20 49 4d 50 5f 53 43 4f |:.X.case| IMP_SCO|
|000040c0| 52 49 4e 47 3a 0a 58 20 | 20 20 20 20 20 09 20 20 |RING:.X | . |
|000040d0| 66 70 72 69 6e 74 66 20 | 28 6c 6f 67 66 69 6c 65 |fprintf |(logfile|
|000040e0| 2c 20 22 25 35 64 5c 6e | 22 2c 20 0a 58 09 09 20 |, "%5d\n|", .X.. |
|000040f0| 20 20 44 75 70 6c 69 63 | 61 74 65 5f 73 63 6f 72 | Duplic|ate_scor|
|00004100| 65 5f 73 65 74 20 28 64 | 6f 77 6e 2c 20 76 75 6c |e_set (d|own, vul|
|00004110| 6e 65 72 61 62 6c 65 5b | 63 6f 6e 74 72 61 63 74 |nerable[|contract|
|00004120| 6f 72 5d 29 29 3b 0a 58 | 09 20 20 62 72 65 61 6b |or]));.X|. break|
|00004130| 3b 0a 58 20 20 20 20 7d | 0a 58 20 20 7d 3b 0a 58 |;.X }|.X };.X|
|00004140| 0a 58 20 20 69 66 20 28 | 28 63 75 72 72 65 6e 74 |.X if (|(current|
|00004150| 5f 62 6f 61 72 64 20 21 | 3d 20 4e 55 4c 4c 29 20 |_board !|= NULL) |
|00004160| 26 26 20 28 63 75 72 72 | 65 6e 74 5f 62 6f 61 72 |&& (curr|ent_boar|
|00004170| 64 2d 3e 73 63 6f 72 65 | 5f 6c 69 73 74 2d 3e 6e |d->score|_list->n|
|00004180| 65 78 74 20 21 3d 20 4e | 55 4c 4c 29 29 20 7b 0a |ext != N|ULL)) {.|
|00004190| 58 20 20 20 20 73 6c 69 | 73 74 20 3d 20 63 75 72 |X sli|st = cur|
|000041a0| 72 65 6e 74 5f 62 6f 61 | 72 64 2d 3e 73 63 6f 72 |rent_boa|rd->scor|
|000041b0| 65 5f 6c 69 73 74 3b 0a | 58 20 20 20 20 66 70 72 |e_list;.|X fpr|
|000041c0| 69 6e 74 66 20 28 6c 6f | 67 66 69 6c 65 2c 20 22 |intf (lo|gfile, "|
|000041d0| 5c 6e 22 29 3b 0a 58 20 | 20 20 20 66 70 72 69 6e |\n");.X | fprin|
|000041e0| 74 66 20 28 6c 6f 67 66 | 69 6c 65 2c 20 22 20 20 |tf (logf|ile, " |
|000041f0| 25 2d 38 73 20 25 2d 38 | 73 20 25 2d 38 73 20 25 |%-8s %-8|s %-8s %|
|00004200| 2d 38 73 20 25 2d 36 73 | 20 25 32 73 20 25 36 73 |-8s %-6s| %2s %6s|
|00004210| 20 25 36 73 20 25 36 73 | 20 25 36 73 5c 6e 22 2c | %6s %6s| %6s\n",|
|00004220| 0a 58 09 20 20 20 20 20 | 22 4e 4f 52 54 48 22 2c |.X. |"NORTH",|
|00004230| 20 22 53 4f 55 54 48 22 | 2c 20 22 45 41 53 54 22 | "SOUTH"|, "EAST"|
|00004240| 2c 20 22 57 45 53 54 22 | 2c 20 22 42 49 44 22 2c |, "WEST"|, "BID",|
|00004250| 20 22 42 59 22 2c 20 22 | 52 45 53 55 4c 54 22 2c | "BY", "|RESULT",|
|00004260| 0a 58 09 20 20 20 20 20 | 22 53 43 4f 52 45 22 2c |.X. |"SCORE",|
|00004270| 20 22 4e 53 2d 4d 50 22 | 2c 20 22 45 57 2d 4d 50 | "NS-MP"|, "EW-MP|
|00004280| 22 29 3b 0a 58 20 20 20 | 20 77 68 69 6c 65 20 28 |");.X | while (|
|00004290| 73 6c 69 73 74 20 21 3d | 20 4e 55 4c 4c 29 20 7b |slist !=| NULL) {|
|000042a0| 0a 58 20 20 20 20 20 20 | 70 61 69 72 20 3d 20 65 |.X |pair = e|
|000042b0| 6d 61 69 6c 5f 72 65 63 | 6f 72 64 2d 3e 70 6c 61 |mail_rec|ord->pla|
|000042c0| 79 65 72 5f 6c 69 73 74 | 20 2b 20 73 6c 69 73 74 |yer_list| + slist|
|000042d0| 2d 3e 6e 73 5f 70 61 69 | 72 3b 0a 58 20 20 20 20 |->ns_pai|r;.X |
|000042e0| 20 20 6e 6f 72 74 68 5f | 6e 61 6d 65 20 3d 20 70 | north_|name = p|
|000042f0| 61 69 72 2d 3e 6e 65 3b | 0a 58 20 20 20 20 20 20 |air->ne;|.X |
|00004300| 73 6f 75 74 68 5f 6e 61 | 6d 65 20 3d 20 70 61 69 |south_na|me = pai|
|00004310| 72 2d 3e 73 77 3b 0a 58 | 20 20 20 20 20 20 70 61 |r->sw;.X| pa|
|00004320| 69 72 20 3d 20 65 6d 61 | 69 6c 5f 72 65 63 6f 72 |ir = ema|il_recor|
|00004330| 64 2d 3e 70 6c 61 79 65 | 72 5f 6c 69 73 74 20 2b |d->playe|r_list +|
|00004340| 20 73 6c 69 73 74 2d 3e | 65 77 5f 70 61 69 72 3b | slist->|ew_pair;|
|00004350| 0a 58 20 20 20 20 20 20 | 65 61 73 74 5f 6e 61 6d |.X |east_nam|
|00004360| 65 20 3d 20 70 61 69 72 | 2d 3e 6e 65 3b 0a 58 20 |e = pair|->ne;.X |
|00004370| 20 20 20 20 20 77 65 73 | 74 5f 6e 61 6d 65 20 3d | wes|t_name =|
|00004380| 20 70 61 69 72 2d 3e 73 | 77 3b 0a 58 20 20 20 20 | pair->s|w;.X |
|00004390| 20 20 66 70 72 69 6e 74 | 66 20 28 6c 6f 67 66 69 | fprint|f (logfi|
|000043a0| 6c 65 2c 20 22 20 20 25 | 2d 38 73 20 25 2d 38 73 |le, " %|-8s %-8s|
|000043b0| 20 25 2d 38 73 20 25 2d | 38 73 20 22 2c 20 6e 6f | %-8s %-|8s ", no|
|000043c0| 72 74 68 5f 6e 61 6d 65 | 2c 20 73 6f 75 74 68 5f |rth_name|, south_|
|000043d0| 6e 61 6d 65 2c 0a 58 09 | 20 20 20 20 20 20 20 65 |name,.X.| e|
|000043e0| 61 73 74 5f 6e 61 6d 65 | 2c 20 77 65 73 74 5f 6e |ast_name|, west_n|
|000043f0| 61 6d 65 29 3b 0a 58 20 | 20 20 20 20 20 73 70 72 |ame);.X | spr|
|00004400| 69 6e 74 66 20 28 66 6f | 72 6d 61 74 5f 62 75 66 |intf (fo|rmat_buf|
|00004410| 66 65 72 2c 20 22 25 73 | 22 2c 20 62 69 64 5f 6e |fer, "%s|", bid_n|
|00004420| 61 6d 65 73 5b 73 6c 69 | 73 74 2d 3e 62 69 64 5d |ames[sli|st->bid]|
|00004430| 29 3b 0a 58 20 20 20 20 | 20 20 69 66 20 28 73 6c |);.X | if (sl|
|00004440| 69 73 74 2d 3e 64 6f 75 | 62 6c 65 64 20 3d 3d 20 |ist->dou|bled == |
|00004450| 42 49 44 5f 52 45 44 4f | 55 42 4c 45 29 0a 58 09 |BID_REDO|UBLE).X.|
|00004460| 73 70 72 69 6e 74 66 20 | 28 66 6f 72 6d 61 74 5f |sprintf |(format_|
|00004470| 62 75 66 66 65 72 2b 73 | 74 72 6c 65 6e 28 66 6f |buffer+s|trlen(fo|
|00004480| 72 6d 61 74 5f 62 75 66 | 66 65 72 29 2c 20 22 2d |rmat_buf|fer), "-|
|00004490| 58 58 22 29 3b 0a 58 20 | 20 20 20 20 20 65 6c 73 |XX");.X | els|
|000044a0| 65 20 69 66 20 28 73 6c | 69 73 74 2d 3e 64 6f 75 |e if (sl|ist->dou|
|000044b0| 62 6c 65 64 20 3d 3d 20 | 42 49 44 5f 44 4f 55 42 |bled == |BID_DOUB|
|000044c0| 4c 45 29 0a 58 09 73 70 | 72 69 6e 74 66 20 28 66 |LE).X.sp|rintf (f|
|000044d0| 6f 72 6d 61 74 5f 62 75 | 66 66 65 72 2b 73 74 72 |ormat_bu|ffer+str|
|000044e0| 6c 65 6e 28 66 6f 72 6d | 61 74 5f 62 75 66 66 65 |len(form|at_buffe|
|000044f0| 72 29 2c 20 22 2d 58 22 | 29 3b 0a 58 20 20 20 20 |r), "-X"|);.X |
|00004500| 20 20 66 70 72 69 6e 74 | 66 20 28 6c 6f 67 66 69 | fprint|f (logfi|
|00004510| 6c 65 2c 20 22 25 2d 36 | 73 20 25 63 20 20 25 2b |le, "%-6|s %c %+|
|00004520| 36 64 20 25 36 64 20 25 | 36 2e 31 66 20 25 36 2e |6d %6d %|6.1f %6.|
|00004530| 31 66 5c 6e 22 2c 20 66 | 6f 72 6d 61 74 5f 62 75 |1f\n", f|ormat_bu|
|00004540| 66 66 65 72 2c 20 0a 58 | 09 20 20 20 20 20 20 20 |ffer, .X|. |
|00004550| 2a 28 22 4e 45 53 57 22 | 20 2b 20 73 6c 69 73 74 |*("NESW"| + slist|
|00004560| 2d 3e 63 6f 6e 74 72 61 | 63 74 6f 72 29 2c 20 73 |->contra|ctor), s|
|00004570| 6c 69 73 74 2d 3e 72 65 | 73 75 6c 74 2c 20 73 6c |list->re|sult, sl|
|00004580| 69 73 74 2d 3e 6e 73 5f | 73 63 6f 72 65 2c 0a 58 |ist->ns_|score,.X|
|00004590| 09 20 20 20 20 20 20 20 | 30 2e 35 20 2a 20 28 28 |. |0.5 * ((|
|000045a0| 66 6c 6f 61 74 29 20 73 | 6c 69 73 74 2d 3e 6e 73 |float) s|list->ns|
|000045b0| 5f 6d 61 74 63 68 5f 70 | 6f 69 6e 74 73 29 2c 0a |_match_p|oints),.|
|000045c0| 58 09 20 20 20 20 20 20 | 20 30 2e 35 20 2a 20 28 |X. | 0.5 * (|
|000045d0| 28 66 6c 6f 61 74 29 20 | 73 6c 69 73 74 2d 3e 65 |(float) |slist->e|
|000045e0| 77 5f 6d 61 74 63 68 5f | 70 6f 69 6e 74 73 29 29 |w_match_|points))|
|000045f0| 3b 0a 58 20 20 20 20 20 | 20 73 6c 69 73 74 20 3d |;.X | slist =|
|00004600| 20 73 6c 69 73 74 2d 3e | 6e 65 78 74 3b 0a 58 20 | slist->|next;.X |
|00004610| 20 20 20 7d 3b 0a 58 20 | 20 7d 3b 0a 58 0a 58 20 | };.X | };.X.X |
|00004620| 20 66 70 72 69 6e 74 66 | 20 28 6c 6f 67 66 69 6c | fprintf| (logfil|
|00004630| 65 2c 20 22 5c 6e 5c 6e | 22 29 3b 0a 58 20 20 66 |e, "\n\n|");.X f|
|00004640| 6f 72 20 28 69 20 3d 20 | 30 3b 20 69 20 3c 20 37 |or (i = |0; i < 7|
|00004650| 32 3b 20 69 2b 2b 29 0a | 58 20 20 20 20 66 70 72 |2; i++).|X fpr|
|00004660| 69 6e 74 66 20 28 6c 6f | 67 66 69 6c 65 2c 20 22 |intf (lo|gfile, "|
|00004670| 3d 22 29 3b 0a 58 20 20 | 66 70 72 69 6e 74 66 20 |=");.X |fprintf |
|00004680| 28 6c 6f 67 66 69 6c 65 | 2c 20 22 5c 6e 25 63 5c |(logfile|, "\n%c\|
|00004690| 6e 22 2c 20 31 32 29 3b | 0a 58 20 20 66 66 6c 75 |n", 12);|.X fflu|
|000046a0| 73 68 20 28 6c 6f 67 66 | 69 6c 65 29 3b 0a 58 7d |sh (logf|ile);.X}|
|000046b0| 3b 0a 58 0a 58 0a 58 73 | 74 61 74 69 63 20 76 6f |;.X.X.Xs|tatic vo|
|000046c0| 69 64 20 7a 68 61 6e 67 | 5f 6c 6f 67 5f 6c 61 73 |id zhang|_log_las|
|000046d0| 74 5f 68 61 6e 64 20 28 | 29 0a 58 2f 2a 20 54 68 |t_hand (|).X/* Th|
|000046e0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 72 6f 75 74 |e follow|ing rout|
|000046f0| 69 6e 65 20 69 73 20 53 | 2e 20 5a 68 61 6e 67 27 |ine is S|. Zhang'|
|00004700| 73 20 72 6f 75 74 69 6e | 65 20 66 6f 72 20 77 72 |s routin|e for wr|
|00004710| 69 74 69 6e 67 20 74 68 | 65 20 6c 6f 67 20 66 69 |iting th|e log fi|
|00004720| 6c 65 2e 0a 58 20 2e 20 | 54 68 69 73 20 63 6f 6e |le..X . |This con|
|00004730| 73 74 69 74 75 74 65 73 | 20 74 68 65 20 68 65 61 |stitutes| the hea|
|00004740| 72 74 20 6f 66 20 68 69 | 73 20 22 6f 6b 62 64 22 |rt of hi|s "okbd"|
|00004750| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 6f 6b 62 72 | version| of okbr|
|00004760| 69 64 67 65 2e 0a 58 20 | 2e 20 49 74 20 68 61 73 |idge..X |. It has|
|00004770| 20 62 65 65 6e 20 6d 6f | 64 69 66 69 65 64 20 66 | been mo|dified f|
|00004780| 72 6f 6d 20 74 68 65 20 | 6c 6f 67 5f 6c 61 73 74 |rom the |log_last|
|00004790| 5f 68 61 6e 64 20 70 72 | 6f 63 65 64 75 72 65 0a |_hand pr|ocedure.|
|000047a0| 58 20 2e 20 62 79 20 53 | 68 61 6e 67 79 6f 75 20 |X . by S|hangyou |
|000047b0| 5a 68 61 6e 67 2c 20 73 | 7a 68 61 6e 67 40 6d 61 |Zhang, s|zhang@ma|
|000047c0| 74 68 2e 75 64 65 6c 2e | 65 64 75 2e 0a 58 20 2a |th.udel.|edu..X *|
|000047d0| 2f 0a 58 7b 20 0a 58 20 | 20 69 6e 74 20 69 2c 20 |/.X{ .X | int i, |
|000047e0| 6a 2c 20 64 6f 77 6e 2c | 20 65 78 63 65 73 73 2c |j, down,| excess,|
|000047f0| 20 73 63 6f 72 65 2c 20 | 63 6f 6e 74 72 61 63 74 | score, |contract|
|00004800| 6f 72 2c 20 70 61 73 73 | 65 73 2c 20 72 6f 75 6e |or, pass|es, roun|
|00004810| 64 2c 20 6c 65 61 64 3b | 0a 58 20 20 69 6e 74 20 |d, lead;|.X int |
|00004820| 72 5f 72 6f 75 6e 64 3b | 0a 58 20 20 63 68 61 72 |r_round;|.X char|
|00004830| 20 66 6f 72 6d 61 74 5f | 62 75 66 66 65 72 20 5b | format_|buffer [|
|00004840| 38 30 5d 3b 0a 58 20 20 | 63 68 61 72 20 2a 62 69 |80];.X |char *bi|
|00004850| 64 5f 7a 68 61 6e 67 5b | 34 5d 5b 32 30 5d 3b 0a |d_zhang[|4][20];.|
|00004860| 58 20 20 63 68 61 72 20 | 7a 68 61 6e 67 5b 34 5d |X char |zhang[4]|
|00004870| 3b 0a 58 20 20 74 69 6d | 65 5f 74 20 63 75 72 72 |;.X tim|e_t curr|
|00004880| 65 6e 74 5f 74 69 6d 65 | 3b 0a 58 20 20 73 74 72 |ent_time|;.X str|
|00004890| 75 63 74 20 74 6d 20 2a | 64 65 63 6f 64 65 64 5f |uct tm *|decoded_|
|000048a0| 74 69 6d 65 3b 0a 58 0a | 58 20 20 7a 68 61 6e 67 |time;.X.|X zhang|
|000048b0| 5b 30 5d 3d 27 4e 27 3b | 20 7a 68 61 6e 67 5b 31 |[0]='N';| zhang[1|
|000048c0| 5d 3d 27 45 27 3b 20 20 | 7a 68 61 6e 67 5b 32 5d |]='E'; |zhang[2]|
|000048d0| 3d 27 53 27 3b 20 7a 68 | 61 6e 67 5b 33 5d 3d 27 |='S'; zh|ang[3]='|
|000048e0| 57 27 3b 0a 58 0a 58 20 | 20 69 66 20 28 7a 68 61 |W';.X.X | if (zha|
|000048f0| 6e 67 5f 6c 6f 67 66 69 | 6c 65 20 3d 3d 20 4e 55 |ng_logfi|le == NU|
|00004900| 4c 4c 29 20 72 65 74 75 | 72 6e 3b 0a 58 20 20 66 |LL) retu|rn;.X f|
|00004910| 6f 72 20 28 69 20 3d 20 | 30 3b 20 69 20 3c 20 34 |or (i = |0; i < 4|
|00004920| 3b 20 69 2b 2b 29 7b 66 | 70 72 69 6e 74 66 28 7a |; i++){f|printf(z|
|00004930| 68 61 6e 67 5f 6c 6f 67 | 66 69 6c 65 2c 20 0a 58 |hang_log|file, .X|
|00004940| 20 20 20 20 20 20 20 20 | 20 22 20 25 2d 38 2e 38 | | " %-8.8|
|00004950| 73 20 22 2c 20 70 6c 61 | 79 65 72 5f 6e 61 6d 65 |s ", pla|yer_name|
|00004960| 73 5b 69 5d 29 3b 0a 58 | 20 20 20 20 66 6f 72 20 |s[i]);.X| for |
|00004970| 28 6a 20 3d 20 33 3b 20 | 6a 20 3e 3d 20 30 3b 20 |(j = 3; |j >= 0; |
|00004980| 6a 2d 2d 29 20 7b 0a 58 | 20 20 20 20 20 20 66 6f |j--) {.X| fo|
|00004990| 72 6d 61 74 5f 73 75 69 | 74 20 28 66 6f 72 6d 61 |rmat_sui|t (forma|
|000049a0| 74 5f 62 75 66 66 65 72 | 2c 20 73 61 76 65 64 5f |t_buffer|, saved_|
|000049b0| 68 61 6e 64 73 5b 69 5d | 2c 20 6a 20 2a 20 31 33 |hands[i]|, j * 13|
|000049c0| 29 3b 0a 58 20 20 20 20 | 20 20 66 70 72 69 6e 74 |);.X | fprint|
|000049d0| 66 20 28 7a 68 61 6e 67 | 5f 6c 6f 67 66 69 6c 65 |f (zhang|_logfile|
|000049e0| 2c 20 22 20 25 2d 31 33 | 73 22 2c 20 66 6f 72 6d |, " %-13|s", form|
|000049f0| 61 74 5f 62 75 66 66 65 | 72 29 3b 0a 58 20 20 20 |at_buffe|r);.X |
|00004a00| 20 7d 3b 20 20 20 20 66 | 70 72 69 6e 74 66 20 28 | }; f|printf (|
|00004a10| 7a 68 61 6e 67 5f 6c 6f | 67 66 69 6c 65 2c 20 22 |zhang_lo|gfile, "|
|00004a20| 5c 6e 22 29 3b 0a 58 20 | 20 7d 3b 0a 58 0a 58 20 |\n");.X | };.X.X |
|00004a30| 20 63 6f 6e 74 72 61 63 | 74 6f 72 20 3d 20 73 69 | contrac|tor = si|
|00004a40| 64 65 5f 6f 66 28 64 65 | 63 6c 61 72 65 72 29 3b |de_of(de|clarer);|
|00004a50| 0a 58 20 20 66 70 72 69 | 6e 74 66 28 7a 68 61 6e |.X fpri|ntf(zhan|
|00004a60| 67 5f 6c 6f 67 66 69 6c | 65 2c 20 22 25 33 64 2e |g_logfil|e, "%3d.|
|00004a70| 28 74 61 62 25 33 64 29 | 22 2c 20 63 75 72 72 65 |(tab%3d)|", curre|
|00004a80| 6e 74 5f 64 65 61 6c 5f | 6e 6f 2c 20 74 61 62 6c |nt_deal_|no, tabl|
|00004a90| 65 5f 6e 6f 29 3b 0a 58 | 0a 58 20 20 66 70 72 69 |e_no);.X|.X fpri|
|00004aa0| 6e 74 66 20 28 7a 68 61 | 6e 67 5f 6c 6f 67 66 69 |ntf (zha|ng_logfi|
|00004ab0| 6c 65 2c 22 20 20 20 25 | 36 2e 36 73 2d 25 63 3a |le," %|6.6s-%c:|
|00004ac0| 22 2c 20 70 6c 61 79 65 | 72 5f 6e 61 6d 65 73 5b |", playe|r_names[|
|00004ad0| 64 65 63 6c 61 72 65 72 | 5d 2c 0a 58 20 20 20 20 |declarer|],.X |
|00004ae0| 20 20 20 20 20 20 20 20 | 20 20 7a 68 61 6e 67 5b | | zhang[|
|00004af0| 64 65 63 6c 61 72 65 72 | 5d 29 3b 20 20 20 0a 58 |declarer|]); .X|
|00004b00| 20 20 66 70 72 69 6e 74 | 66 20 28 7a 68 61 6e 67 | fprint|f (zhang|
|00004b10| 5f 6c 6f 67 66 69 6c 65 | 2c 20 22 25 64 25 31 2e |_logfile|, "%d%1.|
|00004b20| 31 73 22 2c 20 0a 58 20 | 20 20 20 20 20 20 20 63 |1s", .X | c|
|00004b30| 6f 6e 74 72 61 63 74 2c | 20 6c 6f 6e 67 5f 73 75 |ontract,| long_su|
|00004b40| 69 74 5f 6e 61 6d 65 73 | 20 5b 74 72 75 6d 70 5f |it_names| [trump_|
|00004b50| 73 75 69 74 5d 20 29 3b | 20 20 0a 58 20 20 69 66 |suit] );| .X if|
|00004b60| 20 28 72 65 64 6f 75 62 | 6c 65 64 29 20 20 20 20 | (redoub|led) |
|00004b70| 20 20 20 20 20 66 70 72 | 69 6e 74 66 20 28 7a 68 | fpr|intf (zh|
|00004b80| 61 6e 67 5f 6c 6f 67 66 | 69 6c 65 2c 20 22 58 58 |ang_logf|ile, "XX|
|00004b90| 22 29 3b 20 0a 58 20 20 | 65 6c 73 65 20 69 66 20 |"); .X |else if |
|00004ba0| 28 64 6f 75 62 6c 65 64 | 29 20 20 20 20 20 20 66 |(doubled|) f|
|00004bb0| 70 72 69 6e 74 66 20 28 | 7a 68 61 6e 67 5f 6c 6f |printf (|zhang_lo|
|00004bc0| 67 66 69 6c 65 2c 20 22 | 58 20 22 29 3b 20 20 0a |gfile, "|X "); .|
|00004bd0| 58 20 20 65 6c 73 65 20 | 20 20 20 20 20 20 20 20 |X else | |
|00004be0| 20 20 20 20 20 20 20 20 | 20 20 66 70 72 69 6e 74 | | fprint|
|00004bf0| 66 20 28 7a 68 61 6e 67 | 5f 6c 6f 67 66 69 6c 65 |f (zhang|_logfile|
|00004c00| 2c 20 22 20 20 22 29 3b | 0a 58 0a 58 20 20 69 66 |, " ");|.X.X if|
|00004c10| 20 28 74 72 69 63 6b 73 | 5b 63 6f 6e 74 72 61 63 | (tricks|[contrac|
|00004c20| 74 6f 72 5d 20 3e 3d 20 | 63 6f 6e 74 72 61 63 74 |tor] >= |contract|
|00004c30| 2b 36 29 20 7b 0a 58 20 | 20 20 20 66 70 72 69 6e |+6) {.X | fprin|
|00004c40| 74 66 20 28 7a 68 61 6e | 67 5f 6c 6f 67 66 69 6c |tf (zhan|g_logfil|
|00004c50| 65 2c 20 22 20 2d 2d 20 | 4d 61 64 65 20 25 32 64 |e, " -- |Made %2d|
|00004c60| 20 20 7c 20 20 22 2c 20 | 0a 58 09 20 20 20 20 20 | | ", |.X. |
|00004c70| 28 63 6f 6e 74 72 61 63 | 74 20 3d 3d 20 30 29 3f |(contrac|t == 0)?|
|00004c80| 20 30 3a 20 74 72 69 63 | 6b 73 5b 63 6f 6e 74 72 | 0: tric|ks[contr|
|00004c90| 61 63 74 6f 72 5d 2d 36 | 29 3b 0a 58 20 20 7d 20 |actor]-6|);.X } |
|00004ca0| 65 6c 73 65 20 7b 20 64 | 6f 77 6e 20 3d 20 63 6f |else { d|own = co|
|00004cb0| 6e 74 72 61 63 74 20 2b | 20 36 20 2d 20 74 72 69 |ntract +| 6 - tri|
|00004cc0| 63 6b 73 5b 63 6f 6e 74 | 72 61 63 74 6f 72 5d 3b |cks[cont|ractor];|
|00004cd0| 0a 58 20 20 20 20 66 70 | 72 69 6e 74 66 20 28 7a |.X fp|rintf (z|
|00004ce0| 68 61 6e 67 5f 6c 6f 67 | 66 69 6c 65 2c 20 22 20 |hang_log|file, " |
|00004cf0| 2d 2d 20 44 6f 77 6e 20 | 25 32 64 20 20 7c 20 20 |-- Down |%2d | |
|00004d00| 22 2c 20 64 6f 77 6e 29 | 3b 0a 58 20 20 7d 3b 0a |", down)|;.X };.|
|00004d10| 58 0a 58 20 20 69 66 20 | 28 76 75 6c 6e 65 72 61 |X.X if |(vulnera|
|00004d20| 62 6c 65 5b 53 49 44 45 | 5f 4e 53 5d 20 26 26 20 |ble[SIDE|_NS] && |
|00004d30| 76 75 6c 6e 65 72 61 62 | 6c 65 5b 53 49 44 45 5f |vulnerab|le[SIDE_|
|00004d40| 45 57 5d 29 20 20 0a 58 | 20 20 20 20 20 20 20 20 |EW]) .X| |
|00004d50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004d60| 20 20 20 20 20 20 20 20 | 66 70 72 69 6e 74 66 20 | |fprintf |
|00004d70| 28 7a 68 61 6e 67 5f 6c | 6f 67 66 69 6c 65 2c 20 |(zhang_l|ogfile, |
|00004d80| 22 56 75 6c 3a 42 4f 54 | 48 20 7c 20 20 22 29 3b |"Vul:BOT|H | ");|
|00004d90| 0a 58 20 20 65 6c 73 65 | 20 69 66 20 28 76 75 6c |.X else| if (vul|
|00004da0| 6e 65 72 61 62 6c 65 5b | 53 49 44 45 5f 4e 53 5d |nerable[|SIDE_NS]|
|00004db0| 29 20 66 70 72 69 6e 74 | 66 20 28 7a 68 61 6e 67 |) fprint|f (zhang|
|00004dc0| 5f 6c 6f 67 66 69 6c 65 | 2c 20 22 56 75 6c 3a 4e |_logfile|, "Vul:N|
|00004dd0| 26 53 20 20 7c 20 20 22 | 29 3b 0a 58 20 20 65 6c |&S | "|);.X el|
|00004de0| 73 65 20 69 66 20 28 76 | 75 6c 6e 65 72 61 62 6c |se if (v|ulnerabl|
|00004df0| 65 5b 53 49 44 45 5f 45 | 57 5d 29 20 66 70 72 69 |e[SIDE_E|W]) fpri|
|00004e00| 6e 74 66 20 28 7a 68 61 | 6e 67 5f 6c 6f 67 66 69 |ntf (zha|ng_logfi|
|00004e10| 6c 65 2c 20 22 56 75 6c | 3a 45 26 57 20 20 7c 20 |le, "Vul|:E&W | |
|00004e20| 20 22 29 3b 0a 58 20 20 | 65 6c 73 65 20 20 20 20 | ");.X |else |
|00004e30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004e40| 20 20 20 20 20 20 66 70 | 72 69 6e 74 66 20 28 7a | fp|rintf (z|
|00004e50| 68 61 6e 67 5f 6c 6f 67 | 66 69 6c 65 2c 20 22 56 |hang_log|file, "V|
|00004e60| 75 6c 3a 4e 4f 4e 45 20 | 7c 20 20 22 29 3b 0a 58 |ul:NONE || ");.X|
|00004e70| 0a 58 0a 58 20 20 69 66 | 20 28 74 72 69 63 6b 73 |.X.X if| (tricks|
|00004e80| 5b 63 6f 6e 74 72 61 63 | 74 6f 72 5d 20 3e 3d 20 |[contrac|tor] >= |
|00004e90| 63 6f 6e 74 72 61 63 74 | 2b 36 29 20 7b 0a 58 20 |contract|+6) {.X |
|00004ea0| 20 20 20 69 66 20 28 20 | 63 6f 6e 74 72 61 63 74 | if ( |contract|
|00004eb0| 6f 72 20 3d 3d 20 53 49 | 44 45 5f 4e 53 20 29 20 |or == SI|DE_NS ) |
|00004ec0| 20 7b 66 70 72 69 6e 74 | 66 20 28 7a 68 61 6e 67 | {fprint|f (zhang|
|00004ed0| 5f 6c 6f 67 66 69 6c 65 | 2c 20 22 20 4e 53 3a 20 |_logfile|, " NS: |
|00004ee0| 20 22 29 3b 7d 20 0a 58 | 20 20 20 20 20 20 20 20 | ");} .X| |
|00004ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004f00| 20 20 20 20 20 65 6c 73 | 65 20 20 66 70 72 69 6e | els|e fprin|
|00004f10| 74 66 20 28 7a 68 61 6e | 67 5f 6c 6f 67 66 69 6c |tf (zhan|g_logfil|
|00004f20| 65 2c 20 22 2a 4e 53 3a | 20 2d 22 29 3b 0a 58 20 |e, "*NS:| -");.X |
|00004f30| 20 20 20 65 78 63 65 73 | 73 20 3d 20 74 72 69 63 | exces|s = tric|
|00004f40| 6b 73 5b 63 6f 6e 74 72 | 61 63 74 6f 72 5d 20 2d |ks[contr|actor] -|
|00004f50| 20 63 6f 6e 74 72 61 63 | 74 20 2d 20 36 3b 0a 58 | contrac|t - 6;.X|
|00004f60| 20 20 20 20 69 66 20 28 | 63 6f 6e 74 72 61 63 74 | if (|contract|
|00004f70| 20 3d 3d 20 30 29 0a 58 | 20 20 20 20 20 20 66 70 | == 0).X| fp|
|00004f80| 72 69 6e 74 66 20 28 7a | 68 61 6e 67 5f 6c 6f 67 |rintf (z|hang_log|
|00004f90| 66 69 6c 65 2c 20 22 30 | 20 20 22 29 3b 0a 58 20 |file, "0| ");.X |
|00004fa0| 20 20 20 65 6c 73 65 0a | 58 20 20 20 20 20 20 66 | else.|X f|
|00004fb0| 70 72 69 6e 74 66 20 28 | 7a 68 61 6e 67 5f 6c 6f |printf (|zhang_lo|
|00004fc0| 67 66 69 6c 65 2c 20 22 | 25 64 20 22 2c 20 0a 58 |gfile, "|%d ", .X|
|00004fd0| 09 20 20 20 20 20 20 20 | 44 75 70 6c 69 63 61 74 |. |Duplicat|
|00004fe0| 65 5f 73 63 6f 72 65 5f | 6d 61 64 65 20 28 65 78 |e_score_|made (ex|
|00004ff0| 63 65 73 73 2c 20 76 75 | 6c 6e 65 72 61 62 6c 65 |cess, vu|lnerable|
|00005000| 5b 63 6f 6e 74 72 61 63 | 74 6f 72 5d 29 29 3b 0a |[contrac|tor]));.|
|00005010| 58 20 20 7d 20 65 6c 73 | 65 20 7b 0a 58 20 20 20 |X } els|e {.X |
|00005020| 20 64 6f 77 6e 20 3d 20 | 63 6f 6e 74 72 61 63 74 | down = |contract|
|00005030| 20 2b 20 36 20 2d 20 74 | 72 69 63 6b 73 5b 63 6f | + 6 - t|ricks[co|
|00005040| 6e 74 72 61 63 74 6f 72 | 5d 3b 0a 58 20 20 20 20 |ntractor|];.X |
|00005050| 69 66 20 28 20 63 6f 6e | 74 72 61 63 74 6f 72 20 |if ( con|tractor |
|00005060| 3d 3d 20 53 49 44 45 5f | 4e 53 20 29 20 20 7b 66 |== SIDE_|NS ) {f|
|00005070| 70 72 69 6e 74 66 20 28 | 7a 68 61 6e 67 5f 6c 6f |printf (|zhang_lo|
|00005080| 67 66 69 6c 65 2c 20 22 | 20 4e 53 3a 20 2d 22 29 |gfile, "| NS: -")|
|00005090| 3b 7d 20 0a 58 20 20 20 | 20 20 20 20 20 20 20 20 |;} .X | |
|000050a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000050b0| 20 20 65 6c 73 65 20 20 | 66 70 72 69 6e 74 66 20 | else |fprintf |
|000050c0| 28 7a 68 61 6e 67 5f 6c | 6f 67 66 69 6c 65 2c 20 |(zhang_l|ogfile, |
|000050d0| 22 2a 4e 53 3a 20 20 22 | 29 3b 0a 58 20 20 20 20 |"*NS: "|);.X |
|000050e0| 66 70 72 69 6e 74 66 20 | 28 7a 68 61 6e 67 5f 6c |fprintf |(zhang_l|
|000050f0| 6f 67 66 69 6c 65 2c 20 | 22 25 64 20 22 2c 20 0a |ogfile, |"%d ", .|
|00005100| 58 09 44 75 70 6c 69 63 | 61 74 65 5f 73 63 6f 72 |X.Duplic|ate_scor|
|00005110| 65 5f 73 65 74 20 28 64 | 6f 77 6e 2c 20 76 75 6c |e_set (d|own, vul|
|00005120| 6e 65 72 61 62 6c 65 5b | 63 6f 6e 74 72 61 63 74 |nerable[|contract|
|00005130| 6f 72 5d 29 29 3b 0a 58 | 20 20 7d 3b 0a 58 0a 58 |or]));.X| };.X.X|
|00005140| 20 20 66 6f 72 20 28 69 | 3d 30 3b 20 69 3c 34 3b | for (i|=0; i<4;|
|00005150| 20 69 2b 2b 29 20 66 6f | 72 20 28 6a 3d 30 3b 20 | i++) fo|r (j=0; |
|00005160| 6a 3c 32 30 3b 20 6a 2b | 2b 29 20 62 69 64 5f 7a |j<20; j+|+) bid_z|
|00005170| 68 61 6e 67 5b 69 5d 5b | 6a 5d 3d 22 20 20 22 3b |hang[i][|j]=" ";|
|00005180| 0a 58 0a 58 20 20 70 61 | 73 73 65 73 20 3d 20 2d |.X.X pa|sses = -|
|00005190| 31 3b 20 20 72 6f 75 6e | 64 20 3d 20 2d 31 3b 20 |1; roun|d = -1; |
|000051a0| 20 72 5f 72 6f 75 6e 64 | 3d 30 3b 20 20 69 20 3d | r_round|=0; i =|
|000051b0| 20 30 3b 0a 58 20 20 77 | 68 69 6c 65 20 28 70 61 | 0;.X w|hile (pa|
|000051c0| 73 73 65 73 20 3c 20 33 | 29 20 7b 0a 58 20 20 20 |sses < 3|) {.X |
|000051d0| 20 69 66 20 28 69 20 3d | 3d 20 64 65 61 6c 65 72 | if (i =|= dealer|
|000051e0| 29 20 72 6f 75 6e 64 2b | 2b 3b 0a 58 20 20 20 20 |) round+|+;.X |
|000051f0| 69 66 20 28 72 6f 75 6e | 64 20 3e 3d 20 30 29 20 |if (roun|d >= 0) |
|00005200| 7b 0a 58 20 20 20 20 20 | 20 62 69 64 5f 7a 68 61 |{.X | bid_zha|
|00005210| 6e 67 5b 69 5d 5b 72 5f | 72 6f 75 6e 64 5d 3d 20 |ng[i][r_|round]= |
|00005220| 62 69 64 5f 6e 61 6d 65 | 73 5b 62 69 64 73 5b 69 |bid_name|s[bids[i|
|00005230| 5d 5b 72 6f 75 6e 64 5d | 5d 3b 0a 58 20 20 20 20 |][round]|];.X |
|00005240| 20 20 69 66 20 28 62 69 | 64 73 5b 69 5d 5b 72 6f | if (bi|ds[i][ro|
|00005250| 75 6e 64 5d 20 3d 3d 20 | 42 49 44 5f 50 41 53 53 |und] == |BID_PASS|
|00005260| 29 20 70 61 73 73 65 73 | 2b 2b 3b 0a 58 20 20 20 |) passes|++;.X |
|00005270| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005280| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 65 6c | | el|
|00005290| 73 65 20 70 61 73 73 65 | 73 20 3d 20 30 3b 0a 58 |se passe|s = 0;.X|
|000052a0| 20 20 20 20 7d 0a 58 20 | 20 20 20 69 20 3d 20 70 | }.X | i = p|
|000052b0| 6c 61 79 65 72 5f 6e 65 | 78 74 20 5b 69 5d 3b 20 |layer_ne|xt [i]; |
|000052c0| 20 0a 58 20 20 20 20 69 | 66 20 28 20 28 69 3d 3d | .X i|f ( (i==|
|000052d0| 30 29 20 26 26 20 70 61 | 73 73 65 73 3c 33 20 29 |0) && pa|sses<3 )|
|000052e0| 20 72 5f 72 6f 75 6e 64 | 2b 2b 3b 0a 58 20 20 7d | r_round|++;.X }|
|000052f0| 3b 0a 58 0a 58 20 20 66 | 6f 72 20 28 69 20 3d 20 |;.X.X f|or (i = |
|00005300| 30 3b 20 69 20 3c 20 34 | 3b 20 69 2b 2b 29 20 7b |0; i < 4|; i++) {|
|00005310| 0a 58 20 20 20 20 66 70 | 72 69 6e 74 66 28 7a 68 |.X fp|rintf(zh|
|00005320| 61 6e 67 5f 6c 6f 67 66 | 69 6c 65 2c 22 5c 6e 25 |ang_logf|ile,"\n%|
|00005330| 63 2d 25 2d 38 2e 38 73 | 22 2c 7a 68 61 6e 67 5b |c-%-8.8s|",zhang[|
|00005340| 69 5d 2c 70 6c 61 79 65 | 72 5f 6e 61 6d 65 73 5b |i],playe|r_names[|
|00005350| 69 5d 29 3b 0a 58 20 20 | 20 20 66 6f 72 20 28 6a |i]);.X | for (j|
|00005360| 20 3d 20 31 3b 20 6a 20 | 3c 20 31 34 3b 20 6a 2b | = 1; j |< 14; j+|
|00005370| 2b 29 20 7b 0a 58 20 20 | 20 20 20 20 69 66 20 28 |+) {.X | if (|
|00005380| 73 61 76 65 64 5f 70 6c | 61 79 73 5b 69 5d 5b 6a |saved_pl|ays[i][j|
|00005390| 5d 20 21 3d 20 28 63 68 | 61 72 29 20 28 2d 31 29 |] != (ch|ar) (-1)|
|000053a0| 29 20 7b 0a 58 09 6c 65 | 61 64 20 3d 20 28 6c 65 |) {.X.le|ad = (le|
|000053b0| 61 64 69 6e 67 5f 70 6c | 61 79 5b 6a 5d 20 3d 3d |ading_pl|ay[j] ==|
|000053c0| 20 69 29 3f 20 27 2a 27 | 3a 20 27 20 27 3b 0a 58 | i)? '*'|: ' ';.X|
|000053d0| 09 69 66 20 28 28 6c 65 | 61 64 20 3d 3d 27 20 27 |.if ((le|ad ==' '|
|000053e0| 29 26 26 28 69 3d 3d 33 | 29 20 29 20 6c 65 61 64 |)&&(i==3|) ) lead|
|000053f0| 3d 27 5f 27 3b 0a 58 09 | 66 70 72 69 6e 74 66 20 |='_';.X.|fprintf |
|00005400| 28 7a 68 61 6e 67 5f 6c | 6f 67 66 69 6c 65 2c 20 |(zhang_l|ogfile, |
|00005410| 22 25 32 73 25 63 22 2c | 20 63 61 72 64 5f 6e 61 |"%2s%c",| card_na|
|00005420| 6d 65 73 5b 73 61 76 65 | 64 5f 70 6c 61 79 73 5b |mes[save|d_plays[|
|00005430| 69 5d 5b 6a 5d 5d 2c 20 | 6c 65 61 64 29 3b 0a 58 |i][j]], |lead);.X|
|00005440| 20 20 20 20 20 20 7d 20 | 65 6c 73 65 0a 58 09 66 | } |else.X.f|
|00005450| 70 72 69 6e 74 66 20 28 | 7a 68 61 6e 67 5f 6c 6f |printf (|zhang_lo|
|00005460| 67 66 69 6c 65 2c 20 22 | 20 20 20 22 29 3b 0a 58 |gfile, "| ");.X|
|00005470| 20 20 20 20 7d 3b 20 66 | 70 72 69 6e 74 66 20 28 | }; f|printf (|
|00005480| 7a 68 61 6e 67 5f 6c 6f | 67 66 69 6c 65 2c 20 22 |zhang_lo|gfile, "|
|00005490| 7c 22 29 3b 0a 58 20 20 | 20 20 66 6f 72 20 28 6a ||");.X | for (j|
|000054a0| 20 3d 20 30 3b 20 6a 20 | 3c 3d 20 72 5f 72 6f 75 | = 0; j |<= r_rou|
|000054b0| 6e 64 3b 20 6a 2b 2b 29 | 20 7b 0a 58 20 20 20 20 |nd; j++)| {.X |
|000054c0| 20 20 66 70 72 69 6e 74 | 66 20 28 7a 68 61 6e 67 | fprint|f (zhang|
|000054d0| 5f 6c 6f 67 66 69 6c 65 | 2c 20 22 25 2d 32 2e 32 |_logfile|, "%-2.2|
|000054e0| 73 20 22 2c 20 62 69 64 | 5f 7a 68 61 6e 67 5b 69 |s ", bid|_zhang[i|
|000054f0| 5d 5b 6a 5d 29 3b 0a 58 | 20 20 20 20 7d 3b 0a 58 |][j]);.X| };.X|
|00005500| 20 20 7d 3b 0a 58 0a 58 | 20 20 66 70 72 69 6e 74 | };.X.X| fprint|
|00005510| 66 20 28 7a 68 61 6e 67 | 5f 6c 6f 67 66 69 6c 65 |f (zhang|_logfile|
|00005520| 2c 20 22 5c 6e 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 22 |, "\n===|======="|
|00005530| 29 3b 0a 58 20 20 66 6f | 72 20 28 69 20 3d 20 30 |);.X fo|r (i = 0|
|00005540| 3b 20 69 20 3c 20 31 33 | 3b 20 69 2b 2b 29 20 20 |; i < 13|; i++) |
|00005550| 20 20 66 70 72 69 6e 74 | 66 20 28 7a 68 61 6e 67 | fprint|f (zhang|
|00005560| 5f 6c 6f 67 66 69 6c 65 | 2c 20 22 25 32 64 3d 22 |_logfile|, "%2d="|
|00005570| 2c 20 69 2b 31 29 3b 0a | 58 20 20 74 69 6d 65 20 |, i+1);.|X time |
|00005580| 28 26 63 75 72 72 65 6e | 74 5f 74 69 6d 65 29 3b |(¤|t_time);|
|00005590| 0a 58 20 20 66 6f 72 20 | 28 69 20 3d 20 30 3b 20 |.X for |(i = 0; |
|000055a0| 69 20 3c 20 36 3b 20 69 | 2b 2b 29 20 20 20 20 20 |i < 6; i|++) |
|000055b0| 66 70 72 69 6e 74 66 20 | 28 7a 68 61 6e 67 5f 6c |fprintf |(zhang_l|
|000055c0| 6f 67 66 69 6c 65 2c 20 | 22 3d 25 32 64 22 2c 20 |ogfile, |"=%2d", |
|000055d0| 69 2b 31 29 3b 0a 58 20 | 20 64 65 63 6f 64 65 64 |i+1);.X | decoded|
|000055e0| 5f 74 69 6d 65 20 3d 20 | 6c 6f 63 61 6c 74 69 6d |_time = |localtim|
|000055f0| 65 20 28 26 63 75 72 72 | 65 6e 74 5f 74 69 6d 65 |e (&curr|ent_time|
|00005600| 29 3b 20 20 20 20 0a 58 | 20 20 66 70 72 69 6e 74 |); .X| fprint|
|00005610| 66 20 28 7a 68 61 6e 67 | 5f 6c 6f 67 66 69 6c 65 |f (zhang|_logfile|
|00005620| 2c 20 22 20 25 73 20 25 | 32 64 5c 6e 25 63 5c 6e |, " %s %|2d\n%c\n|
|00005630| 22 2c 20 0a 58 09 20 20 | 20 6d 6f 6e 74 68 5f 6e |", .X. | month_n|
|00005640| 61 6d 65 73 5b 64 65 63 | 6f 64 65 64 5f 74 69 6d |ames[dec|oded_tim|
|00005650| 65 2d 3e 74 6d 5f 6d 6f | 6e 5d 2c 20 64 65 63 6f |e->tm_mo|n], deco|
|00005660| 64 65 64 5f 74 69 6d 65 | 2d 3e 74 6d 5f 6d 64 61 |ded_time|->tm_mda|
|00005670| 79 2c 20 31 32 29 3b 0a | 58 20 20 66 66 6c 75 73 |y, 12);.|X fflus|
|00005680| 68 20 28 7a 68 61 6e 67 | 5f 6c 6f 67 66 69 6c 65 |h (zhang|_logfile|
|00005690| 29 3b 0a 58 7d 3b 0a 58 | 0a 58 69 6e 74 20 62 69 |);.X};.X|.Xint bi|
|000056a0| 64 64 69 6e 67 5f 63 6f | 64 65 20 28 62 69 64 5f |dding_co|de (bid_|
|000056b0| 74 79 70 65 2c 20 6c 65 | 76 65 6c 2c 20 73 75 69 |type, le|vel, sui|
|000056c0| 74 29 0a 58 20 20 20 20 | 69 6e 74 20 62 69 64 5f |t).X |int bid_|
|000056d0| 74 79 70 65 2c 20 6c 65 | 76 65 6c 2c 20 73 75 69 |type, le|vel, sui|
|000056e0| 74 3b 0a 58 2f 2a 20 47 | 69 76 65 6e 20 74 68 65 |t;.X/* G|iven the|
|000056f0| 20 62 69 64 64 69 6e 67 | 20 74 79 70 65 2c 20 61 | bidding| type, a|
|00005700| 73 20 61 62 6f 76 65 2c | 20 61 6e 64 20 74 68 65 |s above,| and the|
|00005710| 20 6c 65 76 65 6c 20 61 | 6e 64 20 73 75 69 74 20 | level a|nd suit |
|00005720| 69 66 20 69 74 20 69 73 | 0a 58 20 2a 20 61 20 63 |if it is|.X * a c|
|00005730| 6f 6e 74 72 61 63 74 20 | 62 69 64 2c 20 72 65 74 |ontract |bid, ret|
|00005740| 75 72 6e 73 20 61 20 75 | 6e 69 71 75 65 20 69 6e |urns a u|nique in|
|00005750| 74 65 67 65 72 20 69 6e | 20 74 68 65 20 72 61 6e |teger in| the ran|
|00005760| 67 65 20 30 2d 33 37 20 | 61 73 73 6f 63 69 61 74 |ge 0-37 |associat|
|00005770| 65 64 0a 58 20 2a 20 77 | 69 74 68 20 74 68 65 20 |ed.X * w|ith the |
|00005780| 62 69 64 2e 20 20 43 6f | 6e 74 72 61 63 74 20 62 |bid. Co|ntract b|
|00005790| 69 64 73 20 61 72 65 20 | 6f 72 64 65 72 65 64 20 |ids are |ordered |
|000057a0| 69 6e 20 69 6e 63 72 65 | 61 73 69 6e 67 20 6f 72 |in incre|asing or|
|000057b0| 64 65 72 2c 20 73 6f 20 | 74 68 61 74 0a 58 20 2a |der, so |that.X *|
|000057c0| 20 31 43 20 69 73 20 74 | 68 65 20 73 6d 61 6c 6c | 1C is t|he small|
|000057d0| 65 73 74 20 61 6e 64 20 | 37 4e 54 20 69 73 20 74 |est and |7NT is t|
|000057e0| 68 65 20 6c 61 72 67 65 | 73 74 2e 0a 58 20 2a 2f |he large|st..X */|
|000057f0| 0a 58 7b 0a 58 09 73 77 | 69 74 63 68 20 28 62 69 |.X{.X.sw|itch (bi|
|00005800| 64 5f 74 79 70 65 29 20 | 7b 0a 58 09 09 63 61 73 |d_type) |{.X..cas|
|00005810| 65 20 42 49 44 5f 50 41 | 53 53 3a 09 20 20 20 72 |e BID_PA|SS:. r|
|00005820| 65 74 75 72 6e 20 28 42 | 49 44 5f 50 41 53 53 29 |eturn (B|ID_PASS)|
|00005830| 3b 0a 58 09 09 63 61 73 | 65 20 42 49 44 5f 44 4f |;.X..cas|e BID_DO|
|00005840| 55 42 4c 45 3a 20 20 20 | 72 65 74 75 72 6e 20 28 |UBLE: |return (|
|00005850| 42 49 44 5f 44 4f 55 42 | 4c 45 29 3b 0a 58 09 09 |BID_DOUB|LE);.X..|
|00005860| 63 61 73 65 20 42 49 44 | 5f 52 45 44 4f 55 42 4c |case BID|_REDOUBL|
|00005870| 45 3a 20 72 65 74 75 72 | 6e 20 28 42 49 44 5f 52 |E: retur|n (BID_R|
|00005880| 45 44 4f 55 42 4c 45 29 | 3b 0a 58 09 09 63 61 73 |EDOUBLE)|;.X..cas|
|00005890| 65 20 42 49 44 5f 53 55 | 49 54 3a 20 20 20 20 20 |e BID_SU|IT: |
|000058a0| 72 65 74 75 72 6e 20 28 | 35 20 2a 20 28 6c 65 76 |return (|5 * (lev|
|000058b0| 65 6c 20 2d 20 31 29 20 | 2b 20 73 75 69 74 20 2b |el - 1) |+ suit +|
|000058c0| 20 33 29 3b 0a 58 09 09 | 64 65 66 61 75 6c 74 3a | 3);.X..|default:|
|000058d0| 09 20 20 20 3b 0a 58 09 | 7d 3b 0a 58 09 72 65 74 |. ;.X.|};.X.ret|
|000058e0| 75 72 6e 20 28 2d 31 29 | 3b 0a 58 7d 3b 0a 58 20 |urn (-1)|;.X};.X |
|000058f0| 0a 58 69 6e 74 20 63 61 | 72 64 5f 63 6f 64 65 20 |.Xint ca|rd_code |
|00005900| 28 73 75 69 74 2c 20 72 | 61 6e 6b 29 0a 58 20 20 |(suit, r|ank).X |
|00005910| 20 20 69 6e 74 20 73 75 | 69 74 2c 20 72 61 6e 6b | int su|it, rank|
|00005920| 3b 0a 58 2f 2a 20 47 69 | 76 65 6e 20 61 20 73 75 |;.X/* Gi|ven a su|
|00005930| 69 74 20 61 6e 64 20 72 | 61 6e 6b 2c 20 72 65 74 |it and r|ank, ret|
|00005940| 75 72 6e 73 20 61 20 75 | 6e 69 71 75 65 20 61 73 |urns a u|nique as|
|00005950| 73 6f 63 69 61 74 65 64 | 20 69 6e 74 65 67 65 72 |sociated| integer|
|00005960| 20 69 6e 20 74 68 65 0a | 58 20 2a 20 72 61 6e 67 | in the.|X * rang|
|00005970| 65 20 30 2d 35 31 2e 20 | 20 54 68 65 20 63 61 72 |e 0-51. | The car|
|00005980| 64 73 20 61 72 65 20 61 | 72 72 61 6e 67 65 64 20 |ds are a|rranged |
|00005990| 73 6f 20 74 68 61 74 20 | 74 68 65 20 32 20 6f 66 |so that |the 2 of|
|000059a0| 20 63 6c 75 62 73 20 68 | 61 73 20 63 6f 64 65 20 | clubs h|as code |
|000059b0| 30 20 61 6e 64 0a 58 20 | 2a 20 74 68 65 20 61 63 |0 and.X |* the ac|
|000059c0| 65 20 6f 66 20 73 70 61 | 64 65 73 20 68 61 73 20 |e of spa|des has |
|000059d0| 63 6f 64 65 20 35 31 2e | 0a 58 20 2a 2f 0a 58 7b |code 51.|.X */.X{|
|000059e0| 0a 58 09 72 65 74 75 72 | 6e 20 28 31 33 20 2a 20 |.X.retur|n (13 * |
|000059f0| 73 75 69 74 20 2b 20 72 | 61 6e 6b 29 3b 0a 58 7d |suit + r|ank);.X}|
|00005a00| 3b 0a 58 20 0a 58 73 74 | 61 74 69 63 20 67 65 6e |;.X .Xst|atic gen|
|00005a10| 65 72 61 74 65 5f 76 61 | 6c 69 64 5f 62 69 64 73 |erate_va|lid_bids|
|00005a20| 20 28 70 2c 20 6d 69 6e | 69 6d 75 6d 5f 62 69 64 | (p, min|imum_bid|
|00005a30| 2c 20 64 6f 75 62 6c 65 | 5f 6f 6b 2c 20 72 65 64 |, double|_ok, red|
|00005a40| 6f 75 62 6c 65 5f 6f 6b | 29 0a 58 20 20 20 20 20 |ouble_ok|).X |
|00005a50| 69 6e 74 20 70 2c 20 2a | 6d 69 6e 69 6d 75 6d 5f |int p, *|minimum_|
|00005a60| 62 69 64 2c 20 2a 64 6f | 75 62 6c 65 5f 6f 6b 2c |bid, *do|uble_ok,|
|00005a70| 20 2a 72 65 64 6f 75 62 | 6c 65 5f 6f 6b 3b 0a 58 | *redoub|le_ok;.X|
|00005a80| 2f 2a 20 44 65 74 65 72 | 6d 69 6e 65 73 20 74 68 |/* Deter|mines th|
|00005a90| 65 20 76 61 6c 69 64 20 | 62 69 64 73 20 66 6f 72 |e valid |bids for|
|00005aa0| 20 74 68 65 20 70 6c 61 | 79 65 72 20 70 2c 20 67 | the pla|yer p, g|
|00005ab0| 69 76 65 6e 20 74 68 61 | 74 20 74 68 65 20 6c 69 |iven tha|t the li|
|00005ac0| 73 74 20 6f 66 0a 58 20 | 2a 20 62 69 64 73 20 6d |st of.X |* bids m|
|00005ad0| 61 64 65 20 73 6f 20 66 | 61 72 20 69 73 20 73 74 |ade so f|ar is st|
|00005ae0| 6f 72 65 64 20 69 6e 20 | 74 68 65 20 67 6c 6f 62 |ored in |the glob|
|00005af0| 61 6c 20 76 61 72 69 61 | 62 6c 65 20 27 62 69 64 |al varia|ble 'bid|
|00005b00| 73 27 2c 20 61 6e 64 20 | 74 68 61 74 0a 58 20 2a |s', and |that.X *|
|00005b10| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 73 20 27 | the var|iables '|
|00005b20| 74 72 75 6d 70 5f 73 75 | 69 74 27 2c 20 27 63 6f |trump_su|it', 'co|
|00005b30| 6e 74 72 61 63 74 27 2c | 20 27 64 65 63 6c 61 72 |ntract',| 'declar|
|00005b40| 65 72 27 2c 20 27 64 6f | 75 62 6c 65 64 27 20 61 |er', 'do|ubled' a|
|00005b50| 6e 64 0a 58 20 2a 20 27 | 72 65 64 6f 75 62 6c 65 |nd.X * '|redouble|
|00005b60| 64 27 20 72 65 66 6c 65 | 63 74 20 74 68 65 20 63 |d' refle|ct the c|
|00005b70| 75 72 72 65 6e 74 20 73 | 74 61 74 65 20 6f 66 20 |urrent s|tate of |
|00005b80| 74 68 65 20 62 69 64 64 | 69 6e 67 2e 20 20 43 6f |the bidd|ing. Co|
|00005b90| 6d 70 75 74 65 73 0a 58 | 20 2a 20 74 68 65 20 6d |mputes.X| * the m|
|00005ba0| 69 6e 69 6d 75 6d 20 63 | 6f 6e 74 72 61 63 74 20 |inimum c|ontract |
|00005bb0| 62 69 64 20 77 68 69 63 | 68 20 69 73 20 61 63 63 |bid whic|h is acc|
|00005bc0| 65 70 74 61 62 6c 65 2c | 20 61 6e 64 20 63 6f 6d |eptable,| and com|
|00005bd0| 70 75 74 65 73 20 62 6f | 6f 6c 65 61 6e 0a 58 20 |putes bo|olean.X |
|00005be0| 2a 20 66 6c 61 67 73 20 | 69 6e 64 69 63 61 74 69 |* flags |indicati|
|00005bf0| 6e 67 20 77 68 65 74 68 | 65 72 20 69 74 20 69 73 |ng wheth|er it is|
|00005c00| 20 6f 6b 20 74 6f 20 64 | 6f 75 62 6c 65 20 6f 72 | ok to d|ouble or|
|00005c10| 20 72 65 64 6f 75 62 6c | 65 2e 0a 58 20 2a 2f 0a | redoubl|e..X */.|
|00005c20| 58 7b 0a 58 09 69 6e 74 | 20 62 69 64 64 69 6e 67 |X{.X.int| bidding|
|00005c30| 5f 73 69 64 65 2c 20 64 | 65 63 6c 61 72 69 6e 67 |_side, d|eclaring|
|00005c40| 5f 73 69 64 65 3b 0a 58 | 20 0a 58 09 62 69 64 64 |_side;.X| .X.bidd|
|00005c50| 69 6e 67 5f 73 69 64 65 | 20 3d 20 73 69 64 65 5f |ing_side| = side_|
|00005c60| 6f 66 20 28 70 29 3b 0a | 58 09 69 66 20 28 63 6f |of (p);.|X.if (co|
|00005c70| 6e 74 72 61 63 74 20 3e | 20 30 29 20 7b 0a 58 09 |ntract >| 0) {.X.|
|00005c80| 09 64 65 63 6c 61 72 69 | 6e 67 5f 73 69 64 65 20 |.declari|ng_side |
|00005c90| 3d 20 73 69 64 65 5f 6f | 66 20 28 64 65 63 6c 61 |= side_o|f (decla|
|00005ca0| 72 65 72 29 3b 0a 58 09 | 09 69 66 20 28 64 65 63 |rer);.X.|.if (dec|
|00005cb0| 6c 61 72 69 6e 67 5f 73 | 69 64 65 20 21 3d 20 62 |laring_s|ide != b|
|00005cc0| 69 64 64 69 6e 67 5f 73 | 69 64 65 29 20 7b 0a 58 |idding_s|ide) {.X|
|00005cd0| 09 09 09 2a 64 6f 75 62 | 6c 65 5f 6f 6b 20 3d 20 |...*doub|le_ok = |
|00005ce0| 21 64 6f 75 62 6c 65 64 | 3b 0a 58 09 09 09 2a 72 |!doubled|;.X...*r|
|00005cf0| 65 64 6f 75 62 6c 65 5f | 6f 6b 20 3d 20 30 3b 0a |edouble_|ok = 0;.|
|00005d00| 58 09 09 7d 20 65 6c 73 | 65 20 7b 0a 58 09 09 09 |X..} els|e {.X...|
|00005d10| 2a 64 6f 75 62 6c 65 5f | 6f 6b 20 3d 20 30 3b 0a |*double_|ok = 0;.|
|00005d20| 58 09 09 09 69 66 20 28 | 64 6f 75 62 6c 65 64 29 |X...if (|doubled)|
|00005d30| 20 2a 72 65 64 6f 75 62 | 6c 65 5f 6f 6b 20 3d 20 | *redoub|le_ok = |
|00005d40| 21 72 65 64 6f 75 62 6c | 65 64 3b 0a 58 09 09 7d |!redoubl|ed;.X..}|
|00005d50| 3b 0a 58 09 7d 3b 0a 58 | 09 69 66 20 28 63 6f 6e |;.X.};.X|.if (con|
|00005d60| 74 72 61 63 74 20 3d 3d | 20 30 29 20 7b 09 2f 2a |tract ==| 0) {./*|
|00005d70| 20 6e 6f 20 6f 6e 65 20 | 68 61 73 20 62 69 64 20 | no one |has bid |
|00005d80| 61 20 63 6f 6e 74 72 61 | 63 74 20 79 65 74 20 2a |a contra|ct yet *|
|00005d90| 2f 0a 58 09 09 2a 6d 69 | 6e 69 6d 75 6d 5f 62 69 |/.X..*mi|nimum_bi|
|00005da0| 64 20 3d 20 62 69 64 64 | 69 6e 67 5f 63 6f 64 65 |d = bidd|ing_code|
|00005db0| 28 42 49 44 5f 53 55 49 | 54 2c 20 31 2c 20 53 55 |(BID_SUI|T, 1, SU|
|00005dc0| 49 54 5f 43 4c 55 42 53 | 29 3b 0a 58 09 09 2a 64 |IT_CLUBS|);.X..*d|
|00005dd0| 6f 75 62 6c 65 5f 6f 6b | 20 3d 20 2a 72 65 64 6f |ouble_ok| = *redo|
|00005de0| 75 62 6c 65 5f 6f 6b 20 | 3d 20 30 3b 0a 58 09 7d |uble_ok |= 0;.X.}|
|00005df0| 20 65 6c 73 65 0a 58 09 | 09 2a 6d 69 6e 69 6d 75 | else.X.|.*minimu|
|00005e00| 6d 5f 62 69 64 20 3d 20 | 31 20 2b 20 62 69 64 64 |m_bid = |1 + bidd|
|00005e10| 69 6e 67 5f 63 6f 64 65 | 28 42 49 44 5f 53 55 49 |ing_code|(BID_SUI|
|00005e20| 54 2c 20 63 6f 6e 74 72 | 61 63 74 2c 0a 58 09 09 |T, contr|act,.X..|
|00005e30| 09 09 09 09 74 72 75 6d | 70 5f 73 75 69 74 29 3b |....trum|p_suit);|
|00005e40| 0a 58 7d 3b 0a 58 20 0a | 58 73 74 61 74 69 63 20 |.X};.X .|Xstatic |
|00005e50| 75 70 64 61 74 65 5f 62 | 69 64 64 69 6e 67 5f 6c |update_b|idding_l|
|00005e60| 69 73 74 20 28 70 2c 20 | 62 69 64 29 0a 58 20 20 |ist (p, |bid).X |
|00005e70| 20 20 20 69 6e 74 20 70 | 2c 20 62 69 64 3b 0a 58 | int p|, bid;.X|
|00005e80| 2f 2a 20 45 6e 74 65 72 | 73 20 61 20 6e 65 77 20 |/* Enter|s a new |
|00005e90| 62 69 64 20 66 6f 72 20 | 70 6c 61 79 65 72 20 70 |bid for |player p|
|00005ea0| 2e 20 20 41 73 73 75 6d | 65 73 20 6f 66 20 63 6f |. Assum|es of co|
|00005eb0| 75 72 73 65 20 74 68 61 | 74 20 69 74 20 69 73 20 |urse tha|t it is |
|00005ec0| 70 27 73 0a 58 20 2a 20 | 74 75 72 6e 20 74 6f 20 |p's.X * |turn to |
|00005ed0| 62 69 64 20 61 6e 64 20 | 74 68 61 74 20 74 68 65 |bid and |that the|
|00005ee0| 20 62 69 64 20 69 73 20 | 6c 65 67 61 6c 2e 20 20 | bid is |legal. |
|00005ef0| 55 70 64 61 74 65 73 20 | 74 68 65 20 76 61 72 69 |Updates |the vari|
|00005f00| 61 62 6c 65 73 3a 0a 58 | 20 2a 20 74 72 75 6d 70 |ables:.X| * trump|
|00005f10| 5f 73 75 69 74 2c 20 63 | 6f 6e 74 72 61 63 74 2c |_suit, c|ontract,|
|00005f20| 20 64 65 63 6c 61 72 65 | 72 2c 20 64 6f 75 62 6c | declare|r, doubl|
|00005f30| 65 64 2c 20 72 65 64 6f | 75 62 6c 65 64 2c 20 62 |ed, redo|ubled, b|
|00005f40| 69 64 73 2c 20 6e 6f 5f | 62 69 64 73 0a 58 20 2a |ids, no_|bids.X *|
|00005f50| 2f 0a 58 7b 0a 58 09 69 | 6e 74 20 72 6f 75 6e 64 |/.X{.X.i|nt round|
|00005f60| 2c 20 69 2c 20 73 69 64 | 65 3b 0a 58 20 0a 58 09 |, i, sid|e;.X .X.|
|00005f70| 72 6f 75 6e 64 20 3d 20 | 6e 6f 5f 62 69 64 73 20 |round = |no_bids |
|00005f80| 2f 20 34 3b 0a 58 09 62 | 69 64 73 20 5b 70 5d 5b |/ 4;.X.b|ids [p][|
|00005f90| 72 6f 75 6e 64 5d 20 3d | 20 62 69 64 3b 0a 58 09 |round] =| bid;.X.|
|00005fa0| 69 66 20 28 62 69 64 20 | 3d 3d 20 42 49 44 5f 50 |if (bid |== BID_P|
|00005fb0| 41 53 53 29 20 7b 0a 58 | 09 09 3b 0a 58 09 7d 20 |ASS) {.X|..;.X.} |
|00005fc0| 65 6c 73 65 20 69 66 20 | 28 62 69 64 20 3d 3d 20 |else if |(bid == |
|00005fd0| 42 49 44 5f 44 4f 55 42 | 4c 45 29 20 7b 0a 58 09 |BID_DOUB|LE) {.X.|
|00005fe0| 09 64 6f 75 62 6c 65 64 | 20 3d 20 31 3b 0a 58 09 |.doubled| = 1;.X.|
|00005ff0| 7d 20 65 6c 73 65 20 69 | 66 20 28 62 69 64 20 3d |} else i|f (bid =|
|00006000| 3d 20 42 49 44 5f 52 45 | 44 4f 55 42 4c 45 29 20 |= BID_RE|DOUBLE) |
|00006010| 7b 0a 58 09 09 72 65 64 | 6f 75 62 6c 65 64 20 3d |{.X..red|oubled =|
|00006020| 20 31 3b 0a 58 09 7d 20 | 65 6c 73 65 20 7b 0a 58 | 1;.X.} |else {.X|
|00006030| 09 09 64 6f 75 62 6c 65 | 64 20 3d 20 72 65 64 6f |..double|d = redo|
|00006040| 75 62 6c 65 64 20 3d 20 | 30 3b 0a 58 09 09 74 72 |ubled = |0;.X..tr|
|00006050| 75 6d 70 5f 73 75 69 74 | 20 3d 20 74 72 75 6d 70 |ump_suit| = trump|
|00006060| 73 75 69 74 5f 6f 66 20 | 28 62 69 64 29 3b 0a 58 |suit_of |(bid);.X|
|00006070| 09 09 63 6f 6e 74 72 61 | 63 74 20 20 20 3d 20 63 |..contra|ct = c|
|00006080| 6f 6e 74 72 61 63 74 5f | 6f 66 20 28 62 69 64 29 |ontract_|of (bid)|
|00006090| 3b 0a 58 09 09 73 69 64 | 65 20 3d 20 73 69 64 65 |;.X..sid|e = side|
|000060a0| 5f 6f 66 28 70 29 3b 0a | 58 09 09 69 66 20 28 64 |_of(p);.|X..if (d|
|000060b0| 65 63 6c 61 72 65 72 73 | 5b 73 69 64 65 5d 5b 74 |eclarers|[side][t|
|000060c0| 72 75 6d 70 5f 73 75 69 | 74 5d 20 3c 20 30 29 0a |rump_sui|t] < 0).|
|000060d0| 58 09 09 09 64 65 63 6c | 61 72 65 72 73 5b 73 69 |X...decl|arers[si|
|000060e0| 64 65 5d 5b 74 72 75 6d | 70 5f 73 75 69 74 5d 20 |de][trum|p_suit] |
|000060f0| 3d 20 70 3b 0a 58 09 09 | 64 65 63 6c 61 72 65 72 |= p;.X..|declarer|
|00006100| 20 3d 20 64 65 63 6c 61 | 72 65 72 73 5b 73 69 64 | = decla|rers[sid|
|00006110| 65 5d 5b 74 72 75 6d 70 | 5f 73 75 69 74 5d 3b 0a |e][trump|_suit];.|
|00006120| 58 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |X | |
|00006130| 20 64 75 6d 6d 79 20 20 | 20 20 3d 20 70 6c 61 79 | dummy | = play|
|00006140| 65 72 5f 70 61 72 74 6e | 65 72 5b 64 65 63 6c 61 |er_partn|er[decla|
|00006150| 72 65 72 5d 3b 0a 58 09 | 7d 3b 0a 58 09 6e 6f 5f |rer];.X.|};.X.no_|
|00006160| 62 69 64 73 20 2b 3d 20 | 31 3b 0a 58 7d 3b 0a 58 |bids += |1;.X};.X|
|00006170| 20 0a 58 20 0a 58 73 74 | 61 74 69 63 20 67 65 6e | .X .Xst|atic gen|
|00006180| 65 72 61 74 65 5f 76 61 | 6c 69 64 5f 70 6c 61 79 |erate_va|lid_play|
|00006190| 73 20 28 70 2c 20 68 29 | 0a 58 20 20 20 20 20 69 |s (p, h)|.X i|
|000061a0| 6e 74 20 70 3b 20 68 61 | 6e 64 20 68 3b 0a 58 2f |nt p; ha|nd h;.X/|
|000061b0| 2a 20 47 65 6e 65 72 61 | 74 65 73 20 61 20 6c 69 |* Genera|tes a li|
|000061c0| 73 74 20 6f 66 20 76 61 | 6c 69 64 20 70 6c 61 79 |st of va|lid play|
|000061d0| 73 20 66 6f 72 20 70 6c | 61 79 65 72 20 70 2e 20 |s for pl|ayer p. |
|000061e0| 20 54 68 65 20 6c 69 73 | 74 20 6f 66 20 76 61 6c | The lis|t of val|
|000061f0| 69 64 0a 58 20 2a 20 70 | 6c 61 79 73 20 69 73 20 |id.X * p|lays is |
|00006200| 64 65 74 65 72 6d 69 6e | 65 64 20 62 79 20 65 78 |determin|ed by ex|
|00006210| 61 6d 69 6e 69 6e 67 20 | 74 68 65 20 67 6c 6f 62 |amining |the glob|
|00006220| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 20 27 6c 65 |al varia|bles 'le|
|00006230| 61 64 65 72 27 20 61 6e | 64 0a 58 20 2a 20 27 63 |ader' an|d.X * 'c|
|00006240| 75 72 72 65 6e 74 5f 68 | 61 6e 64 27 2e 20 20 54 |urrent_h|and'. T|
|00006250| 68 65 20 76 61 6c 69 64 | 20 70 6c 61 79 73 20 61 |he valid| plays a|
|00006260| 72 65 20 73 74 6f 72 65 | 64 20 61 73 20 61 20 62 |re store|d as a b|
|00006270| 6f 6f 6c 65 61 6e 20 73 | 74 72 69 6e 67 0a 58 20 |oolean s|tring.X |
|00006280| 2a 20 69 6e 20 68 2c 20 | 73 6f 20 74 68 61 74 20 |* in h, |so that |
|00006290| 68 5b 63 5d 20 3d 3d 20 | 74 72 75 65 20 69 66 66 |h[c] == |true iff|
|000062a0| 20 69 74 20 69 73 20 6c | 65 67 61 6c 20 74 6f 20 | it is l|egal to |
|000062b0| 70 6c 61 79 20 63 61 72 | 64 20 63 2e 0a 58 20 2a |play car|d c..X *|
|000062c0| 2f 0a 58 7b 0a 58 09 69 | 6e 74 20 69 2c 20 6e 2c |/.X{.X.i|nt i, n,|
|000062d0| 20 6c 65 61 64 5f 73 75 | 69 74 3b 0a 58 20 0a 58 | lead_su|it;.X .X|
|000062e0| 09 69 66 20 28 70 20 3d | 3d 20 6c 65 61 64 65 72 |.if (p =|= leader|
|000062f0| 29 20 7b 0a 58 09 09 66 | 6f 72 20 28 69 20 3d 20 |) {.X..f|or (i = |
|00006300| 30 3b 20 69 20 3c 20 35 | 32 3b 20 69 2b 2b 29 0a |0; i < 5|2; i++).|
|00006310| 58 09 09 09 68 5b 69 5d | 20 3d 20 63 75 72 72 65 |X...h[i]| = curre|
|00006320| 6e 74 5f 68 61 6e 64 5b | 70 5d 5b 69 5d 3b 0a 58 |nt_hand[|p][i];.X|
|00006330| 09 7d 20 65 6c 73 65 20 | 7b 0a 58 09 09 6c 65 61 |.} else |{.X..lea|
|00006340| 64 5f 73 75 69 74 20 3d | 20 73 75 69 74 5f 6f 66 |d_suit =| suit_of|
|00006350| 28 70 6c 61 79 73 5b 6c | 65 61 64 65 72 5d 29 3b |(plays[l|eader]);|
|00006360| 0a 58 09 09 6e 20 3d 20 | 30 3b 0a 58 09 09 66 6f |.X..n = |0;.X..fo|
|00006370| 72 20 28 69 20 3d 20 30 | 3b 20 69 20 3c 20 35 32 |r (i = 0|; i < 52|
|00006380| 3b 20 69 2b 2b 29 20 7b | 0a 58 09 09 09 68 5b 69 |; i++) {|.X...h[i|
|00006390| 5d 20 3d 20 20 63 75 72 | 72 65 6e 74 5f 68 61 6e |] = cur|rent_han|
|000063a0| 64 5b 70 5d 5b 69 5d 20 | 26 26 0a 58 09 09 09 09 |d[p][i] |&&.X....|
|000063b0| 28 73 75 69 74 5f 6f 66 | 28 69 29 20 3d 3d 20 6c |(suit_of|(i) == l|
|000063c0| 65 61 64 5f 73 75 69 74 | 29 3b 0a 58 09 09 09 69 |ead_suit|);.X...i|
|000063d0| 66 20 28 68 5b 69 5d 29 | 20 6e 20 2b 3d 20 31 3b |f (h[i])| n += 1;|
|000063e0| 0a 58 09 09 7d 3b 0a 58 | 09 09 69 66 20 28 6e 20 |.X..};.X|..if (n |
|000063f0| 3d 3d 20 30 29 0a 58 09 | 09 09 66 6f 72 20 28 69 |== 0).X.|..for (i|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.