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).
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 20 6d 69 70 | 6f 73 33 21 6f 6d 65 70 |From mip|os3!omep|
|00000010| 64 21 6c 69 74 74 6c 65 | 69 21 72 65 65 64 21 74 |d!little|i!reed!t|
|00000020| 65 6b 74 72 6f 6e 69 78 | 21 74 65 6b 67 65 6e 21 |ektronix|!tekgen!|
|00000030| 74 65 6b 72 65 64 21 67 | 61 6d 65 73 2d 72 65 71 |tekred!g|ames-req|
|00000040| 75 65 73 74 20 53 61 74 | 20 46 65 62 20 32 30 20 |uest Sat| Feb 20 |
|00000050| 31 33 3a 35 36 3a 31 37 | 20 50 53 54 20 31 39 38 |13:56:17| PST 198|
|00000060| 38 0a 41 72 74 69 63 6c | 65 20 31 38 34 20 6f 66 |8.Articl|e 184 of|
|00000070| 20 63 6f 6d 70 2e 73 6f | 75 72 63 65 73 2e 67 61 | comp.so|urces.ga|
|00000080| 6d 65 73 3a 0a 50 61 74 | 68 3a 20 74 64 32 63 61 |mes:.Pat|h: td2ca|
|00000090| 64 21 6d 69 70 6f 73 33 | 21 6f 6d 65 70 64 21 6c |d!mipos3|!omepd!l|
|000000a0| 69 74 74 6c 65 69 21 72 | 65 65 64 21 74 65 6b 74 |ittlei!r|eed!tekt|
|000000b0| 72 6f 6e 69 78 21 74 65 | 6b 67 65 6e 21 74 65 6b |ronix!te|kgen!tek|
|000000c0| 72 65 64 21 67 61 6d 65 | 73 2d 72 65 71 75 65 73 |red!game|s-reques|
|000000d0| 74 0a 46 72 6f 6d 3a 20 | 67 61 6d 65 73 2d 72 65 |t.From: |games-re|
|000000e0| 71 75 65 73 74 40 74 65 | 6b 72 65 64 2e 54 45 4b |quest@te|kred.TEK|
|000000f0| 2e 43 4f 4d 0a 4e 65 77 | 73 67 72 6f 75 70 73 3a |.COM.New|sgroups:|
|00000100| 20 63 6f 6d 70 2e 73 6f | 75 72 63 65 73 2e 67 61 | comp.so|urces.ga|
|00000110| 6d 65 73 0a 53 75 62 6a | 65 63 74 3a 20 76 30 33 |mes.Subj|ect: v03|
|00000120| 69 30 38 34 3a 20 20 6a | 75 6d 62 6c 65 32 20 2d |i084: j|umble2 -|
|00000130| 20 70 6c 61 79 20 74 68 | 65 20 67 61 6d 65 20 6f | play th|e game o|
|00000140| 66 20 6a 75 6d 62 6c 65 | 0a 4d 65 73 73 61 67 65 |f jumble|.Message|
|00000150| 2d 49 44 3a 20 3c 32 31 | 39 34 40 74 65 6b 72 65 |-ID: <21|94@tekre|
|00000160| 64 2e 54 45 4b 2e 43 4f | 4d 3e 0a 44 61 74 65 3a |d.TEK.CO|M>.Date:|
|00000170| 20 31 39 20 46 65 62 20 | 38 38 20 30 31 3a 30 35 | 19 Feb |88 01:05|
|00000180| 3a 30 39 20 47 4d 54 0a | 53 65 6e 64 65 72 3a 20 |:09 GMT.|Sender: |
|00000190| 62 69 6c 6c 72 40 74 65 | 6b 72 65 64 2e 54 45 4b |billr@te|kred.TEK|
|000001a0| 2e 43 4f 4d 0a 4c 69 6e | 65 73 3a 20 36 32 32 0a |.COM.Lin|es: 622.|
|000001b0| 41 70 70 72 6f 76 65 64 | 3a 20 62 69 6c 6c 72 40 |Approved|: billr@|
|000001c0| 74 65 6b 72 65 64 2e 54 | 45 4b 2e 43 4f 4d 0a 0a |tekred.T|EK.COM..|
|000001d0| 53 75 62 6d 69 74 74 65 | 64 20 62 79 3a 20 44 61 |Submitte|d by: Da|
|000001e0| 6e 20 48 65 6c 6c 65 72 | 20 28 61 72 67 76 29 20 |n Heller| (argv) |
|000001f0| 3c 69 73 6c 61 6e 64 21 | 61 72 67 76 40 73 75 6e |<island!|argv@sun|
|00000200| 2e 63 6f 6d 3e 0a 43 6f | 6d 70 2e 73 6f 75 72 63 |.com>.Co|mp.sourc|
|00000210| 65 73 2e 67 61 6d 65 73 | 3a 20 56 6f 6c 75 6d 65 |es.games|: Volume|
|00000220| 20 33 2c 20 49 73 73 75 | 65 20 38 34 0a 41 72 63 | 3, Issu|e 84.Arc|
|00000230| 68 69 76 65 2d 6e 61 6d | 65 3a 20 6a 75 6d 62 6c |hive-nam|e: jumbl|
|00000240| 65 32 0a 0a 09 5b 41 20 | 70 72 65 76 69 6f 75 73 |e2...[A |previous|
|00000250| 6c 79 20 70 6f 73 74 65 | 64 20 67 61 6d 65 20 22 |ly poste|d game "|
|00000260| 6a 75 6d 62 6c 65 22 20 | 6f 6e 6c 79 20 75 6e 73 |jumble" |only uns|
|00000270| 63 72 61 6d 62 6c 65 64 | 20 77 6f 72 64 73 0a 09 |crambled| words..|
|00000280| 20 74 68 61 74 20 79 6f | 75 20 66 65 64 20 69 74 | that yo|u fed it|
|00000290| 2e 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 70 |. This p|rogram p|
|000002a0| 6c 61 79 73 20 74 68 65 | 20 77 68 6f 6c 65 20 67 |lays the| whole g|
|000002b0| 61 6d 65 2c 20 66 65 65 | 64 69 6e 67 0a 09 20 79 |ame, fee|ding.. y|
|000002c0| 6f 75 20 74 68 65 20 6a | 75 6d 62 6c 65 64 20 77 |ou the j|umbled w|
|000002d0| 6f 72 64 73 20 61 6e 64 | 20 6c 65 74 74 69 6e 67 |ords and| letting|
|000002e0| 20 79 6f 75 20 74 72 79 | 20 61 6e 64 20 75 6e 73 | you try| and uns|
|000002f0| 63 72 61 6d 62 6c 65 0a | 09 20 74 68 65 6d 2e 20 |cramble.|. them. |
|00000300| 49 20 63 6f 6d 70 69 6c | 65 64 20 61 6e 64 20 72 |I compil|ed and r|
|00000310| 61 6e 20 74 68 69 73 20 | 6f 6e 20 61 20 53 75 6e |an this |on a Sun|
|00000320| 20 33 2f 36 30 2e 20 20 | 2d 62 72 5d 0a 0a 23 21 | 3/60. |-br]..#!|
|00000330| 20 2f 62 69 6e 2f 73 68 | 0a 23 20 54 68 69 73 20 | /bin/sh|.# This |
|00000340| 69 73 20 61 20 73 68 65 | 6c 6c 20 61 72 63 68 69 |is a she|ll archi|
|00000350| 76 65 2e 20 20 52 65 6d | 6f 76 65 20 61 6e 79 74 |ve. Rem|ove anyt|
|00000360| 68 69 6e 67 20 62 65 66 | 6f 72 65 20 74 68 69 73 |hing bef|ore this|
|00000370| 20 6c 69 6e 65 2c 20 74 | 68 65 6e 20 75 6e 70 61 | line, t|hen unpa|
|00000380| 63 6b 0a 23 20 69 74 20 | 62 79 20 73 61 76 69 6e |ck.# it |by savin|
|00000390| 67 20 69 74 20 69 6e 74 | 6f 20 61 20 66 69 6c 65 |g it int|o a file|
|000003a0| 20 61 6e 64 20 74 79 70 | 69 6e 67 20 22 73 68 20 | and typ|ing "sh |
|000003b0| 66 69 6c 65 22 2e 20 20 | 54 6f 20 6f 76 65 72 77 |file". |To overw|
|000003c0| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 0a 23 20 |rite exi|sting.# |
|000003d0| 66 69 6c 65 73 2c 20 74 | 79 70 65 20 22 73 68 20 |files, t|ype "sh |
|000003e0| 66 69 6c 65 20 2d 63 22 | 2e 20 20 59 6f 75 20 63 |file -c"|. You c|
|000003f0| 61 6e 20 61 6c 73 6f 20 | 66 65 65 64 20 74 68 69 |an also |feed thi|
|00000400| 73 20 61 73 20 73 74 61 | 6e 64 61 72 64 20 69 6e |s as sta|ndard in|
|00000410| 70 75 74 20 76 69 61 0a | 23 20 75 6e 73 68 61 72 |put via.|# unshar|
|00000420| 2c 20 6f 72 20 62 79 20 | 74 79 70 69 6e 67 20 22 |, or by |typing "|
|00000430| 73 68 20 3c 66 69 6c 65 | 22 2c 20 65 2e 67 2e 2e |sh <file|", e.g..|
|00000440| 20 20 49 66 20 74 68 69 | 73 20 61 72 63 68 69 76 | If thi|s archiv|
|00000450| 65 20 69 73 20 63 6f 6d | 70 6c 65 74 65 2c 20 79 |e is com|plete, y|
|00000460| 6f 75 0a 23 20 77 69 6c | 6c 20 73 65 65 20 74 68 |ou.# wil|l see th|
|00000470| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6d 65 73 73 |e follow|ing mess|
|00000480| 61 67 65 20 61 74 20 74 | 68 65 20 65 6e 64 3a 0a |age at t|he end:.|
|00000490| 23 09 09 22 45 6e 64 20 | 6f 66 20 73 68 65 6c 6c |#.."End |of shell|
|000004a0| 20 61 72 63 68 69 76 65 | 2e 22 0a 23 20 43 6f 6e | archive|.".# Con|
|000004b0| 74 65 6e 74 73 3a 20 20 | 52 45 41 44 4d 45 20 4d |tents: |README M|
|000004c0| 61 6b 65 66 69 6c 65 20 | 6a 75 6d 62 6c 65 2e 63 |akefile |jumble.c|
|000004d0| 0a 23 20 57 72 61 70 70 | 65 64 20 62 79 20 62 69 |.# Wrapp|ed by bi|
|000004e0| 6c 6c 72 40 73 61 61 62 | 20 6f 6e 20 54 68 75 20 |llr@saab| on Thu |
|000004f0| 46 65 62 20 31 38 20 31 | 36 3a 34 35 3a 34 38 20 |Feb 18 1|6:45:48 |
|00000500| 31 39 38 38 0a 50 41 54 | 48 3d 2f 62 69 6e 3a 2f |1988.PAT|H=/bin:/|
|00000510| 75 73 72 2f 62 69 6e 3a | 2f 75 73 72 2f 75 63 62 |usr/bin:|/usr/ucb|
|00000520| 20 3b 20 65 78 70 6f 72 | 74 20 50 41 54 48 0a 69 | ; expor|t PATH.i|
|00000530| 66 20 74 65 73 74 20 2d | 66 20 52 45 41 44 4d 45 |f test -|f README|
|00000540| 20 2d 61 20 22 24 7b 31 | 7d 22 20 21 3d 20 22 2d | -a "${1|}" != "-|
|00000550| 63 22 20 3b 20 74 68 65 | 6e 20 0a 20 20 65 63 68 |c" ; the|n . ech|
|00000560| 6f 20 73 68 61 72 3a 20 | 57 69 6c 6c 20 6e 6f 74 |o shar: |Will not|
|00000570| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00000580| 74 69 6e 67 20 66 69 6c | 65 20 5c 22 52 45 41 44 |ting fil|e \"READ|
|00000590| 4d 45 5c 22 0a 65 6c 73 | 65 0a 65 63 68 6f 20 73 |ME\".els|e.echo s|
|000005a0| 68 61 72 3a 20 45 78 74 | 72 61 63 74 69 6e 67 20 |har: Ext|racting |
|000005b0| 5c 22 52 45 41 44 4d 45 | 5c 22 20 5c 28 32 38 37 |\"README|\" \(287|
|000005c0| 20 63 68 61 72 61 63 74 | 65 72 73 5c 29 0a 73 65 | charact|ers\).se|
|000005d0| 64 20 22 73 2f 5e 58 2f | 2f 22 20 3e 52 45 41 44 |d "s/^X/|/" >READ|
|000005e0| 4d 45 20 3c 3c 27 45 4e | 44 5f 4f 46 5f 52 45 41 |ME <<'EN|D_OF_REA|
|000005f0| 44 4d 45 27 0a 58 4a 75 | 6d 62 6c 65 20 2d 2d 20 |DME'.XJu|mble -- |
|00000600| 20 74 68 65 20 67 61 6d | 65 20 69 6e 20 77 68 69 | the gam|e in whi|
|00000610| 63 68 20 79 6f 75 20 75 | 6e 73 63 72 61 6d 62 6c |ch you u|nscrambl|
|00000620| 65 20 77 6f 72 64 73 20 | 74 6f 20 63 6f 6d 70 65 |e words |to compe|
|00000630| 74 65 20 66 6f 72 0a 58 | 70 6f 69 6e 74 73 20 6f |te for.X|points o|
|00000640| 6e 20 61 20 68 69 67 68 | 20 73 63 6f 72 65 20 6c |n a high| score l|
|00000650| 69 73 74 20 6f 66 20 31 | 30 20 61 6e 64 20 34 20 |ist of 1|0 and 4 |
|00000660| 6c 65 76 65 6c 73 20 6f | 66 0a 58 64 69 66 66 69 |levels o|f.Xdiffi|
|00000670| 63 75 6c 74 79 20 74 6f | 20 63 68 6f 6f 73 65 20 |culty to| choose |
|00000680| 66 72 6f 6d 2e 20 57 6f | 72 64 73 20 61 72 65 20 |from. Wo|rds are |
|00000690| 66 6f 75 6e 64 20 69 6e | 20 2f 75 73 72 2f 64 69 |found in| /usr/di|
|000006a0| 63 74 2f 77 6f 72 64 73 | 2c 0a 58 74 68 65 20 62 |ct/words|,.Xthe b|
|000006b0| 61 73 69 63 20 64 69 63 | 74 69 6f 6e 61 72 79 20 |asic dic|tionary |
|000006c0| 66 6f 75 6e 64 20 6f 6e | 20 61 6c 6c 20 55 4e 49 |found on| all UNI|
|000006d0| 58 20 73 79 73 74 65 6d | 73 2e 0a 58 0a 58 54 68 |X system|s..X.XTh|
|000006e0| 69 73 20 70 72 6f 67 72 | 61 6d 20 77 61 73 20 77 |is progr|am was w|
|000006f0| 72 69 74 74 65 6e 20 62 | 79 20 44 61 6e 20 48 65 |ritten b|y Dan He|
|00000700| 6c 6c 65 72 2e 0a 58 69 | 73 6c 61 6e 64 21 61 72 |ller..Xi|sland!ar|
|00000710| 67 76 40 73 75 6e 2e 63 | 6f 6d 0a 45 4e 44 5f 4f |gv@sun.c|om.END_O|
|00000720| 46 5f 52 45 41 44 4d 45 | 0a 69 66 20 74 65 73 74 |F_README|.if test|
|00000730| 20 32 38 37 20 2d 6e 65 | 20 60 77 63 20 2d 63 20 | 287 -ne| `wc -c |
|00000740| 3c 52 45 41 44 4d 45 60 | 3b 20 74 68 65 6e 0a 20 |<README`|; then. |
|00000750| 20 20 20 65 63 68 6f 20 | 73 68 61 72 3a 20 5c 22 | echo |shar: \"|
|00000760| 52 45 41 44 4d 45 5c 22 | 20 75 6e 70 61 63 6b 65 |README\"| unpacke|
|00000770| 64 20 77 69 74 68 20 77 | 72 6f 6e 67 20 73 69 7a |d with w|rong siz|
|00000780| 65 21 0a 66 69 0a 23 20 | 65 6e 64 20 6f 66 20 6f |e!.fi.# |end of o|
|00000790| 76 65 72 77 72 69 74 69 | 6e 67 20 63 68 65 63 6b |verwriti|ng check|
|000007a0| 0a 66 69 0a 69 66 20 74 | 65 73 74 20 2d 66 20 4d |.fi.if t|est -f M|
|000007b0| 61 6b 65 66 69 6c 65 20 | 2d 61 20 22 24 7b 31 7d |akefile |-a "${1}|
|000007c0| 22 20 21 3d 20 22 2d 63 | 22 20 3b 20 74 68 65 6e |" != "-c|" ; then|
|000007d0| 20 0a 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 57 | . echo| shar: W|
|000007e0| 69 6c 6c 20 6e 6f 74 20 | 6f 76 65 72 2d 77 72 69 |ill not |over-wri|
|000007f0| 74 65 20 65 78 69 73 74 | 69 6e 67 20 66 69 6c 65 |te exist|ing file|
|00000800| 20 5c 22 4d 61 6b 65 66 | 69 6c 65 5c 22 0a 65 6c | \"Makef|ile\".el|
|00000810| 73 65 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 45 78 |se.echo |shar: Ex|
|00000820| 74 72 61 63 74 69 6e 67 | 20 5c 22 4d 61 6b 65 66 |tracting| \"Makef|
|00000830| 69 6c 65 5c 22 20 5c 28 | 32 35 38 20 63 68 61 72 |ile\" \(|258 char|
|00000840| 61 63 74 65 72 73 5c 29 | 0a 73 65 64 20 22 73 2f |acters\)|.sed "s/|
|00000850| 5e 58 2f 2f 22 20 3e 4d | 61 6b 65 66 69 6c 65 20 |^X//" >M|akefile |
|00000860| 3c 3c 27 45 4e 44 5f 4f | 46 5f 4d 61 6b 65 66 69 |<<'END_O|F_Makefi|
|00000870| 6c 65 27 0a 58 23 20 73 | 69 6d 70 6c 65 20 6d 61 |le'.X# s|imple ma|
|00000880| 6b 65 66 69 6c 65 20 66 | 6f 72 20 6a 75 6d 62 6c |kefile f|or jumbl|
|00000890| 65 0a 58 6a 75 6d 62 6c | 65 3a 20 6a 75 6d 62 6c |e.Xjumbl|e: jumbl|
|000008a0| 65 2e 63 0a 58 09 63 63 | 20 2d 6f 20 6a 75 6d 62 |e.c.X.cc| -o jumb|
|000008b0| 6c 65 20 6a 75 6d 62 6c | 65 2e 63 0a 58 0a 58 69 |le jumbl|e.c.X.Xi|
|000008c0| 6e 73 74 61 6c 6c 3a 20 | 6a 75 6d 62 6c 65 0a 58 |nstall: |jumble.X|
|000008d0| 09 63 70 20 6a 75 6d 62 | 6c 65 20 2f 75 73 72 2f |.cp jumb|le /usr/|
|000008e0| 67 61 6d 65 73 0a 58 09 | 23 20 6e 6f 74 65 3a 20 |games.X.|# note: |
|000008f0| 74 68 69 73 20 70 61 74 | 68 20 69 73 20 77 69 72 |this pat|h is wir|
|00000900| 65 64 20 69 6e 74 6f 20 | 74 68 65 20 63 6f 64 65 |ed into |the code|
|00000910| 0a 58 09 23 20 65 64 69 | 74 20 69 74 20 69 66 20 |.X.# edi|t it if |
|00000920| 79 6f 75 20 63 68 61 6e | 67 65 20 74 68 65 20 70 |you chan|ge the p|
|00000930| 61 74 68 0a 58 09 74 6f | 75 63 68 20 2f 75 73 72 |ath.X.to|uch /usr|
|00000940| 2f 67 61 6d 65 73 2f 6c | 69 62 2f 6a 75 6d 62 6c |/games/l|ib/jumbl|
|00000950| 65 2e 73 63 6f 72 65 0a | 58 09 63 68 6d 6f 64 20 |e.score.|X.chmod |
|00000960| 36 36 36 20 2f 75 73 72 | 2f 67 61 6d 65 73 2f 6c |666 /usr|/games/l|
|00000970| 69 62 2f 6a 75 6d 62 6c | 65 2e 73 63 6f 72 65 0a |ib/jumbl|e.score.|
|00000980| 45 4e 44 5f 4f 46 5f 4d | 61 6b 65 66 69 6c 65 0a |END_OF_M|akefile.|
|00000990| 69 66 20 74 65 73 74 20 | 32 35 38 20 2d 6e 65 20 |if test |258 -ne |
|000009a0| 60 77 63 20 2d 63 20 3c | 4d 61 6b 65 66 69 6c 65 |`wc -c <|Makefile|
|000009b0| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|000009c0| 20 73 68 61 72 3a 20 5c | 22 4d 61 6b 65 66 69 6c | shar: \|"Makefil|
|000009d0| 65 5c 22 20 75 6e 70 61 | 63 6b 65 64 20 77 69 74 |e\" unpa|cked wit|
|000009e0| 68 20 77 72 6f 6e 67 20 | 73 69 7a 65 21 0a 66 69 |h wrong |size!.fi|
|000009f0| 0a 23 20 65 6e 64 20 6f | 66 20 6f 76 65 72 77 72 |.# end o|f overwr|
|00000a00| 69 74 69 6e 67 20 63 68 | 65 63 6b 0a 66 69 0a 69 |iting ch|eck.fi.i|
|00000a10| 66 20 74 65 73 74 20 2d | 66 20 6a 75 6d 62 6c 65 |f test -|f jumble|
|00000a20| 2e 63 20 2d 61 20 22 24 | 7b 31 7d 22 20 21 3d 20 |.c -a "$|{1}" != |
|00000a30| 22 2d 63 22 20 3b 20 74 | 68 65 6e 20 0a 20 20 65 |"-c" ; t|hen . e|
|00000a40| 63 68 6f 20 73 68 61 72 | 3a 20 57 69 6c 6c 20 6e |cho shar|: Will n|
|00000a50| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|00000a60| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 5c 22 6a 75 |isting f|ile \"ju|
|00000a70| 6d 62 6c 65 2e 63 5c 22 | 0a 65 6c 73 65 0a 65 63 |mble.c\"|.else.ec|
|00000a80| 68 6f 20 73 68 61 72 3a | 20 45 78 74 72 61 63 74 |ho shar:| Extract|
|00000a90| 69 6e 67 20 5c 22 6a 75 | 6d 62 6c 65 2e 63 5c 22 |ing \"ju|mble.c\"|
|00000aa0| 20 5c 28 31 39 39 31 34 | 20 63 68 61 72 61 63 74 | \(19914| charact|
|00000ab0| 65 72 73 5c 29 0a 73 65 | 64 20 22 73 2f 5e 58 2f |ers\).se|d "s/^X/|
|00000ac0| 2f 22 20 3e 6a 75 6d 62 | 6c 65 2e 63 20 3c 3c 27 |/" >jumb|le.c <<'|
|00000ad0| 45 4e 44 5f 4f 46 5f 6a | 75 6d 62 6c 65 2e 63 27 |END_OF_j|umble.c'|
|00000ae0| 0a 58 2f 2a 0a 58 20 2a | 20 4a 75 6d 62 6c 65 20 |.X/*.X *| Jumble |
|00000af0| 2d 2d 20 20 74 68 65 20 | 67 61 6d 65 20 69 6e 20 |-- the |game in |
|00000b00| 77 68 69 63 68 20 79 6f | 75 20 75 6e 73 63 72 61 |which yo|u unscra|
|00000b10| 6d 62 6c 65 20 77 6f 72 | 64 73 20 74 6f 20 63 6f |mble wor|ds to co|
|00000b20| 6d 70 65 74 65 20 66 6f | 72 0a 58 20 2a 20 20 20 |mpete fo|r.X * |
|00000b30| 70 6f 69 6e 74 73 20 6f | 6e 20 61 20 68 69 67 68 |points o|n a high|
|00000b40| 20 73 63 6f 72 65 20 6c | 69 73 74 20 6f 66 20 31 | score l|ist of 1|
|00000b50| 30 20 61 6e 64 20 34 20 | 6c 65 76 65 6c 73 20 6f |0 and 4 |levels o|
|00000b60| 66 0a 58 20 2a 20 20 20 | 64 69 66 66 69 63 75 6c |f.X * |difficul|
|00000b70| 74 79 20 74 6f 20 63 68 | 6f 6f 73 65 20 66 72 6f |ty to ch|oose fro|
|00000b80| 6d 2e 20 57 6f 72 64 73 | 20 61 72 65 20 66 6f 75 |m. Words| are fou|
|00000b90| 6e 64 20 69 6e 20 2f 75 | 73 72 2f 64 69 63 74 2f |nd in /u|sr/dict/|
|00000ba0| 77 6f 72 64 73 2c 0a 58 | 20 2a 20 20 20 74 68 65 |words,.X| * the|
|00000bb0| 20 62 61 73 69 63 20 64 | 69 63 74 69 6f 6e 61 72 | basic d|ictionar|
|00000bc0| 79 20 66 6f 75 6e 64 20 | 6f 6e 20 61 6c 6c 20 55 |y found |on all U|
|00000bd0| 4e 49 58 20 73 79 73 74 | 65 6d 73 2e 0a 58 20 2a |NIX syst|ems..X *|
|00000be0| 20 0a 58 20 2a 20 20 20 | 54 68 69 73 20 70 72 6f | .X * |This pro|
|00000bf0| 67 72 61 6d 20 77 61 73 | 20 77 72 69 74 74 65 6e |gram was| written|
|00000c00| 20 62 79 20 44 61 6e 20 | 48 65 6c 6c 65 72 2e 0a | by Dan |Heller..|
|00000c10| 58 20 2a 20 20 20 69 73 | 6c 61 6e 64 21 61 72 67 |X * is|land!arg|
|00000c20| 76 40 73 75 6e 2e 63 6f | 6d 0a 58 20 2a 0a 58 20 |v@sun.co|m.X *.X |
|00000c30| 2a 20 20 20 63 6f 6d 70 | 69 6c 65 20 6e 6f 72 6d |* comp|ile norm|
|00000c40| 61 6c 6c 79 2c 20 62 75 | 74 20 69 66 20 79 6f 75 |ally, bu|t if you|
|00000c50| 27 72 65 20 6f 6e 20 61 | 20 6d 61 63 68 69 6e 65 |'re on a| machine|
|00000c60| 20 77 69 74 68 20 31 36 | 20 62 69 74 20 69 6e 74 | with 16| bit int|
|00000c70| 73 2c 20 75 73 65 0a 58 | 20 2a 20 20 20 72 61 6e |s, use.X| * ran|
|00000c80| 64 6f 6d 28 29 20 61 74 | 20 74 68 65 20 65 6e 64 |dom() at| the end|
|00000c90| 20 6f 66 20 74 68 69 73 | 20 66 69 6c 65 2e 0a 58 | of this| file..X|
|00000ca0| 20 2a 20 0a 58 20 2a 2f | 0a 58 0a 58 2f 2a 20 49 | * .X */|.X.X/* I|
|00000cb0| 6e 63 6c 75 64 65 20 66 | 69 6c 65 73 20 2a 2f 0a |nclude f|iles */.|
|00000cc0| 58 0a 58 23 69 6e 63 6c | 75 64 65 20 3c 73 74 64 |X.X#incl|ude <std|
|00000cd0| 69 6f 2e 68 3e 0a 58 23 | 69 6e 63 6c 75 64 65 20 |io.h>.X#|include |
|00000ce0| 3c 63 74 79 70 65 2e 68 | 3e 0a 58 23 69 6e 63 6c |<ctype.h|>.X#incl|
|00000cf0| 75 64 65 20 3c 73 69 67 | 6e 61 6c 2e 68 3e 0a 58 |ude <sig|nal.h>.X|
|00000d00| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 74 69 |#include| <sys/ti|
|00000d10| 6d 65 2e 68 3e 0a 58 23 | 69 6e 63 6c 75 64 65 20 |me.h>.X#|include |
|00000d20| 3c 73 79 73 2f 74 79 70 | 65 73 2e 68 3e 0a 58 23 |<sys/typ|es.h>.X#|
|00000d30| 69 6e 63 6c 75 64 65 20 | 3c 73 79 73 2f 73 74 61 |include |<sys/sta|
|00000d40| 74 2e 68 3e 0a 58 0a 58 | 2f 2a 20 20 63 6f 6e 76 |t.h>.X.X|/* conv|
|00000d50| 65 6e 69 65 6e 63 65 20 | 20 2a 2f 0a 58 23 64 65 |enience | */.X#de|
|00000d60| 66 69 6e 65 20 75 70 70 | 65 72 28 63 29 20 28 69 |fine upp|er(c) (i|
|00000d70| 73 75 70 70 65 72 28 63 | 29 20 3f 20 63 20 3a 20 |supper(c|) ? c : |
|00000d80| 74 6f 75 70 70 65 72 28 | 63 29 29 0a 58 23 64 65 |toupper(|c)).X#de|
|00000d90| 66 69 6e 65 20 6c 6f 77 | 65 72 28 63 29 20 28 69 |fine low|er(c) (i|
|00000da0| 73 6c 6f 77 65 72 28 63 | 29 20 3f 20 63 20 3a 20 |slower(c|) ? c : |
|00000db0| 74 6f 6c 6f 77 65 72 28 | 63 29 29 0a 58 23 64 65 |tolower(|c)).X#de|
|00000dc0| 66 69 6e 65 20 55 70 70 | 65 72 28 63 29 20 28 63 |fine Upp|er(c) (c|
|00000dd0| 20 3d 20 75 70 70 65 72 | 28 63 29 29 0a 58 23 64 | = upper|(c)).X#d|
|00000de0| 65 66 69 6e 65 20 4c 6f | 77 65 72 28 63 29 20 28 |efine Lo|wer(c) (|
|00000df0| 63 20 3d 20 6c 6f 77 65 | 72 28 63 29 29 0a 58 23 |c = lowe|r(c)).X#|
|00000e00| 64 65 66 69 6e 65 20 77 | 68 65 6e 20 62 72 65 61 |define w|hen brea|
|00000e10| 6b 3b 63 61 73 65 0a 58 | 23 64 65 66 69 6e 65 20 |k;case.X|#define |
|00000e20| 6f 74 68 65 72 77 69 73 | 65 20 62 72 65 61 6b 3b |otherwis|e break;|
|00000e30| 64 65 66 61 75 6c 74 0a | 58 0a 58 2f 2a 20 63 6f |default.|X.X/* co|
|00000e40| 6e 73 74 61 6e 74 73 20 | 2a 2f 0a 58 23 64 65 66 |nstants |*/.X#def|
|00000e50| 69 6e 65 20 74 69 6d 65 | 5f 6c 65 66 74 20 20 28 |ine time|_left (|
|00000e60| 69 6e 74 29 28 73 74 61 | 72 74 5f 74 69 6d 65 20 |int)(sta|rt_time |
|00000e70| 2b 20 64 65 61 74 68 5f | 74 69 6d 65 20 2d 20 6e |+ death_|time - n|
|00000e80| 6f 77 29 20 2f 2a 20 74 | 69 6d 65 20 6c 65 66 74 |ow) /* t|ime left|
|00000e90| 20 74 6f 20 67 75 65 73 | 73 20 2a 2f 0a 58 23 64 | to gues|s */.X#d|
|00000ea0| 65 66 69 6e 65 20 4e 41 | 4d 45 4c 45 4e 09 09 33 |efine NA|MELEN..3|
|00000eb0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|00000ec0| 20 20 20 20 20 2f 2a 20 | 6c 65 6e 67 74 68 20 6f | /* |length o|
|00000ed0| 66 20 6e 61 6d 65 20 66 | 6f 72 20 73 63 6f 72 65 |f name f|or score|
|00000ee0| 73 20 2a 2f 0a 58 23 64 | 65 66 69 6e 65 20 57 4f |s */.X#d|efine WO|
|00000ef0| 52 44 53 5f 4e 45 45 44 | 45 44 20 20 20 20 20 34 |RDS_NEED|ED 4|
|00000f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 77 | | /* w|
|00000f10| 6f 72 64 73 20 6e 65 65 | 64 65 64 20 74 6f 20 67 |ords nee|ded to g|
|00000f20| 65 74 20 6f 6e 20 73 63 | 6f 72 65 20 66 69 6c 65 |et on sc|ore file|
|00000f30| 20 2a 2f 0a 58 23 64 65 | 66 69 6e 65 20 74 68 65 | */.X#de|fine the|
|00000f40| 5f 70 6f 70 65 5f 69 73 | 5f 63 61 74 68 6f 6c 69 |_pope_is|_catholi|
|00000f50| 63 20 31 20 20 20 20 20 | 20 2f 2a 20 77 68 69 6c |c 1 | /* whil|
|00000f60| 65 28 31 29 20 69 73 20 | 62 6f 72 69 6e 67 20 2a |e(1) is |boring *|
|00000f70| 2f 0a 58 0a 58 2f 2a 20 | 6f 74 68 65 72 20 66 69 |/.X.X/* |other fi|
|00000f80| 6c 65 73 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |les */.X|#define |
|00000f90| 57 4f 52 44 53 20 09 09 | 22 2f 75 73 72 2f 64 69 |WORDS ..|"/usr/di|
|00000fa0| 63 74 2f 77 6f 72 64 73 | 22 20 20 20 20 20 20 20 |ct/words|" |
|00000fb0| 20 20 20 20 20 20 2f 2a | 20 77 68 65 72 65 20 74 | /*| where t|
|00000fc0| 6f 20 67 65 74 20 77 6f | 72 64 73 20 2a 2f 0a 58 |o get wo|rds */.X|
|00000fd0| 23 64 65 66 69 6e 65 20 | 53 43 4f 52 45 46 49 4c |#define |SCOREFIL|
|00000fe0| 45 09 22 2f 75 73 72 2f | 67 61 6d 65 73 2f 6c 69 |E."/usr/|games/li|
|00000ff0| 62 2f 6a 75 6d 62 6c 65 | 2e 73 63 6f 72 65 73 22 |b/jumble|.scores"|
|00001000| 20 2f 2a 20 77 68 65 72 | 65 20 73 63 6f 72 65 73 | /* wher|e scores|
|00001010| 20 6c 69 76 65 20 20 2a | 2f 0a 58 0a 58 63 68 61 | live *|/.X.Xcha|
|00001020| 72 20 2a 67 65 74 6c 6f | 67 69 6e 28 29 3b 09 09 |r *getlo|gin();..|
|00001030| 20 20 20 20 2f 2a 20 72 | 65 74 75 72 6e 20 74 68 | /* r|eturn th|
|00001040| 65 20 6c 6f 67 69 6e 20 | 6e 61 6d 65 20 6f 66 20 |e login |name of |
|00001050| 75 73 65 72 20 2a 2f 0a | 58 63 68 61 72 20 2a 6f |user */.|Xchar *o|
|00001060| 72 64 69 6e 61 74 65 28 | 29 3b 20 20 20 20 20 20 |rdinate(|); |
|00001070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00001080| 72 65 74 75 72 6e 73 20 | 22 73 74 22 2c 20 22 6e |returns |"st", "n|
|00001090| 64 22 2c 20 65 74 63 2e | 20 66 6f 72 20 6e 75 6d |d", etc.| for num|
|000010a0| 62 65 72 73 20 2a 2f 0a | 58 63 68 61 72 20 6a 75 |bers */.|Xchar ju|
|000010b0| 6d 62 6c 65 5f 77 6f 72 | 64 5b 34 30 5d 3b 20 20 |mble_wor|d[40]; |
|000010c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|000010d0| 77 68 61 74 20 74 68 65 | 20 77 6f 72 64 20 77 65 |what the| word we|
|000010e0| 27 72 65 20 6a 75 6d 62 | 6c 69 6e 67 20 69 73 20 |'re jumb|ling is |
|000010f0| 2a 2f 0a 58 63 68 61 72 | 20 6a 75 6d 62 6c 65 64 |*/.Xchar| jumbled|
|00001100| 5b 34 30 5d 3b 20 20 20 | 20 20 20 20 20 20 20 20 |[40]; | |
|00001110| 20 20 20 20 20 20 20 20 | 2f 2a 20 77 68 61 74 20 | |/* what |
|00001120| 74 68 65 20 6a 75 6d 62 | 6c 65 64 20 77 6f 72 64 |the jumb|led word|
|00001130| 20 69 73 20 2a 2f 0a 58 | 69 6e 74 20 64 65 62 75 | is */.X|int debu|
|00001140| 67 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |g; | |
|00001150| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 64 | | /* d|
|00001160| 65 62 75 67 20 6d 6f 64 | 65 20 2d 2d 20 6c 65 74 |ebug mod|e -- let|
|00001170| 73 20 79 6f 75 20 63 68 | 65 61 74 20 2a 2f 0a 58 |s you ch|eat */.X|
|00001180| 69 6e 74 20 6e 75 6d 5f | 6f 66 5f 77 6f 72 64 73 |int num_|of_words|
|00001190| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|000011a0| 20 20 20 20 2f 2a 20 68 | 6f 77 20 6d 61 6e 79 20 | /* h|ow many |
|000011b0| 77 6f 72 64 73 20 70 6c | 61 79 65 72 20 63 68 6f |words pl|ayer cho|
|000011c0| 73 65 20 74 6f 20 70 6c | 61 79 20 2a 2f 0a 58 69 |se to pl|ay */.Xi|
|000011d0| 6e 74 20 77 6f 72 64 73 | 5f 67 69 76 65 6e 3b 20 |nt words|_given; |
|000011e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000011f0| 20 20 20 2f 2a 20 68 6f | 77 20 6d 61 6e 79 20 77 | /* ho|w many w|
|00001200| 6f 72 64 73 20 77 65 27 | 76 65 20 67 69 76 65 6e |ords we'|ve given|
|00001210| 20 74 68 69 73 20 72 6f | 75 6e 64 20 2a 2f 0a 58 | this ro|und */.X|
|00001220| 69 6e 74 20 70 61 73 73 | 65 73 3b 20 20 20 20 20 |int pass|es; |
|00001230| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001240| 20 20 20 20 2f 2a 20 68 | 6f 77 20 6d 61 6e 79 20 | /* h|ow many |
|00001250| 70 61 73 73 65 73 20 74 | 68 65 20 70 6c 61 79 65 |passes t|he playe|
|00001260| 72 20 68 61 73 20 75 73 | 65 64 20 2a 2f 0a 58 69 |r has us|ed */.Xi|
|00001270| 6e 74 20 74 6f 74 61 6c | 5f 70 61 73 73 65 73 3b |nt total|_passes;|
|00001280| 20 20 20 09 09 20 20 20 | 20 2f 2a 20 6e 75 6d 62 | .. | /* numb|
|00001290| 65 72 20 6f 66 20 70 61 | 73 73 65 73 20 70 6c 61 |er of pa|sses pla|
|000012a0| 79 65 72 20 68 61 73 20 | 2a 2f 0a 58 69 6e 74 20 |yer has |*/.Xint |
|000012b0| 67 6f 74 69 74 3b 20 20 | 20 20 20 20 20 20 20 20 |gotit; | |
|000012c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000012d0| 2f 2a 20 64 69 64 20 70 | 6c 61 79 65 72 20 67 75 |/* did p|layer gu|
|000012e0| 65 73 73 20 74 68 65 20 | 6a 75 6d 62 6c 65 64 20 |ess the |jumbled |
|000012f0| 77 6f 72 64 3f 20 2a 2f | 0a 58 69 6e 74 20 6c 65 |word? */|.Xint le|
|00001300| 76 65 6c 3b 20 20 20 20 | 20 20 20 20 20 20 20 20 |vel; | |
|00001310| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a | | /*|
|00001320| 20 74 68 65 20 64 69 66 | 66 69 63 75 6c 74 79 20 | the dif|ficulty |
|00001330| 6f 66 20 70 6c 61 79 20 | 70 6c 61 79 65 72 20 63 |of play |player c|
|00001340| 68 6f 73 65 20 2a 2f 0a | 58 69 6e 74 20 6c 65 6e |hose */.|Xint len|
|00001350| 67 74 68 3b 20 20 20 20 | 20 20 20 20 20 20 20 20 |gth; | |
|00001360| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00001370| 6c 65 6e 67 74 68 20 6f | 66 20 74 68 65 20 63 75 |length o|f the cu|
|00001380| 72 72 65 6e 74 20 6a 75 | 6d 62 6c 65 64 20 77 6f |rrent ju|mbled wo|
|00001390| 72 64 20 2a 2f 0a 58 75 | 6e 73 69 67 6e 65 64 20 |rd */.Xu|nsigned |
|000013a0| 64 65 61 74 68 5f 74 69 | 6d 65 3b 20 20 20 20 20 |death_ti|me; |
|000013b0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 74 69 | | /* ti|
|000013c0| 6d 65 20 79 6f 75 20 68 | 61 76 65 20 74 6f 20 75 |me you h|ave to u|
|000013d0| 6e 73 63 72 61 6d 62 6c | 65 20 77 6f 72 64 73 20 |nscrambl|e words |
|000013e0| 2a 2f 0a 58 74 69 6d 65 | 5f 74 20 73 74 61 72 74 |*/.Xtime|_t start|
|000013f0| 5f 74 69 6d 65 3b 20 20 | 20 20 20 20 20 20 20 20 |_time; | |
|00001400| 20 20 20 20 20 20 20 20 | 2f 2a 20 74 68 65 20 74 | |/* the t|
|00001410| 69 6d 65 20 6f 66 20 74 | 68 65 20 73 74 61 72 74 |ime of t|he start|
|00001420| 20 6f 66 20 65 61 63 68 | 20 72 6f 75 6e 64 20 2a | of each| round *|
|00001430| 2f 0a 58 74 69 6d 65 5f | 74 20 6e 6f 77 3b 20 20 |/.Xtime_|t now; |
|00001440| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001450| 20 20 20 20 20 20 20 2f | 2a 20 77 68 61 74 20 74 | /|* what t|
|00001460| 69 6d 65 20 69 74 20 69 | 73 20 6e 6f 77 20 2a 2f |ime it i|s now */|
|00001470| 0a 58 6c 6f 6e 67 20 72 | 61 6e 64 6f 6d 28 29 3b |.Xlong r|andom();|
|00001480| 09 09 09 20 20 20 20 2f | 2a 20 73 65 65 20 74 68 |... /|* see th|
|00001490| 65 20 65 6e 64 20 6f 66 | 20 74 68 69 73 20 66 69 |e end of| this fi|
|000014a0| 6c 65 20 2a 2f 0a 58 6c | 6f 6e 67 20 44 49 43 54 |le */.Xl|ong DICT|
|000014b0| 53 49 5a 45 3b 20 20 20 | 20 20 20 20 20 20 20 20 |SIZE; | |
|000014c0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 74 68 | | /* th|
|000014d0| 65 20 73 69 7a 65 20 6f | 66 20 74 68 65 20 64 69 |e size o|f the di|
|000014e0| 63 74 69 6f 6e 61 72 79 | 20 2a 2f 0a 58 46 49 4c |ctionary| */.XFIL|
|000014f0| 45 20 2a 64 69 63 74 69 | 6f 6e 61 72 79 3b 20 20 |E *dicti|onary; |
|00001500| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001510| 20 2f 2a 20 66 69 6c 65 | 20 70 6f 69 6e 74 65 72 | /* file| pointer|
|00001520| 20 74 6f 20 74 68 65 20 | 64 69 63 74 69 6f 6e 61 | to the |dictiona|
|00001530| 72 79 20 2a 2f 0a 58 0a | 58 75 6e 73 69 67 6e 65 |ry */.X.|Xunsigne|
|00001540| 64 20 61 6c 61 72 6d 28 | 29 2c 20 65 78 74 72 61 |d alarm(|), extra|
|00001550| 5f 63 72 65 64 69 74 28 | 29 3b 0a 58 0a 58 6d 61 |_credit(|);.X.Xma|
|00001560| 69 6e 28 61 72 67 63 2c | 20 61 72 67 76 29 0a 58 |in(argc,| argv).X|
|00001570| 69 6e 74 20 61 72 67 63 | 3b 0a 58 63 68 61 72 20 |int argc|;.Xchar |
|00001580| 2a 2a 61 72 67 76 3b 0a | 58 7b 0a 58 20 20 20 20 |**argv;.|X{.X |
|00001590| 63 68 61 72 20 63 3b 0a | 58 20 20 20 20 73 74 72 |char c;.|X str|
|000015a0| 75 63 74 20 73 74 61 74 | 20 62 75 66 3b 0a 58 20 |uct stat| buf;.X |
|000015b0| 20 20 20 69 6e 74 20 6f | 77 6e 65 72 2c 20 71 75 | int o|wner, qu|
|000015c0| 69 74 28 29 2c 20 6c 6f | 73 65 28 29 3b 0a 58 20 |it(), lo|se();.X |
|000015d0| 20 20 20 73 72 61 6e 64 | 6f 6d 28 67 65 74 70 69 | srand|om(getpi|
|000015e0| 64 28 29 29 3b 20 20 2f | 2a 20 69 66 20 79 6f 75 |d()); /|* if you|
|000015f0| 27 72 65 20 6f 6e 20 61 | 20 31 36 20 62 69 74 20 |'re on a| 16 bit |
|00001600| 6d 61 63 68 69 6e 65 20 | 63 68 61 6e 67 65 20 74 |machine |change t|
|00001610| 6f 20 73 72 61 6e 64 28 | 29 20 2a 2f 0a 58 20 20 |o srand(|) */.X |
|00001620| 20 20 69 66 20 28 21 28 | 64 69 63 74 69 6f 6e 61 | if (!(|dictiona|
|00001630| 72 79 20 3d 20 66 6f 70 | 65 6e 28 57 4f 52 44 53 |ry = fop|en(WORDS|
|00001640| 2c 20 22 72 22 29 29 29 | 20 20 20 20 20 2f 2a 20 |, "r")))| /* |
|00001650| 6f 70 65 6e 20 74 68 65 | 20 64 69 63 74 69 6f 6e |open the| diction|
|00001660| 61 72 79 20 2a 2f 0a 58 | 09 70 72 69 6e 74 66 28 |ary */.X|.printf(|
|00001670| 22 53 6f 72 72 79 2c 20 | 63 61 6e 27 74 20 74 68 |"Sorry, |can't th|
|00001680| 69 6e 6b 20 6f 66 20 61 | 6e 79 20 77 6f 72 64 73 |ink of a|ny words|
|00001690| 20 72 69 67 68 74 20 6e | 6f 77 2e 5c 6e 22 29 2c | right n|ow.\n"),|
|000016a0| 20 71 75 69 74 28 29 3b | 0a 58 20 20 20 20 66 73 | quit();|.X fs|
|000016b0| 74 61 74 28 66 69 6c 65 | 6e 6f 28 64 69 63 74 69 |tat(file|no(dicti|
|000016c0| 6f 6e 61 72 79 29 2c 20 | 26 62 75 66 29 3b 20 2f |onary), |&buf); /|
|000016d0| 2a 20 67 65 74 20 74 68 | 65 20 66 69 6c 65 20 73 |* get th|e file s|
|000016e0| 74 61 74 75 73 20 6f 66 | 20 64 69 63 74 69 6f 6e |tatus of| diction|
|000016f0| 61 72 79 20 20 2a 2f 0a | 58 20 20 20 20 44 49 43 |ary */.|X DIC|
|00001700| 54 53 49 5a 45 20 3d 20 | 62 75 66 2e 73 74 5f 73 |TSIZE = |buf.st_s|
|00001710| 69 7a 65 3b 20 20 20 20 | 20 20 20 20 20 20 2f 2a |ize; | /*|
|00001720| 20 67 6f 74 20 74 68 65 | 20 73 69 7a 65 20 6f 66 | got the| size of|
|00001730| 20 74 68 65 20 64 69 63 | 74 69 6f 6e 61 72 79 20 | the dic|tionary |
|00001740| 20 20 20 20 2a 2f 0a 58 | 20 20 20 20 73 69 67 6e | */.X| sign|
|00001750| 61 6c 28 53 49 47 41 4c | 52 4d 2c 20 6c 6f 73 65 |al(SIGAL|RM, lose|
|00001760| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 |); | /* |
|00001770| 74 65 6c 6c 20 74 68 65 | 20 61 6c 61 72 6d 20 77 |tell the| alarm w|
|00001780| 68 61 74 20 66 75 6e 63 | 74 69 6f 6e 20 74 6f 20 |hat func|tion to |
|00001790| 67 6f 20 2a 2f 0a 58 09 | 09 09 09 20 20 20 20 20 |go */.X.|... |
|000017a0| 2f 2a 20 74 6f 20 69 66 | 20 74 69 6d 65 20 72 75 |/* to if| time ru|
|000017b0| 6e 73 20 6f 75 74 20 20 | 20 20 20 20 20 20 20 20 |ns out | |
|000017c0| 20 20 20 20 20 20 2a 2f | 0a 58 20 20 20 20 73 69 | */|.X si|
|000017d0| 67 6e 61 6c 28 53 49 47 | 49 4e 54 2c 20 71 75 69 |gnal(SIG|INT, qui|
|000017e0| 74 29 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 2f |t); | /|
|000017f0| 2a 20 69 66 20 74 68 65 | 79 20 63 74 72 6c 2d 63 |* if the|y ctrl-c|
|00001800| 20 6c 65 74 20 65 6d 20 | 71 75 69 74 20 20 20 20 | let em |quit |
|00001810| 20 20 20 20 20 2a 2f 0a | 58 20 20 20 20 73 69 67 | */.|X sig|
|00001820| 6e 61 6c 28 53 49 47 51 | 55 49 54 2c 71 75 69 74 |nal(SIGQ|UIT,quit|
|00001830| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |); | /*|
|00001840| 20 73 61 6d 65 20 61 73 | 20 61 62 6f 76 65 20 20 | same as| above |
|00001850| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001860| 20 20 20 20 2a 2f 0a 58 | 20 20 20 20 6f 77 6e 65 | */.X| owne|
|00001870| 72 20 3d 20 28 73 74 61 | 74 28 61 72 67 76 5b 30 |r = (sta|t(argv[0|
|00001880| 5d 2c 20 26 62 75 66 29 | 20 21 3d 20 2d 31 20 26 |], &buf)| != -1 &|
|00001890| 26 20 62 75 66 2e 73 74 | 5f 75 69 64 20 3d 3d 20 |& buf.st|_uid == |
|000018a0| 67 65 74 75 69 64 28 29 | 29 3b 0a 58 09 09 09 20 |getuid()|);.X... |
|000018b0| 2f 2a 20 69 73 20 74 68 | 65 20 70 6c 61 79 65 72 |/* is th|e player|
|000018c0| 20 74 68 65 20 6f 77 6e | 65 72 20 6f 66 20 74 68 | the own|er of th|
|000018d0| 65 20 70 72 6f 67 72 61 | 6d 3f 20 2a 2f 0a 58 20 |e progra|m? */.X |
|000018e0| 20 20 20 64 65 62 75 67 | 20 3d 20 28 6f 77 6e 65 | debug| = (owne|
|000018f0| 72 20 26 26 20 61 72 67 | 63 20 3e 20 31 20 26 26 |r && arg|c > 1 &&|
|00001900| 20 21 73 74 72 63 6d 70 | 28 61 72 67 76 5b 31 5d | !strcmp|(argv[1]|
|00001910| 2c 20 22 2d 78 22 29 29 | 3b 0a 58 09 20 2f 2a 20 |, "-x"))|;.X. /* |
|00001920| 69 66 20 74 68 65 79 20 | 75 73 65 64 20 61 20 2d |if they |used a -|
|00001930| 78 20 66 6c 61 67 20 61 | 6e 64 20 74 68 65 79 27 |x flag a|nd they'|
|00001940| 72 65 20 74 68 65 20 6f | 77 6e 65 72 2c 20 65 6e |re the o|wner, en|
|00001950| 74 65 72 20 64 65 62 75 | 67 20 6d 6f 64 65 20 2a |ter debu|g mode *|
|00001960| 2f 0a 58 20 20 20 20 69 | 66 20 28 61 72 67 63 20 |/.X i|f (argc |
|00001970| 3e 20 31 20 26 26 20 28 | 21 73 74 72 63 6d 70 28 |> 1 && (|!strcmp(|
|00001980| 61 72 67 76 5b 31 5d 2c | 20 22 2d 73 22 29 20 7c |argv[1],| "-s") ||
|00001990| 7c 20 21 73 74 72 63 6d | 70 28 61 72 67 76 5b 31 || !strcm|p(argv[1|
|000019a0| 5d 2c 20 22 2d 6e 22 29 | 29 29 0a 58 09 68 69 67 |], "-n")|)).X.hig|
|000019b0| 68 5f 73 63 6f 72 65 28 | 31 2c 61 72 67 76 5b 31 |h_score(|1,argv[1|
|000019c0| 5d 5b 31 5d 20 3d 3d 20 | 27 6e 27 20 26 26 20 6f |][1] == |'n' && o|
|000019d0| 77 6e 65 72 29 2c 20 65 | 78 69 74 28 30 29 3b 0a |wner), e|xit(0);.|
|000019e0| 58 09 20 2f 2a 20 69 66 | 20 74 68 65 20 70 6c 61 |X. /* if| the pla|
|000019f0| 79 65 72 20 6a 75 73 74 | 20 77 61 6e 74 73 20 74 |yer just| wants t|
|00001a00| 6f 20 73 65 65 20 74 68 | 65 20 68 69 67 68 20 73 |o see th|e high s|
|00001a10| 63 6f 72 65 73 20 6f 72 | 2c 20 69 66 20 74 68 65 |cores or|, if the|
|00001a20| 20 6f 77 6e 65 72 20 20 | 2a 2f 0a 58 09 20 2f 2a | owner |*/.X. /*|
|00001a30| 20 77 61 6e 74 73 20 74 | 6f 20 73 65 65 20 74 68 | wants t|o see th|
|00001a40| 65 20 61 63 63 6f 75 6e | 74 20 6e 61 6d 65 73 20 |e accoun|t names |
|00001a50| 6f 66 20 74 68 6f 73 65 | 20 6f 6e 20 74 68 65 20 |of those| on the |
|00001a60| 68 69 67 68 20 73 63 6f | 72 65 73 20 6c 69 73 74 |high sco|res list|
|00001a70| 20 20 20 2a 2f 0a 58 20 | 20 20 20 70 72 69 6e 74 | */.X | print|
|00001a80| 66 28 22 44 6f 20 79 6f | 75 20 77 61 6e 74 20 64 |f("Do yo|u want d|
|00001a90| 69 72 65 63 74 69 6f 6e | 73 3f 20 22 29 3b 0a 58 |irection|s? ");.X|
|00001aa0| 20 20 20 20 77 68 69 6c | 65 20 28 28 63 20 3d 20 | whil|e ((c = |
|00001ab0| 67 65 74 63 68 61 72 28 | 29 29 20 3d 3d 20 27 20 |getchar(|)) == ' |
|00001ac0| 27 20 7c 7c 20 63 20 3d | 3d 20 27 5c 74 27 29 3b |' || c =|= '\t');|
|00001ad0| 0a 58 20 20 20 20 69 66 | 28 63 20 3d 3d 20 27 79 |.X if|(c == 'y|
|00001ae0| 27 20 7c 7c 20 63 20 3d | 3d 20 27 59 27 29 0a 58 |' || c =|= 'Y').X|
|00001af0| 09 68 65 6c 70 28 61 72 | 67 76 29 3b 20 09 09 09 |.help(ar|gv); ...|
|00001b00| 20 20 20 20 20 20 2f 2a | 20 67 69 76 65 20 68 65 | /*| give he|
|00001b10| 6c 70 20 69 66 20 77 61 | 6e 74 65 64 20 2a 2f 0a |lp if wa|nted */.|
|00001b20| 58 20 20 20 20 77 68 69 | 6c 65 28 63 20 21 3d 20 |X whi|le(c != |
|00001b30| 27 5c 6e 27 29 0a 58 09 | 63 20 3d 20 67 65 74 63 |'\n').X.|c = getc|
|00001b40| 68 61 72 28 29 3b 20 20 | 20 09 09 20 20 20 20 20 |har(); | .. |
|00001b50| 20 2f 2a 20 66 6c 75 73 | 68 20 74 68 65 20 69 6e | /* flus|h the in|
|00001b60| 70 75 74 20 6c 69 6e 65 | 20 2a 2f 0a 58 20 20 20 |put line| */.X |
|00001b70| 20 67 65 74 5f 6c 65 76 | 65 6c 28 29 3b 20 20 20 | get_lev|el(); |
|00001b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b90| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 66 69 | | /* fi|
|00001ba0| 6e 64 20 6f 75 74 20 68 | 6f 77 20 62 61 64 6c 79 |nd out h|ow badly|
|00001bb0| 20 74 6f 20 6b 69 6c 6c | 20 2a 2f 0a 58 20 20 20 | to kill| */.X |
|00001bc0| 20 77 68 69 6c 65 28 74 | 68 65 5f 70 6f 70 65 5f | while(t|he_pope_|
|00001bd0| 69 73 5f 63 61 74 68 6f | 6c 69 63 29 20 7b 20 20 |is_catho|lic) { |
|00001be0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 6c 65 | | /* le|
|00001bf0| 74 27 73 20 70 6c 61 79 | 20 2a 2f 0a 58 09 67 65 |t's play| */.X.ge|
|00001c00| 74 5f 6e 75 6d 5f 6f 66 | 5f 77 6f 72 64 73 28 29 |t_num_of|_words()|
|00001c10| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|00001c20| 20 20 20 20 2f 2a 20 68 | 6f 77 20 6d 61 6e 79 20 | /* h|ow many |
|00001c30| 77 6f 72 64 73 20 74 68 | 69 73 20 72 6f 75 6e 64 |words th|is round|
|00001c40| 3f 20 2a 2f 0a 58 09 67 | 6f 74 69 74 20 3d 20 31 |? */.X.g|otit = 1|
|00001c50| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|00001c60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00001c70| 73 6f 20 66 61 72 20 74 | 68 65 79 27 72 65 20 64 |so far t|hey're d|
|00001c80| 6f 69 6e 67 20 66 69 6e | 65 20 20 2a 2f 0a 58 09 |oing fin|e */.X.|
|00001c90| 77 6f 72 64 73 5f 67 69 | 76 65 6e 20 3d 20 70 61 |words_gi|ven = pa|
|00001ca0| 73 73 65 73 20 3d 20 30 | 3b 20 20 20 20 20 20 20 |sses = 0|; |
|00001cb0| 20 20 20 20 20 20 2f 2a | 20 62 61 73 69 63 20 76 | /*| basic v|
|00001cc0| 61 72 69 61 62 6c 65 73 | 20 67 65 74 20 76 61 6c |ariables| get val|
|00001cd0| 75 65 73 20 2a 2f 0a 58 | 09 69 66 20 28 28 74 6f |ues */.X|.if ((to|
|00001ce0| 74 61 6c 5f 70 61 73 73 | 65 73 20 3d 20 28 6e 75 |tal_pass|es = (nu|
|00001cf0| 6d 5f 6f 66 5f 77 6f 72 | 64 73 20 2d 20 28 2d 31 |m_of_wor|ds - (-1|
|00001d00| 2a 6c 65 76 65 6c 20 2b | 20 35 29 29 29 20 3c 20 |*level +| 5))) < |
|00001d10| 30 29 0a 58 09 20 20 20 | 20 74 6f 74 61 6c 5f 70 |0).X. | total_p|
|00001d20| 61 73 73 65 73 20 3d 20 | 30 3b 0a 58 09 64 65 61 |asses = |0;.X.dea|
|00001d30| 74 68 5f 74 69 6d 65 20 | 3d 20 28 6c 6f 6e 67 29 |th_time |= (long)|
|00001d40| 35 35 2e 30 20 2a 20 6e | 75 6d 5f 6f 66 5f 77 6f |55.0 * n|um_of_wo|
|00001d50| 72 64 73 20 2a 20 28 31 | 2b 6c 65 76 65 6c 20 2f |rds * (1|+level /|
|00001d60| 20 31 2e 35 29 3b 0a 58 | 09 28 76 6f 69 64 29 20 | 1.5);.X|.(void) |
|00001d70| 74 69 6d 65 28 26 73 74 | 61 72 74 5f 74 69 6d 65 |time(&st|art_time|
|00001d80| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f |); | /|
|00001d90| 2a 20 67 61 6d 65 20 73 | 74 61 72 74 73 20 6e 6f |* game s|tarts no|
|00001da0| 77 20 2a 2f 0a 58 09 28 | 76 6f 69 64 29 20 61 6c |w */.X.(|void) al|
|00001db0| 61 72 6d 28 64 65 61 74 | 68 5f 74 69 6d 65 29 3b |arm(deat|h_time);|
|00001dc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00001dd0| 61 6c 61 72 6d 20 67 6f | 65 73 20 6f 66 66 20 69 |alarm go|es off i|
|00001de0| 6e 20 64 65 61 74 68 74 | 69 6d 65 20 2a 2f 0a 58 |n deatht|ime */.X|
|00001df0| 09 70 72 69 6e 74 66 28 | 22 25 64 20 77 6f 72 64 |.printf(|"%d word|
|00001e00| 25 73 20 63 6f 6d 69 6e | 67 2e 5c 6e 5c 6e 22 2c |%s comin|g.\n\n",|
|00001e10| 20 0a 58 09 09 6e 75 6d | 5f 6f 66 5f 77 6f 72 64 | .X..num|_of_word|
|00001e20| 73 2c 20 28 6e 75 6d 5f | 6f 66 5f 77 6f 72 64 73 |s, (num_|of_words|
|00001e30| 20 3e 20 31 29 20 3f 20 | 22 73 22 20 3a 20 22 22 | > 1) ? |"s" : ""|
|00001e40| 29 3b 0a 58 09 70 72 69 | 6e 74 66 28 22 59 6f 75 |);.X.pri|ntf("You|
|00001e50| 20 68 61 76 65 20 25 64 | 20 70 61 73 73 25 73 2e | have %d| pass%s.|
|00001e60| 5c 6e 22 2c 20 0a 58 09 | 20 20 20 20 20 74 6f 74 |\n", .X.| tot|
|00001e70| 61 6c 5f 70 61 73 73 65 | 73 2c 20 28 74 6f 74 61 |al_passe|s, (tota|
|00001e80| 6c 5f 70 61 73 73 65 73 | 20 3d 3d 20 31 29 20 3f |l_passes| == 1) ?|
|00001e90| 20 22 22 20 3a 20 22 65 | 73 22 29 3b 0a 58 09 77 | "" : "e|s");.X.w|
|00001ea0| 68 69 6c 65 20 28 67 6f | 74 69 74 20 3e 20 30 20 |hile (go|tit > 0 |
|00001eb0| 26 26 20 77 6f 72 64 73 | 5f 67 69 76 65 6e 20 3c |&& words|_given <|
|00001ec0| 20 6e 75 6d 5f 6f 66 5f | 77 6f 72 64 73 29 20 7b | num_of_|words) {|
|00001ed0| 0a 58 09 20 20 20 20 66 | 69 6e 64 5f 61 5f 77 6f |.X. f|ind_a_wo|
|00001ee0| 72 64 28 29 3b 0a 58 09 | 20 20 20 20 6d 69 78 69 |rd();.X.| mixi|
|00001ef0| 74 28 29 3b 0a 58 09 20 | 20 20 20 77 6f 72 64 73 |t();.X. | words|
|00001f00| 5f 67 69 76 65 6e 2b 2b | 3b 20 20 20 2f 2a 20 77 |_given++|; /* w|
|00001f10| 65 27 72 65 20 67 69 76 | 69 6e 67 20 61 6e 6f 74 |e're giv|ing anot|
|00001f20| 68 65 72 20 77 6f 72 64 | 2e 2e 2e 20 2a 2f 0a 58 |her word|... */.X|
|00001f30| 09 20 20 20 20 70 72 69 | 6e 74 69 74 28 29 3b 0a |. pri|ntit();.|
|00001f40| 58 09 20 20 20 20 69 66 | 28 21 6c 65 74 65 6d 67 |X. if|(!letemg|
|00001f50| 75 65 73 73 28 29 29 20 | 77 6f 72 64 73 5f 67 69 |uess()) |words_gi|
|00001f60| 76 65 6e 2d 2d 3b 0a 58 | 09 09 20 20 2f 2a 20 6c |ven--;.X|.. /* l|
|00001f70| 65 74 65 6d 67 75 65 73 | 73 20 72 65 74 75 72 6e |etemgues|s return|
|00001f80| 73 20 30 20 69 66 20 74 | 68 65 79 20 70 61 73 73 |s 0 if t|hey pass|
|00001f90| 65 64 20 74 68 69 73 20 | 77 6f 72 64 20 2a 2f 0a |ed this |word */.|
|00001fa0| 58 09 20 20 20 20 65 6c | 73 65 20 69 66 28 77 6f |X. el|se if(wo|
|00001fb0| 72 64 73 5f 67 69 76 65 | 6e 20 2d 20 57 4f 52 44 |rds_give|n - WORD|
|00001fc0| 53 5f 4e 45 45 44 45 44 | 20 3e 20 30 29 20 7b 0a |S_NEEDED| > 0) {.|
|00001fd0| 58 09 09 70 72 69 6e 74 | 66 28 22 5c 6e 45 78 74 |X..print|f("\nExt|
|00001fe0| 72 61 20 74 69 6d 65 20 | 66 6f 72 20 65 78 74 72 |ra time |for extr|
|00001ff0| 61 20 77 6f 72 64 73 3a | 20 22 29 3b 0a 58 09 09 |a words:| ");.X..|
|00002000| 2f 2a 20 72 65 73 65 74 | 20 61 6c 61 72 6d 20 2a |/* reset| alarm *|
|00002010| 2f 0a 58 09 09 28 76 6f | 69 64 29 20 61 6c 61 72 |/.X..(vo|id) alar|
|00002020| 6d 28 61 6c 61 72 6d 28 | 28 75 6e 73 69 67 6e 65 |m(alarm(|(unsigne|
|00002030| 64 29 30 29 20 2b 20 65 | 78 74 72 61 5f 63 72 65 |d)0) + e|xtra_cre|
|00002040| 64 69 74 28 29 29 3b 0a | 58 09 20 20 20 20 7d 0a |dit());.|X. }.|
|00002050| 58 09 2f 2a 20 74 68 65 | 79 20 67 6f 74 20 69 74 |X./* the|y got it|
|00002060| 20 73 6f 20 67 69 76 65 | 20 74 68 65 6d 20 65 78 | so give| them ex|
|00002070| 74 72 61 20 63 72 65 64 | 69 74 20 66 6f 72 20 77 |tra cred|it for w|
|00002080| 6f 72 64 73 0a 58 09 09 | 09 09 09 20 67 6f 74 74 |ords.X..|... gott|
|00002090| 65 6e 20 61 66 74 65 72 | 20 77 6f 72 64 73 20 6e |en after| words n|
|000020a0| 65 65 64 65 64 20 2a 2f | 0a 58 09 7d 0a 58 09 69 |eeded */|.X.}.X.i|
|000020b0| 66 20 28 67 6f 74 69 74 | 20 21 3d 20 2d 31 29 20 |f (gotit| != -1) |
|000020c0| 77 68 69 6c 65 28 70 61 | 73 73 65 73 20 3c 20 74 |while(pa|sses < t|
|000020d0| 6f 74 61 6c 5f 70 61 73 | 73 65 73 29 20 7b 0a 58 |otal_pas|ses) {.X|
|000020e0| 09 20 20 20 20 77 6f 72 | 64 73 5f 67 69 76 65 6e |. wor|ds_given|
|000020f0| 2b 2b 3b 20 20 2f 2a 20 | 66 6f 72 20 65 61 63 68 |++; /* |for each|
|00002100| 20 70 61 73 73 2c 20 67 | 69 76 65 20 61 77 61 79 | pass, g|ive away|
|00002110| 20 61 20 66 72 65 65 20 | 77 6f 72 64 20 2a 2f 0a | a free |word */.|
|00002120| 58 09 20 20 20 20 70 72 | 69 6e 74 66 28 22 42 6f |X. pr|intf("Bo|
|00002130| 6e 75 73 20 66 6f 72 20 | 75 6e 75 73 65 64 20 70 |nus for |unused p|
|00002140| 61 73 73 20 23 25 64 3a | 20 22 2c 2b 2b 70 61 73 |ass #%d:| ",++pas|
|00002150| 73 65 73 29 3b 0a 58 09 | 20 20 20 20 73 74 61 72 |ses);.X.| star|
|00002160| 74 5f 74 69 6d 65 20 2b | 3d 20 65 78 74 72 61 5f |t_time +|= extra_|
|00002170| 63 72 65 64 69 74 28 29 | 3b 0a 58 09 7d 0a 58 09 |credit()|;.X.}.X.|
|00002180| 74 69 6d 65 28 26 6e 6f | 77 29 3b 20 2f 2a 20 67 |time(&no|w); /* g|
|00002190| 65 74 20 63 75 72 72 65 | 6e 74 20 74 69 6d 65 20 |et curre|nt time |
|000021a0| 61 6e 64 20 63 68 65 63 | 6b 20 74 6f 20 73 65 65 |and chec|k to see|
|000021b0| 20 69 66 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | if the |current |
|000021c0| 2a 2f 0a 58 09 09 20 20 | 20 20 2f 2a 20 73 63 6f |*/.X.. | /* sco|
|000021d0| 72 65 20 6d 61 64 65 20 | 69 74 2e 20 20 54 68 69 |re made |it. Thi|
|000021e0| 73 20 69 73 20 62 61 73 | 65 64 20 6f 6e 20 74 69 |s is bas|ed on ti|
|000021f0| 6d 65 20 74 61 6b 65 6e | 20 74 6f 20 20 20 2a 2f |me taken| to */|
|00002200| 0a 58 09 09 20 20 20 20 | 2f 2a 20 75 6e 73 63 72 |.X.. |/* unscr|
|00002210| 61 6d 62 6c 65 20 61 6c | 6c 20 74 68 65 20 77 6f |amble al|l the wo|
|00002220| 72 64 73 20 2a 2f 0a 58 | 09 61 6e 64 5f 6e 6f 77 |rds */.X|.and_now|
|00002230| 28 29 3b 20 20 2f 2a 20 | 77 65 27 6c 6c 20 74 61 |(); /* |we'll ta|
|00002240| 6c 6b 20 61 62 6f 75 74 | 20 69 74 20 77 68 65 6e |lk about| it when|
|00002250| 20 77 65 20 67 65 74 20 | 74 68 65 72 65 20 2a 2f | we get |there */|
|00002260| 0a 58 20 20 20 20 7d 0a | 58 7d 0a 58 0a 58 2f 2a |.X }.|X}.X.X/*|
|00002270| 0a 58 20 2a 20 67 65 74 | 20 74 68 65 20 6e 75 6d |.X * get| the num|
|00002280| 62 65 72 20 6f 66 20 77 | 6f 72 64 73 20 74 68 65 |ber of w|ords the|
|00002290| 79 20 77 69 73 68 20 74 | 6f 20 75 6e 73 63 72 61 |y wish t|o unscra|
|000022a0| 6d 62 6c 65 2e 20 20 54 | 68 65 79 20 68 61 76 65 |mble. T|hey have|
|000022b0| 20 74 6f 0a 58 20 2a 20 | 63 68 6f 6f 73 65 20 61 | to.X * |choose a|
|000022c0| 74 20 6c 65 61 73 74 20 | 57 4f 52 44 53 5f 4e 45 |t least |WORDS_NE|
|000022d0| 45 44 45 44 20 74 6f 20 | 67 65 74 20 6f 6e 20 74 |EDED to |get on t|
|000022e0| 68 65 20 68 69 67 68 20 | 73 63 6f 72 65 20 66 69 |he high |score fi|
|000022f0| 6c 65 20 61 6e 64 0a 58 | 20 2a 20 68 61 76 65 20 |le and.X| * have |
|00002300| 74 6f 20 63 68 6f 6f 73 | 65 20 61 74 20 6c 65 61 |to choos|e at lea|
|00002310| 73 74 20 31 20 74 6f 20 | 70 6c 61 79 20 28 6f 72 |st 1 to |play (or|
|00002320| 20 74 6f 20 65 78 69 74 | 20 70 72 6f 63 65 64 75 | to exit| procedu|
|00002330| 72 65 29 0a 58 20 2a 2f | 0a 58 67 65 74 5f 6e 75 |re).X */|.Xget_nu|
|00002340| 6d 5f 6f 66 5f 77 6f 72 | 64 73 28 29 0a 58 7b 0a |m_of_wor|ds().X{.|
|00002350| 58 20 20 20 20 63 68 61 | 72 20 62 75 66 5b 31 35 |X cha|r buf[15|
|00002360| 5d 3b 0a 58 20 20 20 20 | 6e 75 6d 5f 6f 66 5f 77 |];.X |num_of_w|
|00002370| 6f 72 64 73 20 3d 20 30 | 3b 0a 58 20 20 20 20 70 |ords = 0|;.X p|
|00002380| 72 69 6e 74 66 28 22 59 | 6f 75 20 6e 65 65 64 20 |rintf("Y|ou need |
|00002390| 61 74 20 6c 65 61 73 74 | 20 25 64 20 77 6f 72 64 |at least| %d word|
|000023a0| 73 20 74 6f 20 67 65 74 | 20 6f 6e 20 74 68 65 20 |s to get| on the |
|000023b0| 74 6f 70 20 74 65 6e 2e | 5c 6e 22 2c 20 57 4f 52 |top ten.|\n", WOR|
|000023c0| 44 53 5f 4e 45 45 44 45 | 44 29 3b 0a 58 20 20 20 |DS_NEEDE|D);.X |
|000023d0| 20 70 72 69 6e 74 66 28 | 22 59 6f 75 20 67 65 74 | printf(|"You get|
|000023e0| 20 65 78 74 72 61 20 74 | 69 6d 65 20 66 6f 72 20 | extra t|ime for |
|000023f0| 75 6e 73 63 72 61 6d 62 | 6c 69 6e 67 20 65 61 63 |unscramb|ling eac|
|00002400| 68 20 77 6f 72 64 20 6f | 76 65 72 20 74 68 65 20 |h word o|ver the |
|00002410| 25 64 25 73 20 77 6f 72 | 64 2e 5c 6e 22 0a 58 09 |%d%s wor|d.\n".X.|
|00002420| 2c 57 4f 52 44 53 5f 4e | 45 45 44 45 44 2c 20 6f |,WORDS_N|EEDED, o|
|00002430| 72 64 69 6e 61 74 65 28 | 57 4f 52 44 53 5f 4e 45 |rdinate(|WORDS_NE|
|00002440| 45 44 45 44 29 29 3b 0a | 58 20 20 20 20 70 72 69 |EDED));.|X pri|
|00002450| 6e 74 66 28 22 48 6f 77 | 20 6d 61 6e 79 20 77 6f |ntf("How| many wo|
|00002460| 72 64 73 20 64 6f 20 79 | 6f 75 20 77 61 6e 74 3f |rds do y|ou want?|
|00002470| 20 22 29 3b 0a 58 20 20 | 20 20 77 68 69 6c 65 28 | ");.X | while(|
|00002480| 6e 75 6d 5f 6f 66 5f 77 | 6f 72 64 73 20 3c 3d 20 |num_of_w|ords <= |
|00002490| 30 29 0a 58 09 69 66 28 | 73 74 72 6c 65 6e 28 67 |0).X.if(|strlen(g|
|000024a0| 65 74 73 28 62 75 66 29 | 29 20 3c 20 31 20 7c 7c |ets(buf)|) < 1 |||
|000024b0| 20 28 6e 75 6d 5f 6f 66 | 5f 77 6f 72 64 73 20 3d | (num_of|_words =|
|000024c0| 20 61 74 6f 69 28 62 75 | 66 29 29 20 3c 3d 20 30 | atoi(bu|f)) <= 0|
|000024d0| 29 20 0a 58 09 20 20 20 | 20 70 72 69 6e 74 66 28 |) .X. | printf(|
|000024e0| 22 55 73 65 20 6e 75 6d | 62 65 72 73 20 28 67 72 |"Use num|bers (gr|
|000024f0| 65 61 74 65 72 20 74 68 | 61 6e 20 30 29 2c 20 70 |eater th|an 0), p|
|00002500| 6c 65 61 73 65 3a 20 22 | 29 3b 0a 58 20 20 20 20 |lease: "|);.X |
|00002510| 70 75 74 63 68 61 72 28 | 27 5c 6e 27 29 3b 0a 58 |putchar(|'\n');.X|
|00002520| 7d 0a 58 0a 58 2f 2a 0a | 58 20 2a 20 6a 75 73 74 |}.X.X/*.|X * just|
|00002530| 20 61 20 62 75 6e 63 68 | 20 6f 66 20 70 72 69 6e | a bunch| of prin|
|00002540| 74 20 73 74 61 74 6d 65 | 6e 74 73 20 64 65 73 63 |t statme|nts desc|
|00002550| 72 69 62 69 6e 67 20 68 | 6f 77 20 74 6f 20 70 6c |ribing h|ow to pl|
|00002560| 61 79 0a 58 20 2a 2f 0a | 58 68 65 6c 70 28 61 72 |ay.X */.|Xhelp(ar|
|00002570| 67 76 29 0a 58 63 68 61 | 72 20 2a 2a 61 72 67 76 |gv).Xcha|r **argv|
|00002580| 3b 0a 58 7b 0a 58 20 20 | 20 20 2f 2a 20 67 65 74 |;.X{.X | /* get|
|00002590| 20 74 68 65 69 72 20 6c | 6f 67 69 6e 20 6e 61 6d | their l|ogin nam|
|000025a0| 65 20 61 6e 64 20 73 63 | 72 61 6d 62 6c 65 20 69 |e and sc|ramble i|
|000025b0| 74 20 2a 2f 0a 58 20 20 | 20 20 28 76 6f 69 64 29 |t */.X | (void)|
|000025c0| 20 73 74 72 63 70 79 28 | 6a 75 6d 62 6c 65 5f 77 | strcpy(|jumble_w|
|000025d0| 6f 72 64 2c 20 67 65 74 | 6c 6f 67 69 6e 28 29 29 |ord, get|login())|
|000025e0| 3b 0a 58 20 20 20 20 6d | 69 78 69 74 28 29 3b 20 |;.X m|ixit(); |
|000025f0| 2f 2a 20 73 63 72 61 6d | 62 6c 65 20 69 74 20 2a |/* scram|ble it *|
|00002600| 2f 0a 58 20 20 20 20 70 | 75 74 73 28 22 5c 6e 4a |/.X p|uts("\nJ|
|00002610| 75 6d 62 6c 65 20 69 73 | 20 61 20 67 61 6d 65 20 |umble is| a game |
|00002620| 69 6e 20 77 68 69 63 68 | 20 79 6f 75 20 68 61 76 |in which| you hav|
|00002630| 65 20 74 6f 20 67 75 65 | 73 73 20 77 68 61 74 20 |e to gue|ss what |
|00002640| 74 68 65 22 29 3b 0a 58 | 20 20 20 20 70 75 74 73 |the");.X| puts|
|00002650| 28 22 6a 75 6d 62 6c 65 | 64 20 77 6f 72 64 20 69 |("jumble|d word i|
|00002660| 73 20 73 75 70 70 6f 73 | 65 64 20 74 6f 20 62 65 |s suppos|ed to be|
|00002670| 2e 20 46 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 79 |. For ex|ample, y|
|00002680| 6f 75 20 77 6f 75 6c 64 | 22 29 3b 0a 58 20 20 20 |ou would|");.X |
|00002690| 20 70 72 69 6e 74 66 28 | 22 68 61 76 65 20 25 64 | printf(|"have %d|
|000026a0| 20 73 65 63 6f 6e 64 73 | 20 74 6f 20 75 6e 73 63 | seconds| to unsc|
|000026b0| 72 61 6d 62 6c 65 20 5c | 22 25 73 5c 22 20 74 6f |ramble \|"%s\" to|
|000026c0| 20 5c 22 25 73 5c 22 2e | 5c 6e 22 2c 0a 58 09 20 | \"%s\".|\n",.X. |
|000026d0| 20 20 20 73 74 72 6c 65 | 6e 28 6a 75 6d 62 6c 65 | strle|n(jumble|
|000026e0| 64 29 20 2a 20 39 2c 20 | 6a 75 6d 62 6c 65 64 2c |d) * 9, |jumbled,|
|000026f0| 20 6a 75 6d 62 6c 65 5f | 77 6f 72 64 29 3b 0a 58 | jumble_|word);.X|
|00002700| 20 20 20 20 70 75 74 73 | 28 22 5c 6e 54 79 70 69 | puts|("\nTypi|
|00002710| 6e 67 20 61 20 27 3f 27 | 20 67 69 76 65 73 20 79 |ng a '?'| gives y|
|00002720| 6f 75 72 20 74 69 6d 65 | 20 6c 65 66 74 20 61 6e |our time| left an|
|00002730| 64 20 72 65 70 72 69 6e | 74 73 20 74 68 65 20 6a |d reprin|ts the j|
|00002740| 75 6d 62 6c 65 64 20 77 | 6f 72 64 2e 22 29 3b 0a |umbled w|ord.");.|
|00002750| 58 20 20 20 20 70 75 74 | 73 28 22 54 79 70 69 6e |X put|s("Typin|
|00002760| 67 20 61 20 27 71 27 20 | 66 6f 72 66 65 69 74 73 |g a 'q' |forfeits|
|00002770| 20 74 68 61 74 20 72 6f | 75 6e 64 20 61 6e 64 20 | that ro|und and |
|00002780| 74 65 6c 6c 20 79 6f 75 | 20 74 68 65 20 63 75 72 |tell you| the cur|
|00002790| 72 65 6e 74 20 77 6f 72 | 64 2e 22 29 3b 0a 58 20 |rent wor|d.");.X |
|000027a0| 20 20 20 70 75 74 73 28 | 22 45 6e 74 65 72 69 6e | puts(|"Enterin|
|000027b0| 67 20 27 70 27 20 28 70 | 61 73 73 29 20 72 65 76 |g 'p' (p|ass) rev|
|000027c0| 65 61 6c 73 20 74 68 65 | 20 63 75 72 72 65 6e 74 |eals the| current|
|000027d0| 20 77 6f 72 64 20 61 6e | 64 20 67 6f 65 73 20 74 | word an|d goes t|
|000027e0| 6f 20 74 68 65 20 6e 65 | 78 74 2e 22 29 3b 0a 58 |o the ne|xt.");.X|
|000027f0| 20 20 20 20 70 72 69 6e | 74 66 28 22 59 6f 75 20 | prin|tf("You |
|00002800| 67 65 74 20 6f 6e 65 20 | 66 72 65 65 20 70 61 73 |get one |free pas|
|00002810| 73 20 66 6f 72 20 65 76 | 65 72 79 20 25 64 25 73 |s for ev|ery %d%s|
|00002820| 20 77 6f 72 64 2e 5c 6e | 22 2c 20 0a 58 09 09 09 | word.\n|", .X...|
|00002830| 57 4f 52 44 53 5f 4e 45 | 45 44 45 44 2c 20 6f 72 |WORDS_NE|EDED, or|
|00002840| 64 69 6e 61 74 65 28 57 | 4f 52 44 53 5f 4e 45 45 |dinate(W|ORDS_NEE|
|00002850| 44 45 44 29 29 3b 0a 58 | 20 20 20 20 70 72 69 6e |DED));.X| prin|
|00002860| 74 66 28 22 46 6f 72 20 | 65 61 63 68 20 77 6f 72 |tf("For |each wor|
|00002870| 64 20 61 66 74 65 72 20 | 74 68 65 20 25 64 25 73 |d after |the %d%s|
|00002880| 20 74 68 61 74 20 79 6f | 75 20 73 75 63 63 65 73 | that yo|u succes|
|00002890| 73 66 75 6c 6c 79 20 75 | 6e 73 63 72 61 6d 62 6c |sfully u|nscrambl|
|000028a0| 65 2c 5c 6e 22 2c 20 0a | 58 09 09 09 09 20 20 20 |e,\n", .|X.... |
|000028b0| 20 57 4f 52 44 53 5f 4e | 45 45 44 45 44 2c 20 6f | WORDS_N|EEDED, o|
|000028c0| 72 64 69 6e 61 74 65 28 | 57 4f 52 44 53 5f 4e 45 |rdinate(|WORDS_NE|
|000028d0| 45 44 45 44 29 29 3b 0a | 58 20 20 20 20 70 75 74 |EDED));.|X put|
|000028e0| 73 28 22 79 6f 75 20 67 | 65 74 20 62 6f 6e 75 73 |s("you g|et bonus|
|000028f0| 20 74 69 6d 65 2e 20 54 | 68 61 74 20 74 69 6d 65 | time. T|hat time|
|00002900| 20 69 6e 63 72 65 61 73 | 65 73 20 6d 6f 72 65 20 | increas|es more |
|00002910| 66 6f 72 20 65 61 63 68 | 20 62 6f 6e 75 73 20 77 |for each| bonus w|
|00002920| 6f 72 64 2e 22 29 3b 0a | 58 20 20 20 20 70 75 74 |ord.");.|X put|
|00002930| 73 28 22 53 6f 6d 65 20 | 77 6f 72 64 73 20 63 61 |s("Some |words ca|
|00002940| 6e 20 62 65 20 63 6f 6e | 73 74 72 75 63 74 65 64 |n be con|structed|
|00002950| 20 64 69 66 66 65 72 65 | 6e 74 20 77 61 79 73 2e | differe|nt ways.|
|00002960| 20 49 66 20 79 6f 75 72 | 20 67 75 65 73 73 20 69 | If your| guess i|
|00002970| 73 20 61 22 29 3b 0a 58 | 20 20 20 20 70 75 74 73 |s a");.X| puts|
|00002980| 28 22 77 6f 72 64 20 74 | 68 61 74 20 77 6f 72 6b |("word t|hat work|
|00002990| 73 20 77 69 74 68 20 74 | 68 65 20 67 69 76 65 6e |s with t|he given|
|000029a0| 20 6c 65 74 74 65 72 73 | 20 62 75 74 20 69 73 6e | letters| but isn|
|000029b0| 27 74 20 61 63 63 65 70 | 74 65 64 2c 22 29 3b 0a |'t accep|ted,");.|
|000029c0| 58 20 20 20 20 70 75 74 | 73 28 22 74 72 79 20 61 |X put|s("try a|
|000029d0| 20 64 69 66 66 65 72 65 | 6e 74 20 77 6f 72 64 2e | differe|nt word.|
|000029e0| 22 29 3b 0a 58 20 20 20 | 20 70 75 74 73 28 22 53 |");.X | puts("S|
|000029f0| 69 6e 63 65 20 79 6f 75 | 20 61 72 65 20 6e 6f 74 |ince you| are not|
|00002a00| 20 70 65 6e 61 6c 69 7a | 65 64 20 66 6f 72 20 77 | penaliz|ed for w|
|00002a10| 72 6f 6e 67 20 67 75 65 | 73 73 65 73 2c 20 69 74 |rong gue|sses, it|
|00002a20| 20 69 73 20 61 64 76 69 | 73 61 62 6c 65 22 29 3b | is advi|sable");|
|00002a30| 0a 58 20 20 20 20 70 75 | 74 73 28 22 74 6f 20 72 |.X pu|ts("to r|
|00002a40| 65 74 79 70 65 20 77 6f | 72 64 73 20 74 6f 20 67 |etype wo|rds to g|
|00002a50| 65 74 20 74 68 65 20 6c | 65 74 74 65 72 73 20 69 |et the l|etters i|
|00002a60| 6e 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 6f 72 |n a diff|erent or|
|00002a70| 64 65 72 2e 22 29 3b 0a | 58 20 20 20 20 70 75 74 |der.");.|X put|
|00002a80| 73 28 22 59 6f 75 20 63 | 61 6e 20 73 65 65 20 74 |s("You c|an see t|
|00002a90| 68 65 20 68 69 67 68 20 | 73 63 6f 72 65 73 20 77 |he high |scores w|
|00002aa0| 69 74 68 6f 75 74 20 70 | 6c 61 79 69 6e 67 20 62 |ithout p|laying b|
|00002ab0| 79 20 74 79 70 69 6e 67 | 3a 22 29 3b 0a 58 20 20 |y typing|:");.X |
|00002ac0| 20 20 70 72 69 6e 74 66 | 28 22 25 25 20 25 73 20 | printf|("%% %s |
|00002ad0| 2d 73 5c 6e 22 2c 61 72 | 67 76 5b 30 5d 29 3b 0a |-s\n",ar|gv[0]);.|
|00002ae0| 58 7d 0a 58 0a 58 2f 2a | 0a 58 20 2a 20 67 65 74 |X}.X.X/*|.X * get|
|00002af0| 20 6f 6e 65 20 6f 66 20 | 66 6f 75 72 20 64 69 66 | one of |four dif|
|00002b00| 66 65 72 6e 74 20 64 69 | 66 66 69 63 75 6c 74 79 |fernt di|fficulty|
|00002b10| 20 6c 65 76 65 6c 73 0a | 58 20 2a 20 6c 65 76 65 | levels.|X * leve|
|00002b20| 6c 20 65 78 70 65 72 74 | 20 66 69 6e 64 73 20 77 |l expert| finds w|
|00002b30| 6f 72 64 73 20 74 68 61 | 74 20 61 72 65 20 6c 6f |ords tha|t are lo|
|00002b40| 6e 67 20 61 6e 64 20 67 | 69 76 65 73 20 79 6f 75 |ng and g|ives you|
|00002b50| 20 6c 69 74 74 6c 65 20 | 74 69 6d 65 0a 58 20 2a | little |time.X *|
|00002b60| 20 74 6f 20 75 6e 73 63 | 72 61 6d 62 6c 65 20 74 | to unsc|ramble t|
|00002b70| 68 65 6d 20 61 6e 64 20 | 65 61 73 79 20 67 69 76 |hem and |easy giv|
|00002b80| 65 73 20 79 6f 75 20 6c | 69 74 74 6c 65 20 77 6f |es you l|ittle wo|
|00002b90| 72 64 73 20 77 69 74 68 | 20 6c 6f 74 73 20 6f 66 |rds with| lots of|
|00002ba0| 0a 58 20 2a 20 74 69 6d | 65 20 74 6f 20 75 6e 73 |.X * tim|e to uns|
|00002bb0| 63 72 61 6d 62 6c 65 20 | 74 68 65 6d 20 61 6e 64 |cramble |them and|
|00002bc0| 20 74 68 65 20 6f 74 68 | 65 72 20 6c 65 76 65 6c | the oth|er level|
|00002bd0| 73 20 61 72 65 20 73 6f | 6d 65 77 68 65 72 65 20 |s are so|mewhere |
|00002be0| 69 6e 20 62 65 74 77 65 | 65 6e 0a 58 20 2a 20 73 |in betwe|en.X * s|
|00002bf0| 65 65 20 66 69 6e 64 5f | 61 5f 77 6f 72 64 28 29 |ee find_|a_word()|
|00002c00| 20 66 6f 72 20 64 65 74 | 61 69 6c 73 0a 58 20 2a | for det|ails.X *|
|00002c10| 2f 0a 58 67 65 74 5f 6c | 65 76 65 6c 28 29 0a 58 |/.Xget_l|evel().X|
|00002c20| 7b 0a 58 20 20 20 20 63 | 68 61 72 20 63 3b 0a 58 |{.X c|har c;.X|
|00002c30| 20 20 20 20 6c 65 76 65 | 6c 20 3d 20 30 3b 0a 58 | leve|l = 0;.X|
|00002c40| 20 20 20 20 70 75 74 73 | 28 22 5c 6e 44 69 66 66 | puts|("\nDiff|
|00002c50| 69 63 75 6c 74 79 20 6c | 65 76 65 6c 73 3a 22 29 |iculty l|evels:")|
|00002c60| 3b 0a 58 20 20 20 20 70 | 72 69 6e 74 66 28 22 28 |;.X p|rintf("(|
|00002c70| 45 29 78 70 65 72 74 2c | 20 28 48 29 61 72 64 2c |E)xpert,| (H)ard,|
|00002c80| 20 28 4d 29 6f 64 65 72 | 61 74 65 20 6f 72 20 28 | (M)oder|ate or (|
|00002c90| 53 29 69 6d 70 6c 65 3f | 20 22 29 3b 0a 58 20 20 |S)imple?| ");.X |
|00002ca0| 20 20 77 68 69 6c 65 28 | 21 6c 65 76 65 6c 29 0a | while(|!level).|
|00002cb0| 58 09 73 77 69 74 63 68 | 28 63 20 3d 20 67 65 74 |X.switch|(c = get|
|00002cc0| 63 68 61 72 28 29 29 20 | 7b 0a 58 09 20 20 20 20 |char()) |{.X. |
|00002cd0| 77 68 65 6e 20 27 20 27 | 20 3a 20 63 61 73 65 20 |when ' '| : case |
|00002ce0| 27 5c 74 27 20 3a 20 62 | 72 65 61 6b 3b 0a 58 09 |'\t' : b|reak;.X.|
|00002cf0| 20 20 20 20 77 68 65 6e | 20 27 45 27 20 3a 20 63 | when| 'E' : c|
|00002d00| 61 73 65 20 27 65 27 20 | 3a 20 20 2f 2a 20 45 78 |ase 'e' |: /* Ex|
|00002d10| 70 65 72 74 20 2a 2f 0a | 58 09 09 20 6c 65 76 65 |pert */.|X.. leve|
|00002d20| 6c 20 3d 20 31 3b 0a 58 | 09 20 20 20 20 77 68 65 |l = 1;.X|. whe|
|00002d30| 6e 20 27 48 27 20 3a 20 | 63 61 73 65 20 27 68 27 |n 'H' : |case 'h'|
|00002d40| 20 3a 20 20 2f 2a 20 48 | 61 72 64 20 2a 2f 0a 58 | : /* H|ard */.X|
|00002d50| 09 09 20 6c 65 76 65 6c | 20 3d 20 32 3b 0a 58 09 |.. level| = 2;.X.|
|00002d60| 20 20 20 20 77 68 65 6e | 20 27 4d 27 20 3a 20 63 | when| 'M' : c|
|00002d70| 61 73 65 20 27 6d 27 20 | 3a 20 20 2f 2a 20 4d 6f |ase 'm' |: /* Mo|
|00002d80| 64 65 72 61 74 65 20 2a | 2f 0a 58 09 09 20 6c 65 |derate *|/.X.. le|
|00002d90| 76 65 6c 20 3d 20 33 3b | 0a 58 09 20 20 20 20 77 |vel = 3;|.X. w|
|00002da0| 68 65 6e 20 27 53 27 20 | 3a 20 63 61 73 65 20 27 |hen 'S' |: case '|
|00002db0| 73 27 20 3a 20 20 2f 2a | 20 53 69 6d 70 6c 65 20 |s' : /*| Simple |
|00002dc0| 2a 2f 0a 58 09 09 20 6c | 65 76 65 6c 20 3d 20 34 |*/.X.. l|evel = 4|
|00002dd0| 3b 0a 58 09 20 20 20 20 | 6f 74 68 65 72 77 69 73 |;.X. |otherwis|
|00002de0| 65 20 3a 20 77 68 69 6c | 65 28 63 20 21 3d 20 27 |e : whil|e(c != '|
|00002df0| 5c 6e 27 29 20 63 20 3d | 20 67 65 74 63 68 61 72 |\n') c =| getchar|
|00002e00| 28 29 3b 20 0a 58 09 09 | 09 09 70 72 69 6e 74 66 |(); .X..|..printf|
|00002e10| 28 22 45 2c 20 48 2c 20 | 4d 2c 20 6f 72 20 53 3a |("E, H, |M, or S:|
|00002e20| 20 22 29 3b 0a 58 09 7d | 0a 58 20 20 20 20 77 68 | ");.X.}|.X wh|
|00002e30| 69 6c 65 28 67 65 74 63 | 68 61 72 28 29 20 21 3d |ile(getc|har() !=|
|00002e40| 20 27 5c 6e 27 29 3b 20 | 20 2f 2a 20 66 6c 75 73 | '\n'); | /* flus|
|00002e50| 68 20 69 6e 70 75 74 20 | 73 74 72 65 61 6d 20 2a |h input |stream *|
|00002e60| 2f 0a 58 20 20 20 20 70 | 75 74 63 68 61 72 28 27 |/.X p|utchar('|
|00002e70| 5c 6e 27 29 3b 0a 58 7d | 0a 58 0a 58 2f 2a 0a 58 |\n');.X}|.X.X/*.X|
|00002e80| 20 2a 20 66 69 6e 64 73 | 20 61 20 72 61 6e 64 6f | * finds| a rando|
|00002e90| 6d 20 77 6f 72 64 20 69 | 6e 20 74 68 65 20 64 69 |m word i|n the di|
|00002ea0| 63 74 69 6f 6e 61 72 79 | 2e 0a 58 20 2a 20 66 69 |ctionary|..X * fi|
|00002eb0| 72 73 74 2c 20 67 6f 20 | 74 6f 20 72 61 6e 64 6f |rst, go |to rando|
|00002ec0| 6d 20 73 70 6f 74 20 69 | 6e 20 74 68 65 20 64 69 |m spot i|n the di|
|00002ed0| 63 74 69 6f 6e 61 72 79 | 0a 58 20 2a 20 74 68 65 |ctionary|.X * the|
|00002ee0| 6e 2c 20 72 65 61 64 20 | 74 69 6c 6c 20 74 68 65 |n, read |till the|
|00002ef0| 20 6e 65 78 74 20 77 6f | 72 64 20 2d 2d 20 20 77 | next wo|rd -- w|
|00002f00| 65 20 77 69 6c 6c 20 70 | 72 6f 62 61 62 6c 79 20 |e will p|robably |
|00002f10| 68 61 76 65 20 6c 61 6e | 64 65 64 0a 58 20 2a 20 |have lan|ded.X * |
|00002f20| 69 6e 20 74 68 65 20 6d | 69 64 64 6c 65 20 6f 66 |in the m|iddle of|
|00002f30| 20 61 20 77 6f 72 64 20 | 73 6f 20 72 65 61 64 20 | a word |so read |
|00002f40| 74 69 6c 6c 20 61 20 63 | 61 72 72 69 61 67 65 20 |till a c|arriage |
|00002f50| 72 65 74 75 72 6e 2e 0a | 58 20 2a 20 4e 6f 77 2c |return..|X * Now,|
|00002f60| 20 77 65 20 65 69 74 68 | 65 72 20 67 6f 74 20 74 | we eith|er got t|
|00002f70| 6f 20 61 20 6e 65 77 20 | 77 6f 72 64 2c 20 6f 72 |o a new |word, or|
|00002f80| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 | the end| of the |
|00002f90| 64 69 63 74 69 6f 6e 61 | 72 79 2c 20 0a 58 20 2a |dictiona|ry, .X *|
|00002fa0| 20 69 6e 20 77 68 69 63 | 68 20 63 61 73 65 20 77 | in whic|h case w|
|00002fb0| 65 27 6c 6c 20 74 72 79 | 20 61 67 61 69 6e 2e 0a |e'll try| again..|
|00002fc0| 58 20 2a 20 45 6c 73 65 | 2c 20 77 65 20 68 61 76 |X * Else|, we hav|
|00002fd0| 65 20 6f 75 72 20 77 6f | 72 64 20 69 6e 20 22 6a |e our wo|rd in "j|
|00002fe0| 75 6d 62 6c 65 5f 77 6f | 72 64 22 2e 0a 58 20 2a |umble_wo|rd"..X *|
|00002ff0| 20 4e 65 78 74 2c 20 66 | 69 6e 64 20 6f 75 74 20 | Next, f|ind out |
|00003000| 68 6f 77 20 6c 6f 6e 67 | 20 74 68 65 20 77 6f 72 |how long| the wor|
|00003010| 64 20 69 73 20 61 6e 64 | 20 69 66 20 69 74 27 73 |d is and| if it's|
|00003020| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 66 6f 72 | appropr|iate for|
|00003030| 20 0a 58 20 2a 20 74 68 | 65 20 6c 65 76 65 6c 20 | .X * th|e level |
|00003040| 6f 66 20 70 6c 61 79 2c | 20 73 65 74 20 6c 6f 63 |of play,| set loc|
|00003050| 61 6c 20 76 61 72 69 61 | 62 6c 65 20 22 4f 6b 22 |al varia|ble "Ok"|
|00003060| 20 74 6f 20 74 72 75 65 | 20 61 6e 64 20 65 78 69 | to true| and exi|
|00003070| 74 2e 0a 58 20 2a 20 77 | 65 20 64 6f 6e 27 74 20 |t..X * w|e don't |
|00003080| 77 61 6e 74 20 77 6f 72 | 64 73 20 77 69 74 68 20 |want wor|ds with |
|00003090| 75 70 70 65 72 20 63 61 | 73 65 20 6c 65 74 74 65 |upper ca|se lette|
|000030a0| 72 73 20 6f 72 20 6e 75 | 6d 62 65 72 73 2e 0a 58 |rs or nu|mbers..X|
|000030b0| 20 2a 2f 0a 58 66 69 6e | 64 5f 61 5f 77 6f 72 64 | */.Xfin|d_a_word|
|000030c0| 28 29 0a 58 7b 0a 58 20 | 20 20 20 69 6e 74 20 63 |().X{.X | int c|
|000030d0| 2c 20 6f 6b 3b 0a 58 20 | 20 20 20 70 72 69 6e 74 |, ok;.X | print|
|000030e0| 66 28 22 4a 75 6d 62 6c | 69 6e 67 20 61 20 77 6f |f("Jumbl|ing a wo|
|000030f0| 72 64 2e 2e 2e 22 29 3b | 0a 58 20 20 20 20 64 6f |rd...");|.X do|
|00003100| 20 20 7b 0a 58 09 6f 6b | 20 3d 20 30 3b 0a 58 09 | {.X.ok| = 0;.X.|
|00003110| 28 76 6f 69 64 29 20 66 | 73 65 65 6b 28 64 69 63 |(void) f|seek(dic|
|00003120| 74 69 6f 6e 61 72 79 2c | 20 28 72 61 6e 64 6f 6d |tionary,| (random|
|00003130| 28 29 20 25 20 44 49 43 | 54 53 49 5a 45 29 2c 20 |() % DIC|TSIZE), |
|00003140| 30 29 3b 20 0a 58 09 77 | 68 69 6c 65 28 28 63 20 |0); .X.w|hile((c |
|00003150| 3d 20 67 65 74 63 28 64 | 69 63 74 69 6f 6e 61 72 |= getc(d|ictionar|
|00003160| 79 29 29 20 21 3d 20 45 | 4f 46 20 26 26 20 63 20 |y)) != E|OF && c |
|00003170| 21 3d 20 27 5c 6e 27 29 | 20 3b 0a 58 09 69 66 28 |!= '\n')| ;.X.if(|
|00003180| 66 73 63 61 6e 66 28 64 | 69 63 74 69 6f 6e 61 72 |fscanf(d|ictionar|
|00003190| 79 2c 20 22 25 73 22 2c | 20 6a 75 6d 62 6c 65 5f |y, "%s",| jumble_|
|000031a0| 77 6f 72 64 29 20 3d 3d | 20 45 4f 46 29 0a 58 09 |word) ==| EOF).X.|
|000031b0| 20 20 20 20 7b 20 63 6c | 65 61 72 65 72 72 28 64 | { cl|earerr(d|
|000031c0| 69 63 74 69 6f 6e 61 72 | 79 29 3b 20 63 6f 6e 74 |ictionar|y); cont|
|000031d0| 69 6e 75 65 3b 20 7d 0a | 58 09 69 66 28 28 6c 65 |inue; }.|X.if((le|
|000031e0| 6e 67 74 68 20 3d 20 73 | 74 72 6c 65 6e 28 6a 75 |ngth = s|trlen(ju|
|000031f0| 6d 62 6c 65 5f 77 6f 72 | 64 29 29 20 3e 3d 20 35 |mble_wor|d)) >= 5|
|00003200| 29 0a 58 09 20 20 20 20 | 73 77 69 74 63 68 28 6c |).X. |switch(l|
|00003210| 65 76 65 6c 29 20 20 7b | 20 20 20 20 20 20 20 20 |evel) {| |
|00003220| 20 0a 58 09 09 77 68 65 | 6e 20 34 20 3a 20 69 66 | .X..whe|n 4 : if|
|00003230| 28 6c 65 6e 67 74 68 20 | 3c 3d 20 36 29 20 6f 6b |(length |<= 6) ok|
|00003240| 20 3d 20 31 3b 0a 58 09 | 09 77 68 65 6e 20 33 20 | = 1;.X.|.when 3 |
|00003250| 3a 20 69 66 28 6c 65 6e | 67 74 68 20 3c 3d 20 37 |: if(len|gth <= 7|
|00003260| 29 20 6f 6b 20 3d 20 31 | 3b 0a 58 09 09 77 68 65 |) ok = 1|;.X..whe|
|00003270| 6e 20 32 20 3a 20 69 66 | 28 6c 65 6e 67 74 68 20 |n 2 : if|(length |
|00003280| 3c 3d 20 38 29 20 6f 6b | 20 3d 20 31 3b 0a 58 09 |<= 8) ok| = 1;.X.|
|00003290| 09 77 68 65 6e 20 31 20 | 3a 20 6f 6b 20 3d 20 31 |.when 1 |: ok = 1|
|000032a0| 3b 20 20 2f 2a 20 61 6e | 79 74 68 69 6e 67 20 67 |; /* an|ything g|
|000032b0| 6f 65 73 20 2a 2f 0a 58 | 09 20 20 20 20 7d 0a 58 |oes */.X|. }.X|
|000032c0| 20 20 20 20 7d 20 77 68 | 69 6c 65 20 28 69 73 75 | } wh|ile (isu|
|000032d0| 70 70 65 72 28 6a 75 6d | 62 6c 65 5f 77 6f 72 64 |pper(jum|ble_word|
|000032e0| 5b 30 5d 29 20 7c 7c 20 | 69 73 64 69 67 69 74 28 |[0]) || |isdigit(|
|000032f0| 6a 75 6d 62 6c 65 5f 77 | 6f 72 64 5b 30 5d 29 20 |jumble_w|ord[0]) |
|00003300| 7c 7c 20 21 6f 6b 29 3b | 0a 58 20 20 20 20 70 75 ||| !ok);|.X pu|
|00003310| 74 63 68 61 72 28 27 5c | 6e 27 29 3b 0a 58 7d 0a |tchar('\|n');.X}.|
|00003320| 58 0a 58 2f 2a 0a 58 20 | 2a 20 6d 69 78 69 74 20 |X.X/*.X |* mixit |
|00003330| 73 63 72 61 6d 62 6c 65 | 73 20 61 20 77 6f 72 64 |scramble|s a word|
|00003340| 20 0a 58 20 2a 20 22 74 | 72 69 65 73 22 20 69 73 | .X * "t|ries" is|
|00003350| 20 73 74 61 74 69 63 20 | 2d 2d 20 74 68 65 20 66 | static |-- the f|
|00003360| 75 6e 63 74 69 6f 6e 20 | 69 73 20 72 65 63 75 72 |unction |is recur|
|00003370| 73 69 76 65 3b 20 69 66 | 20 69 74 20 63 61 6e 27 |sive; if| it can'|
|00003380| 74 20 73 63 72 61 6d 62 | 6c 65 0a 58 20 2a 20 61 |t scramb|le.X * a|
|00003390| 20 77 6f 72 64 20 74 68 | 65 20 66 69 72 73 74 20 | word th|e first |
|000033a0| 74 69 6d 65 2c 20 77 65 | 20 63 61 6c 6c 20 69 74 |time, we| call it|
|000033b0| 20 61 67 61 69 6e 20 66 | 72 6f 6d 20 77 69 74 68 | again f|rom with|
|000033c0| 69 6e 20 69 74 73 65 6c | 66 2e 0a 58 20 2a 20 46 |in itsel|f..X * F|
|000033d0| 69 72 73 74 2c 20 63 6f | 6e 76 65 72 74 20 74 68 |irst, co|nvert th|
|000033e0| 65 20 65 6e 74 69 72 65 | 20 77 6f 72 64 20 74 6f |e entire| word to|
|000033f0| 20 75 70 70 65 72 20 63 | 61 73 65 20 6c 65 74 74 | upper c|ase lett|
|00003400| 65 72 73 2c 20 73 6f 20 | 74 68 61 74 20 77 65 20 |ers, so |that we |
|00003410| 6b 6e 6f 77 0a 58 20 2a | 20 77 68 69 63 68 20 6c |know.X *| which l|
|00003420| 65 74 74 65 72 73 20 68 | 61 76 65 20 62 65 65 6e |etters h|ave been|
|00003430| 20 75 73 65 64 20 61 6e | 64 20 77 68 69 63 68 20 | used an|d which |
|00003440| 68 61 76 65 6e 27 74 20 | 62 65 65 6e 20 75 73 65 |haven't |been use|
|00003450| 64 2e 20 20 57 68 65 6e | 0a 58 20 2a 20 73 65 61 |d. When|.X * sea|
|00003460| 72 63 68 69 6e 67 20 66 | 6f 72 20 61 20 6c 65 74 |rching f|or a let|
|00003470| 74 65 72 20 74 6f 20 72 | 61 6e 64 6f 6d 6c 79 20 |ter to r|andomly |
|00003480| 70 69 63 6b 2c 20 66 69 | 6e 64 20 6f 6e 65 20 74 |pick, fi|nd one t|
|00003490| 68 61 74 20 69 73 20 75 | 70 70 65 72 20 63 61 73 |hat is u|pper cas|
|000034a0| 65 0a 58 20 2a 20 70 75 | 74 20 69 74 20 69 6e 20 |e.X * pu|t it in |
|000034b0| 61 20 72 61 6e 64 6f 6d | 20 70 6c 61 63 65 20 69 |a random| place i|
|000034c0| 6e 20 74 68 65 20 6a 75 | 6d 62 6c 65 64 20 77 6f |n the ju|mbled wo|
|000034d0| 72 64 20 76 61 72 69 61 | 62 6c 65 20 61 6e 64 20 |rd varia|ble and |
|000034e0| 63 68 61 6e 67 65 20 69 | 74 0a 58 20 2a 20 74 6f |change i|t.X * to|
|000034f0| 20 6c 6f 77 65 72 20 63 | 61 73 65 2e 0a 58 20 2a | lower c|ase..X *|
|00003500| 20 53 6f 6d 65 74 69 6d | 65 73 2c 20 61 6c 74 68 | Sometim|es, alth|
|00003510| 6f 2c 20 6e 6f 74 20 6f | 66 74 65 6e 2c 20 77 65 |o, not o|ften, we|
|00003520| 20 72 61 6e 64 6f 6d 6c | 79 20 73 63 72 61 6d 62 | randoml|y scramb|
|00003530| 6c 65 20 61 20 77 6f 72 | 64 20 35 20 74 69 6d 65 |le a wor|d 5 time|
|00003540| 73 20 61 6e 64 0a 58 20 | 2a 20 65 61 63 68 20 74 |s and.X |* each t|
|00003550| 69 6d 65 2c 20 69 74 20 | 63 6f 6d 65 73 20 6f 75 |ime, it |comes ou|
|00003560| 74 20 74 68 65 20 73 61 | 6d 65 20 61 73 20 74 68 |t the sa|me as th|
|00003570| 65 20 72 65 67 75 6c 61 | 72 20 77 6f 72 64 2e 0a |e regula|r word..|
|00003580| 58 20 2a 2f 0a 58 6d 69 | 78 69 74 28 29 0a 58 7b |X */.Xmi|xit().X{|
|00003590| 0a 58 20 20 20 20 73 74 | 61 74 69 63 20 69 6e 74 |.X st|atic int|
|000035a0| 20 74 72 69 65 73 20 3d | 20 30 3b 0a 58 20 20 20 | tries =| 0;.X |
|000035b0| 20 69 6e 74 20 63 6f 75 | 6e 74 20 3d 20 30 2c 20 | int cou|nt = 0, |
|000035c0| 72 6e 64 5f 6e 75 6d 3b | 0a 58 20 20 20 20 6c 65 |rnd_num;|.X le|
|000035d0| 6e 67 74 68 20 3d 20 63 | 6f 75 6e 74 20 3d 20 73 |ngth = c|ount = s|
|000035e0| 74 72 6c 65 6e 28 6a 75 | 6d 62 6c 65 5f 77 6f 72 |trlen(ju|mble_wor|
|000035f0| 64 29 3b 0a 58 20 20 20 | 20 77 68 69 6c 65 28 20 |d);.X | while( |
|00003600| 63 6f 75 6e 74 2d 2d 20 | 29 0a 58 09 55 70 70 65 |count-- |).X.Uppe|
|00003610| 72 28 6a 75 6d 62 6c 65 | 5f 77 6f 72 64 5b 63 6f |r(jumble|_word[co|
|00003620| 75 6e 74 5d 29 3b 0a 58 | 20 20 20 20 63 6f 75 6e |unt]);.X| coun|
|00003630| 74 20 3d 20 30 3b 20 20 | 2f 2a 20 72 65 73 65 74 |t = 0; |/* reset|
|00003640| 20 63 6f 75 6e 74 3b 20 | 2d 31 20 61 66 74 65 72 | count; |-1 after|
|00003650| 20 6c 6f 6f 70 20 2a 2f | 0a 58 20 20 20 20 77 68 | loop */|.X wh|
|00003660| 69 6c 65 28 20 63 6f 75 | 6e 74 20 3c 20 6c 65 6e |ile( cou|nt < len|
|00003670| 67 74 68 20 29 20 7b 0a | 58 09 64 6f 20 72 6e 64 |gth ) {.|X.do rnd|
|00003680| 5f 6e 75 6d 20 3d 20 72 | 61 6e 64 6f 6d 28 29 20 |_num = r|andom() |
|00003690| 25 20 6c 65 6e 67 74 68 | 3b 0a 58 09 77 68 69 6c |% length|;.X.whil|
|000036a0| 65 28 69 73 6c 6f 77 65 | 72 28 6a 75 6d 62 6c 65 |e(islowe|r(jumble|
|000036b0| 5f 77 6f 72 64 5b 72 6e | 64 5f 6e 75 6d 5d 29 29 |_word[rn|d_num]))|
|000036c0| 3b 0a 58 09 6a 75 6d 62 | 6c 65 64 5b 63 6f 75 6e |;.X.jumb|led[coun|
|000036d0| 74 2b 2b 5d 20 3d 20 4c | 6f 77 65 72 28 6a 75 6d |t++] = L|ower(jum|
|000036e0| 62 6c 65 5f 77 6f 72 64 | 5b 72 6e 64 5f 6e 75 6d |ble_word|[rnd_num|
|000036f0| 5d 29 3b 0a 58 20 20 20 | 20 7d 0a 58 20 20 20 20 |]);.X | }.X |
|00003700| 6a 75 6d 62 6c 65 64 5b | 63 6f 75 6e 74 5d 20 3d |jumbled[|count] =|
|00003710| 20 30 3b 20 2f 2a 20 74 | 65 72 6d 69 6e 61 74 65 | 0; /* t|erminate|
|00003720| 20 73 74 72 69 6e 67 20 | 77 69 74 68 20 61 20 4e | string |with a N|
|00003730| 55 4c 4c 20 63 68 61 72 | 61 63 74 65 72 20 2a 2f |ULL char|acter */|
|00003740| 0a 58 20 20 20 20 69 66 | 20 28 21 73 74 72 63 6d |.X if| (!strcm|
|00003750| 70 28 6a 75 6d 62 6c 65 | 5f 77 6f 72 64 2c 20 6a |p(jumble|_word, j|
|00003760| 75 6d 62 6c 65 64 29 29 | 20 74 72 69 65 73 2b 2b |umbled))| tries++|
|00003770| 3b 20 2f 2a 20 69 73 20 | 69 74 20 64 69 66 66 65 |; /* is |it diffe|
|00003780| 72 65 6e 74 3f 20 2a 2f | 0a 58 20 20 20 20 69 66 |rent? */|.X if|
|00003790| 20 28 74 72 69 65 73 20 | 3e 20 35 29 20 70 72 69 | (tries |> 5) pri|
|000037a0| 6e 74 66 28 22 49 20 63 | 61 6e 27 74 20 73 65 65 |ntf("I c|an't see|
|000037b0| 6d 20 74 6f 20 6a 75 6d | 62 6c 65 20 74 68 69 73 |m to jum|ble this|
|000037c0| 20 77 6f 72 64 3a 20 25 | 73 5c 6e 22 2c 6a 75 6d | word: %|s\n",jum|
|000037d0| 62 6c 65 64 29 3b 0a 58 | 20 20 20 20 65 6c 73 65 |bled);.X| else|
|000037e0| 20 69 66 28 74 72 69 65 | 73 29 20 6d 69 78 69 74 | if(trie|s) mixit|
|000037f0| 28 29 3b 0a 58 20 20 20 | 20 74 72 69 65 73 20 3d |();.X | tries =|
|00003800| 20 30 3b 0a 58 7d 0a 58 | 0a 58 2f 2a 0a 58 20 2a | 0;.X}.X|.X/*.X *|
|00003810| 20 70 72 69 6e 74 73 20 | 69 6e 66 6f 20 2d 2d 20 | prints |info -- |
|00003820| 74 68 65 20 77 6f 72 64 | 20 79 6f 75 20 6e 65 65 |the word| you nee|
|00003830| 64 20 74 6f 20 75 6e 73 | 63 72 61 6d 62 6c 65 2c |d to uns|cramble,|
|00003840| 20 68 6f 77 20 6d 75 63 | 68 20 74 69 6d 65 20 6c | how muc|h time l|
|00003850| 65 66 74 0a 58 20 2a 20 | 62 65 66 6f 72 65 20 79 |eft.X * |before y|
|00003860| 6f 75 20 6c 6f 73 65 2c | 20 65 74 63 2e 2e 2e 0a |ou lose,| etc....|
|00003870| 58 20 2a 2f 0a 58 70 72 | 69 6e 74 69 74 28 29 0a |X */.Xpr|intit().|
|00003880| 58 7b 0a 58 20 20 20 20 | 69 6e 74 20 63 6f 75 6e |X{.X |int coun|
|00003890| 74 20 3d 20 6e 75 6d 5f | 6f 66 5f 77 6f 72 64 73 |t = num_|of_words|
|000038a0| 20 2d 20 77 6f 72 64 73 | 5f 67 69 76 65 6e 3b 0a | - words|_given;.|
|000038b0| 58 20 20 20 20 74 69 6d | 65 28 26 6e 6f 77 29 3b |X tim|e(&now);|
|000038c0| 0a 58 20 20 20 20 70 72 | 69 6e 74 66 28 22 20 54 |.X pr|intf(" T|
|000038d0| 69 6d 65 3a 20 25 44 20 | 6d 69 6e 2e 20 25 44 20 |ime: %D |min. %D |
|000038e0| 73 65 63 2e 5c 6e 25 64 | 20 77 6f 72 64 25 73 20 |sec.\n%d| word%s |
|000038f0| 6c 65 66 74 2e 20 22 2c | 0a 58 09 20 20 20 74 69 |left. ",|.X. ti|
|00003900| 6d 65 5f 6c 65 66 74 20 | 2f 20 36 30 2c 20 74 69 |me_left |/ 60, ti|
|00003910| 6d 65 5f 6c 65 66 74 20 | 25 20 36 30 2c 20 63 6f |me_left |% 60, co|
|00003920| 75 6e 74 2c 20 28 63 6f | 75 6e 74 20 21 3d 20 31 |unt, (co|unt != 1|
|00003930| 29 20 3f 20 22 73 22 20 | 3a 20 22 22 29 3b 0a 58 |) ? "s" |: "");.X|
|00003940| 20 20 20 20 70 72 69 6e | 74 66 28 22 27 71 27 20 | prin|tf("'q' |
|00003950| 74 6f 20 71 75 69 74 22 | 29 3b 0a 58 20 20 20 20 |to quit"|);.X |
|00003960| 69 66 28 70 61 73 73 65 | 73 20 3c 20 74 6f 74 61 |if(passe|s < tota|
|00003970| 6c 5f 70 61 73 73 65 73 | 29 0a 58 09 70 72 69 6e |l_passes|).X.prin|
|00003980| 74 66 28 22 2c 20 27 70 | 27 20 74 6f 20 70 61 73 |tf(", 'p|' to pas|
|00003990| 73 20 28 25 64 29 22 2c | 20 74 6f 74 61 6c 5f 70 |s (%d)",| total_p|
|000039a0| 61 73 73 65 73 20 2d 20 | 70 61 73 73 65 73 29 3b |asses - |passes);|
|000039b0| 0a 58 20 20 20 20 70 75 | 74 73 28 22 2e 22 29 3b |.X pu|ts(".");|
|000039c0| 0a 58 20 20 20 20 70 72 | 69 6e 74 66 28 22 5c 6e |.X pr|intf("\n|
|000039d0| 20 57 6f 72 64 20 23 25 | 64 3a 20 5c 22 25 73 5c | Word #%|d: \"%s\|
|000039e0| 22 2e 5c 6e 22 2c 20 77 | 6f 72 64 73 5f 67 69 76 |".\n", w|ords_giv|
|000039f0| 65 6e 2c 20 6a 75 6d 62 | 6c 65 64 29 3b 0a 58 7d |en, jumb|led);.X}|
|00003a00| 0a 58 0a 58 2f 2a 0a 58 | 20 2a 20 6c 65 74 65 6d |.X.X/*.X| * letem|
|00003a10| 67 75 65 73 73 20 2d 2d | 20 69 66 20 74 69 6d 65 |guess --| if time|
|00003a20| 20 72 75 6e 73 20 6f 75 | 74 2c 20 74 68 65 79 20 | runs ou|t, they |
|00003a30| 6c 6f 73 65 2e 20 69 66 | 20 74 68 65 79 20 74 79 |lose. if| they ty|
|00003a40| 70 65 20 61 20 27 3f 27 | 0a 58 20 2a 20 67 6f 74 |pe a '?'|.X * got|
|00003a50| 6f 20 70 72 69 6e 74 69 | 74 20 61 62 6f 76 65 2e |o printi|t above.|
|00003a60| 20 69 66 20 27 71 27 2c | 20 74 65 72 6d 69 6e 61 | if 'q',| termina|
|00003a70| 74 65 20 74 68 69 73 20 | 72 6f 75 6e 64 20 61 6e |te this |round an|
|00003a80| 64 20 74 65 6c 6c 20 74 | 68 65 6d 0a 58 20 2a 20 |d tell t|hem.X * |
|00003a90| 74 68 65 20 77 6f 72 64 | 2e 20 69 66 20 74 68 65 |the word|. if the|
|00003aa0| 79 20 67 75 65 73 73 20 | 69 74 2c 20 67 72 65 61 |y guess |it, grea|
|00003ab0| 74 2e 20 20 69 66 20 69 | 6e 20 64 65 62 75 67 20 |t. if i|n debug |
|00003ac0| 6d 6f 64 65 2c 20 75 73 | 65 72 20 74 79 70 65 73 |mode, us|er types|
|00003ad0| 0a 58 20 2a 20 27 78 27 | 20 61 6e 64 20 74 68 65 |.X * 'x'| and the|
|00003ae0| 20 6a 75 6d 62 6c 65 64 | 20 77 6f 72 64 20 77 69 | jumbled| word wi|
|00003af0| 6c 6c 20 62 65 20 70 72 | 69 6e 74 65 64 20 69 6e |ll be pr|inted in|
|00003b00| 20 70 61 72 65 6e 73 2e | 0a 58 20 2a 20 69 66 20 | parens.|.X * if |
|00003b10| 74 68 65 79 20 74 79 70 | 65 20 22 70 61 73 73 22 |they typ|e "pass"|
|00003b20| 2c 20 61 6e 64 20 74 68 | 65 79 20 68 61 76 65 20 |, and th|ey have |
|00003b30| 70 61 73 73 65 73 2c 20 | 74 65 6c 6c 20 74 68 65 |passes, |tell the|
|00003b40| 6d 20 77 6f 72 64 20 61 | 6e 64 0a 58 20 2a 20 63 |m word a|nd.X * c|
|00003b50| 6f 6e 74 69 6e 75 65 20 | 77 69 74 68 20 67 61 6d |ontinue |with gam|
|00003b60| 65 2e 0a 58 20 2a 2f 0a | 58 6c 65 74 65 6d 67 75 |e..X */.|Xletemgu|
|00003b70| 65 73 73 28 29 0a 58 7b | 0a 58 20 20 20 20 63 68 |ess().X{|.X ch|
|00003b80| 61 72 20 67 75 65 73 73 | 5b 38 30 5d 3b 0a 58 20 |ar guess|[80];.X |
|00003b90| 20 20 20 67 6f 74 69 74 | 20 3d 20 30 3b 0a 58 20 | gotit| = 0;.X |
|00003ba0| 20 20 20 70 72 69 6e 74 | 66 28 22 2d 2d 2d 3e 20 | print|f("---> |
|00003bb0| 20 47 75 65 73 73 3a 20 | 22 29 3b 0a 58 20 20 20 | Guess: |");.X |
|00003bc0| 20 77 68 69 6c 65 28 21 | 67 6f 74 69 74 20 26 26 | while(!|gotit &&|
|00003bd0| 20 67 65 74 73 28 67 75 | 65 73 73 29 29 0a 58 09 | gets(gu|ess)).X.|
|00003be0| 69 66 20 28 74 69 6d 65 | 5f 6c 65 66 74 20 3c 3d |if (time|_left <=|
|00003bf0| 20 30 29 20 72 65 74 75 | 72 6e 20 31 3b 0a 58 09 | 0) retu|rn 1;.X.|
|00003c00| 65 6c 73 65 20 69 66 20 | 28 21 73 74 72 6c 65 6e |else if |(!strlen|
|00003c10| 28 67 75 65 73 73 29 29 | 20 70 72 69 6e 74 66 28 |(guess))| printf(|
|00003c20| 22 47 75 65 73 73 3a 20 | 22 29 3b 0a 58 09 65 6c |"Guess: |");.X.el|
|00003c30| 73 65 20 69 66 20 28 21 | 73 74 72 63 6d 70 28 67 |se if (!|strcmp(g|
|00003c40| 75 65 73 73 2c 20 22 3f | 22 29 29 20 70 72 69 6e |uess, "?|")) prin|
|00003c50| 74 69 74 28 29 2c 20 70 | 72 69 6e 74 66 28 22 47 |tit(), p|rintf("G|
|00003c60| 75 65 73 73 3a 20 22 29 | 3b 0a 58 09 65 6c 73 65 |uess: ")|;.X.else|
|00003c70| 20 69 66 20 28 21 73 74 | 72 63 6d 70 28 67 75 65 | if (!st|rcmp(gue|
|00003c80| 73 73 2c 20 22 71 22 29 | 20 7c 7c 20 21 73 74 72 |ss, "q")| || !str|
|00003c90| 63 6d 70 28 67 75 65 73 | 73 2c 20 22 51 22 29 29 |cmp(gues|s, "Q"))|
|00003ca0| 20 67 6f 74 69 74 20 3d | 20 2d 31 3b 0a 58 09 65 | gotit =| -1;.X.e|
|00003cb0| 6c 73 65 20 69 66 28 21 | 73 74 72 63 6d 70 28 67 |lse if(!|strcmp(g|
|00003cc0| 75 65 73 73 2c 20 6a 75 | 6d 62 6c 65 5f 77 6f 72 |uess, ju|mble_wor|
|00003cd0| 64 29 29 20 67 6f 74 69 | 74 20 3d 20 31 3b 0a 58 |d)) goti|t = 1;.X|
|00003ce0| 09 65 6c 73 65 20 69 66 | 28 64 65 62 75 67 20 26 |.else if|(debug &|
|00003cf0| 26 20 21 73 74 72 63 6d | 70 28 67 75 65 73 73 2c |& !strcm|p(guess,|
|00003d00| 22 78 22 29 29 20 70 72 | 69 6e 74 66 28 22 28 25 |"x")) pr|intf("(%|
|00003d10| 73 29 5c 6e 22 2c 6a 75 | 6d 62 6c 65 5f 77 6f 72 |s)\n",ju|mble_wor|
|00003d20| 64 29 3b 0a 58 09 65 6c | 73 65 20 69 66 28 21 73 |d);.X.el|se if(!s|
|00003d30| 74 72 63 6d 70 28 67 75 | 65 73 73 2c 22 70 22 29 |trcmp(gu|ess,"p")|
|00003d40| 29 0a 58 09 20 20 20 20 | 69 66 20 28 70 61 73 73 |).X. |if (pass|
|00003d50| 65 73 20 3e 3d 20 74 6f | 74 61 6c 5f 70 61 73 73 |es >= to|tal_pass|
|00003d60| 65 73 29 0a 58 09 09 70 | 72 69 6e 74 66 28 22 59 |es).X..p|rintf("Y|
|00003d70| 6f 75 20 68 61 76 65 20 | 6e 6f 20 70 61 73 73 65 |ou have |no passe|
|00003d80| 73 2e 5c 6e 47 75 65 73 | 73 3a 20 22 29 3b 0a 58 |s.\nGues|s: ");.X|
|00003d90| 09 20 20 20 20 65 6c 73 | 65 20 7b 0a 58 09 09 70 |. els|e {.X..p|
|00003da0| 61 73 73 65 73 2b 2b 3b | 0a 58 09 09 70 72 69 6e |asses++;|.X..prin|
|00003db0| 74 66 28 22 57 6f 72 64 | 20 77 61 73 3a 20 5c 22 |tf("Word| was: \"|
|00003dc0| 25 73 5c 22 5c 6e 59 6f | 75 20 68 61 76 65 20 25 |%s\"\nYo|u have %|
|00003dd0| 64 20 70 61 73 73 25 73 | 20 6c 65 66 74 2e 5c 6e |d pass%s| left.\n|
|00003de0| 5c 6e 22 2c 0a 58 09 09 | 20 20 20 20 20 20 6a 75 |\n",.X..| ju|
|00003df0| 6d 62 6c 65 5f 77 6f 72 | 64 2c 20 74 6f 74 61 6c |mble_wor|d, total|
|00003e00| 5f 70 61 73 73 65 73 20 | 2d 20 70 61 73 73 65 73 |_passes |- passes|
|00003e10| 2c 20 0a 58 09 09 20 20 | 20 20 20 20 28 74 6f 74 |, .X.. | (tot|
|00003e20| 61 6c 5f 70 61 73 73 65 | 73 20 2d 20 70 61 73 73 |al_passe|s - pass|
|00003e30| 65 73 20 3d 3d 20 31 29 | 20 3f 20 22 22 20 3a 20 |es == 1)| ? "" : |
|00003e40| 22 65 73 22 29 3b 0a 58 | 09 09 67 6f 74 69 74 20 |"es");.X|..gotit |
|00003e50| 3d 20 31 3b 20 2f 2a 20 | 67 6f 74 69 74 20 3d 20 |= 1; /* |gotit = |
|00003e60| 31 20 73 6f 20 61 73 20 | 6e 6f 74 20 74 6f 20 65 |1 so as |not to e|
|00003e70| 78 69 74 20 6d 61 69 6e | 20 6c 6f 6f 70 20 2a 2f |xit main| loop */|
|00003e80| 0a 58 09 09 72 65 74 75 | 72 6e 20 30 3b 20 20 2f |.X..retu|rn 0; /|
|00003e90| 2a 20 72 65 74 75 72 6e | 20 30 20 69 66 20 70 61 |* return| 0 if pa|
|00003ea0| 73 73 65 64 2e 20 2a 2f | 0a 58 09 20 20 20 20 7d |ssed. */|.X. }|
|00003eb0| 0a 58 09 65 6c 73 65 20 | 70 72 69 6e 74 66 28 22 |.X.else |printf("|
|00003ec0| 4e 6f 70 65 2e 20 47 75 | 65 73 73 3a 20 22 29 3b |Nope. Gu|ess: ");|
|00003ed0| 0a 58 20 20 20 20 69 66 | 28 73 74 72 63 6d 70 28 |.X if|(strcmp(|
|00003ee0| 67 75 65 73 73 2c 20 6a | 75 6d 62 6c 65 5f 77 6f |guess, j|umble_wo|
|00003ef0| 72 64 29 29 0a 58 09 63 | 6c 65 61 72 65 72 72 28 |rd)).X.c|learerr(|
|00003f00| 73 74 64 69 6e 29 2c 20 | 67 6f 74 69 74 20 3d 20 |stdin), |gotit = |
|00003f10| 2d 31 3b 20 2f 2a 20 69 | 6e 20 63 61 73 65 20 73 |-1; /* i|n case s|
|00003f20| 6f 6d 65 20 6a 65 72 6b | 20 5e 44 27 73 20 2a 2f |ome jerk| ^D's */|
|00003f30| 0a 58 20 20 20 20 74 69 | 6d 65 28 26 6e 6f 77 29 |.X ti|me(&now)|
|00003f40| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 |; | /* |
|00003f50| 67 65 74 20 63 75 72 72 | 65 6e 74 20 74 69 6d 65 |get curr|ent time|
|00003f60| 20 2a 2f 0a 58 20 20 20 | 20 69 66 20 28 67 6f 74 | */.X | if (got|
|00003f70| 69 74 20 3d 3d 20 2d 31 | 29 20 6c 6f 73 65 28 29 |it == -1|) lose()|
|00003f80| 3b 0a 58 20 20 20 20 65 | 6c 73 65 20 70 72 69 6e |;.X e|lse prin|
|00003f90| 74 66 28 22 59 6f 75 20 | 67 6f 74 20 69 74 21 5c |tf("You |got it!\|
|00003fa0| 6e 22 29 3b 0a 58 20 20 | 20 20 72 65 74 75 72 6e |n");.X | return|
|00003fb0| 20 31 3b 0a 58 7d 0a 58 | 0a 58 2f 2a 0a 58 20 2a | 1;.X}.X|.X/*.X *|
|00003fc0| 20 74 68 65 79 20 6c 6f | 73 74 20 65 69 74 68 65 | they lo|st eithe|
|00003fd0| 72 20 62 79 20 6e 6f 20 | 6d 6f 72 65 20 74 69 6d |r by no |more tim|
|00003fe0| 65 20 6c 65 66 74 2c 20 | 6f 72 20 74 68 65 79 20 |e left, |or they |
|00003ff0| 74 79 70 65 64 20 27 71 | 27 20 61 62 6f 76 65 2e |typed 'q|' above.|
|00004000| 0a 58 20 2a 20 73 65 74 | 20 61 6c 61 72 6d 28 30 |.X * set| alarm(0|
|00004010| 29 20 74 6f 20 74 75 72 | 6e 20 6f 66 66 20 61 6c |) to tur|n off al|
|00004020| 61 72 6d 20 63 6c 6f 63 | 6b 20 61 6e 64 20 67 65 |arm cloc|k and ge|
|00004030| 74 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 74 69 |t the cu|rrent ti|
|00004040| 6d 65 2e 0a 58 20 2a 20 | 69 66 20 74 68 65 20 74 |me..X * |if the t|
|00004050| 69 6d 65 5f 6c 65 66 74 | 20 69 73 20 30 2c 20 74 |ime_left| is 0, t|
|00004060| 69 6d 65 20 72 61 6e 20 | 6f 75 74 2e 2e 2e 0a 58 |ime ran |out....X|
|00004070| 20 2a 20 74 65 6c 6c 20 | 74 68 65 6d 20 77 6f 72 | * tell |them wor|
|00004080| 64 2e 0a 58 20 2a 2f 0a | 58 6c 6f 73 65 28 29 0a |d..X */.|Xlose().|
|00004090| 58 7b 0a 58 20 20 20 20 | 28 76 6f 69 64 29 20 61 |X{.X |(void) a|
|000040a0| 6c 61 72 6d 28 30 29 3b | 0a 58 20 20 20 20 28 76 |larm(0);|.X (v|
|000040b0| 6f 69 64 29 20 74 69 6d | 65 28 26 6e 6f 77 29 3b |oid) tim|e(&now);|
|000040c0| 0a 58 20 20 20 20 69 66 | 20 28 67 6f 74 69 74 20 |.X if| (gotit |
|000040d0| 3d 3d 20 31 29 20 72 65 | 74 75 72 6e 3b 20 20 2f |== 1) re|turn; /|
|000040e0| 2a 20 77 65 27 72 65 20 | 69 6e 20 6c 69 6d 62 6f |* we're |in limbo|
|000040f0| 2c 20 62 65 74 77 65 65 | 6e 20 77 6f 72 64 73 2c |, betwee|n words,|
|00004100| 20 77 68 61 74 65 76 65 | 72 2e 2e 2e 20 2a 2f 0a | whateve|r... */.|
|00004110| 58 20 20 20 20 69 66 20 | 28 74 69 6d 65 5f 6c 65 |X if |(time_le|
|00004120| 66 74 20 3c 20 31 29 0a | 58 09 70 75 74 73 28 22 |ft < 1).|X.puts("|
|00004130| 54 69 6d 65 20 72 61 6e | 20 6f 75 74 2e 22 29 3b |Time ran| out.");|
|00004140| 0a 58 20 20 20 20 70 72 | 69 6e 74 66 28 22 54 68 |.X pr|intf("Th|
|00004150| 65 20 77 6f 72 64 20 77 | 61 73 20 5c 22 25 73 5c |e word w|as \"%s\|
|00004160| 22 2e 5c 6e 22 2c 20 6a | 75 6d 62 6c 65 5f 77 6f |".\n", j|umble_wo|
|00004170| 72 64 29 3b 0a 58 20 20 | 20 20 69 66 20 28 74 69 |rd);.X | if (ti|
|00004180| 6d 65 5f 6c 65 66 74 20 | 3c 20 31 29 0a 58 09 66 |me_left |< 1).X.f|
|00004190| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 20 22 |printf(s|tderr, "|
|000041a0| 2d 2d 48 69 74 20 52 45 | 54 55 52 4e 2d 2d 22 29 |--Hit RE|TURN--")|
|000041b0| 2c 20 67 6f 74 69 74 20 | 3d 20 2d 31 3b 0a 58 7d |, gotit |= -1;.X}|
|000041c0| 0a 58 0a 58 2f 2a 0a 58 | 20 2a 20 77 65 27 72 65 |.X.X/*.X| * we're|
|000041d0| 20 64 6f 6e 65 20 77 69 | 74 68 20 74 68 65 20 6c | done wi|th the l|
|000041e0| 61 73 74 20 72 6f 75 6e | 64 2c 20 77 68 61 74 20 |ast roun|d, what |
|000041f0| 64 6f 65 73 20 70 6c 61 | 79 65 72 20 77 61 6e 74 |does pla|yer want|
|00004200| 20 74 6f 20 64 6f 20 6e | 65 78 74 3f 0a 58 20 2a | to do n|ext?.X *|
|00004210| 2f 0a 58 61 6e 64 5f 6e | 6f 77 28 29 0a 58 7b 0a |/.Xand_n|ow().X{.|
|00004220| 58 20 20 20 20 69 66 20 | 28 67 6f 74 69 74 20 3e |X if |(gotit >|
|00004230| 20 30 29 20 7b 0a 58 09 | 69 6e 74 20 66 6f 6f 20 | 0) {.X.|int foo |
|00004240| 3d 20 28 64 65 61 74 68 | 5f 74 69 6d 65 20 2d 20 |= (death|_time - |
|00004250| 74 69 6d 65 5f 6c 65 66 | 74 29 3b 0a 58 09 70 72 |time_lef|t);.X.pr|
|00004260| 69 6e 74 66 28 22 59 6f | 75 72 20 73 63 6f 72 65 |intf("Yo|ur score|
|00004270| 3a 20 25 64 20 77 6f 72 | 64 25 73 20 69 6e 20 25 |: %d wor|d%s in %|
|00004280| 44 20 6d 69 6e 2e 20 25 | 44 20 73 65 63 2e 20 20 |D min. %|D sec. |
|00004290| 28 25 32 2e 32 66 20 77 | 6f 72 64 73 2f 6d 69 6e |(%2.2f w|ords/min|
|000042a0| 2e 29 5c 6e 22 2c 0a 58 | 09 09 20 6e 75 6d 5f 6f |.)\n",.X|.. num_o|
|000042b0| 66 5f 77 6f 72 64 73 2c | 20 28 6e 75 6d 5f 6f 66 |f_words,| (num_of|
|000042c0| 5f 77 6f 72 64 73 20 3d | 3d 20 31 29 20 3f 20 22 |_words =|= 1) ? "|
|000042d0| 22 20 3a 20 22 73 22 2c | 20 66 6f 6f 20 2f 20 36 |" : "s",| foo / 6|
|000042e0| 30 2c 0a 58 09 09 20 66 | 6f 6f 20 25 20 36 30 2c |0,.X.. f|oo % 60,|
|000042f0| 20 28 66 6c 6f 61 74 29 | 28 77 6f 72 64 73 5f 67 | (float)|(words_g|
|00004300| 69 76 65 6e 20 2f 20 28 | 66 6f 6f 20 2f 20 36 30 |iven / (|foo / 60|
|00004310| 2e 30 29 29 29 3b 0a 58 | 09 68 69 67 68 5f 73 63 |.0)));.X|.high_sc|
|00004320| 6f 72 65 28 30 2c 30 29 | 3b 0a 58 20 20 20 20 7d |ore(0,0)|;.X }|
|00004330| 0a 58 20 20 20 20 70 72 | 69 6e 74 66 28 22 5c 6e |.X pr|intf("\n|
|00004340| 52 45 54 55 52 4e 20 74 | 6f 20 50 6c 61 79 20 61 |RETURN t|o Play a|
|00004350| 67 61 69 6e 2c 20 28 43 | 29 68 61 6e 67 65 20 73 |gain, (C|)hange s|
|00004360| 6b 69 6c 6c 20 6c 65 76 | 65 6c 2c 20 28 53 29 63 |kill lev|el, (S)c|
|00004370| 6f 72 65 73 2c 20 28 51 | 29 75 69 74 3a 20 22 29 |ores, (Q|)uit: ")|
|00004380| 3b 0a 58 20 20 20 20 77 | 68 69 6c 65 28 74 68 65 |;.X w|hile(the|
|00004390| 5f 70 6f 70 65 5f 69 73 | 5f 63 61 74 68 6f 6c 69 |_pope_is|_catholi|
|000043a0| 63 29 0a 58 09 73 77 69 | 74 63 68 28 67 65 74 63 |c).X.swi|tch(getc|
|000043b0| 68 61 72 28 29 29 20 7b | 0a 58 09 20 20 20 20 63 |har()) {|.X. c|
|000043c0| 61 73 65 20 27 20 27 20 | 3a 20 63 61 73 65 20 27 |ase ' ' |: case '|
|000043d0| 5c 74 27 20 3a 20 62 72 | 65 61 6b 3b 0a 58 09 20 |\t' : br|eak;.X. |
|000043e0| 20 20 20 63 61 73 65 20 | 27 5c 6e 27 20 3a 20 20 | case |'\n' : |
|000043f0| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 70 6c 61 79 | | /* play|
|00004400| 20 61 67 61 69 6e 2c 20 | 6e 6f 20 63 68 61 6e 67 | again, |no chang|
|00004410| 65 73 20 2a 2f 0a 58 09 | 09 72 65 74 75 72 6e 3b |es */.X.|.return;|
|00004420| 0a 58 09 20 20 20 20 63 | 61 73 65 20 27 43 27 20 |.X. c|ase 'C' |
|00004430| 3a 20 63 61 73 65 20 27 | 63 27 20 3a 20 2f 2a 20 |: case '|c' : /* |
|00004440| 67 65 74 20 6e 65 77 20 | 6c 65 76 65 6c 20 6f 66 |get new |level of|
|00004450| 20 70 6c 61 79 20 2a 2f | 0a 58 09 09 77 68 69 6c | play */|.X..whil|
|00004460| 65 28 67 65 74 63 68 61 | 72 28 29 20 21 3d 20 27 |e(getcha|r() != '|
|00004470| 5c 6e 27 29 3b 20 67 65 | 74 5f 6c 65 76 65 6c 28 |\n'); ge|t_level(|
|00004480| 29 3b 20 72 65 74 75 72 | 6e 3b 0a 58 09 20 20 20 |); retur|n;.X. |
|00004490| 20 63 61 73 65 20 27 51 | 27 20 3a 20 63 61 73 65 | case 'Q|' : case|
|000044a0| 20 27 71 27 20 3a 20 2f | 2a 20 71 75 69 74 20 2a | 'q' : /|* quit *|
|000044b0| 2f 0a 58 09 09 71 75 69 | 74 28 29 3b 0a 58 09 20 |/.X..qui|t();.X. |
|000044c0| 20 20 20 63 61 73 65 20 | 27 53 27 20 3a 20 63 61 | case |'S' : ca|
|000044d0| 73 65 20 27 73 27 20 3a | 20 2f 2a 20 6c 6f 6f 6b |se 's' :| /* look|
|000044e0| 20 61 74 20 74 68 65 20 | 73 63 6f 72 65 73 20 2a | at the |scores *|
|000044f0| 2f 0a 58 09 09 68 69 67 | 68 5f 73 63 6f 72 65 28 |/.X..hig|h_score(|
|00004500| 31 2c 30 29 3b 0a 58 09 | 20 20 20 20 64 65 66 61 |1,0);.X.| defa|
|00004510| 75 6c 74 20 3a 20 77 68 | 69 6c 65 28 67 65 74 63 |ult : wh|ile(getc|
|00004520| 68 61 72 28 29 20 21 3d | 20 27 5c 6e 27 29 3b 0a |har() !=| '\n');.|
|00004530| 58 09 09 70 72 69 6e 74 | 66 28 22 3c 63 72 3e 2c |X..print|f("<cr>,|
|00004540| 20 27 63 27 2c 20 27 73 | 27 2c 20 6f 72 20 27 71 | 'c', 's|', or 'q|
|00004550| 27 3a 20 22 29 3b 0a 58 | 09 7d 0a 58 7d 0a 58 0a |': ");.X|.}.X}.X.|
|00004560| 58 73 74 72 75 63 74 20 | 73 63 6f 72 65 73 20 7b |Xstruct |scores {|
|00004570| 0a 58 20 20 20 20 63 68 | 61 72 20 73 63 5f 6e 61 |.X ch|ar sc_na|
|00004580| 6d 65 5b 4e 41 4d 45 4c | 45 4e 5d 3b 20 20 20 20 |me[NAMEL|EN]; |
|00004590| 20 20 20 2f 2a 20 74 68 | 69 73 20 69 73 20 77 68 | /* th|is is wh|
|000045a0| 61 74 20 74 68 65 79 20 | 70 75 74 20 6f 6e 20 74 |at they |put on t|
|000045b0| 68 65 20 68 69 67 68 20 | 73 63 6f 72 65 73 20 2a |he high |scores *|
|000045c0| 2f 0a 58 20 20 20 20 63 | 68 61 72 20 73 63 5f 6c |/.X c|har sc_l|
|000045d0| 6f 67 69 6e 5b 38 5d 3b | 20 20 20 20 20 20 20 20 |ogin[8];| |
|000045e0| 20 20 20 20 2f 2a 20 74 | 68 69 73 20 69 73 20 66 | /* t|his is f|
|000045f0| 6f 72 20 74 68 65 69 72 | 20 6c 6f 67 69 6e 20 6e |or their| login n|
|00004600| 61 6d 65 73 20 2a 2f 0a | 58 20 20 20 20 6c 6f 6e |ames */.|X lon|
|00004610| 67 20 73 63 5f 74 69 6d | 65 3b 20 20 20 20 20 20 |g sc_tim|e; |
|00004620| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 74 69 6d | | /* tim|
|00004630| 65 20 74 61 6b 65 6e 20 | 66 6f 72 20 74 68 61 74 |e taken |for that|
|00004640| 20 67 61 6d 65 20 20 20 | 20 20 20 2a 2f 0a 58 20 | game | */.X |
|00004650| 20 20 20 69 6e 74 20 73 | 63 5f 77 6f 72 64 73 3b | int s|c_words;|
|00004660| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004670| 2f 2a 20 68 6f 77 20 6d | 61 6e 79 20 77 6f 72 64 |/* how m|any word|
|00004680| 73 20 64 69 64 20 74 68 | 65 79 20 70 6c 61 79 20 |s did th|ey play |
|00004690| 77 69 74 68 20 2a 2f 0a | 58 20 20 20 20 69 6e 74 |with */.|X int|
|000046a0| 20 73 63 5f 6c 65 76 65 | 6c 3b 20 20 20 20 20 20 | sc_leve|l; |
|000046b0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 74 68 65 | | /* the|
|000046c0| 20 6c 65 76 65 6c 20 6f | 66 20 70 6c 61 79 20 66 | level o|f play f|
|000046d0| 6f 72 20 74 68 61 74 20 | 70 65 72 73 6f 6e 20 2a |or that |person *|
|000046e0| 2f 0a 58 7d 20 74 6f 70 | 5f 74 65 6e 5b 31 30 5d |/.X} top|_ten[10]|
|000046f0| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|00004700| 20 20 20 20 2f 2a 20 77 | 65 20 6f 6e 6c 79 20 77 | /* w|e only w|
|00004710| 61 6e 74 20 31 30 20 68 | 69 67 68 20 73 63 6f 72 |ant 10 h|igh scor|
|00004720| 65 73 2e 20 20 2a 2f 0a | 58 0a 58 68 69 67 68 5f |es. */.|X.Xhigh_|
|00004730| 73 63 6f 72 65 28 52 65 | 61 64 2c 20 6e 61 6d 65 |score(Re|ad, name|
|00004740| 73 29 0a 58 73 68 6f 72 | 74 20 52 65 61 64 2c 20 |s).Xshor|t Read, |
|00004750| 6e 61 6d 65 73 3b 20 20 | 20 2f 2a 20 73 68 6f 75 |names; | /* shou|
|00004760| 6c 64 20 77 65 20 52 65 | 61 64 20 74 68 65 20 73 |ld we Re|ad the s|
|00004770| 63 6f 72 65 73 2c 20 6f | 72 20 61 74 74 65 6d 70 |cores, o|r attemp|
|00004780| 74 20 74 6f 20 65 6e 74 | 65 72 20 6f 6e 65 20 2a |t to ent|er one *|
|00004790| 2f 0a 58 7b 0a 58 20 20 | 20 20 73 74 72 75 63 74 |/.X{.X | struct|
|000047a0| 20 73 63 6f 72 65 73 20 | 2a 73 63 70 2c 20 2a 74 | scores |*scp, *t|
|000047b0| 65 6d 70 3b 20 2f 2a 20 | 73 63 70 20 69 73 20 61 |emp; /* |scp is a|
|000047c0| 20 73 63 6f 72 65 20 70 | 6f 69 6e 74 65 72 2c 20 | score p|ointer, |
|000047d0| 61 6e 64 20 74 65 6d 70 | 20 69 73 20 2a 2f 0a 58 |and temp| is */.X|
|000047e0| 09 09 09 20 20 20 20 20 | 20 20 2f 2a 20 66 6f 72 |... | /* for|
|000047f0| 20 74 65 6d 70 6f 72 61 | 72 79 20 73 74 6f 72 61 | tempora|ry stora|
|00004800| 67 65 20 2a 2f 0a 58 20 | 20 20 20 46 49 4c 45 20 |ge */.X | FILE |
|00004810| 2a 73 63 6f 72 65 66 70 | 3b 20 2f 2a 20 66 69 6c |*scorefp|; /* fil|
|00004820| 65 20 64 65 73 63 72 69 | 70 74 6f 72 20 6f 66 20 |e descri|ptor of |
|00004830| 74 68 65 20 73 63 6f 72 | 65 20 66 69 6c 65 20 2a |the scor|e file *|
|00004840| 2f 0a 58 0a 58 20 20 20 | 20 2f 2a 0a 58 20 20 20 |/.X.X | /*.X |
|00004850| 20 20 2a 20 66 69 6c 6c | 20 61 6c 6c 20 74 65 6e | * fill| all ten|
|00004860| 20 65 6e 74 72 69 65 73 | 20 77 69 74 68 20 6e 6f | entries| with no|
|00004870| 74 68 69 6e 67 20 69 6e | 20 63 61 73 65 20 74 68 |thing in| case th|
|00004880| 65 20 68 69 67 68 20 73 | 63 6f 72 65 20 66 69 6c |e high s|core fil|
|00004890| 65 0a 58 20 20 20 20 20 | 2a 20 69 73 6e 27 74 20 |e.X |* isn't |
|000048a0| 63 6f 6d 70 6c 65 74 65 | 6c 79 20 66 69 6c 6c 65 |complete|ly fille|
|000048b0| 64 2e 0a 58 20 20 20 20 | 20 2a 2f 0a 58 20 20 20 |d..X | */.X |
|000048c0| 20 66 6f 72 20 28 73 63 | 70 20 3d 20 74 6f 70 5f | for (sc|p = top_|
|000048d0| 74 65 6e 3b 20 73 63 70 | 20 3c 20 26 74 6f 70 5f |ten; scp| < &top_|
|000048e0| 74 65 6e 5b 31 30 5d 3b | 20 73 63 70 2b 2b 29 20 |ten[10];| scp++) |
|000048f0| 7b 0a 58 09 73 63 70 2d | 3e 73 63 5f 6e 61 6d 65 |{.X.scp-|>sc_name|
|00004900| 5b 30 5d 20 3d 20 30 3b | 0a 58 09 73 63 70 2d 3e |[0] = 0;|.X.scp->|
|00004910| 73 63 5f 6c 6f 67 69 6e | 5b 30 5d 20 3d 20 30 3b |sc_login|[0] = 0;|
|00004920| 0a 58 09 73 63 70 2d 3e | 73 63 5f 74 69 6d 65 20 |.X.scp->|sc_time |
|00004930| 3d 20 30 3b 0a 58 09 73 | 63 70 2d 3e 73 63 5f 77 |= 0;.X.s|cp->sc_w|
|00004940| 6f 72 64 73 20 3d 20 30 | 3b 0a 58 09 73 63 70 2d |ords = 0|;.X.scp-|
|00004950| 3e 73 63 5f 6c 65 76 65 | 6c 20 3d 20 30 3b 0a 58 |>sc_leve|l = 0;.X|
|00004960| 20 20 20 20 7d 0a 58 0a | 58 20 20 20 20 2f 2a 0a | }.X.|X /*.|
|00004970| 58 20 20 20 20 20 2a 20 | 6f 70 65 6e 20 73 63 6f |X * |open sco|
|00004980| 72 65 20 66 69 6c 65 20 | 66 6f 72 20 63 6f 6e 63 |re file |for conc|
|00004990| 75 72 72 65 6e 74 20 72 | 65 61 64 2f 77 72 69 74 |urrent r|ead/writ|
|000049a0| 65 20 61 63 63 65 73 73 | 20 61 6e 64 0a 58 20 20 |e access| and.X |
|000049b0| 20 20 20 2a 20 72 65 61 | 64 20 74 68 65 20 74 6f | * rea|d the to|
|000049c0| 70 20 74 65 6e 20 66 69 | 6c 65 20 69 6e 74 6f 20 |p ten fi|le into |
|000049d0| 74 68 65 20 61 72 72 61 | 79 20 0a 58 20 20 20 20 |the arra|y .X |
|000049e0| 20 2a 2f 0a 58 20 20 20 | 20 69 66 20 28 28 73 63 | */.X | if ((sc|
|000049f0| 6f 72 65 66 70 20 3d 20 | 66 6f 70 65 6e 28 53 43 |orefp = |fopen(SC|
|00004a00| 4f 52 45 46 49 4c 45 2c | 20 22 72 2b 22 29 29 20 |OREFILE,| "r+")) |
|00004a10| 3d 3d 20 30 29 0a 58 09 | 7b 20 70 65 72 72 6f 72 |== 0).X.|{ perror|
|00004a20| 28 53 43 4f 52 45 46 49 | 4c 45 29 3b 20 72 65 74 |(SCOREFI|LE); ret|
|00004a30| 75 72 6e 3b 20 7d 0a 58 | 20 20 20 20 28 76 6f 69 |urn; }.X| (voi|
|00004a40| 64 29 20 66 72 65 61 64 | 28 28 63 68 61 72 20 2a |d) fread|((char *|
|00004a50| 29 74 6f 70 5f 74 65 6e | 2c 20 73 69 7a 65 6f 66 |)top_ten|, sizeof|
|00004a60| 28 73 74 72 75 63 74 20 | 73 63 6f 72 65 73 29 2c |(struct |scores),|
|00004a70| 20 31 30 2c 20 73 63 6f | 72 65 66 70 29 3b 0a 58 | 10, sco|refp);.X|
|00004a80| 0a 58 20 20 20 20 69 66 | 20 28 52 65 61 64 29 20 |.X if| (Read) |
|00004a90| 7b 20 20 20 20 20 20 2f | 2a 20 50 72 69 6e 74 20 |{ /|* Print |
|00004aa0| 74 68 65 20 6c 69 73 74 | 20 2a 2f 0a 58 09 70 72 |the list| */.X.pr|
|00004ab0| 69 6e 74 66 28 22 54 6f | 70 20 4a 75 6d 62 6c 65 |intf("To|p Jumble|
|00004ac0| 72 73 3a 5c 6e 22 29 3b | 0a 58 09 70 72 69 6e 74 |rs:\n");|.X.print|
|00004ad0| 66 28 22 4c 65 76 65 6c | 5c 74 57 6f 72 64 73 5c |f("Level|\tWords\|
|00004ae0| 74 5c 74 54 69 6d 65 5c | 74 20 20 20 20 77 6f 72 |t\tTime\|t wor|
|00004af0| 64 73 2f 6d 69 6e 5c 74 | 4e 61 6d 65 5c 6e 22 29 |ds/min\t|Name\n")|
|00004b00| 3b 0a 58 20 20 20 20 20 | 20 20 20 66 6f 72 20 28 |;.X | for (|
|00004b10| 73 63 70 20 3d 20 74 6f | 70 5f 74 65 6e 3b 20 73 |scp = to|p_ten; s|
|00004b20| 63 70 20 3c 20 26 74 6f | 70 5f 74 65 6e 5b 31 30 |cp < &to|p_ten[10|
|00004b30| 5d 3b 20 73 63 70 2b 2b | 29 20 0a 58 09 09 2f 2a |]; scp++|) .X../*|
|00004b40| 20 70 72 69 6e 74 20 6f | 6e 6c 79 20 74 68 6f 73 | print o|nly thos|
|00004b50| 65 20 73 63 6f 72 65 73 | 20 74 68 61 74 20 61 72 |e scores| that ar|
|00004b60| 65 20 76 61 6c 69 64 20 | 28 6e 6f 74 20 30 29 20 |e valid |(not 0) |
|00004b70| 20 20 2a 2f 0a 58 09 20 | 20 20 20 69 66 20 28 73 | */.X. | if (s|
|00004b80| 63 70 2d 3e 73 63 5f 77 | 6f 72 64 73 20 3e 3d 20 |cp->sc_w|ords >= |
|00004b90| 57 4f 52 44 53 5f 4e 45 | 45 44 45 44 20 26 26 20 |WORDS_NE|EDED && |
|00004ba0| 73 63 70 2d 3e 73 63 5f | 6c 6f 67 69 6e 5b 30 5d |scp->sc_|login[0]|
|00004bb0| 29 20 7b 0a 58 09 20 20 | 20 20 20 20 20 20 70 72 |) {.X. | pr|
|00004bc0| 69 6e 74 66 28 22 25 73 | 5c 74 25 33 64 5c 74 20 |intf("%s|\t%3d\t |
|00004bd0| 20 25 32 44 20 4d 69 6e | 2e 20 25 32 44 20 73 65 | %2D Min|. %2D se|
|00004be0| 63 2e 20 20 20 20 20 25 | 32 2e 32 66 5c 74 25 73 |c. %|2.2f\t%s|
|00004bf0| 22 2c 0a 58 09 09 28 73 | 63 70 2d 3e 73 63 5f 6c |",.X..(s|cp->sc_l|
|00004c00| 65 76 65 6c 20 3d 3d 20 | 31 29 20 3f 20 0a 58 09 |evel == |1) ? .X.|
|00004c10| 09 20 20 20 20 22 45 78 | 70 65 72 74 22 20 3a 20 |. "Ex|pert" : |
|00004c20| 28 73 63 70 2d 3e 73 63 | 5f 6c 65 76 65 6c 20 3d |(scp->sc|_level =|
|00004c30| 3d 20 32 29 20 3f 0a 58 | 09 09 20 20 20 20 22 48 |= 2) ?.X|.. "H|
|00004c40| 61 72 64 22 20 20 20 3a | 20 28 73 63 70 2d 3e 73 |ard" :| (scp->s|
|00004c50| 63 5f 6c 65 76 65 6c 20 | 3d 3d 20 33 29 20 3f 0a |c_level |== 3) ?.|
|00004c60| 58 09 09 20 20 20 20 22 | 4d 65 64 69 75 6d 22 20 |X.. "|Medium" |
|00004c70| 3a 20 22 45 61 73 79 22 | 2c 0a 58 09 09 73 63 70 |: "Easy"|,.X..scp|
|00004c80| 2d 3e 73 63 5f 77 6f 72 | 64 73 2c 20 73 63 70 2d |->sc_wor|ds, scp-|
|00004c90| 3e 73 63 5f 74 69 6d 65 | 20 2f 20 36 30 2c 20 73 |>sc_time| / 60, s|
|00004ca0| 63 70 2d 3e 73 63 5f 74 | 69 6d 65 20 25 20 36 30 |cp->sc_t|ime % 60|
|00004cb0| 2c 20 0a 58 09 09 28 66 | 6c 6f 61 74 29 28 73 63 |, .X..(f|loat)(sc|
|00004cc0| 70 2d 3e 73 63 5f 77 6f | 72 64 73 20 2f 20 28 73 |p->sc_wo|rds / (s|
|00004cd0| 63 70 2d 3e 73 63 5f 74 | 69 6d 65 20 2f 20 36 30 |cp->sc_t|ime / 60|
|00004ce0| 2e 30 29 29 2c 20 73 63 | 70 2d 3e 73 63 5f 6e 61 |.0)), sc|p->sc_na|
|00004cf0| 6d 65 29 3b 0a 58 09 09 | 69 66 20 28 6e 61 6d 65 |me);.X..|if (name|
|00004d00| 73 29 0a 58 09 09 20 20 | 20 20 70 72 69 6e 74 66 |s).X.. | printf|
|00004d10| 28 22 28 25 73 29 22 2c | 20 73 63 70 2d 3e 73 63 |("(%s)",| scp->sc|
|00004d20| 5f 6c 6f 67 69 6e 29 3b | 0a 58 09 09 70 75 74 63 |_login);|.X..putc|
|00004d30| 68 61 72 28 27 5c 6e 27 | 29 3b 0a 58 09 20 20 20 |har('\n'|);.X. |
|00004d40| 20 7d 0a 58 09 20 20 20 | 20 65 6c 73 65 20 62 72 | }.X. | else br|
|00004d50| 65 61 6b 3b 0a 58 20 20 | 20 20 7d 0a 58 20 20 20 |eak;.X | }.X |
|00004d60| 20 2f 2a 20 63 68 65 63 | 6b 20 74 6f 20 73 65 65 | /* chec|k to see|
|00004d70| 20 69 66 20 63 75 72 72 | 65 6e 74 20 73 63 6f 72 | if curr|ent scor|
|00004d80| 65 20 6d 61 64 65 20 69 | 74 20 2a 2f 0a 58 20 20 |e made i|t */.X |
|00004d90| 20 20 65 6c 73 65 20 69 | 66 20 28 6e 75 6d 5f 6f | else i|f (num_o|
|00004da0| 66 5f 77 6f 72 64 73 20 | 3e 3d 20 57 4f 52 44 53 |f_words |>= WORDS|
|00004db0| 5f 4e 45 45 44 45 44 29 | 20 7b 0a 58 09 69 6e 74 |_NEEDED)| {.X.int|
|00004dc0| 20 63 6f 75 6e 74 20 3d | 20 30 3b 0a 58 09 73 69 | count =| 0;.X.si|
|00004dd0| 67 6e 61 6c 28 53 49 47 | 51 55 49 54 2c 20 53 49 |gnal(SIG|QUIT, SI|
|00004de0| 47 5f 49 47 4e 29 3b 20 | 2f 2a 20 77 65 20 64 6f |G_IGN); |/* we do|
|00004df0| 6e 27 74 20 77 61 6e 74 | 20 74 68 65 6d 20 74 6f |n't want| them to|
|00004e00| 20 6c 65 61 76 65 20 6a | 75 73 74 20 79 65 74 20 | leave j|ust yet |
|00004e10| 2a 2f 0a 58 09 73 69 67 | 6e 61 6c 28 53 49 47 49 |*/.X.sig|nal(SIGI|
|00004e20| 4e 54 2c 20 53 49 47 5f | 49 47 4e 29 3b 0a 58 09 |NT, SIG_|IGN);.X.|
|00004e30| 66 6f 72 20 28 73 63 70 | 20 3d 20 74 6f 70 5f 74 |for (scp| = top_t|
|00004e40| 65 6e 3b 20 73 63 70 20 | 3c 20 26 74 6f 70 5f 74 |en; scp |< &top_t|
|00004e50| 65 6e 5b 31 30 5d 3b 20 | 73 63 70 2b 2b 29 0a 58 |en[10]; |scp++).X|
|00004e60| 09 20 20 20 20 69 66 20 | 28 2b 2b 63 6f 75 6e 74 |. if |(++count|
|00004e70| 20 26 26 20 76 61 6c 75 | 65 5f 63 6d 70 28 73 63 | && valu|e_cmp(sc|
|00004e80| 70 29 29 20 20 20 2f 2a | 20 63 68 65 63 6b 20 66 |p)) /*| check f|
|00004e90| 75 6e 63 74 69 6f 6e 20 | 76 61 6c 75 65 5f 63 6d |unction |value_cm|
|00004ea0| 70 20 2a 2f 0a 58 09 09 | 62 72 65 61 6b 3b 20 20 |p */.X..|break; |
|00004eb0| 20 20 20 20 2f 2a 20 69 | 66 20 69 74 20 72 65 74 | /* i|f it ret|
|00004ec0| 75 72 6e 73 20 74 72 75 | 65 2c 20 63 75 72 72 65 |urns tru|e, curre|
|00004ed0| 6e 74 20 73 63 6f 72 65 | 20 6d 61 64 65 20 69 74 |nt score| made it|
|00004ee0| 20 2a 2f 0a 58 09 69 66 | 20 28 73 63 70 20 3c 20 | */.X.if| (scp < |
|00004ef0| 26 74 6f 70 5f 74 65 6e | 5b 31 30 5d 29 20 7b 0a |&top_ten|[10]) {.|
|00004f00| 58 09 20 20 20 20 2f 2a | 0a 58 09 20 20 20 20 20 |X. /*|.X. |
|00004f10| 2a 20 6d 6f 76 65 20 61 | 6c 6c 20 74 68 65 20 6f |* move a|ll the o|
|00004f20| 74 68 65 72 20 73 63 6f | 72 65 73 20 64 6f 77 6e |ther sco|res down|
|00004f30| 20 6f 6e 65 20 69 6e 20 | 74 68 65 20 6c 69 73 74 | one in |the list|
|00004f40| 0a 58 09 20 20 20 20 20 | 2a 2f 0a 58 09 20 20 20 |.X. |*/.X. |
|00004f50| 20 66 6f 72 20 28 74 65 | 6d 70 20 3d 20 26 74 6f | for (te|mp = &to|
|00004f60| 70 5f 74 65 6e 5b 39 5d | 3b 20 74 65 6d 70 20 3e |p_ten[9]|; temp >|
|00004f70| 20 73 63 70 3b 20 74 65 | 6d 70 2d 2d 29 0a 58 09 | scp; te|mp--).X.|
|00004f80| 09 2a 74 65 6d 70 20 3d | 20 2a 28 74 65 6d 70 2d |.*temp =| *(temp-|
|00004f90| 31 29 3b 0a 58 09 20 20 | 20 20 2f 2a 20 0a 58 09 |1);.X. | /* .X.|
|00004fa0| 20 20 20 20 20 2a 20 65 | 6e 74 65 72 20 63 75 72 | * e|nter cur|
|00004fb0| 72 6e 65 74 20 76 61 6c | 75 65 73 20 69 6e 74 6f |rnet val|ues into|
|00004fc0| 20 6c 69 73 74 0a 58 09 | 20 20 20 20 20 2a 20 61 | list.X.| * a|
|00004fd0| 6e 64 20 67 65 74 20 68 | 69 73 20 6e 61 6d 65 0a |nd get h|is name.|
|00004fe0| 58 09 20 20 20 20 20 2a | 2f 0a 58 09 20 20 20 20 |X. *|/.X. |
|00004ff0| 73 63 70 2d 3e 73 63 5f | 77 6f 72 64 73 20 3d 20 |scp->sc_|words = |
|00005000| 6e 75 6d 5f 6f 66 5f 77 | 6f 72 64 73 3b 0a 58 09 |num_of_w|ords;.X.|
|00005010| 20 20 20 20 73 63 70 2d | 3e 73 63 5f 6c 65 76 65 | scp-|>sc_leve|
|00005020| 6c 20 3d 20 6c 65 76 65 | 6c 3b 0a 58 09 20 20 20 |l = leve|l;.X. |
|00005030| 20 73 63 70 2d 3e 73 63 | 5f 74 69 6d 65 20 3d 20 | scp->sc|_time = |
|00005040| 64 65 61 74 68 5f 74 69 | 6d 65 20 2d 20 74 69 6d |death_ti|me - tim|
|00005050| 65 5f 6c 65 66 74 3b 0a | 58 09 20 20 20 20 28 76 |e_left;.|X. (v|
|00005060| 6f 69 64 29 20 73 74 72 | 63 70 79 28 73 63 70 2d |oid) str|cpy(scp-|
|00005070| 3e 73 63 5f 6c 6f 67 69 | 6e 2c 20 67 65 74 6c 6f |>sc_logi|n, getlo|
|00005080| 67 69 6e 28 29 29 3b 0a | 58 09 20 20 20 20 70 72 |gin());.|X. pr|
|00005090| 69 6e 74 66 28 22 59 6f | 75 20 6d 61 64 65 20 74 |intf("Yo|u made t|
|000050a0| 68 65 20 74 6f 70 20 74 | 65 6e 21 20 28 23 25 64 |he top t|en! (#%d|
|000050b0| 29 20 45 6e 74 65 72 20 | 61 20 6e 61 6d 65 20 28 |) Enter |a name (|
|000050c0| 25 64 20 63 68 61 72 73 | 29 3a 20 22 2c 0a 58 09 |%d chars|): ",.X.|
|000050d0| 09 09 20 20 63 6f 75 6e | 74 2c 20 4e 41 4d 45 4c |.. coun|t, NAMEL|
|000050e0| 45 4e 29 3b 0a 58 09 20 | 20 20 20 66 67 65 74 73 |EN);.X. | fgets|
|000050f0| 28 73 63 70 2d 3e 73 63 | 5f 6e 61 6d 65 2c 20 4e |(scp->sc|_name, N|
|00005100| 41 4d 45 4c 45 4e 2c 20 | 73 74 64 69 6e 29 3b 0a |AMELEN, |stdin);.|
|00005110| 58 09 20 20 20 20 73 63 | 70 2d 3e 73 63 5f 6e 61 |X. sc|p->sc_na|
|00005120| 6d 65 5b 73 74 72 6c 65 | 6e 28 73 63 70 2d 3e 73 |me[strle|n(scp->s|
|00005130| 63 5f 6e 61 6d 65 29 20 | 2d 20 31 5d 20 3d 20 30 |c_name) |- 1] = 0|
|00005140| 3b 0a 58 09 20 20 20 20 | 2f 2a 0a 58 09 20 20 20 |;.X. |/*.X. |
|00005150| 20 20 2a 20 69 66 20 74 | 68 65 79 20 64 69 64 6e | * if t|hey didn|
|00005160| 27 74 20 74 79 70 65 20 | 61 6e 79 74 68 69 6e 67 |'t type |anything|
|00005170| 2c 20 64 6f 6e 27 74 20 | 65 6e 74 65 72 20 74 68 |, don't |enter th|
|00005180| 65 20 73 63 6f 72 65 0a | 58 09 20 20 20 20 20 2a |e score.|X. *|
|00005190| 20 65 6c 73 65 2c 20 72 | 65 77 69 6e 64 20 74 68 | else, r|ewind th|
|000051a0| 65 20 66 69 6c 65 20 61 | 6e 64 20 65 6e 74 65 72 |e file a|nd enter|
|000051b0| 20 74 68 65 20 6e 65 77 | 20 73 63 6f 72 65 20 6c | the new| score l|
|000051c0| 69 73 74 0a 58 09 20 20 | 20 20 20 2a 2f 0a 58 09 |ist.X. | */.X.|
|000051d0| 20 20 20 20 69 66 20 28 | 21 73 74 72 6c 65 6e 28 | if (|!strlen(|
|000051e0| 73 63 70 2d 3e 73 63 5f | 6e 61 6d 65 29 29 20 0a |scp->sc_|name)) .|
|000051f0| 58 09 09 70 72 69 6e 74 | 66 28 22 4e 6f 20 6e 61 |X..print|f("No na|
|00005200| 6d 65 2c 20 6e 6f 20 65 | 6e 74 72 79 2e 5c 6e 22 |me, no e|ntry.\n"|
|00005210| 29 3b 0a 58 09 20 20 20 | 20 65 6c 73 65 20 7b 0a |);.X. | else {.|
|00005220| 58 09 09 72 65 77 69 6e | 64 28 73 63 6f 72 65 66 |X..rewin|d(scoref|
|00005230| 70 29 3b 0a 58 09 69 66 | 20 28 66 77 72 69 74 65 |p);.X.if| (fwrite|
|00005240| 28 28 63 68 61 72 20 2a | 29 74 6f 70 5f 74 65 6e |((char *|)top_ten|
|00005250| 2c 20 73 69 7a 65 6f 66 | 28 73 74 72 75 63 74 20 |, sizeof|(struct |
|00005260| 73 63 6f 72 65 73 29 2c | 20 31 30 2c 20 73 63 6f |scores),| 10, sco|
|00005270| 72 65 66 70 29 20 3c 3d | 20 30 29 0a 58 09 09 20 |refp) <=| 0).X.. |
|00005280| 20 20 20 70 65 72 72 6f | 72 28 53 43 4f 52 45 46 | perro|r(SCOREF|
|00005290| 49 4c 45 29 3b 0a 58 09 | 20 20 20 20 7d 0a 58 09 |ILE);.X.| }.X.|
|000052a0| 7d 0a 58 09 2f 2a 0a 58 | 09 20 2a 20 54 68 65 79 |}.X./*.X|. * They|
|000052b0| 20 64 69 64 6e 27 74 20 | 6d 61 6b 65 20 74 68 65 | didn't |make the|
|000052c0| 20 74 6f 70 20 74 65 6e | 2c 20 73 6f 20 61 70 6f | top ten|, so apo|
|000052d0| 6c 6f 67 69 7a 65 0a 58 | 09 20 2a 20 52 65 73 65 |logize.X|. * Rese|
|000052e0| 74 20 74 68 65 20 73 69 | 67 6e 61 6c 20 69 6e 74 |t the si|gnal int|
|000052f0| 65 72 72 75 70 74 20 68 | 61 6e 64 6c 65 72 73 20 |errupt h|andlers |
|00005300| 61 6e 64 20 63 6c 6f 73 | 65 20 74 68 65 20 73 63 |and clos|e the sc|
|00005310| 6f 72 65 20 66 69 6c 65 | 0a 58 09 20 2a 2f 0a 58 |ore file|.X. */.X|
|00005320| 09 65 6c 73 65 20 70 72 | 69 6e 74 66 28 22 47 6f |.else pr|intf("Go|
|00005330| 6f 64 20 6a 6f 62 2e 20 | 53 6f 72 72 79 20 79 6f |od job. |Sorry yo|
|00005340| 75 20 64 69 64 6e 27 74 | 20 6d 61 6b 65 20 74 68 |u didn't| make th|
|00005350| 65 20 74 6f 70 20 74 65 | 6e 2e 5c 6e 22 29 3b 0a |e top te|n.\n");.|
|00005360| 58 09 73 69 67 6e 61 6c | 28 53 49 47 51 55 49 54 |X.signal|(SIGQUIT|
|00005370| 2c 20 71 75 69 74 29 3b | 0a 58 09 73 69 67 6e 61 |, quit);|.X.signa|
|00005380| 6c 28 53 49 47 49 4e 54 | 2c 20 71 75 69 74 29 3b |l(SIGINT|, quit);|
|00005390| 0a 58 09 28 76 6f 69 64 | 29 20 66 63 6c 6f 73 65 |.X.(void|) fclose|
|000053a0| 28 73 63 6f 72 65 66 70 | 29 3b 0a 58 20 20 20 20 |(scorefp|);.X |
|000053b0| 7d 0a 58 7d 0a 58 0a 58 | 2f 2a 0a 58 20 2a 20 75 |}.X}.X.X|/*.X * u|
|000053c0| 73 65 64 20 74 6f 20 63 | 6f 6d 70 61 72 65 20 74 |sed to c|ompare t|
|000053d0| 68 65 20 63 75 72 72 65 | 6e 74 20 76 61 6c 75 65 |he curre|nt value|
|000053e0| 73 20 6f 66 20 74 68 65 | 20 67 61 6d 65 20 6a 75 |s of the| game ju|
|000053f0| 73 74 20 70 6c 61 79 65 | 64 20 77 69 74 68 0a 58 |st playe|d with.X|
|00005400| 20 2a 20 77 68 61 74 65 | 76 65 72 20 74 68 65 20 | * whate|ver the |
|00005410| 76 61 6c 75 65 73 20 61 | 72 65 20 69 6e 20 74 68 |values a|re in th|
|00005420| 65 20 63 75 72 72 65 6e | 74 20 68 69 67 68 20 73 |e curren|t high s|
|00005430| 63 6f 72 65 20 65 6e 74 | 72 79 2e 20 49 66 20 74 |core ent|ry. If t|
|00005440| 68 65 0a 58 20 2a 20 74 | 69 6d 65 20 66 6f 72 20 |he.X * t|ime for |
|00005450| 74 68 65 20 65 6e 74 72 | 79 20 69 73 20 30 2c 20 |the entr|y is 0, |
|00005460| 72 65 74 75 72 6e 20 74 | 72 75 65 20 62 65 63 61 |return t|rue beca|
|00005470| 75 73 65 20 69 74 27 73 | 20 61 20 67 61 72 62 61 |use it's| a garba|
|00005480| 67 65 20 73 63 6f 72 65 | 2e 0a 58 20 2a 20 41 6c |ge score|..X * Al|
|00005490| 73 6f 2c 20 63 68 65 6b | 63 20 66 6f 72 20 64 69 |so, chek|c for di|
|000054a0| 66 66 69 63 75 6c 74 79 | 20 6c 65 76 65 6c 73 20 |fficulty| levels |
|000054b0| 2d 2d 20 6d 6f 72 65 20 | 64 69 66 66 69 63 75 6c |-- more |difficul|
|000054c0| 74 20 6c 65 76 65 6c 73 | 20 61 6c 77 61 79 73 0a |t levels| always.|
|000054d0| 58 20 2a 20 77 69 6e 20 | 6f 76 65 72 20 6c 65 73 |X * win |over les|
|000054e0| 73 20 64 69 66 66 69 63 | 75 6c 74 20 6c 65 76 65 |s diffic|ult leve|
|000054f0| 6c 73 2e 0a 58 20 2a 20 | 6e 65 78 74 2c 20 63 68 |ls..X * |next, ch|
|00005500| 65 63 6b 20 74 6f 20 73 | 65 65 20 69 66 20 74 68 |eck to s|ee if th|
|00005510| 65 20 61 76 65 72 61 67 | 65 20 77 6f 72 64 73 20 |e averag|e words |
|00005520| 70 65 72 20 6d 69 6e 75 | 74 65 20 69 73 20 62 65 |per minu|te is be|
|00005530| 74 74 65 72 20 74 68 61 | 6e 0a 58 20 2a 20 74 68 |tter tha|n.X * th|
|00005540| 61 74 20 6f 66 20 74 68 | 65 20 63 75 72 72 65 6e |at of th|e curren|
|00005550| 74 20 73 63 6f 72 65 20 | 65 6e 74 72 79 2e 0a 58 |t score |entry..X|
|00005560| 20 2a 2f 0a 58 76 61 6c | 75 65 5f 63 6d 70 28 65 | */.Xval|ue_cmp(e|
|00005570| 6e 74 72 79 29 0a 58 73 | 74 72 75 63 74 20 73 63 |ntry).Xs|truct sc|
|00005580| 6f 72 65 73 20 2a 65 6e | 74 72 79 3b 0a 58 7b 0a |ores *en|try;.X{.|
|00005590| 58 20 20 20 20 69 66 28 | 21 65 6e 74 72 79 2d 3e |X if(|!entry->|
|000055a0| 73 63 5f 74 69 6d 65 29 | 20 72 65 74 75 72 6e 20 |sc_time)| return |
|000055b0| 31 3b 0a 58 20 20 20 20 | 69 66 28 6c 65 76 65 6c |1;.X |if(level|
|000055c0| 20 21 3d 20 65 6e 74 72 | 79 2d 3e 73 63 5f 6c 65 | != entr|y->sc_le|
|000055d0| 76 65 6c 29 20 72 65 74 | 75 72 6e 28 6c 65 76 65 |vel) ret|urn(leve|
|000055e0| 6c 20 3c 20 65 6e 74 72 | 79 2d 3e 73 63 5f 6c 65 |l < entr|y->sc_le|
|000055f0| 76 65 6c 29 3b 0a 58 20 | 20 20 20 72 65 74 75 72 |vel);.X | retur|
|00005600| 6e 20 28 6e 75 6d 5f 6f | 66 5f 77 6f 72 64 73 20 |n (num_o|f_words |
|00005610| 2f 20 28 66 6c 6f 61 74 | 29 28 64 65 61 74 68 5f |/ (float|)(death_|
|00005620| 74 69 6d 65 20 2d 20 74 | 69 6d 65 5f 6c 65 66 74 |time - t|ime_left|
|00005630| 29 20 3e 3d 0a 58 09 20 | 65 6e 74 72 79 2d 3e 73 |) >=.X. |entry->s|
|00005640| 63 5f 77 6f 72 64 73 20 | 2f 20 28 66 6c 6f 61 74 |c_words |/ (float|
|00005650| 29 28 65 6e 74 72 79 2d | 3e 73 63 5f 74 69 6d 65 |)(entry-|>sc_time|
|00005660| 29 29 3b 0a 58 7d 0a 58 | 0a 58 2f 2a 20 71 75 69 |));.X}.X|.X/* qui|
|00005670| 74 20 2d 2d 20 69 67 6e | 6f 72 65 20 73 69 67 6e |t -- ign|ore sign|
|00005680| 61 6c 73 2c 20 63 6c 6f | 73 65 20 66 69 6c 65 73 |als, clo|se files|
|00005690| 2c 20 67 6f 20 61 77 61 | 79 20 2a 2f 0a 58 71 75 |, go awa|y */.Xqu|
|000056a0| 69 74 28 29 0a 58 7b 0a | 58 20 20 20 20 73 69 67 |it().X{.|X sig|
|000056b0| 6e 61 6c 28 53 49 47 51 | 55 49 54 2c 20 53 49 47 |nal(SIGQ|UIT, SIG|
|000056c0| 5f 49 47 4e 29 3b 0a 58 | 20 20 20 20 73 69 67 6e |_IGN);.X| sign|
|000056d0| 61 6c 28 53 49 47 49 4e | 54 2c 20 20 53 49 47 5f |al(SIGIN|T, SIG_|
|000056e0| 49 47 4e 29 3b 0a 58 20 | 20 20 20 70 75 74 63 68 |IGN);.X | putch|
|000056f0| 61 72 28 27 5c 6e 27 29 | 3b 0a 58 20 20 20 20 28 |ar('\n')|;.X (|
|00005700| 76 6f 69 64 29 20 66 63 | 6c 6f 73 65 28 64 69 63 |void) fc|lose(dic|
|00005710| 74 69 6f 6e 61 72 79 29 | 3b 0a 58 20 20 20 20 65 |tionary)|;.X e|
|00005720| 78 69 74 28 30 29 3b 0a | 58 7d 0a 58 0a 58 2f 2a |xit(0);.|X}.X.X/*|
|00005730| 0a 58 20 2a 20 65 78 74 | 72 61 20 63 72 64 69 74 |.X * ext|ra crdit|
|00005740| 20 67 69 76 65 6e 20 74 | 6f 20 74 68 6f 73 65 20 | given t|o those |
|00005750| 62 72 61 76 65 20 65 6e | 6f 75 67 68 20 74 6f 20 |brave en|ough to |
|00005760| 72 65 71 75 65 73 74 20 | 6d 6f 72 65 20 77 6f 72 |request |more wor|
|00005770| 64 73 20 74 68 61 6e 0a | 58 20 2a 20 6e 65 65 64 |ds than.|X * need|
|00005780| 65 64 20 61 73 20 69 6e | 63 65 6e 74 69 76 65 20 |ed as in|centive |
|00005790| 74 6f 20 70 6c 61 79 20 | 66 6f 72 20 68 69 67 68 |to play |for high|
|000057a0| 65 72 20 73 63 6f 72 65 | 73 2e 20 20 54 68 65 20 |er score|s. The |
|000057b0| 65 78 74 72 61 20 63 72 | 65 64 69 74 20 69 73 0a |extra cr|edit is.|
|000057c0| 58 20 2a 20 67 69 76 65 | 6e 20 69 6e 20 74 69 6d |X * give|n in tim|
|000057d0| 65 20 28 73 65 63 6f 6e | 64 73 29 2e 0a 58 20 2a |e (secon|ds)..X *|
|000057e0| 20 72 65 74 75 72 6e 20 | 74 68 65 20 61 63 74 75 | return |the actu|
|000057f0| 61 6c 20 61 6d 6f 75 6e | 74 20 6f 66 20 74 69 6d |al amoun|t of tim|
|00005800| 65 20 61 77 61 72 64 65 | 64 0a 58 20 2a 2f 0a 58 |e awarde|d.X */.X|
|00005810| 75 6e 73 69 67 6e 65 64 | 0a 58 65 78 74 72 61 5f |unsigned|.Xextra_|
|00005820| 63 72 65 64 69 74 28 29 | 0a 58 7b 0a 58 20 20 20 |credit()|.X{.X |
|00005830| 20 69 6e 74 20 65 78 74 | 72 61 3b 0a 58 20 20 20 | int ext|ra;.X |
|00005840| 20 69 66 20 28 6c 65 76 | 65 6c 20 3d 3d 20 34 29 | if (lev|el == 4)|
|00005850| 20 65 78 74 72 61 20 3d | 20 31 20 2b 20 72 61 6e | extra =| 1 + ran|
|00005860| 64 6f 6d 28 29 20 25 20 | 35 3b 0a 58 20 20 20 20 |dom() % |5;.X |
|00005870| 65 6c 73 65 20 65 78 74 | 72 61 20 3d 20 28 28 77 |else ext|ra = ((w|
|00005880| 6f 72 64 73 5f 67 69 76 | 65 6e 20 2d 20 57 4f 52 |ords_giv|en - WOR|
|00005890| 44 53 5f 4e 45 45 44 45 | 44 29 20 2a 20 28 28 2d |DS_NEEDE|D) * ((-|
|000058a0| 31 20 2a 20 6c 65 76 65 | 6c 29 20 2b 20 34 29 20 |1 * leve|l) + 4) |
|000058b0| 2a 20 33 29 3b 0a 58 20 | 20 20 20 70 72 69 6e 74 |* 3);.X | print|
|000058c0| 66 28 22 25 64 20 6d 69 | 6e 2e 20 61 6e 64 20 25 |f("%d mi|n. and %|
|000058d0| 64 20 73 65 63 2e 20 62 | 6f 6e 75 73 20 74 69 6d |d sec. b|onus tim|
|000058e0| 65 2e 5c 6e 22 2c 20 65 | 78 74 72 61 20 2f 20 36 |e.\n", e|xtra / 6|
|000058f0| 30 2c 20 65 78 74 72 61 | 20 25 20 36 30 29 3b 0a |0, extra| % 60);.|
|00005900| 58 20 20 20 20 72 65 74 | 75 72 6e 20 65 78 74 72 |X ret|urn extr|
|00005910| 61 3b 0a 58 7d 0a 58 0a | 58 2f 2a 20 6f 72 64 69 |a;.X}.X.|X/* ordi|
|00005920| 6e 61 74 65 28 29 20 61 | 64 64 73 20 22 74 68 22 |nate() a|dds "th"|
|00005930| 20 65 74 63 2e 2e 2e 20 | 6f 6e 20 74 68 65 20 65 | etc... |on the e|
|00005940| 6e 64 20 6f 66 20 6e 75 | 6d 62 65 72 73 20 2a 2f |nd of nu|mbers */|
|00005950| 0a 58 63 68 61 72 20 2a | 0a 58 6f 72 64 69 6e 61 |.Xchar *|.Xordina|
|00005960| 74 65 28 6e 75 6d 29 0a | 58 69 6e 74 20 6e 75 6d |te(num).|Xint num|
|00005970| 3b 0a 58 7b 0a 58 20 20 | 20 20 69 66 28 6e 75 6d |;.X{.X | if(num|
|00005980| 20 25 20 31 30 30 20 3c | 20 32 31 20 26 26 20 6e | % 100 <| 21 && n|
|00005990| 75 6d 20 25 20 31 30 30 | 20 3e 20 33 29 20 72 65 |um % 100| > 3) re|
|000059a0| 74 75 72 6e 20 22 74 68 | 22 3b 0a 58 20 20 20 20 |turn "th|";.X |
|000059b0| 73 77 69 74 63 68 28 6e | 75 6d 20 25 20 31 30 29 |switch(n|um % 10)|
|000059c0| 20 7b 0a 58 09 63 61 73 | 65 20 31 20 3a 20 72 65 | {.X.cas|e 1 : re|
|000059d0| 74 75 72 6e 20 22 73 74 | 22 3b 0a 58 09 63 61 73 |turn "st|";.X.cas|
|000059e0| 65 20 32 20 3a 20 72 65 | 74 75 72 6e 20 22 6e 64 |e 2 : re|turn "nd|
|000059f0| 22 3b 0a 58 09 63 61 73 | 65 20 33 20 3a 20 72 65 |";.X.cas|e 3 : re|
|00005a00| 74 75 72 6e 20 22 72 64 | 22 3b 0a 58 09 64 65 66 |turn "rd|";.X.def|
|00005a10| 61 75 6c 74 20 3a 20 72 | 65 74 75 72 6e 20 22 74 |ault : r|eturn "t|
|00005a20| 68 22 3b 0a 58 20 20 20 | 20 7d 0a 58 7d 0a 58 0a |h";.X | }.X}.X.|
|00005a30| 58 2f 2a 0a 58 49 66 20 | 79 6f 75 27 72 65 20 6f |X/*.XIf |you're o|
|00005a40| 6e 20 61 20 50 44 50 2c | 20 75 73 65 20 74 68 69 |n a PDP,| use thi|
|00005a50| 73 21 20 69 66 20 59 6f | 75 27 72 65 20 6f 6e 20 |s! if Yo|u're on |
|00005a60| 61 20 73 75 6e 2c 20 69 | 74 27 6c 6c 20 63 72 61 |a sun, i|t'll cra|
|00005a70| 73 68 20 79 6f 75 72 20 | 73 79 73 74 65 6d 21 0a |sh your |system!.|
|00005a80| 58 6c 6f 6e 67 20 72 61 | 6e 64 6f 6d 28 29 0a 58 |Xlong ra|ndom().X|
|00005a90| 7b 0a 58 20 20 20 20 72 | 65 74 75 72 6e 20 72 61 |{.X r|eturn ra|
|00005aa0| 6e 64 28 29 20 2a 20 36 | 35 35 33 35 4c 20 2b 20 |nd() * 6|5535L + |
|00005ab0| 72 61 6e 64 28 29 20 2a | 20 32 35 36 4c 20 20 2b |rand() *| 256L +|
|00005ac0| 20 72 61 6e 64 28 29 3b | 0a 58 7d 0a 58 2a 2f 0a | rand();|.X}.X*/.|
|00005ad0| 58 0a 45 4e 44 5f 4f 46 | 5f 6a 75 6d 62 6c 65 2e |X.END_OF|_jumble.|
|00005ae0| 63 0a 69 66 20 74 65 73 | 74 20 31 39 39 31 34 20 |c.if tes|t 19914 |
|00005af0| 2d 6e 65 20 60 77 63 20 | 2d 63 20 3c 6a 75 6d 62 |-ne `wc |-c <jumb|
|00005b00| 6c 65 2e 63 60 3b 20 74 | 68 65 6e 0a 20 20 20 20 |le.c`; t|hen. |
|00005b10| 65 63 68 6f 20 73 68 61 | 72 3a 20 5c 22 6a 75 6d |echo sha|r: \"jum|
|00005b20| 62 6c 65 2e 63 5c 22 20 | 75 6e 70 61 63 6b 65 64 |ble.c\" |unpacked|
|00005b30| 20 77 69 74 68 20 77 72 | 6f 6e 67 20 73 69 7a 65 | with wr|ong size|
|00005b40| 21 0a 66 69 0a 23 20 65 | 6e 64 20 6f 66 20 6f 76 |!.fi.# e|nd of ov|
|00005b50| 65 72 77 72 69 74 69 6e | 67 20 63 68 65 63 6b 0a |erwritin|g check.|
|00005b60| 66 69 0a 65 63 68 6f 20 | 73 68 61 72 3a 20 45 6e |fi.echo |shar: En|
|00005b70| 64 20 6f 66 20 73 68 65 | 6c 6c 20 61 72 63 68 69 |d of she|ll archi|
|00005b80| 76 65 2e 0a 65 78 69 74 | 20 30 0a 0a 0a |ve..exit| 0... |
+--------+-------------------------+-------------------------+--------+--------+