$! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))' $! $! This archive created by VMS_SHARE Version 8.3 $! On 7-APR-1993 22:25:30.21 By user AKE (Earle Ake ) $! $! The VMS_SHARE software that created this archive $! was written by Andy Harper, Kings College London UK $! -- December 1992 $! $! Credit is due to these people for their original ideas: $! James Gray, Michael Bednarek $! $!+ THIS PACKAGE DISTRIBUTED IN 16 PARTS, TO KEEP EACH PART $! BELOW 100 BLOCKS $! $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER $! AND EXECUTE AS A COMMAND PROCEDURE ( @name ) $! $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING: $! 1. README.;1 $! 2. TODO.;1 $! 3. LDB.DOC;1 $! 4. LDB.MAN;1 $! 5. LDB.PS;1 $! 6. MAKEFILE.;10 $! 7. MAKEFILE.UNIX;1 $! 8. MAKEFILE.VMS;4 $! 9. LDB.OPT;1 $! 10. MAKELDB.COM;1 $! 11. BOARD.C;1 $! 12. CHECK.C;1 $! 13. CONTROL.C;1 $! 14. DOHELP.C;1 $! 15. DOSTATS.C;1 $! 16. FE_CURSES.C;1 $! 17. FLIST_NONE.C;1 $! 18. FLIST_UNIX.C;1 $! 19. FLIST_VMS.C;1 $! 20. GAME.C;1 $! 21. LOCK.C;1 $! 22. MAIN.C;1 $! 23. MISC.C;1 $! 24. MOVE.C;1 $! 25. PROCESS.C;1 $! 26. RCVOP.C;1 $! 27. READMAIL.C;1 $! 28. RENAME.C;1 $! 29. R_XRAND.C;1 $! 30. SAVE.C;1 $! 31. T_EMAIL.C;1 $! 32. VARS.C;1 $! 33. LDB.H;1 $! 34. PATCHLEVEL.H;1 $! 35. LDBSTARTER.CSH;1 $! 36. LDB.TEX;1 $! $set="set" $set symbol/scope=(nolocal,noglobal) $f=f$parse("SHARE_UNPACK_TEMP","SYS$SCRATCH:."+f$getjpi("","PID")) $e="write sys$error ""%UNPACK"", " $w="write sys$output ""%UNPACK"", " $ if .not. f$trnlnm("SHARE_UNPACK_LOG") then $ w = "!" $ if f$getsyi("CPU") .gt. 127 then $ goto start $ ve=f$getsyi("version") $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto start $ e "-E-OLDVER, Must run at least VMS 4.4" $ v=f$verify(v) $ exit 44 $unpack: subroutine ! P1=filename, P2=checksum, P3=attributes $ if f$parse(P1) .nes. "" then $ goto dirok $ dn=f$parse(P1,,,"DIRECTORY") $ w "-I-CREDIR, Creating directory ''dn'" $ create/dir 'dn' $ if $status then $ goto dirok $ e "-E-CREDIRFAIL, Unable to create ''dn' File skipped" $ delete 'f'* $ exit $dirok: $ x=f$search(P1) $ if x .eqs. "" then $ goto file_absent $ e "-W-EXISTS, File ''P1' exists. Skipped" $ delete 'f'* $ exit $file_absent: $ w "-I-UNPACK, Unpacking file ", P1 $ n=P1 $ if P3 .nes. "" then $ n=f $ if .not. f$verify() then $ define/user sys$output nl: $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='n' PROCEDURE GetHex(s,p)LOCAL x1,x2;x1:=INDEX(t,SUBSTR(s,p,1))-1;x2:=INDEX(t, SUBSTR(s,p+1,1))-1;RETURN 16*x1+x2;ENDPROCEDURE; PROCEDURE SkipPartsep LOOP EXITIF MARK(NONE)=END_OF(b);EXITIF INDEX(ERASE_LINE, "-+-+-+-+-+-+-+-+")=1;ENDLOOP;ENDPROCEDURE;PROCEDURE ProcessLine LOCAL c,s,l,b, n,p;c := ERASE_CHARACTER(1);s := ERASE_LINE;IF c = "X" THEN SPLIT_LINE; ENDIF; MOVE_HORIZONTAL(-1);l := LENGTH(s);p := 1;LOOP EXITIF p > l;c := SUBSTR(s,p,1); p := p+1;CASE c FROM ' ' TO '`' ['`']: COPY_TEXT(ASCII(GetHex(s,p))); p:=p+2;[ ' ']: p:=p+1;[INRANGE,OUTRANGE]: COPY_TEXT(c);ENDCASE;ENDLOOP;ENDPROCEDURE; PROCEDURE Decode POSITION(BEGINNING_OF(b));LOOP EXITIF MARK(NONE)=END_OF(b); IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+-")=1 THEN SkipPartSep;ELSE ProcessLine; MOVE_HORIZONTAL(1);ENDIF;ENDLOOP;ENDPROCEDURE;SET(FACILITY_NAME,"UNPACK");SET( SUCCESS,OFF);SET(INFORMATIONAL,OFF);t:="0123456789ABCDEF";f:=GET_INFO( COMMAND_LINE,"file_name");b:=CREATE_BUFFER(f,f);Decode;WRITE_FILE(b,GET_INFO( COMMAND_LINE,"output_file"));QUIT; $ if p3 .eqs. "" then $ goto dl $ open/write fdl &f $ write fdl "RECORD" $ write fdl P3 $ close fdl $ w "-I-CONVRFM, Converting record format to ", P3 $ convert/fdl=&f &f-1 &P1 $dl: delete 'f'* $ checksum 'P1' $ if checksum$checksum .nes. P2 then $ - e "-E-CHKSMFAIL, Checksum of ''P1' failed." $ exit $ endsubroutine $start: $! $ create 'f' X`09`09Long`20Distance`20Backgammon X`09`09------------------------ X X`09This`20is`20a`20program`20that`20lets`20two`20people`20easily`20play`20back Vgammon Xby`20e-mail.`20`20It`20currently`20runs`20only`20on`20character-oriented`20ter Vminals X(or`20emulators`20thereof)`20under`20the`20curses`20package.`20`20It`20runs V`20on`20most Xflavors`20of`20UNIX,`20as`20well`20as`20VMS`20version`205.0`20and`20above. X X`09To`20build`20ldb,`20create`20a`20directory,`20copy`20all`20the`20parts`20in Vto Xthat`20directory,`20strip`20the`20usenet`20or`20mail`20headers`20with`20a`20te Vxt`20editor, Xand`20execute`20them`20with`20a`20shell`20(e.g.`20sh`20Part1;`20sh`20Part2; V`20...). XThe`20installation`20options`20are`20documented`20in`20the`20Makefile. X X`09Suggestions`20and`20problems`20are`20cheerfully`20accepted,`20all`20the`20m Vore Xso`20when`20accompanied`20by`20appropriate`20patches,`20in`20any`20format`20th Ve`20patch Xprogram`20understands`20(e.g.`20context`20diff).`20`20E-mail`20to`20ross@emf78 V0.den.mmc.com. X X`09This`20file`20is`20for`20version`201.3`20of`20ldb.`20`20For`20those`20upgra Vding`20from X1.0`20who`20are`20wondering`20what`20happened`20to`201.1,`20it`20was`20only V`20released`20on Xthe`20DECUS`20tape.`20`20Because`20of`20time`20constraints,`20it`20had`20to V`20be`20released Xwithout`20some`20of`20the`20planned`20features,`20so`20it`20was`20assigned`20a V`20unique`20rev`20number. X1.2`20was`20to`20be`20the`20next`20version,`20but`20it`20was`20released`20so V`20widely`20for`20beta Xtest`20that`20there`20were`20countless`20different`20"versions"`20of`20version V`201.2. X X`09`09New`20Features X`09`09------------ X X`09A`20complete`20listing`20of`20the`20changes`20for`20rev`201.1,`201.2,`20and V`201.3`20is`20in Xthe`20comments`20at`20the`20top`20of`20main.c.`20`20Briefly,`20they`20are: X`09-`20Ldb`20has`20a`20context-sensitive`20help`20function`20that`20is`20activ Vated X`09`20`20whenever`20you`20press`20?`20or`20h. X`09-`20Match`20play`20is`20now`20supported. X`09-`20The`20Crawford`20and`20Jacoby`20rules`20are`20supported,`20as`20is`20th Ve`20european X`09`20`20scoring`20of`20backgammons`20as`20double`20rather`20than`20triple`20g Vames. X`09-`20You`20can`20now`20declare`20a`20game`20to`20be`20"permanent",`20meaning V`20that`20it X`09`20`20will`20be`20automatically`20restarted`20when`20it`20ends.`20`20This V`20is`20for X`09`20`20people`20you`20play`20continuously. X`09-`20The`20current`20pip`20count`20for`20you`20and`20your`20opponent`20is V`20displayed X`09`20`20above`20the`20board. X`09-`20You`20can`20obtain`20detailed`20statistics`20about`20the`20rolls`20you V`20and X`09`20`20your`20opponent`20have`20received,`20including`20a`20histogram`20of X`09`20`20relative`20frequency,`20by`20pressing`20the`20%`20or`20#`20keys. X`09-`20You`20can`20use`20the`20-score`20option`20to`20print`20a`20summary`20of V`20games X`09`20`20won/lost`20by`20opponent. X`09-`20You`20can`20press`20ESC`20while`20entering`20a`20message`20to`20get`20b Vack`20to X`09`20`20your`20game`20and`20abort`20the`20operation. X`09-`20Ldb`20will`20not`20ask`20for`20the`20second`20digit`20of`20a`201-digit V`20point`20number X`09`20`20unless`20it`20needs`20to`20(e.g.`20to`20tell`20the`20difference`20bet Vween`201`20and`2012) X`09-`20Comments`20are`20rot13'd`20before`20they`20are`20sent.`20`20That`20way V`20you`20won't X`09`20`20accidentally`20read`20the`20comment`20while`20extracting`20your`20mai Vl`20and X`09`20`20ruin`20the`20surprise.`20`20If`20ldb`20sees`20that`20your`20opponent V`20is`20running X`09`20`20an`20old`20version`20of`20ldb,`20comments`20work`20like`20they`20used V`20to. X`09-`20Concede`20now`20scores`20gammons/backgammons,`20so`20a`20player`20canno Vt X`09`20`20concede`20to`20avoid`20a`20gammon`20or`20backgammon. X`09-`20A`20lock`20file`20is`20used`20to`20prevent`20more`20than`20one`20ldb V`20from`20running X`09`20`20at`20the`20same`20time`20in`20any`20account. X`09-`20The`20name,`20mail`20address,`20and`20an`20alias`20for`20all`20your`20o Vpponents`20are X`09`20`20stored`20in`20a`20new`20file.`20`20This`20file`20also`20keeps`20track V`20of`20games X`09`20`20won`20and`20lost`20to`20that`20opponent. X`09-`20If`20you`20clobber`20your`20data`20file,`20ldb`20can`20reconstruct`20it V`20from`20your X`09`20`20opponents'`20data`20files. X`09-`20Reverse`20video`20now`20works`20on`20VMS,`20as`20does`20the`20screen V`20redraw`20and X`09`20`20the`20supervisor`20key. X`09-`20Any`20printing`20characters`20may`20be`20used`20to`20draw`20the`20game V`20pieces. X`09-`20You`20can`20dump`20the`20screen`20to`20a`20file`20from`20the`20-control V`20menu. X X X`09`09Automatic`20Game`20Starters X`09`09----------------------- X X`09An`20automatic`20game`20starter`20has`20been`20set`20up`20by`20Mark`20Rubin V`20on Xcs.umb.edu.`20`20This`20matches`20people`20by`20ability`20and`20automatically V`20starts`20a Xgame`20between`20them.`20`20The`20ability`20categories`20are`20novice,`20inter Vmediate,`20and Xexpert.`20`20For`20example,`20if`20you`20consider`20yourself`20an`20expert, V`20you`20would Xmail`20to: X X`09`09ldb-expert@cs.umb.edu X Xwhereupon`20you`20will`20be`20matched`20at`20random`20with`20someone`20else V`20who`20mailed`20to`20the Xsame`20address,`20and`20your`20game`20will`20be`20started`20using`20the`20remo Vtestart Xfunction`20of`20ldb. X X`09For`20more`20information,`20mail`20to: X X`09`09ldb-help@cs.umb.edu X XYou`20will`20receive`20an`20automated`20reply`20by`20return`20mail. X XFor`20those`20wishing`20to`20set`20up`20their`20own`20game`20starter,`20the V`20shellscript`20used Xto`20do`20it`20is`20included`20in`20this`20distribution`20as`20ldbstarter.csh. V XGetting`20it`20to`20work`20on`20your`20system`20may`20take`20a`20little`20work V. X X X`09`09Running`20Ldb X`09`09----------- X X`09The`20first`20time`20ldb`20is`20run,`20it`20will`20create`20a`20file`20in V`20your`20home Xdirectory`20called`20".ldbrc".`20`20If`20this`20name`20is`20inconvenient,`20de Vfine`20the Xenvironment`20variable`20LDBRC`20to`20be`20the`20name`20you`20want`20before V`20running`20it Xthe`20first`20time`20(and`20all`20times`20after`20that).`20`20Ldb`20will`20ask V`20for`20your Xpersonal,`20human-type`20name`20and`20your`20e-mail`20address.`20`20All`20othe Vr`20options Xwill`20be`20set`20to`20their`20defaults,`20as`20explained`20in`20the`20manual. V`20`20The`20"sendcmd" Xoption`20in`20.ldbrc`20may`20need`20to`20be`20modified`20to`20work`20with`20th Ve`20mail`20program Xon`20your`20system.`20`20This`20option`20tells`20ldb`20how`20to`20send`20mail V`20to`20your`20opponent, Xand`20must`20be`20correctly`20set`20for`20ldb`20to`20work.`20`20This`20string V`20after`20"sendcmd=" Xis`20executed`20by`20ldb`20after`20making`20the`20following`20substitutions: X`09$a`09is`20replaced`20by`20the`20address`20to`20mail`20to. X`09$f`09is`20replaced`20by`20the`20file`20containing`20the`20message. X`09$s`09is`20replaced`20by`20the`20subject`20line`20of`20the`20message. X`09$$`09is`20replaced`20by`20a`20single`20$. XThe`20default,`20which`20should`20work`20with`20most`20UNIX`20systems,`20is: X`09mail`20-s`20'$s'`20$a`20<`20$f XNote`20that`20ldb`20performs`20the`20substitutions,`20not`20the`20shell,`20so V`20the`20substitutions Xare`20not`20subject`20to`20any`20quoting.`20`20All`20other`20characters,`20inc Vluding`20shell Xmetacharacters,`20are`20passed`20to`20the`20system`20unchanged. X XVMS`20users`20will`20have`20the`20following`20default`20sendcmd`20set: X X`09sendcmd=MAIL/SUBJECT="$s"`20$f`20IN%"""$a""" X XThis`20is`20correct`20if`20you`20are`20using`20the`20IN%`20SMTP`20mailer.`20 V`20If`20not, Xyou`20may`20need`20to`20change`20the`20sendcmd=`20line`20as`20follows: X XIf`20you`20are`20using`20VMS`20mail`20only,`20use`20the`20line: X X`09sendcmd=MAIL/SUBJECT="$s"`20$f`20$a X XDepending`20on`20which`20SMTP`20mailer`20you`20have,`20the`20IN%`20may`20need V`20to`20be Xchanged`20to`20WINS%`20(for`20Wollongong),`20etc. X X X`09`09Starting`20A`20Game X`09`09--------------- X X`09To`20start`20a`20game,`20type: X`09`09ldb`20-start`20opponent's-email-address Xand`20everything`20is`20automatic`20from`20there.`20`20You`20may`20have`20to V`20exchange Xseveral`20mail`20messages`20before`20you`20are`20ready`20to`20play,`20since V`20your`20ldb`20has`20to Xdo`20the`20initial`20roll`20with`20the`20remote`20ldb,`20and`20if`20there`20is V`20a`20tie,`20the Xinitial`20roll`20is`20repeated.`20`20Eventually,`20you`20will`20see`20a`20boar Vd`20drawn`20on Xthe`20screen.`20`20The`20commands`20are`20in`20the`20bottom`20right`20corner. V`20`20The`20moves`20by Xyou`20and`20your`20opponent`20are`20above`20that,`20on`20the`20right`20side V`20of`20the`20screen,`20and Xthe`20bottom`20of`20the`20screen`20contains`20a`20place`20for`20you`20to`20enc Vlose`20a`202-line Xmessage`20with`20each`20move.`20`20This`20is`20useful`20for`20taunting,`20plea Vding,`20etc. XYou`20will`20need`20to`20press`20'r'`20to`20roll`20the`20dice,`20then`20press V`20the`20number`20of`20the`20roll Xyou`20want`20to`20use`20followed`20by`20the`20point`20you`20want`20to`20move V`20from.`20`20For`20example, Xif`20you`20roll`205`202,`20and`20you`20want`20to`20move`20the`20piece`20on`20t Vhe`2011`20point`205,`20press X5`201`201.`20`20You`20don't`20need`20to`20hit`20return.`20`20After`20you`20hav Ve`20used`20one`20of`20your`20rolls, Xthere`20are`203`20shortcuts`20you`20can`20use`20for`20the`20remainder`20of`20y Vour`20roll: X`09`09Continues`20the`20last`20move.`20`20The`20piece`20you`20las Vt`20moved X`09`09`09is`20moved`20by`20the`20amount`20of`20the`20other/next`20roll. X`09`09Repeat`20the`20last`20move.`20`20The`20other/next`20roll`20is V`20applied X`09`09`09to`20the`20same`20point`20you`20moved`20from`20last`20time. X`09p`09`09Make`20point.`20`20This`20gets`20a`20little`20tricky.`20`20Ldb`20att Vempts X`09`09`09to`20use`20the`20other/next`20roll`20to`20move`20one`20of`20your`20pi Veces X`09`09`09so`20that`20it`20ends`20up`20on`20the`20same`20point`20as`20your`20la Vst`20move X`09`09`09ended`20on.`20`20That`20is,`20if`20you`20roll`205`202`20and`20use`20t Vhe`205 X`09`09`09to`20move`20from`20the`206`20point`20to`20the`2011`20point,`20and`20h Vit`20"p", X`09`09`09ldb`20will`20move`20one`20of`20your`20pieces`20from`20the`209`20point V`20to X`09`09`09the`2011`20point`20to`20make`20the`2011`20point.`20`20This`20assumes, V X`09`09`09of`20course,`20that`20you`20have`20a`20piece`20on`20the`209`20point. X X`09Ldb`20checks`20your`20moves`20for`20all`20conceivable`20errors.`20`20These Xare`20listed`20in`20the`20manual. X X`09To`20move`20off`20the`20bar,`20merely`20select`20a`20roll.`20`20That`20roll V`20will Xautomatically`20bring`20you`20off`20the`20bar,`20since`20you`20have`20no`20oth Ver`20legal Xmove`20anyway.`20`20To`20bear`20pieces`20off,`20you`20can`20either`20enter`20t Vhe`20point Xnumber`20like`20normal,`20or`20press`20"o"`20to`20have`20it`20bear`20off`20for V`20you`20automatically. X X`09When`20a`20move`20arrives`20in`20your`20mail,`20go`20into`20mail`20and`20sa Vve`20the`20message Xinto`20a`20file.`20`20Delete`20the`20message`20from`20your`20mail,`20exit`20ma Vil,`20and`20run Xldb`20with`20the`20name`20of`20the`20file`20as`20an`20argument.`20`20There`20a Vre`20easier`20ways Xto`20feed`20incoming`20mail`20to`20ldb;`20these`20are`20discussed`20in`20the V`20manual. X X`09For`20more`20options,`20read`20the`20manual`20and`20the`20comments`20at`20t Vhe`20top Xof`20main.c. X X`09Good`20luck! X X`09`09`09`09`09`09Perry`20R.`20Ross X`09`09`09`09`09`09ross@emf780.den.mmc.com X X----------------------------------------------------------------------------- X X`09Really`20Scary`20and`20Hopefully`20Bulletproof`20Legal`20Statement: X XThis`20software`20is`20copyright`201991`20by`20Perry`20R.`20Ross.`20`20Permiss Vion`20to`20use, Xcopy,`20modify,`20and`20redistribute`20it`20is`20granted`20provided: X`09(1)`20It`20is`20not`20sold. X`09(2)`20This`20notice`20accompanies`20all`20copies,`20and`20is`20kept`20intac Vt. X`09(3)`20Users`20do`20not`20cheat`20by`20any`20method,`20including`20but`20not V`20limited`20to: X`09`09A.`20modifying`20the`20roll`20generated`20by`20the`20random`20number`20g Venerator, X`09`09B.`20modifying`20the`20code`20to`20provide`20any`20roll`20other`20than V`20that X`09`09`20`20`20generated`20by`20a`20bona-fide`20random`20number`20generator, X`09`09C.`20taking`20advantage`20of`20any`20non-randomness`20in`20a`20random X`09`09`20`20`20number`20generator`20to`20predict`20upcoming`20rolls, X`09`09D.`20changing`20the`20contents`20of`20an`20incoming`20message`20or`20of V`20the X`09`09`20`20`20.ldbdata`20file`20to`20modify`20the`20normal`20progression`20of V`20a X`09`09`20`20`20game`20in`20any`20way,`20or X`09`09E.`20generating`20a`20roll`20before`20offering`20to`20double. X`09`20`20`20Persons`20guilty`20of`20cheating`20in`20any`20way`20while`20using V`20this`20software X`09`20`20`20are`20denied`20permission`20to`20use`20or`20distribute`20this`20so Vftware X`09`20`20`20in`20perpetuity.`20`20Excluded`20from`20the`20definition`20of`20ch Veating`20is X`09`20`20`20any`20action`20whose`20intention`20is`20to`20test`20or`20debug`20t Vhis`20software, X`09`20`20`20as`20long`20as`20the`20opponent`20is`20aware`20that`20these`20acti Vons`20are`20being X`09`20`20`20performed,`20and`20the`20game`20is`20considered`20"unofficial". XThe`20above`20restrictions`20are`20made`20in`20all`20seriousness,`20and`20with V`20every Xintention`20of`20enforcement`20by`20any`20and`20all`20legal`20means`20where V`20practical. X X(Sounds`20almost`20as`20good`20as`20the`20real`20thing,`20doesn't`20it?) $ call unpack README.;1 1649131628 "" $! $ create 'f' Xdelmail`20option`20should`20work`20on`20system`20mail`20file. X XMake`20superkey`20work`20instantly,`20instead`20of`20only`20when`20waiting`20f Vor`20a`20character. X XWay`20of`20changing`20local`20colors`20for`20a`20game,`20or`20for`20setting V`20local`20colors Xindependent`20of`20colors`20specified`20in`20START. X XIndication`20of`20last`20access`20time`20for`20a`20game`20in`20-control. X XInstead`20of`20keeping`203`20board`20images`20Bef,`20Aft,`20Cur,`20keep`20log V`20file`20of Xall`20prior`20moves,`20with`20board`20image,`20player,`20`26`20move`20made. V`20`20Use`20`5E`20and`20v Xcommands`20(or`20ku`20`26`20kd`20from`20termcap?)`20to`20scroll`20backward`20a Vnd`20forward`20through Xlog`20file,`20displaying`20board`20`26`20pieces`20moved`20at`20each`20step. V`20`20Delete`20log`20file Xwhen`20game`20is`20deleted?`20`20Use`20name`20like`20.ldblogXXXXX`20for`20log V`20file, Xput`20log`20file`20name`20into`20game`20structure.`20`20Scan`20directory`20for V`20unused Xlog`20files`20when`20games`20are`20read,`20so`20they`20can`20be`20deleted?`20 V`20Maybe,`20each Xscroll`20back`20is`20in`20two`20steps,`20before`20move`20was`20made`20`26`20af Vter.`20`20That`20is, XCur,`20-1`20After,`20-1`20Before,`20-2`20After,`20-2`20Before,`20... X XWay`20of`20specifying`20that`20board`20should`20invert`20if`20necessary`20auto Vmatically Xso`20that`20play`20is`20always`20in`20the`20desired`20direction. X XWay`20of`20informing`20your`20opponents`20of`20a`20change`20in`20your`20e-mail V`20address. XUse`20new`20opcode?`20`20Check`20opponent's`20version`20to`20avoid`20killing V`20opponent's Xldb`20with`20invalid`20opcode.`20`20If`20in`20OPSTATE,`20also`20request`20rese Vnd? XSend`20one`20packet`20per`20game?`20`20Be`20sure`20to`20update`20people`20file V`20too. XEliminate`20old`20address`20when`20no`20more`20games`20point`20to`20it.`20`20M Vaybe`20better Xto`20send`20one`20packet`20per`20opponent`20(scan`20people`20file),`20so`20it V`20can Xjust`20change`20the`20people`20record`20in`20place.`20`20What`20to`20do`20with V`20equiv's? X Xallow`20unlimited`20length`20comments,`20scroll`20window. X XWay`20to`20print`20board`20to`20file,`20load`20board`20from`20file.`20`20Allow V`20board Xto`20be`20set`20up`20in`20any`20desired`20configuration. X XSecurity`20from`20(1)`20advance`20knowledge`20of`20rolls,`20(2)`20generating V`20false`20rolls. X XMultiple`20language`20support. X Xregister`20vars X XFlip`20board`20left/right. X XFlush`20input`20before`20reading. X XSocket`20transport. X XMotif`20front-end.`20`20Open`20Look?`20`20Xlib? X XVMS`20command`20line`20interface.`20`20Maybe,`20separate`20out`20all`20host-sp Vecific Xstuff`20into`20a`20separate`20file,`20`26`20only`20compile`20in`20the`20one V`20you`20need. X XOption`20to`20display`20"scratch"`20screen,`20move`20any`20piece.`20`20Don't V`20save. XInitial`20setup? X XProtect`20critical`20sections`20from`20SIGINT.`20`20Catch`20more`20signals? XCatch`20SIGSTOP/SIGTSTP/SIGCONT`20`26`20reset`20tty`20modes. X XAllow`20multiple`20rolls`20without`20sending`20packet`20when`20opponent`20is V`20closed`20out. XAllow`20opponent's`20roll`20to`20be`20generated`20locally`20when`20piece`20is V`20on`20the`20bar, X`26`20skip`20if`20he`20cannot`20move.`20`20Conflicts`20with`20secure`20dice V`20roller?`20`20How Xto`20send`20multiple`20moves`20in`20one`20packet? X XProcess`20id`20in`20lock`20file,`20look`20to`20see`20if`20process`20still`20ex Vists. XPortability?`20`20How`20in`20VMS? X XPlug`20memory`20leaks. X XFaster`20start`20protocol,`20have`20starting`20host`20perform`20entire`20openi Vng`20roll Xand`20reroll`20ties`20immediately.`20`20Conflicts`20with:`201)`20backward`20co Vmpatibility, X2)`20autodoubling,`203)`20secure`20roller. X XCatch`20failure`20in`20sending`20mail,`20return`20to`20move`20state. X Xhandle`20failed`20write`20better.`20`20""`20in`20writegames. $ call unpack TODO.;1 1651455370 "" $! $ create 'f' X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X XNAME X`20`20`20`20`20ldb`20-`20Play`20backgammon`20by`20e-mail X XSYNOPSIS X`20`20`20`20`20ldb`20`5Boptions`5D`20`5Binput`20files...`5D X XDESCRIPTION X`20`20`20`20`20_`08L_`08d_`08b`20allows`20two`20people`20to`20`20play`20`20bac Vkgammon`20`20over`20`20a`20`20network X`20`20`20`20`20using`20`20`20electronic`20`20mail.`20`20`20It`20`20runs`20`20o Vn`20`20character-oriented X`20`20`20`20`20terminals,`20or`20emulators`20thereof,`20`20using`20`20the`20 V`20_`08c_`08u_`08r_`08s_`08e_`08s`20`20screen X`20`20`20`20`20package.`20`20`20It`20`20will`20`20run`20`20on`20`20most`20UNIX V`20dialects,`20as`20well`20as X`20`20`20`20`20VAX-C`20under`20VMS`205.0`20and`20above.`20`20_`08L_`08d_`08b V`20will`20display`20`20a`20`20picture X`20`20`20`20`20of`20`20the`20`20board,`20`20prompt`20`20the`20user`20to`20ente Vr`20a`20move,`20check`20the X`20`20`20`20`20move`20for`20legality,`20and`20send`20the`20move`20to`20the`20o Vpponent.`20`20`20When X`20`20`20`20`20it`20`20arrives,`20`20it`20will`20be`20displayed`20on`20the`20o Vpponent's`20screen, X`20`20`20`20`20after`20which`20the`20opponent`20will`20be`20prompted`20for`20a V`20move`20`20to`20`20be X`20`20`20`20`20sent`20back. X XFEATURES X`20`20`20`20`20Multiple`20Games X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20can`20keep`20track`20of`20`20a Vn`20`20arbitrary`20`20number`20`20of`20`20games X`20`20`20`20`20`20`20`20`20`20simultaneously,`20and`20will`20display`20them V`20one`20at`20a`20time`20for X`20`20`20`20`20`20`20`20`20`20you`20to`20play.`20`20You`20can`20exit`20from V`20_`08l_`08d_`08b`20at`20any`20`20time;`20`20when X`20`20`20`20`20`20`20`20`20`20you`20run`20ldb`20again,`20it`20will`20pick`20up V`20your`20games`20where`20you X`20`20`20`20`20`20`20`20`20`20left`20off. X X`20`20`20`20`20Move`20Checking X`20`20`20`20`20`20`20`20`20`20Both`20your`20moves`20and`20your`20opponent's V`20moves`20`20are`20`20checked X`20`20`20`20`20`20`20`20`20`20for`20legality.`20`20This`20includes: X X`20`20`20`20`20-`20`20`20`20Landing`20on`20an`20occupied`20point. X X`20`20`20`20`20-`20`20`20`20Bearing`20off`20before`20your`20inner`20table`20is V`20full. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20move`20pieces`20that`20are`20on`20th Ve`20`20board`20`20when`20`20you X`20`20`20`20`20`20`20`20`20`20have`20a`20piece`20on`20the`20bar. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20bear`20off`20a`20piece`20when`20ther Ve`20is`20a`20piece`20`20on`20`20a X`20`20`20`20`20`20`20`20`20`20higher`20point,`20and`20the`20roll`20is`20not V`20being`20used`20exactly. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20leave`20a`20usable`20move`20unused. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20leave`20a`20move`20unused`20when`20i Vt`20is`20usable`20and`20has X`20`20`20`20`20`20`20`20`20`20a`20higher`20roll`20than`20the`20move`20that`20i Vs`20used. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20double`20when`20you`20doubled`20last V. X X`20`20`20`20`20-`20`20`20`20Trying`20to`20double`20in`20a`20Crawford`20rule V`20game. X X`20`20`20`20`20Message`20Reliability X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20detects`20(and`20rejects)`20du Vplicate`20messages,`20`20and`20`20can X`20`20`20`20`20`20`20`20`20`20regenerate`20lost`20messages. X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`201 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20Remote`20Start X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20can`20start`20a`20game`20`20be Vtween`20`20two`20`20players`20`20on`20`20remote X`20`20`20`20`20`20`20`20`20`20hosts.`20`20`20This`20`20is`20`20used`20to`20set V`20up`20"game`20starter"`20hosts, X`20`20`20`20`20`20`20`20`20`20where`20people`20interested`20in`20finding`20 V`20new`20`20opponents`20`20are X`20`20`20`20`20`20`20`20`20`20matched`20`20by`20`20some`20`20criteria`20`20(su Vch`20`20as`20ability,`20or`20by`20a X`20`20`20`20`20`20`20`20`20`20tournament`20schedule),`20`20and`20`20have`20 V`20their`20`20games`20`20started X`20`20`20`20`20`20`20`20`20`20automatically.`20`20`20For`20`20a`20current`20li Vsting`20of`20game`20starter X`20`20`20`20`20`20`20`20`20`20hosts,`20see`20the`20README`20file. X X`20`20`20`20`20Game`20Value X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20`20detects`20`20the`20`20end V`20`20of`20`20the`20`20game,`20`20`20gammons,`20`20`20and X`20`20`20`20`20`20`20`20`20`20backgammons,`20`20and`20`20notifies`20`20both V`20`20players`20`20of`20the`20game X`20`20`20`20`20`20`20`20`20`20value`20when`20the`20game`20is`20over.`20`20The V`20Jacoby`20`20rule`20`20may`20`20be X`20`20`20`20`20`20`20`20`20`20enabled,`20as`20may`20European`20scoring,`20to V`20calculate`20the`20game X`20`20`20`20`20`20`20`20`20`20value`20as`20desired. X X`20`20`20`20`20Online`20Help`20Screen X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20has`20an`20online,`20context V`20sensitive`20help`20facility`20that X`20`20`20`20`20`20`20`20`20`20lists`20the`20available`20commands`20for`20the V`20current`20screen. X X`20`20`20`20`20Match`20Play X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20can`20support`20matches`20that V`20play`20to`20any`20desired`20`20point X`20`20`20`20`20`20`20`20`20`20total,`20`20and`20`20will`20`20continue`20`20to V`20`20start`20`20games`20until`20one X`20`20`20`20`20`20`20`20`20`20player`20reaches`20that`20total. X XOPTIONS X`20`20`20`20`20-read X`20`20`20`20`20`20`20`20`20`20Mail`20is`20read,`20and`20the`20games`20are`20up Vdated`20and`20saved.`20`20The X`20`20`20`20`20`20`20`20`20`20user`20`20is`20`20not`20prompted`20for`20his`20m Voves.`20`20If`20neither`20-read X`20`20`20`20`20`20`20`20`20`20nor`20-play`20are`20given,`20both`20are`20assume Vd. X X`20`20`20`20`20-play X`20`20`20`20`20`20`20`20`20`20Any`20`20games`20`20that`20`20are`20`20waiting V`20`20for`20`20local`20`20input`20`20`20are X`20`20`20`20`20`20`20`20`20`20displayed`20`20for`20`20the`20`20user`20to`20pro Vcess.`20`20No`20mail`20is`20read. X`20`20`20`20`20`20`20`20`20`20If`20neither`20-read`20nor`20-play`20are`20given V,`20both`20are`20assumed. X X`20`20`20`20`20-color`20xy X`20`20`20`20`20`20`20`20`20`20The`20colors`20for`20the`20game`20started`20by V`20this`20ldb`20run`20are`20set X`20`20`20`20`20`20`20`20`20`20to`20`20x`20`20and`20`20y.`20`20`20The`20first V`20color`20is`20played`20by`20the`20local X`20`20`20`20`20`20`20`20`20`20user,`20and`20the`20other`20is`20played`20by`20t Vhe`20`20opponent.`20`20`20Legal X`20`20`20`20`20`20`20`20`20`20color`20`20characters`20`20are`20`20any`20`20pri Vnting`20character,`20except X`20`20`20`20`20`20`20`20`20`20that`20x`20and`20y`20may`20not`20be`20the`20uppe Vr`20and`20lower`20case`20of`20the X`20`20`20`20`20`20`20`20`20`20same`20character.`20`20The`20default`20is`20"-co Vlor`20rw". X X`20`20`20`20`20-direction`20up/down X`20`20`20`20`20`20`20`20`20`20This`20sets`20the`20direction`20of`20play`20for V`20the`20local`20user`20`20for X`20`20`20`20`20`20`20`20`20`20the`20`20game`20`20started`20`20by`20`20this`20 V`20ldb`20`20run.`20`20The`20default`20is X`20`20`20`20`20`20`20`20`20`20"-direction`20up". X X`20`20`20`20`20-myaddr`20addr X`20`20`20`20`20`20`20`20`20`20Your`20mail`20address`20is`20set`20to`20_`08a_ V`08d_`08d_`08r`20for`20games`20`20started`20`20on X`20`20`20`20`20`20`20`20`20`20this`20`20ldb`20run.`20`20This`20overrides`20the V`20address`20specified`20in X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`202 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20._`08l_`08d_`08b_`08r_`08c. X X`20`20`20`20`20-start`20user X`20`20`20`20`20`20`20`20`20`20A`20game`20is`20started`20with`20the`20specified V`20`20user.`20`20`20The`20`20_`08u_`08s_`08e_`08r X`20`20`20`20`20`20`20`20`20`20argument`20`20may`20`20be`20`20any`20e-mail`20ad Vdress`20that`20is`20valid`20for X`20`20`20`20`20`20`20`20`20`20your`20host.`20`20Some`20`20e-mail`20`20addresse Vs`20`20will`20`20need`20`20to`20`20be X`20`20`20`20`20`20`20`20`20`20quoted`20`20if`20they`20contain`20shell`20metach Varacters.`20`20The`20_`08u_`08s_`08e_`08r X`20`20`20`20`20`20`20`20`20`20argument`20may`20also`20be`20an`20_`08a_`08l_ V`08i_`08a_`08s`20for`20an`20opponent`20you`20`20have X`20`20`20`20`20`20`20`20`20`20played`20before.`20`20Aliases`20are`20defined V`20in`20the`20people`20file, X`20`20`20`20`20`20`20`20`20`20and`20are`20initialized`20to`20the`20first`20nam Ve`20of`20the`20`20opponent, X`20`20`20`20`20`20`20`20`20`20with`20`20all`20`20upper-case`20`20letters`20 V`20changed`20`20to`20lower.`20`20The X`20`20`20`20`20`20`20`20`20`20-start`20`20option`20`20is`20`20deferred`20`20un Vtil`20`20all`20`20command`20`20line X`20`20`20`20`20`20`20`20`20`20options`20`20have`20`20been`20`20scanned,`20`20s Vo`20`20the`20`20position`20of`20the X`20`20`20`20`20`20`20`20`20`20-start`20option`20on`20the`20command`20`20line V`20`20is`20`20not`20`20important. X`20`20`20`20`20`20`20`20`20`20Only`20one`20-start`20may`20be`20used`20per`20ld Vb`20run. X X`20`20`20`20`20-remotestart`20user1`20user2 X`20`20`20`20`20`20`20`20`20`20A`20game`20is`20started`20between`20user1`20and V`20user2.`20`20`20The`20`20local X`20`20`20`20`20`20`20`20`20`20host`20`20sends`20a`20remote`20start`20message V`20to`20user1`20instructing X`20`20`20`20`20`20`20`20`20`20it`20to`20start`20a`20game`20with`20user2.`20 V`20The`20local`20host`20does`20not X`20`20`20`20`20`20`20`20`20`20participate`20`20thereafter`20`20in`20the`20game V.`20`20For`20the`20purposes X`20`20`20`20`20`20`20`20`20`20of`20`20the`20`20-color`20`20and`20`20-direction V`20`20options,`20`20`20user1`20`20`20is X`20`20`20`20`20`20`20`20`20`20considered`20`20the`20local`20user.`20`20The`20- Vremotestart`20option`20is X`20`20`20`20`20`20`20`20`20`20deferred`20until`20`20all`20`20command`20`20line V`20`20options`20`20have`20`20been X`20`20`20`20`20`20`20`20`20`20scanned,`20`20so`20the`20position`20of`20the`20- Vremotestart`20option`20on X`20`20`20`20`20`20`20`20`20`20the`20`20command`20`20line`20`20is`20`20`20not V`20`20`20important.`20`20`20`20Only`20`20`20one X`20`20`20`20`20`20`20`20`20`20-remotestart`20may`20be`20used`20per`20ldb`20run V. X X`20`20`20`20`20-notify`20addr X`20`20`20`20`20`20`20`20`20`20This`20option`20affects`20games`20started`20by V`20either`20`20-start`20`20or X`20`20`20`20`20`20`20`20`20`20-remotestart`20on`20this`20ldb`20run.`20`20A`20m Vessage`20is`20sent`20to`20the X`20`20`20`20`20`20`20`20`20`20specified`20address`20when`20the`20game`20that V`20is`20started`20by`20`20the X`20`20`20`20`20`20`20`20`20`20-start`20`20or`20`20-remotestart`20`20option`20 V`20ends.`20`20`20This`20`20message X`20`20`20`20`20`20`20`20`20`20includes`20the`20termination`20code`20of`20`20th Ve`20`20game,`20`20the`20`20game X`20`20`20`20`20`20`20`20`20`20value,`20`20and`20`20a`20`20gammon/backgammon V`20flag.`20`20This`20option`20is X`20`20`20`20`20`20`20`20`20`20mainly`20for`20the`20use`20of`20game`20starters V`20that`20wish`20to`20either X`20`20`20`20`20`20`20`20`20`20keep`20score`20or`20start`20new`20games`20when V`20the`20old`20ones`20finish. X`20`20`20`20`20`20`20`20`20`20Even`20though`20-notify`20is`20only`20used`20 V`20by`20`20the`20`20player`20`20that X`20`20`20`20`20`20`20`20`20`20starts`20`20`20the`20`20game`20`20(or`20`20the V`20`20game`20`20starter`20`20that`20`20uses X`20`20`20`20`20`20`20`20`20`20-remotestart),`20both`20player's`20ldb`20will V`20`20send`20`20a`20`20message X`20`20`20`20`20`20`20`20`20`20when`20the`20game`20ends. X X`20`20`20`20`20-jacoby X`20`20`20`20`20`20`20`20`20`20The`20Jacoby`20rule`20is`20enabled`20for`20the V`20game`20started`20by`20this X`20`20`20`20`20`20`20`20`20`20ldb`20`20`20run.`20`20`20`20This`20`20rule`20 V`20specifies`20`20that`20`20gammons`20`20and X`20`20`20`20`20`20`20`20`20`20backgammons`20count`20as`20a`20single`20point V`20if`20`20neither`20`20player X`20`20`20`20`20`20`20`20`20`20doubled`20`20during`20`20the`20`20game.`20`20 V`20This`20`20option`20`20may`20only`20be X`20`20`20`20`20`20`20`20`20`20enabled`20by`20the`20user`20starting`20the`20gam Ve,`20and`20may`20`20not`20`20be X`20`20`20`20`20`20`20`20`20`20disabled`20`20by`20`20the`20`20other`20`20player V.`20`20`20If`20`20the`20`20opponent's X`20`20`20`20`20`20`20`20`20`20version`20of`20ldb`20does`20not`20support`20the V`20Jacoby`20rule,`20it`20`20is X`20`20`20`20`20`20`20`20`20`20disabled`20`20and`20`20the`20`20game`20`20procee Vds`20`20as`20if`20it`20were`20never X`20`20`20`20`20`20`20`20`20`20enabled. X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`203 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20-crawford X`20`20`20`20`20`20`20`20`20`20The`20Crawford`20rule`20is`20enabled`20for`20the V`20`20game`20`20started`20`20by X`20`20`20`20`20`20`20`20`20`20this`20`20ldb`20run.`20`20This`20rule`20specifie Vs`20that`20neither`20player X`20`20`20`20`20`20`20`20`20`20may`20double`20for`20the`20first`20game`20of`20a V`20match`20`20after`20`20either X`20`20`20`20`20`20`20`20`20`20player`20`20is`20`20within`20`201`20`20point`20 V`20of`20winning`20the`20match.`20`20If X`20`20`20`20`20`20`20`20`20`20match`20`20play`20`20is`20`20not`20`20enabled, V`20`20this`20`20argument`20`20has`20`20no X`20`20`20`20`20`20`20`20`20`20meaning.`20`20`20This`20`20option`20may`20only V`20be`20enabled`20by`20the`20user X`20`20`20`20`20`20`20`20`20`20starting`20the`20game,`20and`20may`20not`20be V`20disabled`20by`20the`20other X`20`20`20`20`20`20`20`20`20`20player.`20`20`20If`20`20the`20`20opponent's`20 V`20version`20`20of`20ldb`20does`20not X`20`20`20`20`20`20`20`20`20`20support`20the`20Crawford`20rule,`20it`20is`20dis Vabled`20and`20the`20`20game X`20`20`20`20`20`20`20`20`20`20proceeds`20as`20if`20it`20were`20never`20enabled V. X X`20`20`20`20`20-european X`20`20`20`20`20`20`20`20`20`20The`20European`20rule`20is`20enabled`20for`20the V`20`20game`20`20started`20`20by X`20`20`20`20`20`20`20`20`20`20this`20`20ldb`20`20run.`20`20`20This`20`20rule V`20specifies`20that`20backgammons X`20`20`20`20`20`20`20`20`20`20count`20as`20double,`20rather`20than`20triple, V`20the`20score`20shown`20on X`20`20`20`20`20`20`20`20`20`20the`20`20cube.`20`20This`20option`20may`20only V`20be`20enabled`20by`20the`20user X`20`20`20`20`20`20`20`20`20`20starting`20the`20game,`20and`20may`20not`20be V`20disabled`20by`20the`20other X`20`20`20`20`20`20`20`20`20`20player.`20`20`20If`20`20the`20`20opponent's`20 V`20version`20`20of`20ldb`20does`20not X`20`20`20`20`20`20`20`20`20`20support`20the`20European`20rule,`20it`20is`20dis Vabled`20and`20the`20`20game X`20`20`20`20`20`20`20`20`20`20proceeds`20as`20if`20it`20were`20never`20enabled V. X X`20`20`20`20`20-permanent X`20`20`20`20`20`20`20`20`20`20The`20game`20started`20by`20this`20ldb`20run`20i Vs`20`20marked`20`20permanent. X`20`20`20`20`20`20`20`20`20`20Permanent`20`20games`20`20are`20automatically V`20restarted`20when`20they X`20`20`20`20`20`20`20`20`20`20end.`20`20This`20is`20for`20people`20you`20play V`20with`20constantly,`20`20and X`20`20`20`20`20`20`20`20`20`20it`20saves`20you`20the`20trouble`20of`20restarti Vng`20the`20game`20when`20it X`20`20`20`20`20`20`20`20`20`20is`20over.`20`20This`20option`20may`20only`20be V`20enabled`20by`20`20the`20`20user X`20`20`20`20`20`20`20`20`20`20starting`20the`20game,`20and`20may`20not`20be V`20disabled`20by`20the`20other X`20`20`20`20`20`20`20`20`20`20player.`20`20If`20the`20opponent's`20`20version V`20`20of`20`20ldb`20`20does`20`20not X`20`20`20`20`20`20`20`20`20`20support`20permanent`20games,`20the`20permanent V`20flag`20is`20disabled X`20`20`20`20`20`20`20`20`20`20and`20the`20game`20proceeds`20as`20if`20it`20wer Ve`20never`20enabled. X X`20`20`20`20`20-match`20points X`20`20`20`20`20`20`20`20`20`20This`20option`20enables`20match`20play`20and`20s Vpecifies`20the`20number X`20`20`20`20`20`20`20`20`20`20of`20points`20the`20match`20is`20to`20play`20to. V`20`20Games`20that`20are`20part X`20`20`20`20`20`20`20`20`20`20of`20a`20match`20have`20additional`20information V`20displayed`20`20above X`20`20`20`20`20`20`20`20`20`20the`20`20board`20`20to`20`20show`20`20the`20`20c Vurrent`20`20match`20score`20and`20the X`20`20`20`20`20`20`20`20`20`20number`20of`20points`20being`20played`20to.`20 V`20When`20a`20game`20that`20`20is X`20`20`20`20`20`20`20`20`20`20part`20`20of`20`20a`20`20match`20`20ends,`20`20a Vnd`20`20the`20specified`20number`20of X`20`20`20`20`20`20`20`20`20`20points`20has`20not`20been`20reached,`20`20the V`20`20game`20`20is`20`20restarted. X`20`20`20`20`20`20`20`20`20`20This`20`20option`20`20may`20`20only`20be`20enabl Ved`20by`20the`20user`20starting X`20`20`20`20`20`20`20`20`20`20the`20game,`20and`20may`20not`20be`20disabled V`20by`20the`20other`20`20player. X`20`20`20`20`20`20`20`20`20`20If`20the`20opponent's`20version`20of`20ldb`20doe Vs`20not`20support`20match X`20`20`20`20`20`20`20`20`20`20play,`20the`20game`20proceeds`20as`20if`20it`20w Vere`20a`20normal`20game. X X`20`20`20`20`20-score X`20`20`20`20`20`20`20`20`20`20The`20cumulative`20score`20`20for`20`20all`20 V`20opponents`20`20is`20`20printed. X`20`20`20`20`20`20`20`20`20`20This`20`20consists`20`20of`20points,`20games, V`20gammons,`20backgammons, X`20`20`20`20`20`20`20`20`20`20and`20matches`20that`20`20have`20`20been`20`20wo Vn`20`20and`20`20lost`20`20for`20`20each X`20`20`20`20`20`20`20`20`20`20opponent.`20`20A`20total`20over`20all`20opponent Vs`20is`20also`20printed. X X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`204 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20-broadcast`20`5Bfile`5D X`20`20`20`20`20`20`20`20`20`20The`20specified`20file`20is`20mailed`20to`20all V`20current`20`20opponents. X`20`20`20`20`20`20`20`20`20`20This`20`20is`20`20useful`20for`20announcing`20va Vcation`20absences,`20etc. X`20`20`20`20`20`20`20`20`20`20If`20the`20file`20argument`20is`20not`20given, V`20`20standard`20`20input`20`20is X`20`20`20`20`20`20`20`20`20`20read`20and`20sent`20to`20all`20opponents. X X`20`20`20`20`20-control X`20`20`20`20`20`20`20`20`20`20This`20option`20puts`20ldb`20into`20a`20special V`20mode`20that`20does`20`20not X`20`20`20`20`20`20`20`20`20`20allow`20games`20to`20be`20played,`20but`20instea Vd`20displays`20them`20one X`20`20`20`20`20`20`20`20`20`20at`20a`20time`20and`20allows`20certain`20"overhe Vad"`20functions`20to`20be X`20`20`20`20`20`20`20`20`20`20performed.`20`20`20These`20`20are`20`20described V`20fully`20in`20the`20section X`20`20`20`20`20`20`20`20`20`20titled`20"CONTROLLING`20A`20GAME". X X`20`20`20`20`20-reconstruct`20file X`20`20`20`20`20`20`20`20`20`20This`20option`20allows`20your`20game`20file`20to V`20`20be`20`20reconstructed X`20`20`20`20`20`20`20`20`20`20if`20`20you`20`20accidentally`20`20clobber`20 V`20it.`20`20`20It`20`20does`20`20this`20by X`20`20`20`20`20`20`20`20`20`20extracting`20the`20information`20from`20`20your V`20`20opponent's`20`20data X`20`20`20`20`20`20`20`20`20`20file`20`20and`20"reversing"`20it`20so`20you`20ca Vn`20use`20it.`20`20To`20use`20the X`20`20`20`20`20`20`20`20`20`20reconstruct`20option,`20ask`20all`20of`20your V`20opponents`20`20to`20`20send X`20`20`20`20`20`20`20`20`20`20you`20their`20.ldbdata`20files.`20`20Extract`20t Vhese`20from`20your`20mail X`20`20`20`20`20`20`20`20`20`20into`20files`20on`20your`20system,`20strip`20the V`20mail`20headers,`20`20and X`20`20`20`20`20`20`20`20`20`20feed`20`20them`20one`20at`20a`20time`20into`20ld Vb.`20`20For`20each`20game`20found X`20`20`20`20`20`20`20`20`20`20listing`20you`20as`20the`20opponent,`20you`20wil Vl`20`20be`20`20prompted`20`20to X`20`20`20`20`20`20`20`20`20`20enter`20`20the`20`20opponent's`20e-mail`20addres Vs`20or`20alias`20(and`20his X`20`20`20`20`20`20`20`20`20`20name`20if`20he`20is`20not`20in`20your`20people V`20file),`20`20and`20`20the`20`20game X`20`20`20`20`20`20`20`20`20`20will`20be`20added`20to`20your`20game`20file. X X`20`20`20`20`20`20`20`20`20`20The`20reconstruct`20function`20cannot`20recover V`20games`20that`20were X`20`20`20`20`20`20`20`20`20`20in`20`20the`20process`20of`20starting`20(i.e. V`20in`20their`20initial`20roll X`20`20`20`20`20`20`20`20`20`20stage),`20or`20that`20have`20already`20completed V`20`20(why`20`20bother?). X`20`20`20`20`20`20`20`20`20`20Your`20`20opponent`20`20should`20`20read`20`20an Vy`20`20mail`20`20files`20you`20sent X`20`20`20`20`20`20`20`20`20`20before`20your`20data`20file`20got`20clobbered, V`20`20and`20`20should`20`20make X`20`20`20`20`20`20`20`20`20`20his`20`20move`20and`20send`20it`20before`20sendi Vng`20you`20his`20data`20file. X`20`20`20`20`20`20`20`20`20`20You`20will`20not`20need`20to`20process`20the`20m Vove`20he`20sent,`20`20though, X`20`20`20`20`20`20`20`20`20`20since`20`20all`20`20that`20`20data`20is`20in`20h Vis`20file`20anyway.`20`20It`20won't X`20`20`20`20`20`20`20`20`20`20hurt`20if`20you`20do,`20ldb`20will`20just`20igno Vre`20it. X X`20`20`20`20`20-help X`20`20`20`20`20`20`20`20`20`20This`20prints`20a`20one-line`20description`20of V`20each`20`20option,`20`20in X`20`20`20`20`20`20`20`20`20`20case`20you`20forget`20later`20on. X XSCREEN X`20`20`20`20`20The`20screen`20displays`20the`20following`20items`20of`20intere Vst: X X`20`20`20`20`20Opponent X`20`20`20`20`20`20`20`20`20`20The`20e-mail`20address`20and`20personal`20name V`20`20of`20`20the`20`20opponent X`20`20`20`20`20`20`20`20`20`20are`20`20displayed`20on`20the`20top`20line`20of V`20the`20screen.`20`20This`20can X`20`20`20`20`20`20`20`20`20`20help`20identify`20the`20`20game`20`20if`20`20you V`20`20have`20`20many`20`20games`20`20in X`20`20`20`20`20`20`20`20`20`20progress`20at`20once. X X`20`20`20`20`20Board`20Label X`20`20`20`20`20`20`20`20`20`20_`08L_`08d_`08b`20displays`20one`20of`20three V`20possible`20board`20`20images`20`20at`20`20a X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`205 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20time;`20`20the`20`20name`20`20of`20`20the`20`20b Voard`20currently`20displayed`20is X`20`20`20`20`20`20`20`20`20`20shown`20on`20the`20second`20line`20of`20the`20sc Vreen,`20near`20the`20`20left. X`20`20`20`20`20`20`20`20`20`20The`20`20significance`20`20of`20`20these`20`20th Vree`20boards`20is`20explained X`20`20`20`20`20`20`20`20`20`20below. X X`20`20`20`20`20Flags X`20`20`20`20`20`20`20`20`20`20This`20area`20displays`20any`20special`20rules V`20in`20effect`20for`20`20the X`20`20`20`20`20`20`20`20`20`20game.`20`20`20Each`20`20special`20`20rule`20`20c Vauses`20one`20character`20to`20be X`20`20`20`20`20`20`20`20`20`20displayed.`20`20These`20are: X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20J`20`20`20`20`20Jacoby`20rule X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20C`20`20`20`20`20Crawford`20rule X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20E`20`20`20`20`20European`20rule X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20P`20`20`20`20`20Permanent`20game X`20`20`20`20`20`20`20`20`20`20In`20addition,`20the`20Crawford`20rule`20indicat Vor`20`20is`20`20shown`20`20in X`20`20`20`20`20`20`20`20`20`20reverse`20`20video`20`20if`20`20the`20Crawford V`20rule`20game`20is`20currently X`20`20`20`20`20`20`20`20`20`20being`20played. X X`20`20`20`20`20Match`20Score X`20`20`20`20`20`20`20`20`20`20The`20current`20match`20score`20is`20displayed V`20next`20to`20the`20`20board X`20`20`20`20`20`20`20`20`20`20label,`20`20as`20`20is`20the`20number`20of`20poi Vnts`20the`20match`20plays`20to. X`20`20`20`20`20`20`20`20`20`20If`20the`20game`20being`20displayed`20is`20not V`20`20part`20`20of`20`20a`20`20match, X`20`20`20`20`20`20`20`20`20`20this`20area`20is`20blanked`20out. X X`20`20`20`20`20Pip`20Count X`20`20`20`20`20`20`20`20`20`20Near`20the`20right`20of`20the`20screen`20on`20th Ve`20second`20line`20is`20`20the X`20`20`20`20`20`20`20`20`20`20pip`20count`20for`20the`20board`20being`20displa Vyed. X X`20`20`20`20`20Board X`20`20`20`20`20`20`20`20`20`20The`20board`20is`20`20displayed`20`20near`20`20t Vhe`20`20left`20`20side`20`20of`20`20the X`20`20`20`20`20`20`20`20`20`20screen,`20`20and`20`20takes`20`20up`20`20most V`20`20of`20`20the`20screen`20area.`20`20It X`20`20`20`20`20`20`20`20`20`20consists`20of`20an`20outline,`20drawn`20`20with V`20`20ASCII`20`20characters, X`20`20`20`20`20`20`20`20`20`20and`20`2028`20"points"`20where`20pieces`20can V`20reside.`20`20Of`20these,`2024 X`20`20`20`20`20`20`20`20`20`20are`20the`20normal`20points`20making`20up`20the V`20main`20`20body`20`20of`20`20the X`20`20`20`20`20`20`20`20`20`20board`20`20(numbered`201-24),`202`20are`20the V`20"BAR"`20points,`20located X`20`20`20`20`20`20`20`20`20`20between`20the`20left`20and`20right`20halves`20of V`20`20the`20`20main`20`20board, X`20`20`20`20`20`20`20`20`20`20and`20`202`20`20are`20the`20"OFF"`20points`20(wh Vere`20pieces`20go`20when`20they X`20`20`20`20`20`20`20`20`20`20are`20borne`20off),`20located`20`20to`20`20the V`20`20left`20`20of`20`20the`20`20board. X`20`20`20`20`20`20`20`20`20`20Pieces`20`20are`20represented`20by`20upper`20or V`20lower`20case`20letters. X`20`20`20`20`20`20`20`20`20`20To`20help`20you`20remember`20which`20direction V`20you`20`20are`20`20playing, X`20`20`20`20`20`20`20`20`20`20there`20are`20arrows`20drawn`20at`20the`20four V`20corners`20of`20the`20board X`20`20`20`20`20`20`20`20`20`20indicating`20`20your`20`20direction`20`20of`20 V`20play.`20`20`20The`20`20`20bar`20`20`20is X`20`20`20`20`20`20`20`20`20`20indicated`20`20by`20`20the`20word`20"BAR";`20thi Vs`20changes`20to`20"---"`20if X`20`20`20`20`20`20`20`20`20`20neither`20player`20can`20hit. X X`20`20`20`20`20Doubling`20Cube X`20`20`20`20`20`20`20`20`20`20The`20current`20value`20of`20the`20doubling`20cu Vbe`20is`20displayed`20`20in X`20`20`20`20`20`20`20`20`20`20reverse`20video`20on`20the`20left`20side`20of V`20the`20screen.`20`20The`20cube X`20`20`20`20`20`20`20`20`20`20will`20appear`20next`20to`20the`20home`20board V`20of`20the`20owner`20of`20`20the X`20`20`20`20`20`20`20`20`20`20cube,`20`20or`20`20in`20the`20middle`20if`20neit Vher`20player`20has`20doubled. X`20`20`20`20`20`20`20`20`20`20For`20example,`20if`20the`20player`20whose`20hom Ve`20board`20is`20`20at`20`20the X`20`20`20`20`20`20`20`20`20`20bottom`20of`20the`20screen`20doubled`20last,`20t Vhe`20cube`20will`20appear X`20`20`20`20`20`20`20`20`20`20beside`20the`20top`20of`20the`20board. X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`206 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20Move`20Blocks +-+-+-+-+-+-+-+- END OF PART 1 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+ X`20`20`20`20`20`20`20`20`20`20The`20move`20blocks`20are`20located`20on`20the V`20right`20of`20the`20screen. X`20`20`20`20`20`20`20`20`20`20There`20`20are`20`20two`20`20move`20`20blocks; V`20one`20for`20you,`20and`20one`20for X`20`20`20`20`20`20`20`20`20`20your`20opponent.`20`20You`20will`20use`20your V`20move`20block`20`20to`20`20enter X`20`20`20`20`20`20`20`20`20`20your`20`20moves,`20`20and`20`20you`20`20will`20 V`20see`20your`20opponent's`20moves X`20`20`20`20`20`20`20`20`20`20displayed`20in`20his`20move`20block.`20`20A`20mo Vve`20block`20consists`20`20of X`20`20`20`20`20`20`20`20`20`20a`20header,`20which`20identifies`20the`20owner V`20of`20the`20move`20block, X`20`20`20`20`20`20`20`20`20`20and`20two`20columns`20of`20either`20two`20or`20f Vour`20lines.`20`20Each`20line X`20`20`20`20`20`20`20`20`20`20in`20a`20move`20block`20is`20one`20roll,`20and V`20shows`20the`20value`20of`20the X`20`20`20`20`20`20`20`20`20`20roll`20(in`20the`20range`201-6)`20and`20`20how V`20`20that`20`20roll`20`20has`20`20been X`20`20`20`20`20`20`20`20`20`20used.`20`20`20If`20`20doubles`20`20were`20`20rol Vled,`20the`20third`20and`20fourth X`20`20`20`20`20`20`20`20`20`20lines`20will`20also`20be`20used`20to`20display V`20the`20`20two`20`20additional X`20`20`20`20`20`20`20`20`20`20rolls`20that`20may`20be`20used. X X`20`20`20`20`20Command`20Box X`20`20`20`20`20`20`20`20`20`20The`20bottom`20right`20corner`20of`20the`20scree Vn`20contains`20a`20`20small X`20`20`20`20`20`20`20`20`20`20box`20`20that`20`20displays`20`20the`20commands V`20that`20are`20legal`20at`20any X`20`20`20`20`20`20`20`20`20`20given`20time.`20`20You`20can`20execute`20a`20com Vmand`20`20by`20`20typing`20`20the X`20`20`20`20`20`20`20`20`20`20first`20`20letter;`20`20you`20`20should`20`20not V`20hit`20return`20afterwards. X`20`20`20`20`20`20`20`20`20`20There`20may`20be`20legal`20commands`20other`20th Van`20those`20`20shown`20`20in X`20`20`20`20`20`20`20`20`20`20the`20command`20box,`20depending`20on`20the`20st Vate`20the`20game`20is`20in. X`20`20`20`20`20`20`20`20`20`20Press`20"h"`20or`20`20"?"`20`20for`20`20a`20`20c Vomplete`20`20listing`20`20of`20`20legal X`20`20`20`20`20`20`20`20`20`20commands. X X`20`20`20`20`20Message`20Area X`20`20`20`20`20`20`20`20`20`20The`20bottom`206`20lines`20`20of`20`20the`20`20s Vcreen`20`20are`20`20reserved`20`20for X`20`20`20`20`20`20`20`20`20`20messages`20of`20various`20types.`20`20The`20bott Vom`20line`20is`20used`20for X`20`20`20`20`20`20`20`20`20`20error`20and`20informative`20messages`20that`20oc Vcur`20as`20a`20game`20`20is X`20`20`20`20`20`20`20`20`20`20played.`20`20`20The`20`20top`20`20line`20in`20th Vis`20area`20displays`20messages X`20`20`20`20`20`20`20`20`20`20pertaining`20to`20the`20status`20of`20a`20game, V`20such`20as`20`20blots`20`20hit X`20`20`20`20`20`20`20`20`20`20by`20`20an`20opponent's`20move.`20`20The`20remai Vning`204`20lines`20are`20used X`20`20`20`20`20`20`20`20`20`20to`20enclose`20a`20message`20to`20your`20opponen Vt`20with`20`20your`20`20move, X`20`20`20`20`20`20`20`20`20`20and`20`20to`20`20display`20`20the`20`20one`20 V`20your`20`20opponent`20sent`20to`20you. X`20`20`20`20`20`20`20`20`20`20These`20messages`20may`20be`20up`20to`202`20line Vs`20of`2056`20characters. X XSTARTUP`20FILE X`20`20`20`20`20The`20first`20time`20you`20run`20_`08l_`08d_`08b,`20it`20will V`20ask`20you`20if`20you`20`20want`20`20to X`20`20`20`20`20create`20`20a`20`20._`08l_`08d_`08b_`08r_`08c`20file.`20`20You V`20should`20answer`20"yes",`20unless`20you X`20`20`20`20`20have`20a`20reason`20not`20to.`20`20If`20you`20want`20the`20ldb V`20startup`20`20file`20`20to X`20`20`20`20`20be`20`20named`20`20something`20`20other`20`20than`20._`08l_`08d V_`08b_`08r_`08c,`20you`20should`20set`20the X`20`20`20`20`20environment`20variable`20LDBRC`20`20to`20`20the`20`20name`20 V`20you`20`20want`20`20before X`20`20`20`20`20running`20`20ldb`20`20for`20the`20first`20time.`20`20If`20you V`20do`20this,`20the`20LDBRC X`20`20`20`20`20variable`20must`20be`20set`20every`20time`20you`20run`20ldb. V`20`20_`08L_`08d_`08b`20`20moves`20`20to X`20`20`20`20`20the`20`20directory`20`20in`20`20the`20`20HOME`20environment`20v Variable,`20if`20it`20is X`20`20`20`20`20set,`20before`20accessing`20`20any`20`20files.`20`20`20This`20 V`20makes`20`20all`20`20files X`20`20`20`20`20(including`20.ldbrc)`20relative`20to`20$HOME. X X`20`20`20`20`20The`20._`08l_`08d_`08b_`08r_`08c`20is`20organized`20as`20a`20se Vquence`20of`20`20name/value`20`20pairs, X`20`20`20`20`20one`20`20per`20line,`20in`20the`20format`20_`08n_`08a_`08m_`08e V=_`08v_`08a_`08l_`08u_`08e`20.`20There`20should`20be`20no X`20`20`20`20`20spaces`20before`20_`08n_`08a_`08m_`08e`20or`20`20before`20`20or V`20`20after`20`20the`20`20equals`20`20sign. X`20`20`20`20`20Comments`20`20are`20indicated`20by`20a`20pound`20sign`20(#)`20i Vn`20column`201,`20and X`20`20`20`20`20extend`20to`20the`20end`20of`20the`20`20line.`20`20`20The`20 V`20following`20`20names`20`20are X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`207 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20defined: X X`20`20`20`20`20myname X`20`20`20`20`20`20`20`20`20`20This`20line`20is`20where`20you`20enter`20your V`20(human)`20name.`20`20It`20`20is X`20`20`20`20`20`20`20`20`20`20sent`20`20to`20`20your`20opponent`20when`20a`20g Vame`20is`20started,`20to`20make X`20`20`20`20`20`20`20`20`20`20things`20a`20little`20more`20personal.`20`20You V`20`20can`20`20put`20`20anything X`20`20`20`20`20`20`20`20`20`20you`20`20like`20`20here,`20`20of`20course,`20but V`20I`20highly`20recommend`20you X`20`20`20`20`20`20`20`20`20`20just`20stick`20to`20your`20name.`20`20The`20_ V`08m_`08y_`08n_`08a_`08m_`08e`20line`20is`20mandatory; X`20`20`20`20`20`20`20`20`20`20if`20`20you`20`20don't`20`20want`20`20your`20nam Ve`20sent`20to`20people,`20you`20can X`20`20`20`20`20`20`20`20`20`20just`20put`20your`20email`20address`20instead, V`20but`20you`20must`20`20have X`20`20`20`20`20`20`20`20`20`20something. X X`20`20`20`20`20myaddr X`20`20`20`20`20`20`20`20`20`20This`20line`20defines`20your`20e-mail`20address. V`20`20This`20is`20sent`20to X`20`20`20`20`20`20`20`20`20`20your`20opponent`20when`20you`20start`20a`20game V`20so`20they`20know`20how`20to X`20`20`20`20`20`20`20`20`20`20send`20mail`20back`20to`20you.`20`20For`20people V`20with`20`20multiple`20`20mail X`20`20`20`20`20`20`20`20`20`20paths,`20`20put`20`20the`20`20one`20`20here`20 V`20you`20use`20the`20most`20(e.g.`20the X`20`20`20`20`20`20`20`20`20`20Internet`20domain-style`20path),`20and`20for`20g Vames`20that`20need`20to X`20`20`20`20`20`20`20`20`20`20use`20`20a`20`20different`20address,`20use`20the V`20-_`08m_`08y_`08a_`08d_`08d_`08r`20command`20line X`20`20`20`20`20`20`20`20`20`20argument`20to`20override`20the`20path`20in`20._ V`08l_`08d_`08b_`08r_`08c.`20_`08N_`08o_`08t_`08e`20_`08t_`08h_`08a_`08t`20`20_ V`08t_`08h_`08e X`20`20`20`20`20`20`20`20`20`20_`08f_`08i_`08r_`08s_`08t`20`20_`08t_`08i_`08m_ V`08e`20`20with`20someone,`20the`20address`20you`20use`20is`20saved X`20`20`20`20`20`20`20`20`20`20in`20your`20people`20file.`20`20Subsequent`20gam Ves`20you`20`20start`20`20with X`20`20`20`20`20`20`20`20`20`20this`20person`20automatically`20use`20this`20sam Ve`20address,`20so`20the X`20`20`20`20`20`20`20`20`20`20-_`08m_`08y_`08a_`08d_`08d_`08r`20option`20will V`20be`20unnecessary.`20`20The`20_`08m_`08y_`08a_`08d_`08d_`08r`20line`20is X`20`20`20`20`20`20`20`20`20`20mandatory. X X`20`20`20`20`20peoplefile X`20`20`20`20`20`20`20`20`20`20This`20line`20sets`20the`20file`20name`20`20that V`20`20is`20`20used`20`20to`20`20store X`20`20`20`20`20`20`20`20`20`20information`20`20about`20`20your`20`20opponents. V`20`20`20In`20`20addition`20`20to X`20`20`20`20`20`20`20`20`20`20storing`20your`20opponents'`20names,`20addresses V,`20and`20`20aliases, X`20`20`20`20`20`20`20`20`20`20it`20`20records`20`20the`20`20number`20`20of`20 V`20games,`20`20points,`20`20gammons, X`20`20`20`20`20`20`20`20`20`20backgammons,`20and`20matches`20you`20have`20won V`20or`20lost`20`20to`20`20that X`20`20`20`20`20`20`20`20`20`20opponent.`20`20`20It`20`20also`20stores`20someth Ving`20called`20the`20_`08f_`08e_`08n_`08c_`08e, X`20`20`20`20`20`20`20`20`20`20which`20is`20the`20start`20time`20of`20the`20mos Vt`20`20recently`20`20finished X`20`20`20`20`20`20`20`20`20`20game.`20`20`20This`20allows`20start`20messages V`20from`20old`20games`20to`20be X`20`20`20`20`20`20`20`20`20`20discarded.`20`20The`20peoplefile`20line`20is`20o Vptional,`20and`20if`20`20it X`20`20`20`20`20`20`20`20`20`20is`20not`20given,`20the`20people`20file`20defaul Vts`20to`20._`08l_`08d_`08b_`08p_`08e_`08o_`08p_`08l_`08e. X X`20`20`20`20`20gamefile X`20`20`20`20`20`20`20`20`20`20This`20line`20sets`20the`20file`20name`20`20that V`20`20is`20`20used`20`20to`20`20store X`20`20`20`20`20`20`20`20`20`20games`20`20in`20`20progress.`20`20`20It`20is`20o Vptional,`20and`20if`20it`20is`20not X`20`20`20`20`20`20`20`20`20`20given,`20the`20game`20file`20defaults`20to`20._ V`08l_`08d_`08b_`08d_`08a_`08t_`08a.`20`20My`20`20advice, X`20`20`20`20`20`20`20`20`20`20if`20you`20care,`20is`20that`20you`20should`20av Void`20using`20a`20file`20name X`20`20`20`20`20`20`20`20`20`20containing`20the`20`20string`20`20_`08g_`08a_ V`08m_`08e_`08s`20`20or`20`20any`20`20other`20`20giveaway X`20`20`20`20`20`20`20`20`20`20string`20`20that`20`20would`20`20let`20`20your V`20boss,`20sysadmin,`20or`20other X`20`20`20`20`20`20`20`20`20`20local`20Nazi-type`20know`20that`20you're`20using V`20a`20very`20expensive X`20`20`20`20`20`20`20`20`20`20piece`20`20of`20`20high-tech`20`20equipment`20 V`20to`20`20goof`20off,`20when`20you X`20`20`20`20`20`20`20`20`20`20could`20do`20that`20with`20nothing`20more`20exot Vic`20`20than`20`20a`20`20rubber X`20`20`20`20`20`20`20`20`20`20band`20and`20some`20spitballs. X X`20`20`20`20`20backupfile X`20`20`20`20`20`20`20`20`20`20This`20is`20the`20file`20your`20old`20_`08g_`08a V_`08m_`08e_`08f_`08i_`08l_`08e`20`20will`20`20be`20`20moved`20`20to X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`208 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20just`20`20before`20`20a`20`20new`20`20one`20`20i Vs`20`20created.`20`20It`20defaults`20to X`20`20`20`20`20`20`20`20`20`20._`08o_`08l_`08d_`08l_`08d_`08b_`08d_`08a_`08t_ V`08a. X X`20`20`20`20`20mailfile X`20`20`20`20`20`20`20`20`20`20This`20line`20is`20where`20you`20tell`20ldb`20ho Vw`20to`20`20find`20`20the`20`20mail X`20`20`20`20`20`20`20`20`20`20messages`20`20your`20`20opponents`20have`20sent. V`20`20There`20are`20several X`20`20`20`20`20`20`20`20`20`20ways`20to`20do`20this.`20`20The`20simplest`20one V`20is`20to`20just`20put`20`20some X`20`20`20`20`20`20`20`20`20`20file`20`20name`20`20here`20(the`20default`20is V`20ldb.rcv)`20and,`20when`20you X`20`20`20`20`20`20`20`20`20`20receive`20mail`20containing`20an`20ldb`20move, V`20just`20`20save`20`20it`20`20to X`20`20`20`20`20`20`20`20`20`20this`20`20file.`20`20`20When`20`20you`20are`20do Vne`20reading`20your`20mail,`20run X`20`20`20`20`20`20`20`20`20`20ldb,`20and`20it`20will`20scan`20this`20file`20an Vd`20`20extract`20`20all`20`20your X`20`20`20`20`20`20`20`20`20`20incoming`20`20moves.`20`20If`20your`20mail`20pro Vgram`20is`20like`20most,`20it X`20`20`20`20`20`20`20`20`20`20will`20append`20messages`20if`20the`20`20file V`20`20you`20`20are`20`20saving`20`20to X`20`20`20`20`20`20`20`20`20`20already`20`20exists,`20which`20is`20just`20what V`20you`20want.`20`20_`08L_`08d_`08b`20will X`20`20`20`20`20`20`20`20`20`20silently`20ignore`20moves`20that`20`20it`20`20ha Vs`20`20already`20`20seen`20`20for X`20`20`20`20`20`20`20`20`20`20games`20`20in`20progress,`20so`20you`20don't`20h Vave`20to`20clean`20them`20out X`20`20`20`20`20`20`20`20`20`20of`20your`20mailfile`20if`20you`20don't`20want V`20`20to.`20`20`20Note`20`20however X`20`20`20`20`20`20`20`20`20`20that`20`20if`20`20anything`20happens`20to`20your V`20people`20file,`20and`20you X`20`20`20`20`20`20`20`20`20`20have`20old`20start`20messages`20in`20your`20inpu Vt`20file,`20`20ldb`20`20could X`20`20`20`20`20`20`20`20`20`20start`20`20a`20`20spurious`20`20game`20`20(i.e. V`20one`20your`20opponent's`20ldb X`20`20`20`20`20`20`20`20`20`20knows`20nothing`20about).`20`20Also,`20if`20your V`20`20input`20`20file`20`20gets X`20`20`20`20`20`20`20`20`20`20really`20long,`20ldb`20will`20take`20a`20while V`20to`20start`20up.`20`20So`20the X`20`20`20`20`20`20`20`20`20`20best`20course`20is`20to`20delete`20all`20`20mess Vages`20`20after`20`20ldb`20`20has X`20`20`20`20`20`20`20`20`20`20read`20them. X X`20`20`20`20`20`20`20`20`20`20For`20UNIX`20users,`20`20a`20`20much`20`20easier V`20`20way`20`20is`20`20to`20`20set`20`20the X`20`20`20`20`20`20`20`20`20`20mailfile`20`20to`20`20point`20`20to`20`20your V`20`20actual`20`20mail`20`20file`20(e.g. X`20`20`20`20`20`20`20`20`20`20/usr/spool/mail/$USER),`20and`20`20let`20`20ldb V`20`20scan`20`20your`20`20mail X`20`20`20`20`20`20`20`20`20`20directly.`20`20`20This`20`20will`20`20only`20 V`20work`20if`20your`20system`20keeps X`20`20`20`20`20`20`20`20`20`20mail`20in`20ASCII`20format,`20but`20many`20do. V`20`20Ldb`20will`20not`20delete X`20`20`20`20`20`20`20`20`20`20these`20messages`20from`20your`20mail`20so`20you V`20will`20have`20to. X X`20`20`20`20`20`20`20`20`20`20The`20third`20option`20is`20to`20set`20the`20mai Vlfile`20`20to`20`20a`20`20pattern X`20`20`20`20`20`20`20`20`20`20instead`20`20of`20`20a`20`20filename.`20`20`20Ld Vb`20`20will`20scan`20all`20matching X`20`20`20`20`20`20`20`20`20`20files`20for`20moves.`20`20This`20is`20good`20for V`20mailers`20`20that`20`20don't X`20`20`20`20`20`20`20`20`20`20append`20`20on`20`20save,`20and`20don't`20store V`20in`20ascii`20format,`20such X`20`20`20`20`20`20`20`20`20`20as`20on`20VMS.`20`20Note`20that`20on`20VMS,`20if V`20no`20version`20`20number`20`20is X`20`20`20`20`20`20`20`20`20`20defined,`20`20mailfile`20`20defaults`20`20to`20s Vcanning`20all`20versions. X`20`20`20`20`20`20`20`20`20`20VMS`20users`20should`20read`20the`20section`20en Vtitled`20"VMS`20`20NOTES" X`20`20`20`20`20`20`20`20`20`20for`20more`20information`20on`20extracting`20mai Vl. X X`20`20`20`20`20delmail X`20`20`20`20`20`20`20`20`20`20This`20option`20causes`20any`20mail`20files`20sc Vanned`20by`20ldb`20to`20`20be X`20`20`20`20`20`20`20`20`20`20removed`20`20after`20`20they`20`20have`20`20been V`20`20scanned.`20`20`20This`20`20is`20a X`20`20`20`20`20`20`20`20`20`20hideously`20dangerous`20option,`20so`20I`20recom Vmend`20you`20`20try`20`20it X`20`20`20`20`20`20`20`20`20`20in`20`20a`20`20friend's`20account`20first.`20 V`20It`20will`20delete`20ANY`20file X`20`20`20`20`20`20`20`20`20`20that`20matches`20the`20`20pattern`20`20specified V`20`20in`20`20the`20`20mailfile X`20`20`20`20`20`20`20`20`20`20line,`20`20with`20`20the`20`20exception`20`20tha Vt,`20`20under`20UNIX,`20it`20will X`20`20`20`20`20`20`20`20`20`20refuse`20to`20delete`20any`20file`20starting`20w Vith`20`20"/".`20`20`20Use`20`20it X`20`20`20`20`20`20`20`20`20`20with`20great`20care.`20`20This`20option`20defaul Vts`20to`20no;`20to`20enable X`20`20`20`20`20`20`20`20`20`20it,`20set`20it`20to`20"yes". X X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`209 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20lockfile X`20`20`20`20`20`20`20`20`20`20This`20line`20sets`20the`20name`20`20of`20`20the V`20`20ldb`20`20lock`20`20file.`20`20`20It X`20`20`20`20`20`20`20`20`20`20defaults`20`20to`20".ldb_lock",`20and`20there's V`20no`20real`20reason`20to X`20`20`20`20`20`20`20`20`20`20change`20it`20unless`20by`20some`20chance`20`20i Vt`20`20conflicts`20`20with`20`20a X`20`20`20`20`20`20`20`20`20`20file`20name`20you`20might`20use.`20`20When`20ldb V`20starts,`20it`20checks`20to X`20`20`20`20`20`20`20`20`20`20see`20if`20`20this`20`20file`20`20exists;`20`20i Vf`20`20it`20`20does,`20`20ldb`20`20exits. X`20`20`20`20`20`20`20`20`20`20Otherwise,`20`20it`20`20creates`20`20it`20and V`20goes`20on.`20`20This`20prevents X`20`20`20`20`20`20`20`20`20`20more`20than`20one`20ldb`20from`20running`20in V`20the`20same`20`20account`20`20at X`20`20`20`20`20`20`20`20`20`20the`20same`20time,`20and`20thereby`20garbling V`20the`20data`20files. X X`20`20`20`20`20sendcmd X`20`20`20`20`20`20`20`20`20`20This`20tells`20ldb`20how`20to`20send`20a`20file V`20with`20your`20`20particular X`20`20`20`20`20`20`20`20`20`20mail`20`20command.`20`20`20This`20`20string`20 V`20is`20passed`20to`20the`20system, X`20`20`20`20`20`20`20`20`20`20after`20making`20the`20following`20substitutions V: X X`20`20`20`20`20`20`20`20`20`20$a`20`20`20is`20substituted`20with`20the`20addre Vss`20to`20mail`20to. X X`20`20`20`20`20`20`20`20`20`20$f`20`20`20is`20`20substituted`20`20with`20`20th Ve`20`20file`20`20containing`20`20`20the X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20message. X X`20`20`20`20`20`20`20`20`20`20$s`20`20`20is`20substituted`20with`20the`20subje Vct`20of`20the`20message. X X`20`20`20`20`20`20`20`20`20`20Most`20mail`20systems`20will`20`20work`20`20fine V`20`20with`20`20the`20`20default, X`20`20`20`20`20`20`20`20`20`20which`20is X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20mail`20-s`20'$s'`20$a`20<`20$f X X`20`20`20`20`20`20`20`20`20`20or,`20on`20VMS, X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20MAIL/SUBJECT="$s"`20$f`20IN%"""<$ Va>""" X X`20`20`20`20`20`20`20`20`20`20Note`20that`20the`20$`20substitutions`20are`20ma Vde`20by`20ldb,`20not`20by`20a X`20`20`20`20`20`20`20`20`20`20shell,`20and`20thus`20are`20not`20subject`20to V`20any`20quoting.`20`20If`20you X`20`20`20`20`20`20`20`20`20`20need`20a`20$`20in`20the`20string,`20use`20$$. V`20`20VMS`20users`20may`20need`20`20to X`20`20`20`20`20`20`20`20`20`20change`20`20the`20`20name`20`20of`20`20the`20SMT VP`20mailer;`20for`20example,`20to X`20`20`20`20`20`20`20`20`20`20send`20mail`20using`20Wollongong`20TCP/IP,`20you V`20`20would`20`20use`20`20the X`20`20`20`20`20`20`20`20`20`20string X X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20MAIL/SUBJECT="$s"`20$f`20WINS%""" V<$a>""" X X`20`20`20`20`20tempfile X`20`20`20`20`20`20`20`20`20`20This`20line`20specifies`20a`20temporary`20file V`20that`20ldb`20`20can`20`20use X`20`20`20`20`20`20`20`20`20`20to`20`20compose`20mail`20messages.`20`20The`20fi Vle`20will`20be`20created`20in X`20`20`20`20`20`20`20`20`20`20your`20home`20directory,`20thus`20avoiding`20fil Ve`20name`20`20conflicts X`20`20`20`20`20`20`20`20`20`20in`20/tmp.`20`20It`20defaults`20to`20ldb.tmp. X X`20`20`20`20`20colors X`20`20`20`20`20`20`20`20`20`20This`20is`20a`20string`20of`20two`20upper`20or V`20`20lower`20`20case`20`20letters, X`20`20`20`20`20`20`20`20`20`20and`20`20defines`20`20your`20`20preferred`20`20c Volors`20for`20any`20games`20you X`20`20`20`20`20`20`20`20`20`20start.`20`20The`20first`20character`20in`20the V`20string`20is`20the`20`20color X`20`20`20`20`20`20`20`20`20`20you`20`20will`20play,`20and`20the`20second`20is V`20the`20one`20your`20opponent X`20`20`20`20`20`20`20`20`20`20will`20play.`20`20It`20defaults`20to`20"rw",`20a Vnd`20is`20`20overridden`20`20by X`20`20`20`20`20`20`20`20`20`20the`20-_`08c_`08o_`08l_`08o_`08r`20command`20lin Ve`20argument. X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2010 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20direction X`20`20`20`20`20`20`20`20`20`20This`20`20is`20`20either`20`20"up"`20`20or`20 V`20"down",`20`20and`20`20defines`20`20your X`20`20`20`20`20`20`20`20`20`20preferred`20`20direction`20`20of`20play`20for V`20games`20you`20start.`20`20The X`20`20`20`20`20`20`20`20`20`20direction`20of`20play`20`20only`20`20refers`20 V`20to`20`20whether`20`20you`20`20play X`20`20`20`20`20`20`20`20`20`20toward`20`20`20increasing`20`20`20or`20`20decrea Vsing`20`20numbered`20`20points. X`20`20`20`20`20`20`20`20`20`20Although`20by`20default`20upward`20play`20goes V`20toward`20the`20top`20`20of X`20`20`20`20`20`20`20`20`20`20the`20screen,`20this`20can`20be`20reversed`20(fo Vr`20your`20screen`20only) X`20`20`20`20`20`20`20`20`20`20by`20the`20"Invert"`20command`20in`20the`20Contr Vol`20menu,`20accessible X`20`20`20`20`20`20`20`20`20`20via`20`20the`20`20-_`08c_`08o_`08n_`08t_`08r_ V`08o_`08l`20`20command`20line`20argument.`20`20The`20default X`20`20`20`20`20`20`20`20`20`20for`20this`20`20line`20`20is`20`20"up",`20`20and V`20`20is`20`20overridden`20`20by`20`20the X`20`20`20`20`20`20`20`20`20`20-_`08d_`08i_`08r_`08e_`08c_`08t_`08i_`08o_`08n V`20command`20line`20argument. X X`20`20`20`20`20initialboard X`20`20`20`20`20`20`20`20`20`20As`20was`20alluded`20to`20earlier,`20your`20`20s Vcreen`20`20shows`20`20one`20`20of X`20`20`20`20`20`20`20`20`20`20three`20`20possible`20board`20images`20at`20any V`20time.`20`20Although`20the X`20`20`20`20`20`20`20`20`20`20purpose`20for`20this`20will`20be`20`20explained V`20`20later,`20`20this`20`20line X`20`20`20`20`20`20`20`20`20`20allows`20you`20to`20select`20which`20of`20these V`20three`20boards`20should X`20`20`20`20`20`20`20`20`20`20be`20displayed`20initially.`20`20The`20legal`20v Values`20are`20"before", X`20`20`20`20`20`20`20`20`20`20"after",`20and`20"current".`20`20The`20default V`20is`20"current". X X`20`20`20`20`20autoroll X`20`20`20`20`20`20`20`20`20`20If`20you`20were`20the`20last`20to`20double,`20yo Vu`20have`20no`20option`20`20but X`20`20`20`20`20`20`20`20`20`20to`20`20roll`20the`20dice`20when`20it`20is`20you Vr`20turn.`20`20If`20autoroll`20is X`20`20`20`20`20`20`20`20`20`20enabled,`20ldb`20will`20roll`20the`20dice`20for V`20`20you`20`20automatically X`20`20`20`20`20`20`20`20`20`20in`20`20this`20`20case.`20`20`20For`20`20those V`20`20that`20`20prefer`20consistency, X`20`20`20`20`20`20`20`20`20`20autoroll`20may`20be`20disabled,`20although`20att Vempting`20to`20double X`20`20`20`20`20`20`20`20`20`20when`20`20you`20`20doubled`20`20last`20`20will V`20`20cause`20an`20error`20message. X`20`20`20`20`20`20`20`20`20`20Possible`20values`20for`20autoroll`20are`20"yes" V`20and`20`20"no",`20`20with X`20`20`20`20`20`20`20`20`20`20"yes"`20being`20the`20default. X X`20`20`20`20`20automove X`20`20`20`20`20`20`20`20`20`20Each`20time`20you`20roll`20the`20dice,`20ldb`20 V`20determines`20`20how`20`20many X`20`20`20`20`20`20`20`20`20`20legal`20ways`20there`20are`20for`20you`20to`20us Ve`20your`20rolls.`20`20In`20the X`20`20`20`20`20`20`20`20`20`20relatively`20unusual`20case`20where`20there`20is V`20only`20one`20way`20for X`20`20`20`20`20`20`20`20`20`20you`20to`20use`20your`20rolls,`20ldb`20can`20aut Vomatically`20apply`20this X`20`20`20`20`20`20`20`20`20`20move`20to`20your`20board`20before`20displaying V`20it.`20`20`20Automove`20`20is X`20`20`20`20`20`20`20`20`20`20disabled`20`20by`20`20default`20because`20quite V`20frankly`20it's`20pretty X`20`20`20`20`20`20`20`20`20`20annoying.`20`20Possible`20values`20for`20automov Ve`20are`20`20"yes"`20`20and X`20`20`20`20`20`20`20`20`20`20"no",`20with`20"no"`20being`20the`20default. X X`20`20`20`20`20autodouble X`20`20`20`20`20`20`20`20`20`20One`20of`20the`20official`20`20rules`20`20of`20 V`20backgammon`20`20allows`20`20for X`20`20`20`20`20`20`20`20`20`20automatically`20`20doubling`20the`20game`20value V`20when`20the`20opening X`20`20`20`20`20`20`20`20`20`20roll`20is`20a`20tie.`20`20The`20rules`20go`20on V`20to`20state`20that`20automatic X`20`20`20`20`20`20`20`20`20`20doubling`20`20is`20`20only`20`20to`20`20be`20 V`20used`20when`20the`20players`20agree X`20`20`20`20`20`20`20`20`20`20beforehand`20on`20its`20use`20and`20limitations. V`20`20The`20method`20`20ldb X`20`20`20`20`20`20`20`20`20`20uses`20`20to`20implement`20this`20somewhat`20vag Vue`20rule`20is`20to`20allow X`20`20`20`20`20`20`20`20`20`20each`20player`20to`20specify`20a`20maximum`20num Vber`20of`20`20autodoubles X`20`20`20`20`20`20`20`20`20`20they`20`20are`20`20willing`20`20to`20`20accept V`20`20in`20`20._`08l_`08d_`08b_`08r_`08c,`20and`20for`20the X`20`20`20`20`20`20`20`20`20`20maximum`20number`20of`20autodoubles`20applied V`20to`20any`20game`20to`20be X`20`20`20`20`20`20`20`20`20`20the`20`20lesser`20`20of`20the`20two`20players' V`20specified`20limits.`20`20For X`20`20`20`20`20`20`20`20`20`20example,`20if`20you`20set`20_`08a_`08u_`08t_`08o V_`08d_`08o_`08u_`08b_`08l_`08e=_`084`20`20in`20`20your`20`20.ldbrc,`20`20no X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2011 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20game`20`20you`20`20play`20`20will`20`20ever`20 V`20be`20autodoubled`20more`20than`204 X`20`20`20`20`20`20`20`20`20`20times,`20although`20the`20number`20of`20`20tied V`20`20opening`20`20rolls`20`20is X`20`20`20`20`20`20`20`20`20`20obviously`20not`20limited.`20`20However,`20if V`20you`20were`20to`20start`20a X`20`20`20`20`20`20`20`20`20`20game`20with`20someone`20who`20had`20set`20_`08a_ V`08u_`08t_`08o_`08d_`08o_`08u_`08b_`08l_`08e=_`082`20,`20that`20`20game X`20`20`20`20`20`20`20`20`20`20would`20`20be`20`20limited`20`20to`20`20at`20 V`20most`202`20autodoubles.`20`20If`20you X`20`20`20`20`20`20`20`20`20`20don't`20want`20to`20play`20automatic`20doubles, V`20set`20autodouble=0, X`20`20`20`20`20`20`20`20`20`20which`20is`20also`20the`20default. X X`20`20`20`20`20superkey X`20`20`20`20`20`20`20`20`20`20If`20you`20live`20in`20fear`20of`20`20roving`20 V`20supervisors`20`20(or`20`20other X`20`20`20`20`20`20`20`20`20`20fun-impaired`20individuals)`20running`20across V`20you`20playing`20an X`20`20`20`20`20`20`20`20`20`20innocent`20game`20of`20backgammon,`20you`20may V`20want`20to`20enable`20the X`20`20`20`20`20`20`20`20`20`20superkey`20function.`20`20Just`20pick`20a`20key V`20on`20the`20keyboard`20you X`20`20`20`20`20`20`20`20`20`20never`20use`20in`20ldb,`20such`20as`20the`20back Vquote,`20and`20put`20a`20line X`20`20`20`20`20`20`20`20`20`20in`20._`08l_`08d_`08b_`08r_`08c`20setting`20supe Vrkey`20to`20the`20_`08d_`08e_`08c_`08i_`08m_`08a_`08l`20_`08A_`08S_`08C_`08I_ V`08I`20_`08c_`08o_`08d_`08e`20of X`20`20`20`20`20`20`20`20`20`20the`20key`20you`20want;`20for`20example,`20`20to V`20`20use`20`20the`20`20backquote X`20`20`20`20`20`20`20`20`20`20key,`20use`20"superkey=96".`20`20Only`20single-c Vharacter`20keys`20are X`20`20`20`20`20`20`20`20`20`20allowed,`20and`20the`20key`20you`20select`20will V`20not`20be`20usable`20`20for X`20`20`20`20`20`20`20`20`20`20normal`20purposes`20within`20ldb.`20`20Make`20it V`20one`20you`20can`20hit`20in X`20`20`20`20`20`20`20`20`20`20a`20hurry. X X`20`20`20`20`20supercmd X`20`20`20`20`20`20`20`20`20`20If`20you'd`20rather`20have`20a`20program`20of V`20your`20choice`20`20come`20`20up X`20`20`20`20`20`20`20`20`20`20instead`20`20of`20the`20shell`20when`20the`20sup Verkey`20is`20pressed,`20put X`20`20`20`20`20`20`20`20`20`20it`20on`20this`20line.`20`20It`20will`20`20be V`20`20passed`20`20unchanged`20`20to`20`20a X`20`20`20`20`20`20`20`20`20`20shell`20via`20the`20system()`20function.`20`20VM VS`20users`20should`20read X`20`20`20`20`20`20`20`20`20`20the`20note`20in`20the`20section`20titled`20"VMS V`20NOTES"`20on`20`20supercmd X`20`20`20`20`20`20`20`20`20`20functionality. X X`20`20`20`20`20checkpoint X`20`20`20`20`20`20`20`20`20`20This`20option`20keeps`20the`20gamefile`20up`20to V`20date`20by`20writing`20it X`20`20`20`20`20`20`20`20`20`20out`20`20whenever`20the`20dice`20are`20rolled V`20or`20a`20message`20is`20sent. X`20`20`20`20`20`20`20`20`20`20This`20prevents`20game`20information`20from`20be Ving`20lost`20`20if`20`20ldb X`20`20`20`20`20`20`20`20`20`20crashes,`20`20your`20`20machine`20`20goes`20`20d Vown,`20`20or`20what`20have`20you. X`20`20`20`20`20`20`20`20`20`20This`20`20option`20`20is`20`20enabled`20`20by V`20`20default,`20`20and`20`20I`20`20highly X`20`20`20`20`20`20`20`20`20`20recommend`20`20you`20`20leave`20`20it`20`20that V`20way.`20`20If`20you`20just`20can't X`20`20`20`20`20`20`20`20`20`20stand`20the`20thought`20of`20a`20few`20extra`20w Vrites`20`20to`20`20disk,`20`20you X`20`20`20`20`20`20`20`20`20`20can`20`20disable`20it`20with`20"checkpoint=no". V`20`20On`20your`20own`20head X`20`20`20`20`20`20`20`20`20`20be`20it. X X`20`20`20`20`20timeout X`20`20`20`20`20`20`20`20`20`20This`20option`20sets`20the`20number`20of`20days V`20ldb`20will`20wait`20for`20a X`20`20`20`20`20`20`20`20`20`20reply`20`20from`20`20your`20`20opponent.`20`20Af Vter`20this`20number`20of`20days X`20`20`20`20`20`20`20`20`20`20passes,`20ldb`20will`20assume`20your`20last`20me Vssage`20was`20lost`20`20and X`20`20`20`20`20`20`20`20`20`20automatically`20`20resend`20`20it.`20`20This`20p Vrevents`20the`20situation X`20`20`20`20`20`20`20`20`20`20where`20both`20players`20think`20they`20are`20wa Viting`20on`20the`20other, X`20`20`20`20`20`20`20`20`20`20and`20`20eventually`20`20both`20`20players`20 V`20forget`20they`20even`20have`20a X`20`20`20`20`20`20`20`20`20`20game`20going.`20`20This`20option`20defaults`20to V`207`20`20days;`20`20you`20`20can X`20`20`20`20`20`20`20`20`20`20disable`20automatic`20resends`20by`20setting`20i Vt`20to`200. X X`20`20`20`20`20keepold X`20`20`20`20`20`20`20`20`20`20This`20option`20sets`20the`20number`20of`20days V`20`20ldb`20`20will`20`20keep`20`20a X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2012 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20game`20`20after`20`20it`20is`20over.`20`20This V`20can`20be`20handy`20in`20case`20you X`20`20`20`20`20`20`20`20`20`20need`20to`20resend`20the`20last`20move`20of`20a V`20`20game.`20`20`20This`20`20option X`20`20`20`20`20`20`20`20`20`20defaults`20`20to`207`20days;`20if`20you`20set V`20it`20to`200,`20finished`20games X`20`20`20`20`20`20`20`20`20`20are`20deleted`20immediately. X X`20`20`20`20`20debug X`20`20`20`20`20`20`20`20`20`20This`20option`20enables`20various`20debug`20mess Vages.`20`20`20It`20`20is`20`20a X`20`20`20`20`20`20`20`20`20`20bitmap,`20`20with`20each`20set`20bit`20enabling V`20debug`20messages`20from X`20`20`20`20`20`20`20`20`20`20a`20different`20part`20of`20ldb.`20`20`20Most V`20`20people`20`20will`20`20want`20`20to X`20`20`20`20`20`20`20`20`20`20leave`20it`20at`200,`20which`20is`20the`20defaul Vt.`20`20If`20you`20want`20debug X`20`20`20`20`20`20`20`20`20`20messages,`20look`20for`20the`20definitions`20of V`20DB_*`20in`20ldb.h. X XPEOPLE`20FILE X`20`20`20`20`20Ldb`20maintains`20a`20list`20of`20all`20of`20`20the`20`20people V`20`20you`20`20have`20`20ever X`20`20`20`20`20played.`20`20This`20file`20is`20used`20for`20several`20purposes V: X X`20`20`20`20`201`20`20`20`20It`20`20stores`20`20the`20`20number`20`20of`20`20g Vames,`20`20points,`20`20`20gammons, X`20`20`20`20`20`20`20`20`20`20backgammons,`20`20and`20matches`20you`20have`20w Von`20and`20lost`20to`20that X`20`20`20`20`20`20`20`20`20`20person. X X`20`20`20`20`202`20`20`20`20It`20stores`20the`20address`20for`20that`20person, V`20and`20the`20`20address X`20`20`20`20`20`20`20`20`20`20that`20`20person`20`20should`20use`20to`20get V`20to`20you.`20`20It`20also`20allows X`20`20`20`20`20`20`20`20`20`20you`20to`20assign`20an`20alias`20to`20that`20per Vson,`20and`20to`20use`20`20that X`20`20`20`20`20`20`20`20`20`20alias`20`20when`20`20starting`20a`20game`20inste Vad`20of`20the`20full`20e-mail X`20`20`20`20`20`20`20`20`20`20address. X X`20`20`20`20`203`20`20`20`20It`20stores`20information`20that`20allows`20ldb V`20to`20`20reject`20`20start X`20`20`20`20`20`20`20`20`20`20messages`20from`20defunct`20games. X X`20`20`20`20`20Normally,`20you`20should`20never`20have`20to`20edit`20the`20peo Vple`20file,`20but X`20`20`20`20`20it`20`20is`20`20described`20`20here`20in`20case`20you`20need V`20to`20for`20some`20reason. X`20`20`20`20`20It`20is`20in`20the`20`20same`20`20overall`20`20format`20`20as V`20`20.ldbrc`20`20(name/value X`20`20`20`20`20pairs). X X`20`20`20`20`20addr`20This`20is`20the`20address`20of`20`20the`20`20opponent. V`20`20`20This`20`20is`20`20what X`20`20`20`20`20`20`20`20`20`20uniquely`20`20defines`20`20the`20`20record,`20in V`20case`20you`20are`20playing X`20`20`20`20`20`20`20`20`20`20two`20people`20with`20the`20same`20name. X X`20`20`20`20`20name`20This`20is`20the`20name`20of`20the`20opponent. X X`20`20`20`20`20alias X`20`20`20`20`20`20`20`20`20`20This`20is`20a`20"nickname"`20you`20can`20`20assi Vgn`20`20to`20`20an`20`20opponent. X`20`20`20`20`20`20`20`20`20`20When`20`20a`20new`20opponent`20is`20found,`20the V`20alias`20is`20initialized X`20`20`20`20`20`20`20`20`20`20to`20the`20first`20word`20of`20`20the`20`20oppon Vent's`20`20name,`20`20with`20`20all X`20`20`20`20`20`20`20`20`20`20upper`20`20case`20`20letters`20`20changed`20to V`20lower.`20`20You`20can`20change X`20`20`20`20`20`20`20`20`20`20the`20alias`20to`20any`20desired`20`20string`20 V`20with`20`20a`20`20text`20`20editor X`20`20`20`20`20`20`20`20`20`20(just`20`20make`20sure`20ldb`20isn't`20running V`20at`20the`20time,`20or`20your X`20`20`20`20`20`20`20`20`20`20changes`20will`20be`20lost). X X`20`20`20`20`20myaddr X`20`20`20`20`20`20`20`20`20`20This`20is`20the`20address`20that`20this`20oppone Vnt`20`20should`20`20use`20`20to X`20`20`20`20`20`20`20`20`20`20mail`20to`20you.`20`20This`20saves`20you`20from V`20having`20to`20specify`20the X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2013 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20`20`20`20`20`20-myaddr`20`20argument`20`20when`20`20starting V`20`20a`20`20`20game,`20`20`20and`20`20`20is X`20`20`20`20`20`20`20`20`20`20especially`20`20important`20with`20permanent`20g Vames,`20since`20these X`20`20`20`20`20`20`20`20`20`20games`20are`20started`20automatically`20without V`20`20giving`20`20you`20`20a X`20`20`20`20`20`20`20`20`20`20chance`20`20to`20`20change`20`20your`20address. V`20`20If`20you`20only`20have`20one X`20`20`20`20`20`20`20`20`20`20e-mail`20path,`20`20you`20`20can`20`20ignore`20 V`20this.`20`20`20This`20`20field`20`20is X`20`20`20`20`20`20`20`20`20`20initialized`20`20to`20`20the`20value`20of`20the V`20-_`08m_`08y_`08a_`08d_`08d_`08r`20option`20at`20the X`20`20`20`20`20`20`20`20`20`20time`20the`20first`20game`20with`20this`20oppone Vnt`20is`20`20started,`20`20or X`20`20`20`20`20`20`20`20`20`20to`20the`20value`20of`20myaddr`20from`20.ldbrc V`20if`20no`20-_`08m_`08y_`08a_`08d_`08d_`08r`20option X`20`20`20`20`20`20`20`20`20`20was`20used. X X`20`20`20`20`20equiv X`20`20`20`20`20`20`20`20`20`20The`20presence`20of`20this`20field`20flags`20 V`20this`20`20as`20`20an`20`20"equiv" X`20`20`20`20`20`20`20`20`20`20record.`20`20`20Equiv`20`20records`20`20allow V`20`20one`20`20opponent`20`20to`20have X`20`20`20`20`20`20`20`20`20`20multiple`20e-mail`20addresses,`20but`20to`20caus Ve`20all`20of`20them`20`20to X`20`20`20`20`20`20`20`20`20`20refer`20`20to`20`20one`20`20people`20`20record. V`20`20`20Equiv`20records`20have`20no X`20`20`20`20`20`20`20`20`20`20valid`20`20fields`20`20except`20`20_`08a_`08d_ V`08d_`08r`20`20and`20`20_`08e_`08q_`08u_`08i_`08v,`20`20and`20`20must`20`20be X`20`20`20`20`20`20`20`20`20`20preceded`20`20by`20`20the`20`20record`20`20they V`20`20refer`20to`20in`20the`20people X`20`20`20`20`20`20`20`20`20`20file. X X`20`20`20`20`20fence X`20`20`20`20`20`20`20`20`20`20The`20fence`20is`20defined`20as`20the`20`20start V`20`20time`20`20of`20`20the`20`20most X`20`20`20`20`20`20`20`20`20`20recently`20started`20game`20that`20has`20finishe Vd.`20`20If`20that`20makes X`20`20`20`20`20`20`20`20`20`20no`20sense,`20don't`20worry,`20you`20should`20ne Vver`20`20have`20`20to`20`20mess X`20`20`20`20`20`20`20`20`20`20with`20it.`20`20It`20is`20used`20to`20discard V`20old`20start`20messages`20that X`20`20`20`20`20`20`20`20`20`20you`20forgot`20to`20clean`20out`20of`20your`20ma Vil. X X`20`20`20`20`20score X`20`20`20`20`20`20`20`20`20`20This`20is`20an`20array`20`20of`20`2010`20`20numb Vers`20`20that`20`20represent,`20`20in X`20`20`20`20`20`20`20`20`20`20order: X X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Games`20won X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Games`20lost X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Points`20won X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Points`20lost X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Gammons`20won X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Gammons`20lost X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Backgammons`20won X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Backgammons`20lost X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Matches`20won X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20-`20Matches`20lost X X`20`20`20`20`20`20`20`20`20`20This`20information`20is`20stored`20purely`20for V`20whatever`20purposes X`20`20`20`20`20`20`20`20`20`20you`20can`20think`20of. X X`20`20`20`20`20end`20`20This`20line`20is`20required`20to`20separate`20people V`20`20records.`20`20`20If X`20`20`20`20`20`20`20`20`20`20you`20hand`20enter`20a`20record,`20you`20must V`20be`20sure`20to`20put`20an`20end X`20`20`20`20`20`20`20`20`20`20marker`20or`20your`20record`20will`20merge`20 V`20with`20`20the`20`20next`20`20one, X`20`20`20`20`20`20`20`20`20`20which`20is`20not`20what`20you`20want. X XSTARTING`20A`20GAME X`20`20`20`20`20To`20start`20a`20game,`20`20you`20`20must`20`20use`20`20the`20 V`20-_`08s_`08t_`08a_`08r_`08t`20`20command`20`20line X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2014 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20argument,`20`20along`20`20with`20`20the`20e-mail`20address`20of V`20the`20person`20you X`20`20`20`20`20wish`20to`20play`20with.`20`20For`20example, X`20`20`20`20`20`20`20`20`20`20ldb`20-start`20mybuddy@back.gammon.com X`20`20`20`20`20If`20you`20want`20to`20play`20'w',`20and`20make`20your`20oppone Vnt`20play X`20`20`20`20`20`20`20`20`20`20ldb`20-color`20wb`20-start`20black@blah.blah.bla Vh X`20`20`20`20`20See`20the`20OPTIONS`20section`20for`20more`20details`20`20on V`20`20the`20`20available X`20`20`20`20`20command`20line`20arguments.`20`20_`08L_`08d_`08b`20will`20not V`20allow`20you`20to`20play`20with X`20`20`20`20`20yourself,`20but`20that's`20ok`20because`20you'd`20probably`20lo Vse. X X`20`20`20`20`20When`20you`20start`20a`20game,`20ldb`20sends`20your`20e-mail V`20address`20to`20your X`20`20`20`20`20opponent,`20`20along`20with`20your`20opening`20roll.`20`20When V`20your`20opponent X`20`20`20`20`20receives`20your`20message,`20his`20ldb`20will`20roll`20his`20 V`20opening`20`20roll, X`20`20`20`20`20and`20`20decide`20who`20won.`20`20If`20you`20won,`20his`20ldb V`20will`20send`20your`20ldb X`20`20`20`20`20a`20message`20to`20that`20effect,`20and`20the`20board`20will V`20come`20up`20on`20your X`20`20`20`20`20screen`20`20with`20`20that`20`20roll`20`20in`20your`20move`20bl Vock.`20`20If`20he`20won,`20he X`20`20`20`20`20will`20use`20the`20opening`20roll`20and`20his`20ldb`20will`20se Vnd`20your`20`20ldb`20`20a X`20`20`20`20`20message`20`20telling`20`20you`20how`20he`20moved.`20`20Either V`20way,`20the`20game`20is X`20`20`20`20`20off`20and`20running. X X`20`20`20`20`20If,`20by`20unfortunate`20chance,`20the`20opening`20roll`20is V`20a`20`20tie,`20`20your X`20`20`20`20`20opponent's`20`20ldb`20will`20send`20your`20ldb`20a`20message V`20to`20that`20effect. X`20`20`20`20`20This`20will`20cause`20a`20new`20opening`20`20roll`20`20sequence V`20`20as`20`20described X`20`20`20`20`20above.`20`20`20A`20`20message`20will`20be`20printed`20telling V`20you`20what's`20going X`20`20`20`20`20on;`20just`20keep`20feeding`20the`20incoming`20messages`20to V`20ldb,`20`20and`20`20it X`20`20`20`20`20will`20take`20care`20of`20everything. X XPLAYING`20A`20GAME X`20`20`20`20`20When`20it`20is`20your`20turn,`20the`20game`20will`20`20be`20 V`20displayed`20`20on`20`20your X`20`20`20`20`20screen,`20`20and`20`20you`20`20will`20`20be`20`20faced`20with V`20three`20options:`20Roll, X`20`20`20`20`20Double,`20or`20Concede.`20`20Unless`20you`20are`20very`20cocky, V`20I`20would`20`20not X`20`20`20`20`20suggest`20`20doubling`20`20at`20this`20point.`20`20You`20could V`20always`20concede, X`20`20`20`20`20but`20I`20really`20think`20that`20would`20be`20selling`20yourse Vlf`20short.`20`20So X`20`20`20`20`20you`20`20should`20`20choose`20`20"Roll".`20`20Just`20press`20"r V",`20and`20watch`20your X`20`20`20`20`20roll`20appear`20on`20your`20move`20block`20(along`20the`20right V`20side`20of`20`20the X`20`20`20`20`20screen,`20`20under`20`20the`20word`20"You").`20`20You`20should V`20see`20two`20numbers X`20`20`20`20`20appear`20(four`20if`20you`20rolled`20doubles),`20`20and`20`20th Ve`20`20word`20`20UNUSED X`20`20`20`20`20beside`20`20them.`20`20`20Decide`20`20which`20`20of`20`20the V`20rolls`20you`20want`20to`20use X`20`20`20`20`20first,`20and`20press`20the`20number`20of`20that`20roll.`20`20Fo Vr`20example,`20`20say X`20`20`20`20`20you`20`20rolled`20`201`206,`20and`20you`20want`20to`20move`20th Ve`20obvious`208-7,`2013-7 X`20`20`20`20`20to`20make`20your`20bar`20point.`20`20Just`20hit`20"6".`20`20 V`20Notice`20`20the`20`20cursor X`20`20`20`20`20jump`20`20up`20`20to`20`20your`20`20move`20`20block,`20beside V`20the`20"6"`20roll?`20`20It`20is X`20`20`20`20`20waiting`20for`20you`20to`20enter`20the`20point`20you`20want`20 V`20to`20`20move`20`20from. X`20`20`20`20`20Press`20`20"1"`20`20"3"`20`20(don't`20hit`20return).`20`20You V`20should`20see`20a`20piece X`20`20`20`20`20move`20from`2013`20to`207,`20and`20this`20fact`20will`20be`20re Vflected`20`20in`20`20your X`20`20`20`20`20move`20block`20as`20well.`20`20Now,`20press`20"1".`20`20Again V`20the`20cursor`20jumps X`20`20`20`20`20to`20the`20move`20block,`20and`20you`20type`20"8".`20`20The`20 V`20second`20`20entry`20`20in X`20`20`20`20`20the`20`20move`20`20block`20`20reflects`20`20this`20`20move,`20 V`20as`20`20does`20the`20board. X`20`20`20`20`20Happy?`20`20If`20not,`20press`20"r";`20this`20will`20`20reset V`20`20your`20`20rolls`20`20to X`20`20`20`20`20UNUSED`20`20and`20`20put`20`20the`20`20board`20`20back`20`20to V`20how`20it`20was`20before`20you X`20`20`20`20`20moved,`20`20and`20`20then`20`20you`20`20can`20`20enter`20`20som Ve`20`20different`20`20`20moves. X`20`20`20`20`20Otherwise,`20`20hit`20"s"`20(not`20"q"!)`20to`20send`20the`20mo Vve.`20`20The`20cursor X`20`20`20`20`20will`20jump`20down`20to`20the`20message`20area,`20where`20you V`20get`20`20a`20`20chance X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2015 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20to`20enclose`20a`20message`20to`20your`20opponent,`20perhaps V`20to`20gloat`20over X`20`20`20`20`20the`20great`20move`20you`20just`20made.`20`20You`20only`20get V`202`20`20lines`20`20of`20`2056 X`20`20`20`20`20characters,`20`20so`20`20keep`20`20it`20`20short.`20`20`20When V`20you`20are`20done,`20press X`20`20`20`20`20.`20`20Your`20move`20is`20on`20its`20way! X X`20`20`20`20`20There`20are`20three`20shortcuts`20you`20can`20use`20after`20you V`20have`20entered X`20`20`20`20`20your`20first`20move: X X`20`20`20`20`201.`20`20`20You`20can`20press`20,`20which`20will`20"repe Vat"`20`20your`20`20last X`20`20`20`20`20`20`20`20`20`20move.`20`20That`20is,`20your`20next`20remaining V`20roll`20will`20move`20from X`20`20`20`20`20`20`20`20`20`20the`20same`20point`20as`20your`20last`20one`20mo Vved`20`20from.`20`20`20This`20`20is X`20`20`20`20`20`20`20`20`20`20handy`20`20when`20`20using`20`20doubles`20to`20m Vove`20more`20than`20one`20piece X`20`20`20`20`20`20`20`20`20`20from`20the`20same`20point. X X`20`20`20`20`202.`20`20`20You`20can`20press`20,`20which`20will`20"conti Vnue"`20your`20`20last X`20`20`20`20`20`20`20`20`20`20move.`20`20That`20is,`20your`20next`20remaining V`20roll`20will`20move`20from X`20`20`20`20`20`20`20`20`20`20the`20point`20your`20last`20move`20ended`20on. X X`20`20`20`20`203.`20`20`20You`20can`20press`20"p",`20which`20will`20attempt V`20to`20make`20the`20point X`20`20`20`20`20`20`20`20`20`20your`20last`20move`20ended`20on.`20`20In`20our V`201`206`20example`20above,`20you X`20`20`20`20`20`20`20`20`20`20could`20have`20just`20hit`20"p"`20after`20you V`20moved`2013-7,`20`20and`20`20ldb X`20`20`20`20`20`20`20`20`20`20would`20`20have`20`20figured`20`20out`20that`20t Vo`20make`20the`207`20point`20with X`20`20`20`20`20`20`20`20`20`20the`20remaining`20roll`20of`201,`20it`20would V`20have`20to`20move`20a`20`20piece X`20`20`20`20`20`20`20`20`20`20from`20the`208`20point. X X`20`20`20`20`20In`20addition,`20there`20is`20one`20more`20shortcut`20`20that V`20`20may`20`20be`20`20used X`20`20`20`20`20with`20`20any`20`20roll.`20`20`20If`20`20you`20`20want`20to`20u Vse`20a`20roll`20to`20bear`20off`20a X`20`20`20`20`20piece,`20you`20can`20just`20hit`20"o".`20`20Ldb`20will`20locate V`20the`20point`20`20(if X`20`20`20`20`20any)`20`20from`20which`20pieces`20may`20be`20legally`20borne V`20off`20by`20the`20next X`20`20`20`20`20unused`20roll,`20and`20make`20that`20move`20automatically.`20 V`20You`20can`20also X`20`20`20`20`20select`20a`20roll,`20then`20hit`20"o". X X`20`20`20`20`20If`20you`20use`20your`20moves,`20hit`20"Send",`20and`20start V`20to`20`20enter`20`20your X`20`20`20`20`20message,`20`20then`20realize`20you`20made`20a`20mistake,`20you V`20can`20press`20ESC X`20`20`20`20`20to`20get`20out`20of`20send`20and`20back`20into`20the`20game, V`20where`20you`20can`20use X`20`20`20`20`20"Reset"`20and`20re-enter`20your`20moves. X XDOUBLING X`20`20`20`20`20If`20you`20decide`20to`20double,`20just`20`20choose`20`20"Doubl Ve"`20`20instead`20`20of X`20`20`20`20`20"Roll".`20`20`20You`20`20will`20get`20to`20enclose`20a`20messag Ve,`20just`20like`20when X`20`20`20`20`20you`20send`20a`20move,`20then`20your`20message`20gets`20sent. V`20`20Once`20you`20have X`20`20`20`20`20doubled,`20`20you`20`20cannot`20`20double`20again`20until`20you Vr`20opponent`20does X`20`20`20`20`20so,`20so`20ldb`20automatically`20selects`20"Roll"`20and`20sends V`20you`20to`20the X`20`20`20`20`20next`20`20menu.`20`20`20If`20`20you`20don't`20like`20this,`20yo Vu`20can`20disable`20it`20by X`20`20`20`20`20setting`20_`08a_`08u_`08t_`08o_`08r_`08o_`08l_`08l=_`08n_`08o V`20in`20.ldbrc. X X`20`20`20`20`20If`20your`20opponent`20doubles,`20you`20will`20see`20a`20messag Ve`20just`20`20under X`20`20`20`20`20the`20`20board`20`20to`20that`20effect,`20and`20a`20menu`20will V`20come`20up`20allowing X`20`20`20`20`20you`20to`20Accept`20or`20Decline`20the`20double.`20`20Declining V`20`20the`20`20double X`20`20`20`20`20means`20`20you`20`20lose`20`20the`20`20game`20`20for`20`20the V`20`20current`20`20game`20`20value. X`20`20`20`20`20Accepting`20means`20that`20the`20game`20continues,`20but`20`20i Vts`20`20value`20`20is X`20`20`20`20`20doubled.`20`20The`20current`20game`20value`20is`20shown`20to V`20the`20left`20of`20the X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2016 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20board.`20`20After`20you`20accept,`20you`20should`20see`20this V`20`20display`20`20move X`20`20`20`20`20next`20`20to`20`20your`20`20home`20`20board,`20`20indicating V`20`20that`20`20you`20`20own`20the X`20`20`20`20`20doubling`20cube. X X`20`20`20`20`20If`20the`20Crawford`20rule`20`20game`20`20is`20`20being`20`20pl Vayed,`20`20doubling`20`20is X`20`20`20`20`20illegal,`20and`20will`20result`20in`20an`20error`20message. X XBOARDS X`20`20`20`20`20_`08L_`08d_`08b`20maintains`20three`20board`20images`20at`20all V`20times.`20`20These`20are: X X`20`20`20`20`201`20`20`20`20The`20board`20before`20your`20opponent's`20last V`20move.`20`20It`20is`20`20for X`20`20`20`20`20`20`20`20`20`20display`20`20purposes`20`20only,`20so`20you`20ca Vn`20see`20your`20opponent's X`20`20`20`20`20`20`20`20`20`20move`20"before`20and`20after".`20`20The`20pieces V`20your`20`20opponent`20`20is +-+-+-+-+-+-+-+- END OF PART 2 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+ X`20`20`20`20`20`20`20`20`20`20going`20to`20move`20are`20highlighted. X X`20`20`20`20`202`20`20`20`20The`20board`20after`20your`20opponent's`20last`20 V`20move.`20`20`20It`20`20shows X`20`20`20`20`20`20`20`20`20`20the`20`20condition`20`20of`20the`20board`20after V`20your`20opponent's`20last X`20`20`20`20`20`20`20`20`20`20move,`20with`20the`20pieces`20he`20moved`20highl Vighted. X X`20`20`20`20`203`20`20`20`20The`20current`20board.`20`20This`20is`20the`20"rea Vl"`20board`20that`20shows X`20`20`20`20`20`20`20`20`20`20the`20current`20state`20of`20the`20game.`20`20No Vthing`20is`20highlighted. X X`20`20`20`20`20By`20default,`20ldb`20displays`20the`20Current`20board`20at`20a Vll`20times.`20`20If X`20`20`20`20`20you`20`20want`20`20to`20`20see`20`20the`20`20other`20boards, V`20use`20the`20Board`20command X`20`20`20`20`20(provided`20it`20is`20in`20`20the`20`20current`20`20menu).`20 V`20`20This`20`20will`20`20cycle X`20`20`20`20`20through`20the`20three`20boards`20in`20the`20order`20they`20are V`20listed`20above. X`20`20`20`20`20The`20second`20line`20of`20the`20`20screen`20`20tells`20`20you V`20`20which`20`20board`20`20is X`20`20`20`20`20displayed`20(near`20the`20left).`20`20When`20you`20roll,`20ldb V`20automatically X`20`20`20`20`20switches`20to`20the`20current`20board`20if`20it`20is`20not`20al Vready`20up.`20`20`20You X`20`20`20`20`20can`20`20set`20`20which`20of`20these`20three`20boards`20is`20in Vitially`20displayed X`20`20`20`20`20via`20the`20_`08i_`08n_`08i_`08t_`08i_`08a_`08l_`08b_`08o_`08a_ V`08r_`08d`20setting`20in`20.ldbrc. X XENTERING`20COMMENTS X`20`20`20`20`20Whenever`20you`20send`20a`20move`20to`20your`20opponent,`20you V`20are`20given`20the X`20`20`20`20`20opportunity`20`20to`20`20enclose`20a`20two`20line`20comment. V`20`20While`20entering X`20`20`20`20`20your`20comment,`20certain`20keys`20have`20special`20meaning. V`20`20These`20are: X X`20`20`20`20`20BS/DEL X`20`20`20`20`20`20`20`20`20`20The`20backspace`20and`20delete`20(or`20rubout) V`20`20keys`20`20both`20`20erase X`20`20`20`20`20`20`20`20`20`20the`20`20last`20`20character`20typed.`20`20You V`20can`20backspace`20from`20one X`20`20`20`20`20`20`20`20`20`20line`20to`20the`20previous`20one. X X`20`20`20`20`20`5EW/`5EB X`20`20`20`20`20`20`20`20`20`20The`20`5EW`20and`20`5EB`20(control-W`20and`20con Vtrol-B)`20keys`20both`20erase X`20`20`20`20`20`20`20`20`20`20the`20last`20word`20typed.`20`20Words`20are`20de Vlimited`20by`20spaces. X X`20`20`20`20`20`5EX/`5EU X`20`20`20`20`20`20`20`20`20`20The`20`5EX`20and`20`5EU`20(control-X`20and`20con Vtrol-U)`20keys`20erase`20`20the X`20`20`20`20`20`20`20`20`20`20current`20`20line`20and`20move`20to`20the`20end V`20of`20the`20previous`20line, X`20`20`20`20`20`20`20`20`20`20or`20to`20the`20beginning`20of`20the`20first`20l Vine`20if`20`20used`20`20on`20`20the X`20`20`20`20`20`20`20`20`20`20first`20line. X X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2017 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20RETURN X`20`20`20`20`20`20`20`20`20`20If`20you`20press`20return`20on`20an`20empty`20li Vne,`20or`20`20on`20`20the`20`20last X`20`20`20`20`20`20`20`20`20`20line,`20`20the`20`20comment`20is`20finished.`20 V`20Otherwise,`20the`20cursor X`20`20`20`20`20`20`20`20`20`20moves`20to`20the`20next`20line. X X`20`20`20`20`20ESC`20`20The`20`20escape`20`20key`20`20aborts`20`20the`20`20ope Vration`20`20(e.g.`20`20Send), X`20`20`20`20`20`20`20`20`20`20restores`20`20the`20`20previous`20`20comment, V`20`20and`20`20returns`20`20to`20the X`20`20`20`20`20`20`20`20`20`20previous`20menu.`20`20This`20allows`20you`20to V`20change`20your`20mind`20and X`20`20`20`20`20`20`20`20`20`20back`20out`20of`20an`20operation. X X`20`20`20`20`20All`20other`20keys`20are`20entered`20into`20the`20comment.`20 V`20When`20you`20reach X`20`20`20`20`20the`20end`20of`20a`20line,`20ldb`20word-wraps`20to`20the`20next V`20line,`20or`20beeps X`20`20`20`20`20if`20you`20are`20at`20the`20end`20of`20`20the`20`20last`20`20li Vne.`20`20`20Note`20`20that`20`20the X`20`20`20`20`20superkey`20is`20still`20active`20while`20entering`20comments, V`20and`20cannot X`20`20`20`20`20be`20entered`20into`20a`20comment. X XCONTROLLING`20A`20GAME X`20`20`20`20`20The`20-_`08c_`08o_`08n_`08t_`08r_`08o_`08l`20option`20permits V`20you`20to`20`20control`20`20your`20`20games`20`20in X`20`20`20`20`20certain`20ways.`20`20Each`20of`20your`20current`20games`20are V`20displayed,`20one X`20`20`20`20`20at`20a`20time,`20just`20as`20they`20are`20when`20you`20are`20 V`20playing,`20`20allowing X`20`20`20`20`20you`20`20to`20`20perform`20`20any`20`20of`20the`20functions`20o Vn`20the`20control`20menu. X`20`20`20`20`20The`20control`20menu`20has`20the`20following`20commands: X X`20`20`20`20`20Invert X`20`20`20`20`20`20`20`20`20`20This`20allows`20you`20to`20invert`20the`20board V`20for`20this`20game.`20`20The X`20`20`20`20`20`20`20`20`20`20board`20`20will`20`20invert`20`20immediately`20o Vn`20your`20screen,`20so`20you X`20`20`20`20`20`20`20`20`20`20can`20see`20if`20you`20like`20it.`20`20Pressing V`20_`08I_`08n_`08v_`08e_`08r_`08t`20again`20will`20put X`20`20`20`20`20`20`20`20`20`20it`20back`20to`20normal.`20`20Inverting`20the V`20board`20does`20not`20affect X`20`20`20`20`20`20`20`20`20`20the`20point`20numbering`20or`20the`20color`20you V`20`20play,`20`20it`20`20merely X`20`20`20`20`20`20`20`20`20`20draws`20the`20board`20with`20the`20low-numbered V`20points`20at`20the`20top X`20`20`20`20`20`20`20`20`20`20of`20the`20screen`20rather`20than`20the`20bottom V.`20`20You`20may`20find`20`20it X`20`20`20`20`20`20`20`20`20`20easier`20`20to`20`20make`20`20all`20`20of`20`20y Vour`20`20games`20`20play`20`20a`20certain X`20`20`20`20`20`20`20`20`20`20direction. X X`20`20`20`20`20Resend X`20`20`20`20`20`20`20`20`20`20From`20time`20to`20time,`20messages`20may`20be V`20lost`20due`20`20to`20`20faulty X`20`20`20`20`20`20`20`20`20`20mailers`20`20or`20`20human`20`20error.`20`20`20I Vf`20`20your`20last`20message`20gets X`20`20`20`20`20`20`20`20`20`20lost,`20you`20can`20regenerate`20it`20with`20 V`20the`20`20_`08R_`08e_`08s_`08e_`08n_`08d`20`20command. X`20`20`20`20`20`20`20`20`20`20There`20`20is`20no`20harm`20in`20regenerating V`20messages,`20as`20ldb`20will X`20`20`20`20`20`20`20`20`20`20ignore`20duplicate`20messages.`20`20If`20you`20 V`20and`20`20your`20`20opponent X`20`20`20`20`20`20`20`20`20`20have`20forgotten`20whose`20move`20it`20is,`20the V`20easiest`20way`20to`20get X`20`20`20`20`20`20`20`20`20`20going`20again`20is`20for`20both`20of`20`20you V`20`20to`20`20resend`20`20your`20`20last X`20`20`20`20`20`20`20`20`20`20message.`20`20`20The`20`20one`20that`20got`20los Vt`20will`20be`20accepted,`20and X`20`20`20`20`20`20`20`20`20`20the`20game`20will`20be`20off`20and`20running`20a Vgain.`20`20`20So`20`20that`20`20you X`20`20`20`20`20`20`20`20`20`20can`20resend`20the`20last`20move`20of`20a`20game V,`20completed`20games`20are X`20`20`20`20`20`20`20`20`20`20kept`20in`20your`20.ldbdata`20for`201`20week, V`20after`20which`20they`20`20are X`20`20`20`20`20`20`20`20`20`20deleted.`20`20`20They`20`20may`20`20be`20deleted V`20sooner`20with`20the`20Delete X`20`20`20`20`20`20`20`20`20`20Game`20command.`20`20Note`20also`20`20that`20 V`20games`20`20that`20`20have`20`20been X`20`20`20`20`20`20`20`20`20`20waiting`20`20for`20your`20opponent`20for`20more V`20than`201`20week`20have`20an X`20`20`20`20`20`20`20`20`20`20automatic`20`20resend`20`20performed`20`20whenev Ver`20`20you`20`20run`20`20`20ldb. X`20`20`20`20`20`20`20`20`20`20Resend`20is`20disabled`20if`20it`20is`20your`20t Vurn. X X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2018 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20Get`20Resend X`20`20`20`20`20`20`20`20`20`20This`20allows`20you`20to`20send`20a`20message V`20`20to`20`20your`20`20opponent's X`20`20`20`20`20`20`20`20`20`20ldb`20`20requesting`20a`20resend.`20`20This`20sa Vves`20your`20opponent`20the X`20`20`20`20`20`20`20`20`20`20trouble`20of`20getting`20into`20-_`08c_`08o_`08n V_`08t_`08r_`08o_`08l,`20`20finding`20`20which`20`20game X`20`20`20`20`20`20`20`20`20`20you're`20`20talking`20`20about,`20and`20resendin Vg.`20`20Instead,`20he`20can X`20`20`20`20`20`20`20`20`20`20just`20feed`20your`20resend`20request`20message V`20into`20ldb`20like`20`20it X`20`20`20`20`20`20`20`20`20`20was`20`20a`20`20regular`20move.`20`20Version`201 V.0`20of`20ldb`20not`20only`20does X`20`20`20`20`20`20`20`20`20`20not`20support`20this`20feature,`20but`20will`20c Vrash`20`20if`20`20a`20`20resend X`20`20`20`20`20`20`20`20`20`20request`20packet`20is`20sent`20to`20it,`20so`20- V_`08c_`08o_`08n_`08t_`08r_`08o_`08l`20will`20check`20to X`20`20`20`20`20`20`20`20`20`20make`20sure`20your`20opponent`20is`20running`20t Vhe`20`20proper`20`20version X`20`20`20`20`20`20`20`20`20`20before`20`20sending`20`20the`20message.`20`20"Ge Vt`20Resend"`20is`20disabled X`20`20`20`20`20`20`20`20`20`20for`20games`20that`20are`20over. X X`20`20`20`20`20Screen`20Dump X`20`20`20`20`20`20`20`20`20`20This`20command`20makes`20an`20exact`20copy`20of V`20the`20screen`20`20in`20`20the X`20`20`20`20`20`20`20`20`20`20file`20`20"ldb_screen.dmp".`20`20`20This`20`20co Vuld`20`20be`20useful`20if`20you X`20`20`20`20`20`20`20`20`20`20want`20to`20mail`20the`20board`20to`20someone V`20or`20print`20it`20out. X X`20`20`20`20`20Delete`20Game X`20`20`20`20`20`20`20`20`20`20This`20command`20marks`20a`20game`20for`20deleti Von.`20`20`20The`20`20game`20`20is X`20`20`20`20`20`20`20`20`20`20not`20`20deleted`20until`20you`20quit,`20and`20y Vou`20can`20undelete`20it`20by X`20`20`20`20`20`20`20`20`20`20pressing`20D`20again.`20`20Normally,`20you`20sho Vuld`20`20not`20`20delete`20`20a X`20`20`20`20`20`20`20`20`20`20game`20in`20this`20manner,`20you`20should`20play V`20until`20someone`20wins X`20`20`20`20`20`20`20`20`20`20or`20concedes.`20`20The`20_`08D_`08e_`08l_`08e_ V`08t_`08e`20_`08G_`08a_`08m_`08e`20command`20can`20`20be`20`20used`20`20to X`20`20`20`20`20`20`20`20`20`20get`20rid`20of`20games`20where`20your`20opponent V`20doesn't`20answer`20his X`20`20`20`20`20`20`20`20`20`20mail,`20or`20doesn't`20want`20to`20play,`20etc. X X`20`20`20`20`20Next`20Game X`20`20`20`20`20`20`20`20`20`20The`20next`20game`20is`20displayed.`20`20If`20th Vere`20is`20no`20next`20`20game, X`20`20`20`20`20`20`20`20`20`20this`20choice`20is`20equivalent`20to`20_`08Q_ V`08u_`08i_`08t. X X`20`20`20`20`20Quit`20This`20allows`20you`20to`20exit`20from`20-_`08c_`08o_ V`08n_`08t_`08r_`08o_`08l`20.`20If`20you`20made`20any X`20`20`20`20`20`20`20`20`20`20changes`20`20`20to`20`20`20your`20`20`20games, V`20`20you`20`20will`20`20be`20`20given`20`20the X`20`20`20`20`20`20`20`20`20`20opportunity`20to`20save`20these`20changes,`20the Vn`20ldb`20will`20exit. X XVMS`20NOTES X`20`20`20`20`20VMS`20users`20have`20a`20few`20unique`20considerations: X X`20`20`20`20`20On`20VMS,`20the`20default`20file`20names`20are`20`20changed`20 V`20from`20`20.ldb*`20`20to X`20`20`20`20`20ldb.*.`20`20This`20groups`20all`20ldb`20files`20together. X X`20`20`20`20`20VMS`20mail`20doesn't`20append`20messages`20to`20`20an`20`20exis Vting`20`20file,`20`20it X`20`20`20`20`20creates`20`20new`20`20versions.`20`20`20To`20`20accommodate`20t Vhis,`20vms-compiled X`20`20`20`20`20executables`20will`20search`20all`20versions`20of`20a`20file V`20`20by`20`20default. X`20`20`20`20`20This`20`20applies`20to`20files`20specified`20on`20the`20command V`20line`20as`20well X`20`20`20`20`20as`20the`20file`20specified`20in`20your`20ldb.rc.`20`20You`20ca Vn`20disable`20`20this X`20`20`20`20`20in`20`20either`20`20case`20`20by`20`20specifying`20`20a`20`20ve Vrsion`20`20number,`20`20or`20by X`20`20`20`20`20specifying`20version`20number`200`20to`20get`20the`20most`20cur Vrent`20version. X`20`20`20`20`20The`20`20`20`20default`20`20`20`20setting`20`20`20`20in`20`20 V`20`20ldb.rc`20`20`20`20is`20`20`20`20to`20`20`20scan X`20`20`20`20`20sys$login:ldb.rcv;*.`20`20You`20`20might`20`20want`20`20to`20 V`20change`20`20this`20`20to X`20`20`20`20`20ldb.txt;*,`20since`20that`20is`20the`20default`20extension`20ad Vded`20by`20mail X`20`20`20`20`20when`20you`20extract`20a`20file.`20`20If`20you`20use`20multiple V`20versions,`20`20you X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2019 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20should`20be`20careful`20not`20to`20PURGE`20until`20after`20you V`20have`20run`20ldb. X X`20`20`20`20`20If`20you`20have`20the`20Eunice`20package,`20ldb`20`20will`20 V`20compile`20`20and`20`20run X`20`20`20`20`20under`20`20it`20fine,`20but`20any`20files`20created`20by`20the V`20Eunice-compiled X`20`20`20`20`20version`20(most`20notably`20the`20games`20file)`20will`20`20be V`20`20incompatible X`20`20`20`20`20with`20`20the`20VAX`20C-compiled`20version.`20`20Use`20the`20un Vixtovms`20command X`20`20`20`20`20to`20convert. X X`20`20`20`20`20Ldb`20`20is`20`20available`20`20in`20`20vms_share`20`20format V`20`20with`20`20the`20`20manual X`20`20`20`20`20preformatted.`20`20If`20you`20have`20MMS,`20you`20can`20use`20t Vhe`20makefile.vms X`20`20`20`20`20provided`20by`20entering: X`20`20`20`20`20`20`20`20`20`20$`20rename`20makefile.vms`20makefile. X`20`20`20`20`20`20`20`20`20`20$`20make X`20`20`20`20`20If`20you`20don't`20have`20a`20make`20available,`20you`20can`20c Vompile`20with: X`20`20`20`20`20`20`20`20`20`20$`20@makeldb X`20`20`20`20`20After`20ldb`20is`20compiled,`20you'll`20`20probably`20`20want V`20`20to`20`20define`20`20a X`20`20`20`20`20symbol`20such`20as: X`20`20`20`20`20`20`20`20`20`20$`20ldb`20:==`20$dua0:`5Bme.ldb`5Dldb X`20`20`20`20`20so`20you`20can`20run`20it. X X`20`20`20`20`20The`20VMS`20implementation`20spawns`20a`20subprocess`20with`20 V`20no`20`20command X`20`20`20`20`20when`20`20the`20`20superkey`20is`20pressed.`20`20You`20can`20en Vter`20LOGOUT`20or`20EOJ X`20`20`20`20`20to`20return`20to`20the`20game.`20`20If`20you`20define`20a`20com Vmand`20to`20run`20`20when X`20`20`20`20`20the`20`20superkey`20`20is`20`20pressed,`20the`20command`20will V`20be`20run,`20but`20you X`20`20`20`20`20will`20still`20need`20to`20logout`20of`20the`20`20subprocess V`20`20to`20`20return`20`20to X`20`20`20`20`20ldb. X XBUGS X`20`20`20`20`20A`20game`20file`20created`20by`20ldb`20under`20Eunice`20must V`20be`20run`20`20through X`20`20`20`20`20"unixtovms"`20before`20the`20VAX-C`20ldb`20can`20read`20it. X X`20`20`20`20`20The`20superkey`20function`20only`20works`20when`20ldb`20is`20wa Viting`20`20for`20`20a X`20`20`20`20`20key.`20`20`20If`20`20ldb`20`20is`20`20doing`20`20something`20ti Vme-consuming,`20such`20as X`20`20`20`20`20calculating`20legal`20moves,`20the`20superkey`20will`20`20not V`20`20work`20`20until X`20`20`20`20`20the`20calculation`20is`20complete. X X`20`20`20`20`20There`20should`20be`20a`20way`20to`20play`20`20interactively V`20`20(using`20`20socket X`20`20`20`20`20connections,`20for`20example),`20rather`20than`20via`20e-mail. X X`20`20`20`20`20Under`20Eunice,`20there`20`20is`20`20a`20`20bug`20`20when`20 V`20delmail`20`20is`20`20enabled, X`20`20`20`20`20received`20mail`20is`20in`20a`20file`20with`20multiple`20versio Vns,`20and`20these X`20`20`20`20`20versions`20are`20entered`20on`20the`20`20command`20`20line`20 V`20(as`20`20opposed`20`20to X`20`20`20`20`20being`20`20specified`20`20by`20`20a`20`20pattern`20in`20.ldbrc) V.`20`20Eunice`20handles X`20`20`20`20`20multiple`20versions`20by`20appending`20a`20dot`20and`20the`20ve Vrsion`20`20number X`20`20`20`20`20to`20all`20versions`20of`20the`20file`20but`20the`20newest`20ve Vrsion,`20to`20which X`20`20`20`20`20it`20`20appends`20`20nothing.`20`20`20When`20`20the`20`20most V`20`20recent`20`20version`20`20is X`20`20`20`20`20deleted,`20the`20next`20older`20version`20becomes`20the`20most V`20recent,`20and X`20`20`20`20`20has`20no`20version`20suffix`20attached.`20`20This`20file`20will V`20be`20`20skipped, X`20`20`20`20`20since`20`20its`20`20name`20`20changed`20between`20the`20time V`20the`20file`20list`20was X`20`20`20`20`20created`20and`20the`20file`20is`20opened.`20`20All`20`20other V`20`20files`20`20will`20`20be X`20`20`20`20`20scanned`20`20properly.`20`20The`20work-around`20for`20this`20is V`20to`20not`20use`20a X`20`20`20`20`20pattern`20like`20'ldb`20ldb.txt*'`20on`20the`20command`20line V`20`20to`20`20specify X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2020 X X X X X X XLDB(1)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20USER`20COMMANDS V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20LDB(1) X X X X`20`20`20`20`20all`20`20versions`20`20of`20`20the`20`20file,`20`20but`20rather V`20use`20'ldb`20ldb.txt.* X`20`20`20`20`20ldb.txt'`20so`20that`20the`20most`20recent`20`20version`20`20is V`20`20scanned`20`20(and X`20`20`20`20`20thus`20`20deleted)`20`20last.`20`20`20Alternatively,`20`20the V`20`20pattern`20`20can`20be X`20`20`20`20`20quoted`20so`20that`20ldb`20interprets`20it`20instead`20of`20the V`20shell. X X`20`20`20`20`20The`20-_`08m_`08y_`08a_`08d_`08d_`08r`20command`20line`20option V`20should`20override`20`20the`20`20myaddr X`20`20`20`20`20line`20in`20the`20people`20file. X X`20`20`20`20`20Version`201.0`20of`20ldb`20only`20allowed`20the`20colors`20red, V`20`20white,`20`20and X`20`20`20`20`20black,`20`20represented`20`20by`20r,`20w,`20and`20b,`20respecti Vvely.`20`20Although X`20`20`20`20`20ldb`201.0`20will`20allow`20games`20to`20be`20started`20and`20pl Vayed`20`20correctly X`20`20`20`20`20with`20`20different`20colors,`20the`20move`20blocks`20will`20ha Vve`20the`20string X`20`20`20`20`20"*BAD`20COLOR*"`20displayed`20where`20the`20color`20should`20be V,`20making`20it X`20`20`20`20`20difficult`20`20to`20`20figure`20`20out`20`20which`20`20color V`20`20you`20`20are`20`20playing. X`20`20`20`20`20Upgrading`20to`20a`20newer`20ldb`20will`20fix`20`20this.`20`20 V`20Nevertheless,`20`20if X`20`20`20`20`20you`20`20are`20`20playing`20someone`20who`20is`20using`20ldb V`201.0,`20you`20may`20want X`20`20`20`20`20to`20restrict`20your`20color`20choices`20to`20r,`20w,`20and`20b V. X X`20`20`20`20`20Occasionally,`20ldb`20will`20print`20a`20spurious`20message`20t Velling`20`20you X`20`20`20`20`20that`20`20you`20`20only`20have`20one`20legal`20move.`20`20Usual Vly`20when`20it`20prints X`20`20`20`20`20this,`20it`20is`20right,`20but`20in`20the`20special`20case`20 V`20where`20`20you`20`20have X`20`20`20`20`20one`20`20piece`20`20left`20to`20bear`20off,`20one`20of`20your V`20rolls`20is`20less`20than X`20`20`20`20`20you`20need`20to`20bear`20it`20off,`20and`20the`20other`20roll V`20is`20big`20enough`20to X`20`20`20`20`20bear`20off`20by`20itself,`20ldb`20will`20want`20you`20to`20use V`20the`20smaller`20die X`20`20`20`20`20first,`20`20then`20`20bear`20`20off`20`20with`20`20the`20`20big Vger`20`20one.`20`20`20This`20`20`20is X`20`20`20`20`20consistent`20with`20the`20rules`20that`20say`20you`20must`20use V`20both`20dice`20if X`20`20`20`20`20you`20can,`20but`20is`20not`20correct`20in`20this`20case.`20 V`20Note`20that`20you`20can X`20`20`20`20`20either`20`20use`20`20both`20dice`20like`20ldb`20wants,`20or`20i Vgnore`20the`20message X`20`20`20`20`20and`20bear`20off`20`20with`20`20the`20`20larger`20`20die.`20 V`20`20Your`20`20move`20`20will`20`20be X`20`20`20`20`20accepted`20either`20way. X X X X X X X X X X X X X X X X X X X X X X X X X XSun`20Release`204.1`20`20`20Last`20change:`20October`206,`201992`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`2021 X X X $ call unpack LDB.DOC;1 1230471664 "" $! $ create 'f' X.`5C"`20ldb.man`09`098/4/91 X.`5C" X.`5C"`20Copyright`201991`20`20Perry`20R.`20Ross X.`5C" X.`5C"`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20s Voftware`20and`20its X.`5C"`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X.`5C"`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here V`20by`20reference. X.`5C"`20Any`20other`20use`20requires`20written`20permission`20from`20the`20aut Vhor.`20`20This`20software X.`5C"`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X.`5C"`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particula Vr`20purpose. X.`5C"`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20resul Vting`20from`20the X.`5C"`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X.`5C"`20to`20these`20terms. X.`5C" X.`5C"`20VMS`20bug`20fixes`20and`20additions`20by`20Earle`20F.`20Ake`20 X.`5C" X.TH`20LDB`201`20"October`206,`201992" X.nh X.nr`20si`205n X.ie`20`5CnT`20.pl`20`5CnTv X.UC`204 X.SH`20NAME Xldb`20`5C-`20Play`20backgammon`20by`20e`5C-mail X.SH`20SYNOPSIS Xldb`20`5Boptions`5D`20`5Binput`20files...`5D X.br X.SH`20DESCRIPTION X.I`20Ldb Xallows`20two`20people`20to`20play`20backgammon`20over`20a Xnetwork`20using`20electronic`20mail.`20`20It`20runs`20on`20character`5C-orient Ved Xterminals,`20or`20emulators`20thereof,`20using`20the X.I`20curses Xscreen`20package.`20`20It`20will`20run`20on`20most`20UNIX`20dialects,`20as Xwell`20as`20VAX`5C-C`20under`20VMS`205.0`20and`20above. X.I`20Ldb Xwill`20display`20a`20picture`20of`20the`20board,`20prompt`20the`20user`20to Xenter`20a`20move,`20check`20the`20move`20for`20legality, Xand`20send`20the`20move`20to`20the`20opponent. XWhen`20it`20arrives,`20it`20will`20be`20displayed`20on`20the`20opponent's`20sc Vreen, Xafter`20which`20the`20opponent`20will`20be`20prompted`20for`20a`20move`20to Xbe`20sent`20back. X.SH`20FEATURES X.IP`20"Multiple`20Games" X.I`20Ldb Xcan`20keep`20track`20of`20an`20arbitrary`20number`20of`20games`20simultaneousl Vy, Xand`20will`20display`20them`20one`20at`20a`20time`20for`20you`20to`20play. XYou`20can`20exit`20from X.I`20ldb Xat`20any`20time;`20when`20you`20run`20ldb`20again,`20it`20will`20pick`20up Xyour`20games`20where`20you`20left`20off. X.IP`20"Move`20Checking" XBoth`20your`20moves`20and`20your`20opponent's`20moves`20are`20checked`20for V`20legality. XThis`20includes: X.IP`20`5C- XLanding`20on`20an`20occupied`20point. X.IP`20`5C- XBearing`20off`20before`20your`20inner`20table`20is`20full. X.IP`20`5C- XTrying`20to`20move`20pieces`20that`20are`20on`20the`20board`20when`20you Xhave`20a`20piece`20on`20the`20bar. X.IP`20`5C- XTrying`20to`20bear`20off`20a`20piece Xwhen`20there`20is`20a`20piece`20on`20a`20higher`20point,`20and Xthe`20roll`20is`20not`20being`20used`20exactly. X.IP`20`5C- XTrying`20to`20leave`20a`20usable`20move`20unused. X.IP`20`5C- XTrying`20to`20leave`20a`20move`20unused`20when`20it`20is`20usable`20and`20has Xa`20higher`20roll`20than`20the`20move`20that`20is`20used. X.IP`20`5C- XTrying`20to`20double`20when`20you`20doubled`20last. X.IP`20`5C- XTrying`20to`20double`20in`20a`20Crawford`20rule`20game. X.IP`20"Message`20Reliability" X.I`20Ldb Xdetects`20(and`20rejects)`20duplicate`20messages,`20and`20can Xregenerate`20lost`20messages. X.IP`20"Remote`20Start" X.I`20Ldb Xcan`20start`20a`20game`20between`20two`20players`20on`20remote`20hosts. XThis`20is`20used`20to`20set`20up`20"game`20starter"`20hosts, Xwhere`20people`20interested`20in`20finding`20new`20opponents`20are Xmatched`20by`20some`20criteria`20(such`20as`20ability,`20or`20by`20a Xtournament`20schedule),`20and`20have`20their`20games`20started Xautomatically.`20`20For`20a`20current`20listing`20of`20game Xstarter`20hosts,`20see`20the`20README`20file. X.IP`20"Game`20Value" X.I`20Ldb Xdetects`20the`20end`20of`20the`20game,`20gammons,`20and`20backgammons, Xand`20notifies`20both`20players`20of`20the`20game`20value`20when`20the Xgame`20is`20over.`20`20The`20Jacoby`20rule`20may`20be`20enabled, Xas`20may`20European`20scoring,`20to`20calculate`20the`20game`20value Xas`20desired. X.IP`20"Online`20Help`20Screen" X.I`20Ldb Xhas`20an`20online,`20context`20sensitive`20help`20facility Xthat`20lists`20the`20available`20commands`20for`20the`20current`20screen. X.IP`20"Match`20Play" X.I`20Ldb Xcan`20support`20matches`20that`20play`20to`20any Xdesired`20point`20total,`20and`20will`20continue`20to Xstart`20games`20until`20one`20player`20reaches`20that`20total. X.PP X.SH`20OPTIONS X.IP`20"`5CfB-read`20`5CfP" XMail`20is`20read,`20and`20the`20games`20are`20updated`20and`20saved. XThe`20user`20is`20not`20prompted`20for`20his`20moves. XIf`20neither`20`5C-read`20nor`20`5C-play`20are`20given, Xboth`20are`20assumed. X.IP`20"`5CfB-play`20`5CfP" XAny`20games`20that`20are`20waiting`20for`20local`20input`20are Xdisplayed`20for`20the`20user`20to`20process.`20`20No`20mail`20is`20read. XIf`20neither`20`5C-read`20nor`20`5C-play`20are`20given, Xboth`20are`20assumed. X.IP`20"`5CfB-color`20xy`5CfP" XThe`20colors`20for`20the`20game`20started`20by`20this`20ldb`20run`20are`20set V`20to`20x`20and`20y. XThe`20first`20color`20is`20played`20by`20the`20local`20user,`20and`20the Xother`20is`20played`20by`20the`20opponent.`20`20Legal`20color Xcharacters`20are`20any`20printing`20character,`20except`20that`20x Xand`20y`20may`20not`20be`20the`20upper`20and`20lower`20case`20of`20the`20same Xcharacter. XThe`20default`20is`20"`5C-color`20rw". X.IP`20"`5CfB-direction`20up/down`5CfP" XThis`20sets`20the Xdirection`20of`20play`20for`20the`20local`20user Xfor`20the`20game`20started`20by`20this`20ldb`20run. XThe`20default`20is`20"`5C-direction`20up". X.IP`20"`5CfB-myaddr`20addr`5CfP" XYour`20mail`20address`20is`20set`20to X.I`20addr Xfor`20games`20started`20on`20this`20ldb`20run. XThis`20overrides`20the`20address Xspecified`20in X.I`20.ldbrc. X.IP`20"`5CfB-start`20user`5CfP" XA`20game`20is`20started`20with`20the`20specified`20user. XThe X.I`20user Xargument`20may`20be`20any`20e`5C-mail`20address`20that`20is`20valid`20for Xyour`20host.`20`20Some`20e`5C-mail`20addresses`20will`20need`20to`20be`20quote Vd Xif`20they`20contain`20shell`20metacharacters. XThe X.I`20user Xargument`20may`20also`20be`20an X.I`20alias Xfor`20an`20opponent`20you`20have`20played`20before. XAliases`20are Xdefined`20in`20the`20people`20file, Xand`20are`20initialized`20to`20the`20first`20name`20of Xthe`20opponent,`20with`20all`20upper-case`20letters`20changed`20to`20lower. XThe`20`5C-start`20option`20is`20deferred`20until`20all`20command`20line Xoptions`20have`20been`20scanned,`20so`20the`20position`20of`20the X`5C-start`20option`20on`20the`20command`20line`20is`20not`20important. XOnly`20one`20`5C-start`20may`20be`20used`20per`20ldb`20run. X.IP`20"`5CfB-remotestart`20user1`20user2`5CfP" XA`20game`20is`20started`20between`20user1`20and`20user2.`20`20The`20local Xhost`20sends`20a`20remote`20start`20message`20to`20user1`20instructing Xit`20to`20start`20a`20game`20with`20user2.`20`20The`20local`20host Xdoes`20not`20participate`20thereafter`20in`20the`20game. XFor`20the`20purposes`20of`20the`20`5C-color`20and`20`5C-direction`20options, Xuser1`20is`20considered`20the`20local`20user. XThe`20`5C-remotestart`20option`20is`20deferred`20until`20all`20command`20line Xoptions`20have`20been`20scanned,`20so`20the`20position`20of`20the X`5C-remotestart`20option`20on`20the`20command`20line`20is`20not`20important. XOnly`20one`20`5C-remotestart`20may`20be`20used`20per`20ldb`20run. X.IP`20"`5CfB-notify`20addr`5CfP" XThis`20option`20affects`20games`20started`20by`20either`20-start`20or X-remotestart`20on`20this`20ldb`20run. XA`20message`20is`20sent`20to`20the`20specified`20address`20when`20the`20game Xthat`20is`20started`20by`20the`20-start`20or`20-remotestart`20option`20ends. XThis`20message`20includes`20the`20termination`20code`20of`20the`20game, Xthe`20game`20value,`20and`20a`20gammon/backgammon`20flag.`20`20This`20option Xis`20mainly`20for`20the`20use`20of`20game`20starters`20that`20wish`20to`20eith Ver Xkeep`20score`20or`20start`20new`20games`20when`20the`20old`20ones`20finish. XEven`20though`20-notify`20is`20only`20used`20by`20the`20player`20that`20starts V Xthe`20game`20(or`20the`20game`20starter`20that`20uses`20-remotestart),`20both Xplayer's`20ldb`20will`20send`20a`20message`20when`20the`20game`20ends. X.IP`20"`5CfB-jacoby`5CfP" XThe`20Jacoby`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run. XThis`20rule`20specifies`20that`20gammons Xand`20backgammons`20count`20as`20a`20single`20point`20if`20neither`20player Xdoubled`20during`20the`20game.`20`20This`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20Jacoby`20rule,`20it`20is`20disabled`20and`20the`20game Xproceeds`20as`20if`20it`20were`20never`20enabled. X.IP`20"`5CfB-crawford`5CfP" XThe`20Crawford`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run. XThis`20rule`20specifies`20that`20neither Xplayer`20may`20double`20for`20the`20first`20game`20of`20a`20match`20after Xeither`20player`20is`20within`201`20point`20of Xwinning`20the`20match.`20`20If`20match`20play`20is`20not`20enabled,`20this Xargument`20has`20no`20meaning. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20Crawford`20rule,`20it`20is`20disabled`20and`20the`20game V Xproceeds`20as`20if`20it`20were`20never`20enabled. X.IP`20"`5CfB-european`5CfP" XThe`20European`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run. XThis`20rule`20specifies`20that`20backgammons Xcount`20as`20double,`20rather`20than`20triple,`20the`20score`20shown`20on`20th Ve`20cube. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20European`20rule,`20it`20is`20disabled`20and`20the`20game V Xproceeds`20as`20if`20it`20were`20never`20enabled. X.IP`20"`5CfB-permanent`5CfP" XThe`20game`20started`20by`20this`20ldb`20run Xis`20marked`20permanent.`20`20Permanent`20games Xare`20automatically`20restarted`20when`20they`20end.`20`20This`20is`20for Xpeople`20you`20play`20with`20constantly,`20and`20it`20saves`20you`20the`20trou Vble Xof`20restarting`20the`20game`20when`20it`20is`20over. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20permanent`20games,`20the`20permanent`20flag`20is`20disabled V`20and`20the`20game Xproceeds`20as`20if`20it`20were`20never`20enabled. X.IP`20"`5CfB-match`20points`5CfP" XThis`20option`20enables`20match`20play`20and`20specifies`20the`20number`20of V`20points Xthe`20match`20is`20to`20play`20to.`20`20Games`20that`20are`20part`20of`20a`20m Vatch`20have`20additional Xinformation`20displayed`20above`20the`20board`20to`20show`20the`20current`20ma Vtch`20score Xand`20the`20number`20of`20points`20being`20played`20to.`20`20When`20a`20game V`20that`20is`20part Xof`20a`20match`20ends,`20and`20the`20specified`20number`20of`20points`20has V`20not`20been`20reached, Xthe`20game`20is`20restarted. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20match`20play,`20the`20game Xproceeds`20as`20if`20it`20were`20a`20normal`20game. X.IP`20"`5CfB-score`5CfP" XThe`20cumulative`20score`20for`20all`20opponents`20is`20printed.`20`20This`20c Vonsists Xof`20points,`20games,`20gammons,`20backgammons,`20and`20matches`20that`20have Xbeen`20won`20and`20lost Xfor`20each`20opponent.`20`20A`20total`20over`20all`20opponents`20is`20also`20p Vrinted. X.IP`20"`5CfB-broadcast`20`5Bfile`5D`5CfP" XThe`20specified`20file`20is`20mailed`20to`20all`20current`20opponents. XThis`20is`20useful`20for`20announcing`20vacation`20absences,`20etc. XIf`20the`20file`20argument`20is`20not`20given,`20standard`20input`20is Xread`20and`20sent`20to`20all`20opponents. X.IP`20"`5CfB-control`5CfP" XThis`20option`20puts`20ldb`20into`20a`20special`20mode`20that`20does`20not`20a Vllow Xgames`20to`20be`20played,`20but`20instead`20displays`20them`20one`20at`20a`20t Vime Xand`20allows`20certain`20"overhead"`20functions`20to`20be`20performed. XThese`20are`20described`20fully`20in`20the`20section`20titled`20"CONTROLLING V`20A`20GAME". X.IP`20"`5CfB-reconstruct`20file`5CfP" XThis`20option`20allows`20your`20game`20file`20to`20be`20reconstructed`20if`20y Vou`20accidentally Xclobber`20it.`20`20It`20does`20this`20by`20extracting`20the`20information`20fr Vom`20your Xopponent's`20data`20file`20and`20"reversing"`20it`20so`20you`20can`20use`20it. V XTo`20use`20the`20reconstruct`20option,`20ask`20all`20of`20your`20opponents`20t Vo`20send Xyou`20their`20.ldbdata`20files.`20`20Extract`20these`20from`20your`20mail`20in Vto`20files Xon`20your`20system,`20strip`20the`20mail`20headers,`20and`20feed`20them`20one V`20at`20a`20time Xinto`20ldb.`20`20For`20each`20game`20found`20listing`20you`20as`20the`20oppone Vnt,`20you`20will Xbe`20prompted`20to`20enter`20the`20opponent's`20e-mail`20address`20or`20alias X(and`20his`20name`20if`20he Xis`20not`20in`20your`20people`20file),`20and`20the`20game`20will`20be`20added V`20to`20your Xgame`20file. X.IP`20"" XThe`20reconstruct`20function`20cannot`20recover`20games`20that`20were`20in`20t Vhe Xprocess`20of`20starting`20(i.e.`20in`20their`20initial`20roll`20stage),`20or V`20that Xhave`20already`20completed`20(why`20bother?).`20`20Your`20opponent`20should Xread`20any`20mail`20files`20you`20sent`20before`20your`20data`20file`20got`20c Vlobbered, Xand`20should`20make`20his`20move`20and`20send`20it`20before`20sending`20you V`20his`20data`20file. XYou`20will`20not`20need`20to`20process`20the`20move`20he`20sent,`20though,`20s Vince`20all Xthat`20data`20is`20in`20his`20file`20anyway.`20`20It`20won't`20hurt`20if`20you V`20do, Xldb`20will`20just`20ignore`20it. X.IP`20"`5CfB-help`5CfP" XThis`20prints`20a`20one-line`20description`20of`20each`20option,`20in`20case V`20you Xforget`20later`20on. X.PP X.SH`20SCREEN XThe`20screen`20displays`20the`20following`20items`20of`20interest: X.IP`20`5CfBOpponent`5CfP XThe`20e`5C-mail`20address`20and`20personal`20name`20of`20the`20opponent`20are V`20displayed Xon`20the`20top`20line`20of`20the`20screen.`20`20This`20can`20help`20identify V`20the Xgame`20if`20you`20have`20many`20games`20in`20progress`20at`20once. X.IP`20"`5CfBBoard`20Label`5CfP" X.I`20Ldb Xdisplays`20one`20of`20three`20possible`20board`20images`20at`20a`20time; Xthe`20name`20of`20the`20board`20currently`20displayed`20is`20shown`20on Xthe`20second`20line`20of`20the`20screen,`20near`20the`20left. XThe`20significance`20of`20these`20three`20boards`20is`20explained`20below. X.IP`20"`5CfBFlags`5CfP" XThis`20area`20displays`20any`20special`20rules`20in`20effect`20for Xthe`20game.`20`20Each`20special`20rule`20causes`20one`20character`20to Xbe`20displayed.`20`20These`20are: X.nf X`20`20`20`20`20J`20`20`20`20`20Jacoby`20rule X`20`20`20`20`20C`20`20`20`20`20Crawford`20rule X`20`20`20`20`20E`20`20`20`20`20European`20rule X`20`20`20`20`20P`20`20`20`20`20Permanent`20game X.fi XIn`20addition,`20the`20Crawford`20rule`20indicator`20is`20shown`20in Xreverse`20video`20if`20the`20Crawford`20rule`20game`20is`20currently Xbeing`20played. X.IP`20"`5CfBMatch`20Score`5CfP" XThe`20current`20match`20score`20is`20displayed`20next`20to`20the`20board`20lab Vel, Xas`20is`20the`20number`20of`20points`20the`20match`20plays`20to. XIf`20the`20game`20being`20displayed`20is`20not`20part`20of`20a`20match, Xthis`20area`20is`20blanked`20out. X.IP`20"`5CfBPip`20Count`5CfP" XNear`20the`20right`20of`20the`20screen`20on`20the`20second`20line`20is`20the Xpip`20count`20for`20the`20board`20being`20displayed. X.IP`20"`5CfBBoard`5CfP" XThe`20board`20is`20displayed`20near`20the`20left`20side`20of`20the`20screen, V`20and`20takes Xup`20most`20of`20the`20screen`20area.`20`20It`20consists`20of`20an`20outline, V`20drawn Xwith`20ASCII`20characters,`20and`2028`20"points"`20where`20pieces`20can`20resi Vde. XOf`20these,`2024`20are`20the`20normal`20points`20making`20up`20the`20main`20bo Vdy`20of`20the Xboard`20(numbered`201`5C-24), X2`20are`20the`20"BAR"`20points,`20located`20between`20the`20left Xand`20right`20halves`20of`20the`20main`20board,`20and`202`20are`20the`20"OFF" Xpoints`20(where`20pieces`20go`20when`20they`20are`20borne`20off),`20located V`20to`20the Xleft`20of`20the`20board.`20`20Pieces`20are`20represented`20by`20upper`20or`20l Vower`20case`20letters. XTo`20help`20you`20remember`20which`20direction`20you Xare`20playing,`20there`20are`20arrows`20drawn`20at`20the`20four`20corners`20of V`20the Xboard`20indicating`20your`20direction`20of`20play. XThe`20bar`20is`20indicated`20by`20the`20word`20"BAR";`20this`20changes`20to X"---"`20if`20neither`20player`20can`20hit. X.IP`20"`5CfBDoubling`20Cube`5CfP" XThe`20current`20value`20of`20the`20doubling`20cube`20is`20displayed`20in`20rev Verse Xvideo`20on`20the`20left`20side`20of`20the`20screen.`20`20The`20cube`20will`20a Vppear Xnext`20to`20the`20home`20board`20of`20the`20owner`20of`20the`20cube, Xor`20in`20the`20middle`20if`20neither`20player Xhas`20doubled.`20`20For`20example,`20if`20the`20player`20whose`20home`20board V`20is Xat`20the`20bottom`20of`20the`20screen`20doubled`20last,`20the`20cube`20will V`20appear Xbeside`20the`20top`20of`20the`20board. X.IP`20"`5CfBMove`20Blocks`5CfP" XThe`20move`20blocks`20are`20located`20on`20the`20right`20of`20the`20screen. V`20`20There Xare`20two`20move`20blocks;`20one`20for`20you,`20and`20one`20for`20your`20oppon Vent. XYou`20will`20use`20your`20move`20block`20to`20enter`20your`20moves,`20and`20yo Vu`20will Xsee`20your`20opponent's`20moves`20displayed`20in`20his`20move`20block.`20`20A V`20move Xblock`20consists`20of`20a`20header,`20which`20identifies`20the`20owner`20of V`20the Xmove`20block,`20and`20two`20columns`20of`20either`20two`20or`20four`20lines. XEach`20line`20in`20a`20move`20block`20is`20one`20roll,`20and`20shows`20the`20v Value Xof`20the`20roll`20(in`20the`20range`201`5C-6)`20and`20how`20that`20roll`20has V`20been`20used. XIf`20doubles`20were`20rolled, Xthe`20third`20and`20fourth`20lines`20will`20also Xbe`20used`20to`20display`20the`20two`20additional`20rolls`20that`20may`20be V`20used. X.IP`20"`5CfBCommand`20Box`5CfP" XThe`20bottom`20right`20corner`20of`20the`20screen`20contains`20a`20small`20box V Xthat`20displays`20the`20commands`20that`20are`20legal`20at`20any`20given`20tim Ve. XYou`20can`20execute`20a`20command`20by`20typing`20the`20first`20letter;`20you Xshould`20not`20hit`20return`20afterwards.`20`20There`20may`20be`20legal`20comm Vands Xother`20than`20those`20shown`20in`20the`20command`20box,`20depending`20on Xthe`20state`20the`20game`20is`20in.`20`20Press`20"h"`20or`20"?"`20for`20a`20co Vmplete`20listing Xof`20legal`20commands. X.IP`20"`5CfBMessage`20Area`5CfP" XThe`20bottom`206`20lines`20of`20the`20screen`20are`20reserved`20for`20messages V`20of Xvarious`20types.`20`20The`20bottom`20line`20is`20used`20for`20error`20and`20in Vformative Xmessages`20that`20occur`20as`20a`20game`20is`20played.`20`20The`20top`20line V`20in`20this Xarea`20displays`20messages`20pertaining`20to`20the`20status`20of`20a`20game, V`20such`20as Xblots`20hit`20by`20an`20opponent's`20move.`20`20The`20remaining`204`20lines V`20are`20used`20to Xenclose`20a`20message`20to`20your`20opponent`20with`20your`20move,`20and`20to V`20display Xthe`20one`20your`20opponent`20sent`20to`20you.`20`20These`20messages`20may`20b Ve`20up`20to X2`20lines`20of`2056`20characters. X.PP X.SH`20"STARTUP`20FILE" XThe`20first`20time`20you`20run X.I`20ldb, Xit`20will`20ask`20you`20if`20you`20want`20to Xcreate`20a X.I`20.ldbrc Xfile.`20`20You`20should`20answer`20"yes",`20unless`20you`20have`20a`20reason Xnot`20to.`20`20If`20you`20want`20the`20ldb`20startup`20file`20to`20be`20named V`20something Xother`20than X.I`20.ldbrc, Xyou`20should`20set`20the`20environment`20variable`20LDBRC`20to`20the Xname`20you`20want`20before Xrunning`20ldb`20for`20the`20first`20time. XIf`20you`20do`20this,`20the`20LDBRC`20variable`20must`20be`20set Xevery`20time`20you`20run`20ldb. X.I`20Ldb Xmoves`20to`20the`20directory`20in`20the`20HOME`20environment`20variable, Xif`20it`20is`20set,`20before`20accessing`20any`20files. XThis`20makes`20all`20files`20(including`20.ldbrc)`20relative Xto`20$HOME. X.PP XThe X.I`20.ldbrc Xis`20organized`20as`20a`20sequence`20of`20name/value`20pairs,`20one`20per`20li Vne, Xin`20the`20format X.I`20"name=value". XThere`20should`20be`20no`20spaces`20before X.I`20name Xor`20before`20or`20after`20the`20equals`20sign.`20`20Comments`20are`20indicate Vd Xby`20a`20pound`20sign`20(#)`20in`20column`201,`20and`20extend`20to`20the`20end V`20of`20the`20line. XThe`20following`20names`20are`20defined: X.IP`20myname XThis`20line`20is`20where`20you`20enter`20your`20(human)`20name. XIt`20is`20sent`20to`20your`20opponent`20when`20a`20game`20is`20started,`20to Xmake`20things`20a`20little`20more`20personal.`20`20You`20can`20put`20anything Xyou`20like`20here,`20of`20course,`20but`20I`20highly`20recommend`20you`20just Xstick`20to`20your`20name. XThe X.I`20myname Xline`20is`20mandatory;`20if`20you`20don't`20want`20your`20name Xsent`20to`20people,`20you`20can`20just`20put`20your`20email`20address`20instea Vd, Xbut`20you`20must`20have`20something. X.IP`20myaddr XThis`20line`20defines`20your`20e`5C-mail`20address.`20`20This`20is`20sent`20to V`20your Xopponent`20when`20you`20start`20a`20game`20so`20they`20know`20how`20to`20send Xmail`20back`20to`20you.`20`20For`20people`20with`20multiple`20mail`20paths, V`20put Xthe`20one`20here`20you`20use`20the`20most`20(e.g.`20the`20Internet`20domain V`5C-style Xpath),`20and`20for`20games`20that`20need`20to`20use`20a`20different`20address, V Xuse`20the X.I`20`5C-myaddr Xcommand`20line`20argument`20to`20override`20the`20path`20in X.I`20.ldbrc.`20`20Note`20that`20the`20first`20time`20you`20start`20a`20game Xwith`20someone,`20the`20address`20you`20use`20is`20saved`20in`20your Xpeople`20file.`20`20Subsequent`20games`20you`20start`20with`20this`20person Xautomatically`20use`20this`20same`20address,`20so`20the X.I`20`5C-myaddr Xoption`20will`20be`20unnecessary. XThe X.I`20myaddr Xline`20is`20mandatory. X.IP`20peoplefile XThis`20line`20sets`20the`20file`20name`20that`20is`20used`20to`20store`20infor Vmation Xabout`20your`20opponents.`20`20In`20addition`20to`20storing`20your`20opponents V' Xnames,`20addresses,`20and`20aliases,`20it`20records`20the`20number`20of Xgames,`20points,`20gammons,`20backgammons,`20and`20matches`20you`20have Xwon`20or`20lost`20to`20that`20opponent.`20`20It`20also`20stores`20something Xcalled`20the X.I`20fence, Xwhich`20is`20the`20start`20time`20of`20the`20most`20recently`20finished`20game V. XThis`20allows`20start`20messages`20from`20old`20games`20to`20be`20discarded. XThe`20peoplefile`20line`20is`20optional,`20and`20if`20it`20is`20not`20given, Xthe`20people`20file`20defaults`20to X.I`20.ldbpeople. X.IP`20gamefile XThis`20line`20sets`20the`20file`20name`20that`20is`20used`20to`20store`20games V Xin`20progress.`20`20It`20is`20optional,`20and`20if`20it`20is`20not`20given, V`20the Xgame`20file`20defaults`20to X.I`20.ldbdata. XMy`20advice,`20if`20you`20care,`20is`20that`20you`20should`20avoid Xusing`20a`20file`20name`20containing`20the`20string X.I`20games Xor`20any`20other`20giveaway`20string`20that`20would`20let`20your`20boss,`20sys Vadmin, Xor`20other`20local`20Nazi`5C-type`20know`20that`20you're`20using Xa`20very`20expensive`20piece`20of`20high`5C-tech`20equipment`20to`20goof`20off V, Xwhen`20you`20could`20do`20that`20with`20nothing`20more`20exotic`20than Xa`20rubber`20band`20and`20some`20spitballs. X.IP`20backupfile XThis`20is`20the`20file`20your`20old X.I`20gamefile Xwill`20be`20moved`20to`20just`20before`20a`20new Xone`20is`20created.`20`20It`20defaults`20to X.I`20".oldldbdata." X.IP`20mailfile XThis`20line`20is`20where`20you`20tell`20ldb`20how`20to`20find`20the`20mail`20m Vessages Xyour`20opponents`20have`20sent.`20`20There`20are`20several`20ways`20to`20do V`20this. XThe`20simplest`20one`20is`20to`20just`20put Xsome`20file`20name`20here`20(the`20default`20is`20ldb.rcv)`20and,`20when`20you V`20receive Xmail`20containing`20an Xldb Xmove,`20just`20save`20it`20to`20this`20file.`20`20When`20you`20are`20done`20re Vading`20your`20mail, Xrun`20ldb,`20and`20it`20will`20scan`20this`20file`20and`20extract`20all`20your V`20incoming Xmoves.`20`20If`20your`20mail`20program`20is`20like`20most,`20it`20will Xappend`20messages`20if`20the`20file`20you`20are`20saving`20to`20already`20exis Vts, Xwhich`20is`20just`20what`20you`20want. X.I`20Ldb Xwill`20silently`20ignore`20moves`20that`20it`20has`20already`20seen`20for`20ga Vmes`20in Xprogress,`20so`20you`20don't`20have`20to`20clean`20them`20out`20of`20your`20ma Vilfile Xif`20you`20don't`20want`20to. XNote`20however`20that`20if`20anything`20happens`20to`20your`20people`20file, Xand`20you`20have`20old`20start`20messages`20in`20your`20input`20file, Xldb`20could`20start`20a`20spurious`20game`20(i.e.`20one`20your`20opponent's V`20ldb Xknows`20nothing`20about).`20`20Also,`20if`20your`20input`20file`20gets`20reall Vy`20long, Xldb`20will`20take`20a`20while`20to`20start`20up. XSo`20the`20best`20course`20is`20to`20delete`20all`20messages Xafter`20ldb`20has`20read`20them. X.IP`20"" XFor`20UNIX`20users,`20a`20much`20easier`20way Xis`20to`20set`20the`20mailfile`20to`20point`20to`20your Xactual`20mail`20file`20(e.g.`20/usr/spool/mail/$USER),`20and`20let`20ldb Xscan`20your`20mail`20directly.`20`20This`20will`20only`20work`20if`20your`20sy Vstem Xkeeps`20mail`20in`20ASCII`20format,`20but`20many`20do.`20`20Ldb`20will`20not Xdelete`20these`20messages`20from`20your`20mail Xso`20you`20will`20have`20to. X.IP`20"" XThe`20third`20option`20is`20to`20set`20the`20mailfile`20to`20a`20pattern`20ins Vtead Xof`20a`20filename.`20`20Ldb`20will`20scan`20all`20matching`20files`20for`20mov Ves. XThis`20is`20good`20for`20mailers`20that`20don't`20append`20on`20save,`20and Xdon't`20store`20in`20ascii`20format,`20such`20as`20on`20VMS.`20`20Note`20that Xon`20VMS,`20if`20no`20version`20number`20is`20defined,`20mailfile`20defaults Xto`20scanning`20all`20versions. XVMS`20users`20should`20read`20the`20section`20entitled`20"VMS`20NOTES" Xfor`20more`20information`20on`20extracting`20mail. X.IP`20delmail XThis`20option`20causes`20any`20mail`20files`20scanned`20by`20ldb`20to`20be`20r Vemoved`20after Xthey`20have`20been`20scanned.`20`20This`20is`20a`20hideously`20dangerous`20opt Vion, Xso`20I`20recommend`20you`20try`20it`20in`20a`20friend's`20account`20first. XIt`20will`20delete`20ANY`20file`20that`20matches`20the`20pattern`20specified V`20in Xthe`20mailfile`20line,`20with`20the`20exception`20that,`20under`20UNIX, Xit`20will`20refuse`20to`20delete`20any`20file`20starting`20with`20"/". XUse`20it`20with`20great`20care.`20`20This`20option`20defaults`20to`20no; Xto`20enable`20it,`20set`20it`20to`20"yes". X.IP`20lockfile XThis`20line`20sets`20the`20name`20of`20the`20ldb`20lock`20file. XIt`20defaults`20to X".ldb_lock", Xand`20there's`20no Xreal`20reason`20to`20change`20it`20unless`20by`20some`20chance`20it`20conflict Vs Xwith`20a`20file`20name`20you`20might`20use. XWhen`20ldb`20starts,`20it`20checks`20to`20see`20if`20this`20file`20exists; Xif`20it`20does,`20ldb`20exits.`20`20Otherwise,`20it`20creates`20it`20and`20goe Vs`20on. XThis`20prevents`20more`20than`20one`20ldb`20from`20running`20in`20the`20same Xaccount`20at`20the`20same`20time,`20and`20thereby`20garbling`20the`20data`20fi Vles. X.IP`20sendcmd XThis`20tells`20ldb`20how`20to`20send`20a`20file`20with`20your`20particular Xmail`20command.`20`20This`20string`20is`20passed`20to`20the`20system,`20after V`20making`20the Xfollowing`20substitutions: X.IP`20"`20`20`20`20`20$a"`2010n Xis`20substituted`20with`20the`20address`20to`20mail`20to. X.IP`20"`20`20`20`20`20$f"`2010n Xis`20substituted`20with`20the`20file`20containing`20the`20message. X.IP`20"`20`20`20`20`20$s"`2010n Xis`20substituted`20with`20the`20subject`20of`20the`20message. X.IP`20""`205n XMost`20mail`20systems`20will`20work`20fine`20with`20the`20default,`20which`20i Vs X.nf X`20`20`20`20`20mail`20`5C-s`20'$s'`20$a`20<`20$f X.fi X.IP`20"" Xor,`20on`20VMS, X.nf X`20`20`20`20`20MAIL/SUBJECT="$s"`20$f`20IN%"""<$a>""" X.fi X.IP`20"" XNote`20that`20the`20$`20substitutions`20are Xmade`20by`20ldb,`20not`20by`20a`20shell,`20and`20thus`20are`20not`20subject V`20to Xany`20quoting.`20`20If`20you`20need`20a`20$`20in`20the`20string,`20use`20$$. +-+-+-+-+-+-+-+- END OF PART 3 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+ XVMS`20users`20may`20need`20to`20change`20the`20name`20of`20the`20SMTP`20mailer V; Xfor`20example,`20to`20send`20mail`20using`20Wollongong`20TCP/IP,`20you`20would V Xuse`20the`20string X.IP`20"" X.nf X`20`20`20`20`20MAIL/SUBJECT="$s"`20$f`20WINS%"""<$a>""" X.fi X.IP`20tempfile XThis`20line`20specifies`20a`20temporary`20file`20that`20ldb`20can`20use`20to V`20compose Xmail`20messages.`20`20The`20file`20will`20be`20created`20in`20your`20home`20di Vrectory, Xthus`20avoiding`20file`20name`20conflicts`20in`20/tmp.`20`20It`20defaults`20to V`20ldb.tmp. X.IP`20colors XThis`20is`20a`20string`20of`20two`20upper`20or`20lower`20case Xletters, Xand`20defines Xyour`20preferred`20colors`20for`20any`20games`20you`20start.`20`20The`20first V`20character Xin`20the`20string`20is`20the`20color`20you`20will`20play,`20and`20the`20second V`20is`20the Xone`20your`20opponent`20will`20play.`20`20It`20defaults`20to`20"rw",`20and`20i Vs Xoverridden`20by`20the X.I`20`5C-color Xcommand`20line`20argument. X.IP`20direction XThis`20is`20either`20"up"`20or`20"down",`20and`20defines`20your`20preferred V`20direction Xof`20play`20for`20games`20you`20start.`20`20The`20direction`20of`20play`20only V`20refers`20to Xwhether`20you`20play`20toward`20increasing`20or`20decreasing`20numbered`20poin Vts. XAlthough`20by`20default`20upward`20play`20goes`20toward`20the`20top`20of`20the V`20screen, Xthis`20can`20be`20reversed`20(for`20your`20screen`20only)`20by`20the`20"Invert V" Xcommand`20in`20the`20Control`20menu, Xaccessible`20via`20the X.I`20`5C-control Xcommand`20line`20argument.`20`20The`20default`20for`20this`20line`20is`20"up", V Xand`20is`20overridden`20by`20the X.I`20`5C-direction Xcommand`20line`20argument. X.IP`20initialboard XAs`20was`20alluded`20to`20earlier,`20your`20screen`20shows`20one`20of Xthree`20possible`20board`20images`20at`20any`20time.`20`20Although Xthe`20purpose`20for`20this Xwill`20be`20explained`20later,`20this`20line`20allows`20you`20to`20select Xwhich`20of`20these`20three`20boards`20should`20be`20displayed`20initially. XThe`20legal`20values`20are`20"before",`20"after",`20and`20"current". XThe`20default`20is`20"current". X.IP`20autoroll XIf`20you`20were`20the`20last`20to`20double,`20you`20have`20no`20option Xbut`20to`20roll`20the`20dice`20when`20it`20is`20your`20turn.`20`20If Xautoroll`20is`20enabled,`20ldb`20will`20roll`20the`20dice`20for`20you`20automa Vtically Xin`20this`20case.`20`20For`20those`20that`20prefer`20consistency,`20autoroll Xmay`20be`20disabled,`20although`20attempting`20to`20double`20when`20you Xdoubled`20last`20will`20cause`20an Xerror`20message.`20`20Possible`20values`20for`20autoroll`20are`20"yes"`20and V`20"no", Xwith`20"yes"`20being`20the`20default. X.IP`20automove XEach`20time`20you`20roll`20the`20dice,`20ldb`20determines`20how`20many Xlegal`20ways`20there`20are`20for`20you`20to`20use`20your`20rolls.`20`20In`20th Ve Xrelatively`20unusual`20case`20where`20there`20is`20only`20one`20way Xfor`20you`20to`20use`20your`20rolls,`20ldb`20can`20automatically`20apply Xthis`20move`20to`20your`20board`20before`20displaying`20it.`20`20Automove Xis`20disabled`20by`20default`20because`20quite`20frankly`20it's Xpretty`20annoying.`20`20Possible`20values`20for`20automove`20are`20"yes" Xand`20"no",`20with`20"no"`20being`20the`20default. X.IP`20autodouble XOne`20of`20the`20official`20rules`20of`20backgammon`20allows`20for Xautomatically`20doubling`20the`20game`20value`20when`20the`20opening Xroll`20is`20a`20tie.`20`20The`20rules`20go`20on`20to`20state`20that`20automati Vc Xdoubling`20is`20only`20to`20be`20used`20when`20the`20players`20agree`20beforeh Vand Xon`20its`20use`20and`20limitations.`20`20The`20method`20ldb`20uses`20to`20impl Vement Xthis`20somewhat`20vague`20rule`20is`20to`20allow`20each`20player`20to`20specif Vy Xa`20maximum`20number`20of`20autodoubles`20they`20are`20willing`20to`20accept V`20in X.I`20.ldbrc, Xand`20for`20the`20maximum`20number`20of`20autodoubles`20applied`20to`20any`20g Vame Xto`20be`20the`20lesser`20of`20the`20two`20players'`20specified`20limits. XFor`20example,`20if`20you`20set X.I`20"autodouble=4" Xin`20your`20.ldbrc,`20no`20game`20you`20play`20will`20ever`20be`20autodoubled Xmore`20than`204`20times,`20although`20the`20number`20of`20tied`20opening`20rol Vls Xis`20obviously`20not`20limited.`20`20However,`20if`20you`20were`20to`20start V`20a`20game Xwith`20someone`20who`20had`20set X.I`20"autodouble=2", Xthat`20game`20would`20be`20limited`20to`20at`20most`202`20autodoubles.`20`20If V`20you`20don't Xwant`20to`20play`20automatic`20doubles,`20set Xautodouble=0,`20which`20is`20also`20the`20default. X.IP`20superkey XIf`20you`20live`20in`20fear`20of`20roving`20supervisors`20(or`20other Xfun-impaired`20individuals)`20running`20across`20you`20playing`20an Xinnocent`20game`20of`20backgammon, Xyou`20may`20want`20to`20enable`20the`20superkey`20function. XJust`20pick`20a`20key`20on`20the`20keyboard`20you`20never`20use`20in`20ldb, V`20such`20as`20the Xbackquote,`20and`20put`20a`20line`20in X.I`20".ldbrc" Xsetting`20superkey`20to`20the X.I`20"decimal`20ASCII`20code" Xof`20the`20key`20you`20want;`20for`20example,`20to`20use`20the`20backquote`20k Vey, Xuse`20"superkey=96". XOnly`20single`5C-character`20keys`20are`20allowed,`20and Xthe`20key`20you`20select`20will`20not`20be`20usable`20for`20normal`20purposes Xwithin`20ldb.`20`20Make`20it`20one`20you`20can`20hit`20in`20a`20hurry. X.IP`20supercmd XIf`20you'd`20rather`20have`20a`20program`20of`20your`20choice`20come`20up Xinstead`20of`20the`20shell`20when`20the`20superkey`20is`20pressed, Xput`20it`20on`20this`20line.`20`20It`20will`20be`20passed Xunchanged`20to`20a`20shell`20via`20the`20system()`20function. XVMS`20users`20should`20read`20the`20note`20in`20the`20section`20titled X"VMS`20NOTES"`20on`20supercmd`20functionality. X.IP`20checkpoint XThis`20option`20keeps`20the`20gamefile`20up`20to`20date`20by`20writing`20it V`20out Xwhenever`20the`20dice`20are`20rolled`20or`20a`20message`20is`20sent.`20`20This V Xprevents`20game`20information`20from`20being`20lost`20if`20ldb`20crashes, Xyour`20machine`20goes`20down,`20or`20what`20have`20you.`20`20This`20option`20i Vs Xenabled`20by`20default,`20and`20I`20highly`20recommend`20you`20leave`20it Xthat`20way.`20`20If`20you`20just`20can't`20stand`20the`20thought`20of`20a`20fe Vw`20extra Xwrites`20to`20disk,`20you`20can`20disable`20it`20with`20"checkpoint=no". XOn`20your`20own`20head`20be`20it. X.IP`20timeout XThis`20option`20sets`20the`20number`20of`20days`20ldb`20will`20wait`20for`20a V`20reply Xfrom`20your`20opponent.`20`20After`20this`20number`20of`20days`20passes,`20ldb V Xwill`20assume`20your`20last`20message`20was`20lost`20and`20automatically`20res Vend`20it. XThis`20prevents`20the`20situation`20where`20both`20players`20think`20they`20ar Ve Xwaiting`20on`20the`20other,`20and`20eventually`20both`20players`20forget`20the Vy Xeven`20have`20a`20game`20going.`20`20This`20option`20defaults`20to`207`20days; V`20 Xyou`20can`20disable`20automatic`20resends`20by`20setting`20it`20to`200. X.IP`20keepold XThis`20option`20sets`20the`20number`20of`20days`20ldb`20will`20keep`20a`20game V`20after Xit`20is`20over.`20`20This`20can`20be`20handy`20in`20case`20you`20need`20to`20r Vesend`20the`20last Xmove`20of`20a`20game.`20`20This`20option`20defaults`20to`207`20days;`20if`20yo Vu`20set Xit`20to`200,`20finished`20games`20are`20deleted`20immediately. X.IP`20debug XThis`20option`20enables`20various`20debug`20messages.`20`20It`20is`20a`20bitma Vp, Xwith`20each`20set`20bit`20enabling`20debug`20messages`20from`20a`20different V`20part Xof`20ldb.`20`20Most`20people`20will`20want`20to`20leave`20it`20at`200,`20which V`20is Xthe`20default.`20`20If`20you`20want`20debug`20messages,`20look`20for`20the Xdefinitions`20of`20DB_*`20in`20ldb.h. X.PP X.SH`20"PEOPLE`20FILE" XLdb`20maintains`20a`20list`20of`20all`20of`20the`20people`20you Xhave`20ever`20played.`20`20This`20file`20is`20used`20for`20several`20purposes: V X.IP`20"1" XIt`20stores`20the`20number`20of`20games,`20points,`20gammons,`20backgammons, Xand`20matches`20you`20have`20won`20and`20lost`20to`20that`20person. X.IP`20"2" XIt`20stores`20the`20address`20for`20that`20person,`20and`20the Xaddress`20that`20person`20should`20use`20to`20get`20to`20you. XIt`20also`20allows`20you`20to`20assign`20an`20alias`20to`20that`20person, Xand`20to`20use`20that`20alias`20when`20starting`20a`20game`20instead Xof`20the`20full`20e`5C-mail`20address. X.IP`20"3" XIt`20stores`20information`20that`20allows`20ldb`20to`20reject Xstart`20messages`20from`20defunct`20games. X.PP XNormally,`20you`20should`20never`20have`20to`20edit`20the Xpeople`20file,`20but`20it`20is`20described`20here`20in`20case Xyou`20need`20to`20for`20some`20reason.`20`20It`20is`20in`20the`20same Xoverall`20format`20as`20.ldbrc`20(name/value`20pairs). X.IP`20"addr" XThis`20is`20the`20address`20of`20the`20opponent.`20`20This`20is`20what Xuniquely`20defines`20the`20record,`20in`20case`20you`20are`20playing Xtwo`20people`20with`20the`20same`20name. X.IP`20"name" XThis`20is`20the`20name`20of`20the`20opponent. X.IP`20"alias" XThis`20is`20a`20"nickname"`20you`20can`20assign`20to Xan`20opponent.`20`20When`20a`20new`20opponent`20is`20found, Xthe`20alias`20is`20initialized`20to`20the`20first`20word`20of Xthe`20opponent's`20name,`20with`20all`20upper`20case`20letters Xchanged`20to`20lower.`20`20You`20can`20change`20the`20alias`20to Xany`20desired`20string`20with`20a`20text`20editor`20(just`20make`20sure Xldb`20isn't`20running`20at`20the`20time,`20or`20your`20changes`20will Xbe`20lost). X.IP`20"myaddr" XThis`20is`20the`20address`20that`20this`20opponent`20should`20use`20to Xmail`20to`20you.`20`20This`20saves`20you`20from`20having`20to`20specify Xthe`20-myaddr`20argument`20when`20starting`20a`20game,`20and`20is Xespecially`20important`20with`20permanent`20games,`20since Xthese`20games`20are`20started`20automatically`20without`20giving Xyou`20a`20chance`20to`20change`20your`20address.`20`20If`20you`20only Xhave`20one`20e`5C-mail`20path,`20you`20can`20ignore`20this. XThis`20field`20is`20initialized`20to`20the`20value`20of`20the X.I`20`5C-myaddr Xoption`20at`20the`20time`20the`20first`20game`20with Xthis`20opponent`20is`20started,`20or`20to Xthe`20value`20of`20myaddr`20from`20.ldbrc`20if`20no X.I`20`5C-myaddr Xoption`20was`20used. X.IP`20"equiv" XThe`20presence`20of`20this`20field`20flags`20this`20as`20an`20"equiv" Xrecord.`20`20Equiv`20records`20allow`20one`20opponent`20to`20have`20multiple Xe`5C-mail`20addresses,`20but`20to`20cause`20all`20of`20them`20to`20refer`20to Xone`20people`20record.`20`20Equiv`20records`20have`20no`20valid`20fields Xexcept X.I`20addr Xand X.I`20equiv, Xand`20must`20be`20preceded`20by`20the`20record`20they`20refer`20to`20in`20the V`20people`20file. X.IP`20"fence" XThe`20fence`20is`20defined`20as`20the`20start`20time`20of`20the`20most Xrecently`20started`20game`20that`20has`20finished.`20`20If`20that`20makes Xno`20sense,`20don't`20worry,`20you`20should`20never`20have`20to`20mess Xwith`20it.`20`20It`20is`20used`20to`20discard`20old`20start`20messages`20that Xyou`20forgot`20to`20clean`20out`20of`20your`20mail. X.IP`20"score" XThis`20is`20an`20array`20of`2010`20numbers`20that`20represent,`20in`20order: X.IP`20"" X.nf X`20`20`20`20`20-`20Games`20won X`20`20`20`20`20-`20Games`20lost X`20`20`20`20`20-`20Points`20won X`20`20`20`20`20-`20Points`20lost X`20`20`20`20`20-`20Gammons`20won X`20`20`20`20`20-`20Gammons`20lost X`20`20`20`20`20-`20Backgammons`20won X`20`20`20`20`20-`20Backgammons`20lost X`20`20`20`20`20-`20Matches`20won X`20`20`20`20`20-`20Matches`20lost X.fi X.IP`20"" XThis`20information`20is`20stored`20purely`20for`20whatever`20purposes`20you Xcan`20think`20of. X.IP`20"end" XThis`20line`20is`20required`20to`20separate`20people`20records.`20`20If`20you Xhand`20enter`20a`20record,`20you`20must`20be`20sure`20to`20put`20an`20end`20ma Vrker Xor`20your`20record`20will`20merge`20with`20the`20next`20one,`20which`20is Xnot`20what`20you`20want. X.PP X.SH`20"STARTING`20A`20GAME" XTo`20start`20a`20game,`20you`20must`20use`20the X.I`20`5C-start Xcommand`20line`20argument,`20along`20with`20the`20e`5C-mail`20address`20of Xthe`20person`20you`20wish`20to`20play`20with. XFor`20example, X.nf X`20`20`20`20`20ldb`20`5C-start`20mybuddy@back.gammon.com X.fi XIf`20you`20want`20to`20play`20'w',`20and`20make`20your`20opponent`20play X'b',`20use`20the`20command X.nf X`20`20`20`20`20ldb`20`5C-color`20wb`20`5C-start`20black@blah.blah.blah X.fi XSee`20the XOPTIONS`20section`20for`20more`20details`20on`20the`20available Xcommand`20line`20arguments. X.I`20Ldb Xwill`20not`20allow`20you`20to`20play`20with`20yourself,`20but Xthat's`20ok`20because`20you'd`20probably`20lose. X.PP XWhen`20you`20start`20a`20game,`20ldb`20sends`20your`20e`5C-mail`20address Xto`20your`20opponent,`20along`20with Xyour`20opening`20roll.`20`20When`20your`20opponent`20receives Xyour`20message,`20his`20ldb`20will`20roll`20his`20opening`20roll,`20and Xdecide`20who`20won.`20`20If`20you`20won,`20his`20ldb`20will`20send`20your`20ld Vb Xa`20message`20to`20that`20effect,`20and`20the`20board`20will`20come`20up Xon`20your`20screen`20with`20that`20roll`20in`20your`20move`20block.`20`20If V`20he Xwon,`20he`20will`20use`20the`20opening`20roll`20and`20his`20ldb`20will`20send Xyour`20ldb Xa`20message`20telling`20you`20how`20he`20moved.`20`20Either`20way,`20the`20gam Ve`20is`20off Xand`20running. X.PP XIf,`20by`20unfortunate`20chance,`20the`20opening`20roll`20is`20a`20tie, Xyour`20opponent's`20ldb`20will`20send Xyour`20ldb`20a`20message`20to`20that`20effect. XThis`20will`20cause`20a`20new`20opening`20roll`20sequence`20as Xdescribed`20above. XA`20message`20will`20be`20printed`20telling`20you Xwhat's`20going`20on; Xjust`20keep`20feeding`20the`20incoming`20messages`20to`20ldb,`20and Xit`20will`20take`20care`20of`20everything. X.PP X.SH`20"PLAYING`20A`20GAME" XWhen`20it`20is`20your`20turn,`20the`20game`20will`20be`20displayed`20on`20your V`20screen, Xand`20you`20will`20be Xfaced`20with`20three`20options:`20Roll,`20Double,`20or`20Concede. XUnless`20you`20are`20very`20cocky,`20I`20would`20not`20suggest`20doubling Xat`20this`20point.`20`20You`20could`20always`20concede,`20but`20I`20really Xthink`20that`20would`20be`20selling`20yourself`20short. XSo`20you`20should`20choose`20"Roll". XJust`20press`20"r",`20and`20watch`20your`20roll`20appear`20on Xyour`20move`20block`20(along`20the`20right`20side`20of`20the`20screen,`20under V`20the Xword`20"You").`20`20You`20should`20see`20two`20numbers`20appear`20(four`20if V`20you Xrolled`20doubles),`20and`20the`20word`20UNUSED`20beside`20them. XDecide`20which`20of`20the`20rolls`20you`20want`20to`20use`20first,`20and`20pre Vss Xthe`20number`20of`20that`20roll.`20`20For`20example,`20say`20you`20rolled X1`206,`20and`20you`20want`20to`20move`20the`20obvious`208`5C-7,`2013`5C-7`20to V Xmake`20your`20bar`20point. XJust`20hit`20"6".`20`20Notice`20the`20cursor`20jump`20up`20to`20your`20move V`20block,`20beside Xthe`20"6"`20roll?`20`20It`20is`20waiting`20for`20you`20to`20enter`20the`20poin Vt`20you`20want Xto`20move`20from.`20`20Press`20"1"`20"3"`20(don't`20hit`20return).`20`20You V`20should`20see Xa`20piece`20move`20from`2013`20to`207,`20and`20this`20fact`20will`20be`20refle Vcted`20in Xyour`20move`20block`20as`20well.`20`20Now,`20press`20"1".`20`20Again`20the`20c Vursor Xjumps`20to`20the`20move`20block,`20and`20you`20type`20"8". XThe`20second`20entry`20in`20the`20move`20block Xreflects`20this`20move,`20as`20does`20the`20board.`20`20Happy?`20`20If`20not, V`20press X"r";`20this`20will`20reset`20your`20rolls`20to`20UNUSED`20and`20put Xthe`20board`20back`20to`20how`20it`20was`20before`20you`20moved, Xand`20then`20you`20can`20enter`20some`20different`20moves.`20`20Otherwise,`20h Vit`20"s" X(not`20"q"!) Xto`20send`20the`20move.`20`20The`20cursor`20will`20jump`20down`20to`20the`20me Vssage`20area, Xwhere`20you`20get`20a`20chance`20to`20enclose`20a`20message`20to`20your`20oppo Vnent, Xperhaps`20to`20gloat`20over`20the`20great`20move`20you`20just`20made. XYou`20only`20get`202`20lines`20of`2056`20characters,`20so`20keep`20it`20short. V`20`20When Xyou`20are`20done,`20press`20.`20`20Your`20move`20is`20on`20its`20way! X.PP XThere`20are`20three`20shortcuts`20you`20can`20use Xafter`20you`20have`20entered`20your`20first`20move: X.IP`201. XYou`20can`20press`20,`20which`20will`20"repeat"`20your`20last`20move. XThat`20is,`20your`20next`20remaining`20roll`20will`20move`20from`20the`20same Xpoint`20as`20your`20last`20one`20moved`20from.`20`20This`20is`20handy`20when Xusing`20doubles`20to`20move`20more`20than`20one`20piece`20from`20the`20same V`20point. X.IP`202. XYou`20can`20press`20,`20which`20will`20"continue"`20your`20last`20move. V XThat`20is,`20your`20next`20remaining`20roll`20will`20move`20from`20the Xpoint`20your`20last`20move`20ended`20on. X.IP`203. XYou`20can`20press`20"p",`20which`20will`20attempt`20to`20make`20the`20point V`20your Xlast`20move`20ended`20on.`20`20In`20our`201`206`20example`20above,`20you`20cou Vld`20have Xjust`20hit`20"p"`20after`20you`20moved`2013`5C-7,`20and`20ldb`20would`20have V`20figured Xout`20that`20to`20make`20the`207`20point`20with`20the`20remaining`20roll`20of V`201, Xit`20would`20have`20to`20move`20a`20piece`20from`20the`208`20point. X.PP XIn`20addition,`20there`20is`20one`20more`20shortcut`20that`20may`20be`20used Xwith`20any`20roll.`20`20If`20you`20want`20to`20use`20a`20roll`20to`20bear`20of Vf Xa`20piece,`20you`20can`20just`20hit`20"o".`20`20Ldb`20will`20locate`20the Xpoint`20(if`20any)`20from`20which`20pieces`20may`20be`20legally`20borne`20off Xby`20the`20next`20unused`20roll,`20and`20make`20that`20move`20automatically. XYou`20can`20also`20select`20a`20roll,`20then`20hit`20"o". X.PP XIf`20you`20use`20your`20moves,`20hit`20"Send",`20and`20start`20to`20enter`20yo Vur Xmessage,`20then`20realize`20you`20made`20a`20mistake,`20you`20can`20press XESC`20to`20get`20out`20of`20send`20and`20back`20into`20the`20game,`20where Xyou`20can`20use`20"Reset"`20and`20re`5C-enter`20your`20moves. X.PP X.SH`20DOUBLING XIf`20you`20decide`20to`20double,`20just`20choose`20"Double"`20instead`20of X"Roll".`20`20You`20will`20get`20to`20enclose`20a`20message,`20just`20like`20wh Ven Xyou`20send`20a`20move,`20then`20your`20message`20gets`20sent.`20`20Once`20you V`20have Xdoubled,`20you`20cannot`20double`20again`20until`20your`20opponent`20does`20so V, Xso`20ldb`20automatically`20selects`20"Roll"`20and`20sends`20you`20to`20the Xnext`20menu.`20`20If`20you`20don't`20like`20this,`20you`20can`20disable`20it V`20by Xsetting X.I`20autoroll=no Xin`20.ldbrc. X.PP XIf`20your`20opponent`20doubles,`20you`20will`20see`20a`20message`20just`20unde Vr Xthe`20board`20to`20that`20effect,`20and`20a`20menu`20will`20come`20up Xallowing`20you`20to`20Accept`20or`20Decline`20the`20double. XDeclining`20the`20double`20means`20you`20lose`20the`20game`20for`20the Xcurrent`20game`20value.`20`20Accepting`20means`20that`20the`20game Xcontinues,`20but`20its`20value`20is`20doubled.`20`20The`20current Xgame`20value`20is`20shown`20to`20the`20left`20of`20the`20board.`20`20After Xyou`20accept,`20you`20should`20see`20this`20display`20move`20next`20to`20your Xhome`20board,`20indicating`20that`20you`20own`20the`20doubling`20cube. X.PP XIf`20the`20Crawford`20rule`20game`20is`20being`20played, Xdoubling`20is`20illegal,`20and`20will`20result`20in`20an`20error`20message. X.PP X.SH`20BOARDS X.I`20Ldb Xmaintains`20three`20board`20images`20at`20all`20times.`20`20These`20are: X.IP`201 XThe`20board`20before`20your`20opponent's`20last`20move. XIt`20is`20for`20display`20purposes`20only,`20so`20you`20can`20see`20your Xopponent's`20move`20"before`20and`20after".`20`20The`20pieces`20your`20opponen Vt Xis`20going`20to`20move`20are`20highlighted. X.IP`202 XThe`20board`20after`20your`20opponent's`20last`20move. XIt`20shows`20the`20condition`20of`20the Xboard`20after`20your`20opponent's`20last`20move,`20with`20the`20pieces`20he Xmoved`20highlighted. X.IP`203 XThe`20current`20board.`20`20This`20is`20the`20"real"`20board`20that`20shows V`20the Xcurrent`20state`20of`20the`20game. XNothing`20is`20highlighted. X.PP XBy`20default,`20ldb`20displays`20the`20Current`20board`20at`20all`20times.`20 V`20If Xyou`20want`20to`20see`20the`20other`20boards,`20use`20the`20Board`20command X(provided`20it`20is`20in`20the`20current`20menu).`20`20This`20will`20cycle`20t Vhrough Xthe`20three`20boards`20in`20the`20order`20they`20are`20listed`20above.`20`20Th Ve`20second Xline`20of`20the`20screen`20tells`20you`20which`20board`20is`20displayed`20(nea Vr`20the`20left).`20`20When Xyou`20roll,`20ldb`20automatically`20switches`20to`20the`20current`20board`20if V Xit`20is`20not`20already`20up.`20`20You`20can`20set`20which`20of`20these`20thre Ve`20boards Xis`20initially`20displayed`20via`20the X.I`20initialboard Xsetting`20in`20.ldbrc. X.PP X.SH`20"ENTERING`20COMMENTS" XWhenever`20you`20send`20a`20move`20to`20your`20opponent,`20you`20are Xgiven`20the`20opportunity`20to`20enclose`20a`20two`20line`20comment. XWhile`20entering`20your`20comment,`20certain`20keys`20have`20special`20meaning V. XThese`20are: X.IP`20"BS/DEL" XThe`20backspace`20and`20delete`20(or`20rubout)`20keys`20both`20erase`20the Xlast`20character`20typed.`20`20You`20can`20backspace`20from`20one`20line`20to Xthe`20previous`20one. X.IP`20"`5EW/`5EB" XThe`20`5EW`20and`20`5EB`20(control-W`20and`20control-B)`20keys`20both`20erase V`20the Xlast`20word`20typed.`20`20Words`20are`20delimited`20by`20spaces. X.IP`20"`5EX/`5EU" XThe`20`5EX`20and`20`5EU`20(control-X`20and`20control-U)`20keys`20erase`20the Xcurrent`20line`20and`20move`20to`20the`20end`20of`20the`20previous`20line, Xor`20to`20the`20beginning`20of`20the`20first`20line`20if`20used`20on`20the Xfirst`20line. X.IP`20"RETURN" XIf`20you`20press`20return`20on`20an`20empty`20line,`20or`20on`20the`20last`20l Vine, Xthe`20comment`20is`20finished.`20`20Otherwise,`20the`20cursor`20moves`20to`20t Vhe Xnext`20line. X.IP`20"ESC" XThe`20escape`20key`20aborts`20the`20operation`20(e.g.`20Send),`20restores Xthe`20previous`20comment,`20and`20returns`20to`20the`20previous`20menu. XThis`20allows`20you`20to`20change`20your`20mind`20and`20back`20out`20of Xan`20operation. X.PP XAll`20other`20keys`20are`20entered`20into`20the`20comment.`20`20When`20you`20r Veach Xthe`20end`20of`20a`20line,`20ldb`20word-wraps`20to`20the`20next`20line,`20or V`20beeps Xif`20you`20are`20at`20the`20end`20of`20the`20last`20line.`20`20Note`20that`20t Vhe Xsuperkey`20is`20still`20active`20while`20entering`20comments,`20and Xcannot`20be`20entered`20into`20a`20comment. X.PP X.SH`20"CONTROLLING`20A`20GAME" XThe X.I`20`5C-control Xoption`20permits`20you`20to`20control`20your`20games`20in Xcertain`20ways.`20`20Each`20of`20your`20current`20games`20are Xdisplayed,`20one`20at`20a`20time,`20just`20as`20they`20are`20when`20you Xare`20playing,`20allowing`20you`20to`20perform`20any`20of`20the Xfunctions`20on`20the`20control`20menu. XThe`20control`20menu`20has`20the`20following`20commands: X.IP`20"Invert" XThis`20allows`20you`20to`20invert`20the`20board`20for`20this`20game.`20`20The Xboard`20will`20invert`20immediately`20on`20your`20screen,`20so`20you`20can Xsee`20if`20you`20like`20it.`20`20Pressing X.I`20Invert Xagain`20will`20put`20it`20back`20to`20normal.`20`20Inverting`20the`20board`20d Voes Xnot`20affect`20the`20point`20numbering`20or`20the`20color`20you`20play, Xit`20merely`20draws`20the`20board`20with`20the`20low-numbered`20points`20at Xthe`20top`20of`20the`20screen`20rather`20than`20the`20bottom.`20`20You`20may V`20find Xit`20easier`20to`20make`20all`20of`20your`20games`20play`20a`20certain`20direc Vtion. X.IP`20"Resend" XFrom`20time`20to`20time,`20messages`20may`20be`20lost`20due`20to`20faulty`20ma Vilers Xor`20human`20error.`20`20If`20your`20last`20message`20gets`20lost,`20you`20can V Xregenerate`20it`20with`20the X.I`20Resend Xcommand.`20`20There`20is`20no`20harm`20in`20regenerating`20messages,`20as Xldb`20will`20ignore`20duplicate`20messages.`20`20If`20you`20and`20your`20oppon Vent Xhave`20forgotten`20whose`20move`20it`20is,`20the`20easiest`20way`20to`20get V`20going Xagain`20is`20for`20both`20of`20you`20to`20resend`20your`20last`20message.`20 V`20The`20one Xthat`20got`20lost`20will`20be`20accepted,`20and`20the`20game`20will`20be`20off V Xand`20running`20again.`20`20So`20that`20you`20can`20resend`20the`20last`20move V Xof`20a`20game,`20completed`20games`20are`20kept`20in`20your`20.ldbdata`20for X1`20week,`20after`20which`20they`20are`20deleted.`20`20They`20may`20be`20delet Ved Xsooner`20with`20the`20Delete`20Game`20command.`20`20Note`20also`20that Xgames`20that`20have`20been`20waiting`20for`20your`20opponent`20for`20more`20th Van X1`20week`20have`20an`20automatic`20resend`20performed`20whenever`20you`20run V`20ldb. XResend`20is`20disabled`20if`20it`20is`20your`20turn. X.IP`20"Get`20Resend" XThis`20allows`20you`20to`20send`20a`20message`20to`20your`20opponent's Xldb`20requesting`20a`20resend.`20`20This`20saves`20your`20opponent`20the Xtrouble`20of`20getting`20into X.I`20`5C-control, Xfinding`20which`20game`20you're`20talking`20about,`20and`20resending. XInstead,`20he`20can`20just`20feed`20your`20resend`20request`20message`20into Xldb`20like`20it`20was`20a`20regular`20move.`20`20Version`201.0`20of`20ldb Xnot`20only`20does`20not`20support`20this`20feature,`20but`20will`20crash Xif`20a`20resend`20request`20packet`20is`20sent`20to`20it,`20so X.I`20`5C-control Xwill`20check`20to`20make`20sure`20your`20opponent`20is`20running Xthe`20proper`20version Xbefore`20sending`20the`20message. X"Get`20Resend"`20is`20disabled`20for`20games`20that`20are`20over. X.IP`20"Screen`20Dump" XThis`20command`20makes`20an`20exact`20copy`20of`20the`20screen`20in`20the Xfile`20"ldb_screen.dmp".`20`20This`20could`20be`20useful`20if`20you Xwant`20to`20mail`20the`20board`20to`20someone`20or`20print`20it`20out. X.IP`20"Delete`20Game" XThis`20command`20marks`20a`20game`20for`20deletion.`20`20The`20game`20is`20not V`20deleted Xuntil`20you`20quit,`20and`20you`20can`20undelete`20it`20by`20pressing`20D`20ag Vain. XNormally,`20you`20should`20not`20delete`20a`20game`20in`20this`20manner,`20 Xyou`20should`20play`20until`20someone`20wins`20or`20concedes.`20`20The X.I`20"Delete`20Game" Xcommand`20can`20be`20used`20to`20get`20rid`20of`20games`20where`20your`20oppon Vent Xdoesn't`20answer`20his`20mail,`20or`20doesn't`20want`20to`20play,`20etc. X.IP`20"Next`20Game" XThe`20next`20game`20is`20displayed.`20`20If`20there`20is`20no`20next`20game, Xthis`20choice`20is`20equivalent`20to X.I`20Quit. X.IP`20"Quit" XThis`20allows`20you`20to`20exit`20from X.I`20"`5C-control". XIf`20you`20made`20any`20changes`20to`20your`20games,`20you`20will`20be`20given V`20the`20opportunity Xto`20save`20these`20changes,`20then`20ldb`20will`20exit. X.SH`20"VMS`20NOTES" X.PP XVMS`20users`20have`20a`20few`20unique`20considerations: X.PP XOn`20VMS,`20the`20default`20file`20names`20are`20changed`20from`20.ldb*`20to V`20ldb.*.`20`20This Xgroups`20all`20ldb`20files`20together. X.PP XVMS`20mail`20doesn't`20append Xmessages`20to`20an`20existing`20file,`20it`20creates`20new`20versions. XTo`20accommodate`20this,`20vms-compiled`20executables`20will`20search`20all V`20versions Xof`20a`20file`20by`20default.`20`20This`20applies`20to`20files`20specified`20o Vn`20the`20command Xline`20as`20well`20as`20the`20file`20specified`20in`20your`20ldb.rc.`20`20You V`20can`20disable Xthis`20in`20either`20case`20by`20specifying`20a`20version`20number,`20or`20by V`20specifying Xversion`20number`200`20to`20get`20the`20most`20current`20version.`20`20The`20d Vefault`20setting Xin`20ldb.rc`20is`20to`20scan`20sys$login:ldb.rcv;*.`20`20You`20might`20want V`20to`20change Xthis`20to`20ldb.txt;*,`20since`20that`20is`20the`20default`20extension`20added V`20by Xmail`20when`20you`20extract`20a`20file.`20`20If`20you`20use`20multiple`20versi Vons,`20you Xshould`20be`20careful`20not`20to`20PURGE`20until`20after`20you`20have`20run V`20ldb. X.PP XIf`20you`20have`20the`20Eunice`20package,`20ldb`20will`20compile`20and`20run V`20under`20it`20fine, Xbut`20any`20files`20created`20by`20the`20Eunice`5C-compiled`20version X(most`20notably`20the`20games`20file) Xwill`20be`20incompatible`20with`20the`20VAX`20C`5C-compiled`20version.`20`20Us Ve`20the Xunixtovms`20command`20to`20convert. X.PP XLdb`20is`20available`20in`20vms_share`20format`20with`20the`20manual`20preform Vatted. XIf`20you`20have`20MMS,`20you`20can`20use`20the`20makefile.vms`20provided`20by V`20entering: X.nf X`20`20`20`20`20$`20rename`20makefile.vms`20makefile. X`20`20`20`20`20$`20make X.fi XIf`20you`20don't`20have`20a`20make`20available,`20you`20can`20compile`20with: X.nf X`20`20`20`20`20$`20@makeldb X.fi XAfter`20ldb`20is`20compiled,`20you'll`20probably`20want Xto`20define`20a`20symbol`20such`20as: X.nf X`20`20`20`20`20$`20ldb`20:==`20$dua0:`5Bme.ldb`5Dldb X.fi Xso`20you`20can`20run`20it. X.PP XThe`20VMS`20implementation`20spawns`20a`20subprocess`20with`20no`20command`20w Vhen`20the Xsuperkey`20is`20pressed.`20`20You`20can`20enter`20LOGOUT`20or`20EOJ`20to`20ret Vurn`20to`20the Xgame.`20`20If`20you`20define`20a`20command`20to`20run`20when`20the`20superkey V`20is`20pressed, Xthe`20command`20will`20be`20run,`20but`20you`20will`20still`20need`20to`20logo Vut`20of Xthe`20subprocess`20to`20return`20to`20ldb. X.PP X.SH`20BUGS X.PP XA`20game`20file`20created`20by`20ldb`20under`20Eunice`20must`20be`20run`20thro Vugh X"unixtovms"`20before`20the`20VAX`5C-C`20ldb`20can`20read`20it. X.PP XThe`20superkey`20function`20only`20works`20when`20ldb`20is`20waiting`20for`20a V`20key. XIf`20ldb`20is`20doing`20something`20time-consuming,`20such`20as`20calculating Xlegal`20moves,`20the`20superkey`20will`20not`20work`20until`20the`20calculatio Vn Xis`20complete. X.PP XThere`20should`20be`20a`20way`20to`20play`20interactively`20(using`20socket V`20connections, Xfor`20example),`20rather`20than`20via`20e`5C-mail. X.PP XUnder`20Eunice,`20there`20is`20a`20bug`20when`20delmail`20is`20enabled, Xreceived`20mail`20is`20in`20a`20file`20with`20multiple`20versions, Xand`20these`20versions`20are`20entered`20on`20the`20command`20line X(as`20opposed`20to`20being`20specified`20by`20a`20pattern`20in`20.ldbrc). XEunice`20handles`20multiple`20versions`20by`20appending`20a`20dot`20and`20the V`20version Xnumber`20to`20all`20versions`20of`20the`20file`20but`20the`20newest`20version, V Xto`20which`20it`20appends`20nothing.`20`20When`20the`20most`20recent`20version V`20is`20deleted, Xthe`20next`20older Xversion`20becomes`20the`20most`20recent,`20and`20has`20no`20version`20suffix Xattached.`20`20This`20file`20will`20be`20skipped,`20since`20its`20name`20chang Ved Xbetween`20the`20time`20the`20file`20list`20was`20created`20and`20the`20file V`20is`20opened. XAll`20other`20files`20will`20be`20scanned`20properly.`20`20The`20work-around V`20for`20this Xis`20to`20not`20use`20a`20pattern`20like`20'ldb`20ldb.txt*'`20on`20the`20comma Vnd`20line Xto`20specify`20all`20versions`20of`20the`20file,`20but`20rather`20use`20'ldb V`20ldb.txt.*`20ldb.txt' Xso`20that`20the`20most`20recent`20version`20is`20scanned`20(and`20thus`20delet Ved)`20last. XAlternatively,`20the`20pattern`20can`20be`20quoted`20so`20that`20ldb`20interpr Vets Xit`20instead`20of`20the`20shell. X.PP XThe X.I`20`5C-myaddr Xcommand`20line`20option`20should`20override`20the Xmyaddr`20line`20in`20the`20people`20file. X.PP XVersion`201.0`20of`20ldb`20only`20allowed`20the`20colors`20red, Xwhite,`20and`20black,`20represented`20by`20r,`20w,`20and`20b, Xrespectively.`20`20Although`20ldb`201.0`20will`20allow`20games Xto`20be`20started`20and`20played`20correctly`20with`20different Xcolors,`20the`20move`20blocks`20will`20have`20the`20string`20"*BAD`20COLOR*" Xdisplayed`20where`20the`20color`20should`20be,`20making`20it`20difficult Xto`20figure`20out`20which`20color`20you`20are`20playing.`20`20Upgrading Xto`20a`20newer`20ldb`20will`20fix`20this.`20`20Nevertheless,`20if`20you Xare`20playing`20someone`20who`20is`20using`20ldb`201.0,`20you`20may`20want Xto`20restrict`20your`20color`20choices`20to`20r,`20w,`20and`20b. X.PP XOccasionally,`20ldb`20will`20print`20a`20spurious`20message`20telling Xyou`20that`20you`20only`20have`20one`20legal`20move.`20`20Usually`20when`20it V`20prints Xthis,`20it`20is`20right,`20but`20in`20the`20special`20case`20where`20you`20hav Ve`20one Xpiece`20left`20to`20bear`20off,`20one`20of`20your`20rolls`20is`20less`20than Xyou`20need`20to`20bear`20it`20off,`20and`20the`20other`20roll`20is`20big`20eno Vugh Xto`20bear`20off`20by`20itself,`20ldb`20will`20want`20you`20to`20use`20the`20sm Valler Xdie`20first,`20then`20bear`20off`20with`20the`20bigger`20one.`20`20This`20is V`20consistent Xwith`20the`20rules`20that`20say`20you`20must`20use`20both`20dice`20if`20you V`20can, Xbut`20is`20not`20correct`20in`20this`20case.`20`20Note`20that`20you`20can`20ei Vther Xuse`20both`20dice`20like`20ldb`20wants,`20or`20ignore`20the`20message`20and V`20bear Xoff`20with`20the`20larger`20die.`20`20Your`20move`20will`20be`20accepted`20eit Vher`20way. $ call unpack LDB.MAN;1 372637774 "" $! $ create 'f' X%!PS-Adobe-2.1 X%%Creator:`20groff`20version`201.01 X%%DocumentFonts:`20Times-Italic`20Times-Bold`20Times-Roman X%%DocumentSuppliedFonts: X%%DocumentNeededFonts:`20Times-Italic`20Times-Bold`20Times-Roman X%%Pages:`2012 X%%EndComments X/grops`20100`20dict`20def`20grops`20begin X%! X%`20If`20you`20add`20definitions`20here,`20be`20sure`20to`20check`20that`20MAX V_PROLOGUE_DEFS X%`20in`20ps.c`20is`20large`20enough. X X%`20The`20ASCII`20code`20of`20the`20space`20character. X/SC`2032`20def X X/A`20/show`20load`20def X/B`20`7B`200`20SC`203`20-1`20roll`20widthshow`20`7D`20bind`20def X/C`20`7B`200`20exch`20ashow`20`7D`20bind`20def X/D`20`7B`200`20exch`200`20SC`205`202`20roll`20awidthshow`20`7D`20bind`20def X/E`20`7B`200`20rmoveto`20show`20`7D`20bind`20def X/F`20`7B`200`20rmoveto`200`20SC`203`20-1`20roll`20widthshow`20`7D`20bind`20def V X/G`20`7B`200`20rmoveto`200`20exch`20ashow`20`7D`20bind`20def X/H`20`7B`200`20rmoveto`200`20exch`200`20SC`205`202`20roll`20awidthshow`20`7D V`20bind`20def X/I`20`7B`200`20exch`20rmoveto`20show`20`7D`20bind`20def X/J`20`7B`200`20exch`20rmoveto`200`20SC`203`20-1`20roll`20widthshow`20`7D`20bin Vd`20def X/K`20`7B`200`20exch`20rmoveto`200`20exch`20ashow`20`7D`20bind`20def X/L`20`7B`200`20exch`20rmoveto`200`20exch`200`20SC`205`202`20roll`20awidthshow V`20`7D`20bind`20def X/M`20`7B`20rmoveto`20show`20`7D`20bind`20def X/N`20`7B`20rmoveto`200`20SC`203`20-1`20roll`20widthshow`20`7D`20bind`20def X/O`20`7B`20rmoveto`200`20exch`20ashow`20`7D`20bind`20def X/P`20`7B`20rmoveto`200`20exch`200`20SC`205`202`20roll`20awidthshow`20`7D`20bin Vd`20def X/Q`20`7B`20moveto`20show`20`7D`20bind`20def`20 X/R`20`7B`20moveto`200`20SC`203`20-1`20roll`20widthshow`20`7D`20bind`20def X/S`20`7B`20moveto`200`20exch`20ashow`20`7D`20bind`20def X/T`20`7B`20moveto`200`20exch`200`20SC`205`202`20roll`20awidthshow`20`7D`20bind V`20def X X%`20name`20size`20font`20SF`20- X X/SF`20`7B X`09findfont`20exch X`09`5B`20exch`20dup`200`20exch`200`20exch`20neg`200`200`20`5D`20makefont X`09dup`20setfont X`09`5B`20exch`20/setfont`20cvx`20`5D`20cvx`20bind`20def X`7D`20bind`20def X X%`20name`20a`20c`20d`20font`20MF X X/MF`20`7B X`09findfont X`09`5B`205`202`20roll X`090`203`201`20roll`20%`20b X`09neg`200`200`20`5D`20makefont X`09dup`20setfont X`09`5B`20exch`20/setfont`20cvx`20`5D`20cvx`20bind`20def X`7D`20bind`20def X X`09 X%`20BP`20- X X/BP`20`7B X`09/level0`20save`20def X`091`20setlinecap X`091`20setlinejoin X`0972`20RES`20div`20dup`20scale X`09LS`20`7B X`09`0990`20rotate X`09`7D`20`7B X`09`090`20PL`20translate X`09`7D`20ifelse X`091`20-1`20scale X`7D`20bind`20def X X/EP`20`7B X`09level0`20restore X`09showpage X`7D`20bind`20def X X X%`20centerx`20centery`20radius`20startangle`20endangle`20DA`20- X X/DA`20`7B X`09newpath`20arcn`20stroke X`7D`20bind`20def X X%`20x`20y`20SN`20-`20x'`20y' X%`20round`20a`20position`20to`20nearest`20(pixel`20+`20(.25,.25)) X X/SN`20`7B X`09transform`20 X`09.25`20sub`20exch`20.25`20sub`20exch X`09round`20.25`20add`20exch`20round`20.25`20add`20exch X`09itransform X`7D`20bind`20def X`09 X%`20endx`20endy`20startx`20starty`20DL`20- X%`20we`20round`20the`20endpoints`20of`20the`20line,`20so`20that`20parallel`20h Vorizontal X%`20and`20vertical`20lines`20will`20appear`20even X X/DL`20`7B X`09SN X`09moveto X`09SN X`09lineto`20stroke X`7D`20bind`20def X X%`20centerx`20centery`20radius`20DC`20- X X/DC`20`7B X`09newpath`200`20360`20arc`20closepath X`7D`20bind`20def X X X/TM`20matrix`20def X X%`20`20width`20height`20centerx`20centery`20DE`20- X X/DE`20`7B X`09TM`20currentmatrix`20pop X`09translate`20scale`20newpath`200`200`20.5`200`20360`20arc`20closepath X`09TM`20setmatrix X`7D`20bind`20def X X%`20these`20are`20for`20splines X X/RC`20/rcurveto`20load`20def X/RL`20/rlineto`20load`20def X/ST`20/stroke`20load`20def X/MT`20/moveto`20load`20def X/CL`20/closepath`20load`20def X X%`20fill`20the`20last`20path X X%`20amount`20FL`20- X X/FL`20`7B X`09currentgray`20exch`20setgray`20fill`20setgray X`7D`20bind`20def X X%`20fill`20with`20the`20`60`60current`20color'' X X/BL`20/fill`20load`20def X X/LW`20/setlinewidth`20load`20def X%`20new_font_name`20encoding_vector`20old_font_name`20RE`20- X X/RE`20`7B X`09findfont X`09dup`20maxlength`20dict`20begin X`09`7B X`09`091`20index`20/FID`20ne`20`7B`20def`20`7D`20`7B`20pop`20pop`20`7D`20ifelse V X`09`7D`20forall X`09/Encoding`20exch`20def X`09dup`20/FontName`20exch`20def X`09currentdict`20end`20definefont`20pop X`7D`20bind`20def X X%`20hpos`20vpos`20EBEGIN`20- X X/EBEGIN`20`7B X`09moveto X`09DEFS`20begin X`7D`20bind`20def X X/EEND`20/end`20load`20def X X%`20llx`20lly`20newwid`20wid`20newht`20ht`20newllx`20newlly`20- X X/PICTURE`20`7B X`09translate X`09div`203`201`20roll`20div`20exch`20scale X`09neg`20exch`20neg`20exch`20translate X`09%`20set`20the`20graphics`20state`20to`20default`20values X`090`20setgray X`090`20setlinecap X`091`20setlinewidth X`090`20setlinejoin X`0910`20setmiterlimit X`09`5B`5D`200`20setdash X`09newpath X`7D`20bind`20def X/DEFS`201`20dict`20def`20DEFS`20begin/u`7B.001`20mul`7Dbind`20def`20end`20end X%%EndProlog X%%IncludeFont:`20Times-Italic X%%IncludeFont:`20Times-Bold X%%IncludeFont:`20Times-Roman X%%BeginSetup Xgrops`20begin/#copies`201`20def/RES`2072`20def/PL`20792`20def/LS`20false`20def V/ENC0`5B/asciicircum X/asciitilde/Scaron/Zcaron/scaron/zcaron/Ydieresis/trademark/.notdef/.notdef X/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef X/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef X/.notdef/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar X/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen X/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolo Vn X/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/ VX X/Y/Z/bracketleft/backslash/bracketright/circumflex/underscore/quoteleft/a/b/c/ Vd X/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde X/.notdef/quotesinglbase/guillemotleft/guillemotright/bullet/florin/fraction X/perthousand/dagger/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj V X/grave/hungarumlaut/dotaccent/breve/caron/ring/ogonek/quotedblleft X/quotedblright/oe/lslash/quotedblbase/OE/Lslash/.notdef/exclamdown/cent X/sterling/currency/yen/brokenbar/section/dieresis/copyright/ordfeminine X/guilsinglleft/logicalnot/minus/registered/macron/degree/plusminus/twosuperior V X/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior X/ordmasculine/guilsinglright/onequarter/onehalf/threequarters/questiondown X/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute X/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve X/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave/Uacute/Ucircumflex V X/Udieresis/Yacute/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis X/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave/iacute X/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis X/divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis`5Dde Vf X/Times-Italic@0`20ENC0/Times-Italic`20RE/Times-Bold@0`20ENC0/Times-Bold`20RE X/Times-Roman@0`20ENC0/Times-Roman`20RE X%%EndSetup X%%Page:`201`201 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`209/Times-Bold@0`20SF X(NAME)72`2084`20Q`20F0(ldb`20`5C255`20Play`20backgammon`20by`20e`5C255mail)108 V`2096`20Q`20F1(SYNOPSIS)72 X112.8`20Q`20F0(ldb`20`5Boptions`5D`20`5Binput`20`5C214les...`5D)108`20124.8 V`20Q`20F1(DESCRIPTION)72`20141.6 XQ/F2`2010/Times-Italic@0`20SF(Ldb)108`20153.6`20Q`20F0`204.007 X(allows`20two`20people`20to`20play`20backgammon`20over`20a`20network`20using V`20electronic`20mail.) X6.507`20F`204.006(It`20runs`20on)9.006`20F`201.175 X(character`5C255oriented`20terminals,`20or`20emulators`20thereof,`20using`20th Ve)108`20165.6`20R XF2(curses)3.675`20E`20F0`201.175(screen`20package.)3.675`20F`201.175(It`20will V`20run`20on`20most) X6.175`20F`201.339(UNIX`20dialects,`20as`20well`20as`20V)108`20177.6`20R`201.33 V9 X(AX`5C255C`20under`20VMS`205.0`20and`20above.)-1.29`20F`20F2(Ldb)6.339`20E`20F V0`201.339 X(will`20display`20a`20picture`20of`20the`20board,)3.839`20F`20.358 X(prompt`20the`20user`20to`20enter`20a`20move,`20check`20the`20move`20for`20leg Vality)108`20189.6`20R`202.858 X(,a)-.65`20G`20.358(nd`20send`20the`20move`20to`20the`20opponent.)362.706`2018 V9.6`20R`20.358(When`20it) X5.358`20F`20.023(arrives,`20it`20will`20be`20displayed`20on`20the`20opponent') V108`20201.6`20R`202.522 X(ss)-.55`20G`20.022(creen,`20after`20which`20the`20opponent`20will`20be`20prom Vpted`20for`20a`20move) X296.78`20201.6`20R(to`20be`20sent`20back.)108`20213.6`20Q`20F1(FEA)72`20230.4 V`20Q(TURES)-.666`20E`20F0 X(Multiple`20Games)108`20242.4`20Q`20F2(Ldb)144`20254.4`20Q`20F0`20.068 X(can`20keep`20track`20of`20an`20arbitrary`20number`20of`20games`20simultaneous Vly)2.568`20F`202.568 X(,a)-.65`20G`20.069(nd`20will`20display`20them`20one`20at`20a)424.038`20254.4 V`20R`20.71 X(time`20for`20you`20to`20play)144`20266.4`20R`205.71(.Y)-.65`20G`20.71(ou`20ca Vn`20exit`20from)240.06 X266.4`20R`20F2(ldb)3.21`20E`20F0`20.709 X(at`20any`20time;`20when`20you`20run`20ldb`20again,`20it`20will`20pick`20up)3. V21`20F X(your`20games`20where`20you`20left`20of)144`20278.4`20Q(f.)-.18`20E(Move`20Che Vcking)108`20295.2`20Q X(Both`20your`20moves`20and`20your`20opponent')144`20307.2`20Q`202.5(sm)-.55 V`20G X(oves`20are`20checked`20for`20legality)307.33`20307.2`20Q`205(.T)-.65`20G(his V`20includes:)435.25 X307.2`20Q`2030.36108`20324`20S(anding`20on`20an`20occupied`20point.)150. V11`20324`20Q`2030.36 X108`20340.8`20S(earing`20of)150.67`20340.8`20Q`202.5(fb)-.18`20G X(efore`20your`20inner`20table`20is`20full.)197.14`20340.8`20Q`2030.36108 V`20357.6`20S X(rying`20to`20move`20pieces`20that`20are`20on`20the`20board`20when`20you`20hav Ve`20a`20piece`20on`20the`20bar) X149.76`20357.6`20Q(.)-.55`20E`2030.36108`20374.4`20S`20.817(rying`20to V`20bear`20of)149.76 X374.4`20R`203.317(fap)-.18`20G`20.817 X(iece`20when`20there`20is`20a`20piece`20on`20a`20higher`20point,`20and`20the V`20roll`20is`20not`20being`20used) X233.365`20374.4`20R(exactly)144`20386.4`20Q(.)-.65`20E`2030.36108`20403. V2`20S X(rying`20to`20leave`20a`20usable`20move`20unused.)149.76`20403.2`20Q`2030.36108`20420`20S(ryin`5C Xg`20to`20leave`20a`20move`20unused`20when`20it`20is`20usable`20and`20has`20a V`20higher`20roll`20than`20the`20move`5C X`20that`20is`20used.)149.76`20420`20Q`2030.36108`20436.8`20S X(rying`20to`20double`20when`20you`20doubled`20last.)149.76`20436.8`20Q`2030.36 V108`20453.6`20S X(rying`20to`20double`20in`20a`20Crawford`20rule`20game.)149.76`20453.6`20Q(Mes Vsage`20Reliability) X108`20470.4`20Q`20F2(Ldb)144`20482.4`20Q`20F0 X(detects`20`5C(and`20rejects`5C)`20duplicate`20messages,`20and`20can`20regener Vate`20lost`20messages.) X2.5`20E(Remote`20Start)108`20499.2`20Q`20F2(Ldb)144`20511.2`20Q`20F0`20.624 X(can`20start`20a`20game`20between`20two`20players`20on`20remote`20hosts.)3.124 V`20F`20.624 X(This`20is`20used`20to`20set`20up`20"game`20starter")5.624`20F`201.326(hosts, V`20where`20people`20inter`5C Xested`20in`20`5C214nding`20new`20opponents`20are`20matched`20by`20some`20crite Vria`20`5C(such`20as)144 X523.2`20R(ability)144`20535.2`20Q`203.583(,o)-.65`20G`203.583(rb)179.993`20535 V.2`20S`203.582(yat) X191.906`20535.2`20S`201.082 X(ournament`20schedule`5C),`20and`20have`20their`20games`20started`20automatica Vlly)211.29`20535.2 XR`206.082(.F)-.65`20G`201.082(or`20a`20current)491.746`20535.2`20R X(listing`20of`20game`20starter`20hosts,`20see`20the`20README`20`5C214le.)144 V`20547.2`20Q(Game`20V)108 X564`20Q(alue)-1.11`20E`20F2(Ldb)144`20576`20Q`20F0`201.107(detects`20the`20end V`20of`20the`20game,`20gamm`5C Xons,`20and`20backgammons,`20and`20noti`5C214es`20both`20players`20of`20the)3.6 V06`20F`20.179 X(game`20value`20when`20the`20game`20is`20over)144`20588`20R`205.178(.T)-.55 V`20G`20.178 X(he`20Jacoby`20rule`20may`20be`20enabled,`20as`20may`20European`20scoring,`20t Vo)296.61`20588`20R X(calculate`20the`20game`20value`20as`20desired.)144`20600`20Q(Online`20Help V`20Screen)108`20616.8`20Q XF2(Ldb)144`20628.8`20Q`20F0`20.514(has`20an`20online,`20context`20sensitive V`20help`20facility`20that`5C X`20lists`20the`20available`20commands`20for`20the`20current)3.014`20F(screen.) V144`20640.8`20Q X(Match`20Play)108`20657.6`20Q`20F2(Ldb)144`20669.6`20Q`20F0`20.224(can`20suppo Vrt`20matches`20that`20pl`5C Xay`20to`20any`20desired`20point`20total,`20and`20will`20continue`20to`20start V`20games`20until)2.724`20F X(one`20player`20reaches`20that`20total.)144`20681.6`20Q`20F1(OPTIONS)72`20703. V2`20Q/F3`2010 X/Times-Bold@0`20SF(-r)108`20715.2`20Q(ead)-.18`20E`20F0`20.908 X(Mail`20is`20read,`20and`20the`20games`20are`20updated`20and`20saved.)144`2071 V5.2`20R`20.909 X(The`20user`20is`20not`20prompted`20for`20his`20moves.)5.908`20F(If)5.909`20E X(neither`20`5C255read`20nor`20`5C255play`20are`20given,`20both`20are`20assumed V.)144`20727.2`20Q X(October`206,`201992)273.645`20768`20Q(1)535`20768`20Q`20EP X%%Page:`202`202 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`2010/Times-Bold@0 XSF(-play)108`2084`20Q`20F0`20.507(Any`20games`20that`20are`20waiting`20for`20l Vocal`20input`20are`20displ`5C Xayed`20for`20the`20user`20to`20process.)144`2084`20R`20.507(No`20mail`20is`20r Vead.)5.507`20F X(If`20neither`20`5C255read`20nor`20`5C255play`20are`20given,`20both`20are`20as Vsumed.)144`2096`20Q`20F1 X(-color`20xy)108`20112.8`20Q`20F0`20.507 X(The`20colors`20for`20the`20game`20started`20by`20this`20ldb`20run`20are`20set V`20to`20x`20and`20y)144`20124.8`20R X5.507(.T)-.65`20G`20.507(he`20`5C214rst`20color`20is`20played`20by`20the)420.8 V58`20124.8`20R`202.21 X(local`20user)144`20136.8`20R`204.71(,a)-.4`20G`202.21 X(nd`20the`20other`20is`20played`20by`20the`20opponent.)196.06`20136.8`20R`202. V21 X(Legal`20color`20characters`20are`20any`20printing)7.21`20F(character)144`2014 V8.8`20Q`203.618(,e) X-.4`20G`201.118 X(xcept`20that`20x`20and`20y`20may`20not`20be`20the`20upper`20and`20lower`20cas Ve`20of`20the`20same`20character) X190.798`20148.8`20R`206.119(.T)-.55`20G(he)530.56`20148.8`20Q(default`20is`20" V`5C255color`20rw".) X144`20160.8`20Q`20F1(-dir)108`20177.6`20Q(ection`20up/down)-.18`20E`20F0`20.10 V9(This`20sets`20the`20di`5C Xrection`20of`20play`20for`20the`20local`20user`20for`20the`20game`20started V`20by`20this`20ldb`20run.)144 X189.6`20R`20.108(The`20default`20is)5.108`20F("`5C255direction`20up".)144`2020 V1.6`20Q`20F1 X(-myaddr`20addr)108`20218.4`20Q`20F0`20-1(Yo)144`20230.4`20S`201.476(ur`20mail V`20address`20is`20set`20to) X1`20F/F2`2010/Times-Italic@0`20SF(addr)3.976`20E`20F0`201.477 X(for`20games`20started`20on`20this`20ldb`20run.)3.976`20F`201.477(This`20overr Vides`20the`20address) X6.477`20F(speci`5C214ed`20in)144`20242.4`20Q`20F2(.ldbr)2.5`20E(c.)-.37`20E V`20F1(-start`20user)108 X259.2`20Q`20F0`203.303(Ag)144`20271.2`20S`20.803(ame`20is`20started`20with`20t Vhe`20speci`5C214ed`20user) X159.523`20271.2`20R`205.803(.T)-.55`20G(he)325.404`20271.2`20Q`20F2(user)3.303 V`20E`20F0(ar)3.303 XE`20.803(gument`20may`20be`20any`20e`5C255mail`20address`20that`20is)-.18`20F V`203.156 X(valid`20for`20your`20host.)144`20283.2`20R`203.156 X(Some`20e`5C255mail`20addresses`20will`20need`20to`20be`20quoted`20if`20they V`20contain`20shell)8.156`20F X2.808(metacharacters.`20The)144`20295.2`20R`20F2(user)2.808`20E`20F0(ar)2.808 V`20E`20.308 X(gument`20may`20also`20be`20an)-.18`20F`20F2(alias)2.807`20E`20F0`20.307 X(for`20an`20opponent`20you`20have`20played`20before.)2.807`20F`20.336(Aliases V`20are`20de`5C214ned`20in`5C X`20the`20people`20`5C214le,`20and`20are`20initialized`20to`20the`20`5C214rst V`20name`20of`20the`20opponent,`20w`5C +-+-+-+-+-+-+-+- END OF PART 4 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+ Xith`20all)144`20307.2`20R(upper)144`20319.2`20Q`20.64(-case`20letters`20change Vd`20to`20lower)-.2`20F X5.639(.T)-.55`20G`20.639 X(he`20`5C255start`20option`20is`20deferred`20until`20all`20command`20line`20op Vtions)301.679`20319.2`20R X1.482(have`20been`20scanned,`20so`20the`20position`20of`20the`20`5C255start V`20option`20on`20the`20comman`5C Xd`20line`20is`20not`20important.)144`20331.2`20R X(Only`20one`20`5C255start`20may`20be`20used`20per`20ldb`20run.)144`20343.2`20Q V`20F1(-r)108`20360`20Q X(emotestart`20user1`20user2)-.18`20E`20F0`203.005(Ag)144`20372`20S`20.505 X(ame`20is`20started`20between`20user1`20and`20user2.)159.225`20372`20R`20.504 X(The`20local`20host`20sends`20a`20remote`20start`20message`20to`20user1)5.505 V`20F`20.127 X(instructing`20it`20to`20start`20a`20game`20with`20user2.)144`20384`20R`20.128 V X(The`20local`20host`20does`20not`20participate`20thereafter`20in`20the`20game. V)5.128`20F`201.503(For`5C X`20the`20purposes`20of`20the`20`5C255color`20and`20`5C255direction`20options, V`20user1`20is`20considered`20`5C Xthe`20local`20user)144`20396`20R`206.503(.T)-.55`20G(he)530.56`20396`20Q`20.48 V5(`5C255remotestart`20`5C Xoption`20is`20deferred`20until`20all`20command`20line`20options`20have`20been V`20scanned,`20so`20the`20po`5C Xsition)144`20408`20R`20.669 X(of`20the`20`5C255remotestart`20option`20on`20the`20command`20line`20is`20not V`20important.)144`20420`20R X.668(Only`20one`20`5C255remotestart`20may`20be)5.668`20F(used`20per`20ldb`20ru Vn.)144`20432`20Q`20F1 X(-notify`20addr)108`20448.8`20Q`20F0`20.121(This`20option`20af)144`20460.8`20R V`20.122 X(fects`20games`20started`20by`20either`20-start`20or`20-remotestart`20on`20thi Vs`20ldb`20run.)-.18`20F X2.622(Am)5.122`20G`20.122(essage`20is`20sent)485.876`20460.8`20R`201.299(to V`20the`20speci`5C214ed`20`5C Xaddress`20when`20the`20game`20that`20is`20started`20by`20the`20-start`20or`20- Vremotestart`20option`20end`5C Xs.)144`20472.8`20R`206.128 X(This`20message`20includes`20the`20termination`20code`20of`20the`20game,`20the V`20game`20value,`20and`20a) X144`20484.8`20R`20.569(gammon/backgammon`20`5C215ag.)144`20496.8`20R`20.569 X(This`20option`20is`20mainly`20for`20the`20use`20of`20game`20starters`20that V`20wish`20to`20either)5.569`20F X.583(keep`20score`20or`20start`20new`20games`20when`20the`20old`20ones`20`5C21 V4nish.)144`20508.8`20R`20.583 X(Even`20though`20-notify`20is`20only`20used`20by`20the)5.583`20F`20.041(player V`20that`20starts`20the`20g`5C Xame`20`5C(or`20the`20game`20starter`20that`20uses`20-remotestart`5C),`20both V`20player)144`20520.8`20R X1.141`20-.55('s`20l).37`20H`20.041(db`20will`20send`20a).55`20F(message`20when V`20the`20game`20ends.)144 X532.8`20Q`20F1(-jacoby)108`20549.6`20Q`20F0`20.437 X(The`20Jacoby`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run.)144`20561.6`20R X.438(This`20rule`20speci`5C214es`20that`20gammons)5.438`20F`20.495(and`20backg Vammons`20count`20as`20`5C Xa`20single`20point`20if`20neither`20player`20doubled`20during`20the`20game.)14 V4`20573.6`20R`20.495 X(This`20option)5.495`20F`20.085(may`20only`20be`20enabled`20by`20the`20user V`20starting`20the`20game,`20a`5C Xnd`20may`20not`20be`20disabled`20by`20the`20other`20player)144`20585.6`20R`205 V.086(.I)-.55`20G(f)536.67 X585.6`20Q`202.27(the`20opponent')144`20597.6`20R`204.77(sv)-.55`20G`202.269 X(ersion`20of`20ldb`20does`20not`20support`20the`20Jacoby`20rule,`20it`20is`20d Visabled`20and`20the`20game) X214.65`20597.6`20R(proceeds`20as`20if`20it`20were`20never`20enabled.)144`20609 V.6`20Q`20F1(-crawford) X108`20626.4`20Q`20F0`20.471 X(The`20Crawford`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run.)144`20638.4`20R X.472(This`20rule`20speci`5C214es`20that`20neither)5.471`20F`20.187(player`20ma Vy`20double`20for`20the`5C X`20`5C214rst`20game`20of`20a`20match`20after`20either`20player`20is`20within V`201`20point`20of`20winning`20the) X144`20650.4`20R`203.912(match.`20If)144`20662.4`20R`201.412 X(match`20play`20is`20not`20enabled,`20this`20ar)3.912`20F`201.413(gument`20has V`20no`20meaning.)-.18`20F X1.413(This`20option`20may`20only`20be)6.413`20F`202.285(enabled`20by`20the`20u Vser`20starting`20the`20g`5C Xame,`20and`20may`20not`20be`20disabled`20by`20the`20other`20player)144`20674.4 V`20R`207.284(.I)-.55`20G X4.784(ft)519.666`20674.4`20S(he)530.56`20674.4`20Q(opponent')144`20686.4`20Q V`202.652(sv)-.55 XG`20.153(ersion`20of`20ldb`20does`20not`20support`20the`20Crawford`20rule,`20i Vt`20is`20disabled`20and`20th`5C Xe`20game`20proceeds)195.542`20686.4`20R(as`20if`20it`20were`20never`20enabled. V)144`20698.4`20Q X(October`206,`201992)273.645`20768`20Q(2)535`20768`20Q`20EP X%%Page:`203`203 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`2010/Times-Bold@0 XSF(-eur)108`2084`20Q(opean)-.18`20E`20F0`202.393 X(The`20European`20rule`20is`20enabled`20for`20the`20game`20started`20by`20this V`20ldb`20run.)144`2096`20R X2.392(This`20rule`20speci`5C214es`20that)7.392`20F`20.681 X(backgammons`20count`20as`20double,`20rather`20than`20triple,`20the`20score V`20shown`20on`20the`20cube.) X144`20108`20R`20.682(This`20option`20may)5.682`20F`20.348(only`20be`20enabled V`20by`20the`20user`20starti`5C Xng`20the`20game,`20and`20may`20not`20be`20disabled`20by`20the`20other`20player V)144`20120`20R`205.348(.I) X-.55`20G`202.848(ft)521.602`20120`20S(he)530.56`20120`20Q(opponent')144`20132 V`20Q`202.652(sv)-.55 XG`20.153(ersion`20of`20ldb`20does`20not`20support`20the`20European`20rule,`20i Vt`20is`20disabled`20and`20th`5C Xe`20game`20proceeds)195.542`20132`20R(as`20if`20it`20were`20never`20enabled.)1 V44`20144`20Q`20F1 X(-permanent)108`20160.8`20Q`20F0`202.326 X(The`20game`20started`20by`20this`20ldb`20run`20is`20marked`20permanent.)144 V`20172.8`20R`202.325 X(Permanent`20games`20are`20automatically)7.325`20F`20.459(restarted`20when`20t Vhey`20end.)144 X184.8`20R`20.459(This`20is`20for`20people`20you`20play`20with`20constantly)5.4 V59`20F`202.96(,a)-.65`20G X.46(nd`20it`20saves`20you`20the`20trouble)432.43`20184.8`20R`20.83 X(of`20restarting`20the`20game`20when`20it`20is`20over)144`20196.8`20R`205.83(. VT)-.55`20G`20.829 X(his`20option`20may`20only`20be`20enabled`20by`20the`20user`20starting`20the)3 V12.84`20196.8`20R`201.499 X(game,`20and`20may`20not`20be`20disabled`20by`20the`20other`20player)144`20208 V.8`20R`206.499(.I)-.55`20G X4(ft)370.9`20208.8`20S`201.5(he`20opponent')381.01`20208.8`20R`204(sv)-.55`20G V`201.5 X(ersion`20of`20ldb`20does`20not)447.34`20208.8`20R`20.051(support`20permanent V`20games,`20the`20perma`5C Xnent`20`5C215ag`20is`20disabled`20and`20the`20game`20proceeds`20as`20if`20it V`20were`20never)144`20220.8`20R X(enabled.)144`20232.8`20Q`20F1(-match`20points)108`20249.6`20Q`20F0`20.306(Thi Vs`20option`20enables`5C X`20match`20play`20and`20speci`5C214es`20the`20number`20of`20points`20the`20mat Vch`20is`20to`20play`20to.)144 X261.6`20R(Games)5.306`20E`20.206(that`20are`20part`20of`20a`20match`20have`20a Vdditional`20informatio`5C Xn`20displayed`20above`20the`20board`20to`20show`20the`20current)144`20273.6 V`20R`20.319 X(match`20score`20and`20the`20number`20of`20points`20being`20played`20to.)144 V`20285.6`20R`20.32 X(When`20a`20game`20that`20is`20part`20of`20a`20match`20ends,)5.319`20F`20.709( Vand`20the`20speci`5C214ed`20nu`5C Xmber`20of`20points`20has`20not`20been`20reached,`20the`20game`20is`20restarted V.)144`20297.6`20R`20.708 X(This`20option`20may)5.708`20F`20.348(only`20be`20enabled`20by`20the`20user V`20starting`20the`20game,`20a`5C Xnd`20may`20not`20be`20disabled`20by`20the`20other`20player)144`20309.6`20R`205 V.349(.I)-.55`20G`202.849 X(ft)521.601`20309.6`20S(he)530.56`20309.6`20Q(opponent')144`20321.6`20Q`203.25 V5(sv)-.55`20G X.754(ersion`20of`20ldb`20does`20not`20support`20match`20play)196.145`20321.6 V`20R`203.254(,t)-.65`20G X.754(he`20game`20proceeds`20as`20if`20it`20were`20a`20normal)375.128`20321.6 V`20R(game.)144`20333.6`20Q XF1(-scor)108`20350.4`20Q(e)-.18`20E`20F0`201.959 X(The`20cumulative`20score`20for`20all`20opponents`20is`20printed.)144`20350.4 V`20R`201.96 X(This`20consists`20of`20points,`20games,`20gammons,)6.959`20F`201.812 X(backgammons,`20and`20matches`20that`20have`20been`20won`20and`20lost`20for V`20each`20opponent.)144 X362.4`20R`204.312(At)6.812`20G`201.812(otal`20over`20all)488.606`20362.4`20R X(opponents`20is`20also`20printed.)144`20374.4`20Q`20F1(-br)108`20391.2`20Q(oad Vcast`20`5B`5C214le`5D) X-.18`20E`20F0`202.138(The`20speci`5C214ed`20`5C214le`20is`20mailed`20to`20all V`20current`20opponents.)144 X403.2`20R`202.138(This`20is`20useful`20for`20announcing`20vacation)7.138`20F(a Vbsences,`20etc.)144 X415.2`20Q(If`20the`20`5C214le`20ar)5`20E X(gument`20is`20not`20given,`20standard`20input`20is`20read`20and`20sent`20to V`20all`20opponents.)-.18`20E XF1(-contr)108`20432`20Q(ol)-.18`20E`20F0`201.726(This`20option`20puts`20ldb V`20into`20a`20special`20mod`5C Xe`20that`20does`20not`20allow`20games`20to`20be`20played,`20but`20instead)144 V`20444`20R`20.806(displays`20`5C Xthem`20one`20at`20a`20time`20and`20allows`20certain`20"overhead"`20functions V`20to`20be`20performed.)144 X456`20R`20.806(These`20are)5.806`20F X(described`20fully`20in`20the`20section`20titled`20"CONTROLLING`20A`20GAME".)1 V44`20468`20Q`20F1(-r) X108`20484.8`20Q(econstruct`20`5C214le)-.18`20E`20F0`20.078(This`20option`20all Vows`20your`20game`20`5C214`5C Xle`20to`20be`20reconstructed`20if`20you`20accidentally`20clobber`20it.)144`204 V96.8`20R`20.077 X(It`20does`20this`20by)5.077`20F`20.502(extracting`20the`20information`20from V`20your`20opponent') X144`20508.8`20R`203.002(sd)-.55`20G`20.502 X(ata`20`5C214le`20and`20"reversing"`20it`20so`20you`20can`20use`20it.)348.1 V`20508.8`20R`20-.7(To)5.502`20G X.274(use`20the`20reconstruct`20option,`20ask`20all`20of`20your`20opponents`20t Vo`20send`20you`20their`20.`5C Xldbdata`20`5C214les.)144`20520.8`20R`20.273(Extract`20these)5.273`20F`20.537(f Vrom`20your`20mail`20in`5C Xto`20`5C214les`20on`20your`20system,`20strip`20the`20mail`20headers,`20and`20f Veed`20them`20one`20at`20a`20time`5C X`20into)144`20532.8`20R`205.152(ldb.`20For)144`20544.8`20R`202.651(each`20game V`20found`20listing`20you`5C X`20as`20the`20opponent,`20you`20will`20be`20prompted`20to`20enter`20the)5.152 V`20F(opponent')144`20556.8 XQ`202.555(se)-.55`20G`20.055(-mail`20address`20or`20alias`20`5C(and`20his`20na Vme`20if`20he`20is`20not`20in`20y`5C Xour`20people`20`5C214le`5C),`20and`20the`20game`20will)194.885`20556.8`20R X(be`20added`20to`20your`20game`20`5C214le.)144`20568.8`20Q`201.239(The`20recon Vstruct`20function`20cann`5C Xot`20recover`20games`20that`20were`20in`20the`20process`20of`20starting`20`5C( Vi.e.`20in`20their)144`20585.6 XR`20.723(initial`20roll`20stage`5C),`20or`20that`20have`20already`20completed V`20`5C(why`20bother?`5C).) X144`20597.6`20R`20-1(Yo)5.724`20G`20.724(ur`20opponent`20should`20read`20any)1 V`20F`201.466(mail`20`5C214`5C Xles`20you`20sent`20before`20your`20data`20`5C214le`20got`20clobbered,`20and V`20should`20make`20his`20move`20a`5C Xnd`20send`20it)144`20609.6`20R`20.484(before`20sending`20you`20his`20data`20 V`5C214le.)144`20621.6`20R`20-1 X(Yo)5.484`20G`202.984(uw)1`20G`20.484 X(ill`20not`20need`20to`20process`20the`20move`20he`20sent,`20though,`20since V`20all)306.086`20621.6`20R X(that`20data`20is`20in`20his`20`5C214le`20anyway)144`20633.6`20Q`205(.I)-.65 V`20G`202.5(tw)270.84`20633.6 XS(on')283.34`20633.6`20Q`202.5(th)-.18`20G(urt`20if`20you`20do,`20ldb`20will V`20just`20ignore`20it.) X306.77`20633.6`20Q`20F1(-help)108`20650.4`20Q`20F0 X(This`20prints`20a`20one-line`20description`20of`20each`20option,`20in`20case V`20you`20for)144`20650.4`20Q X(get`20later`20on.)-.18`20E/F2`209/Times-Bold@0`20SF(SCREEN)72`20672`20Q`20F0 X(The`20screen`20displays`20the`20following`20items`20of`20interest:)108`20684 V`20Q`20F1(Opponent)108 X700.8`20Q`20F0`20.189(The`20e`5C255mail`20address`20and`20personal`20name`20of V`20the`20opponent`20are`20di`5C Xsplayed`20on`20the`20top`20line`20of`20the`20screen.)144`20712.8`20R X(This`20can`20help`20identify`20the`20game`20if`20you`20have`20many`20games V`20in`20progress`20at`20once.) X144`20724.8`20Q(October`206,`201992)273.645`20768`20Q(3)535`20768`20Q`20EP X%%Page:`204`204 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`2010/Times-Bold@0 XSF(Board`20Label)108`2084`20Q/F2`2010/Times-Italic@0`20SF(Ldb)144`2096`20Q`20F V0`202.219(displays`5C X`20one`20of`20three`20possible`20board`20images`20at`20a`20time;`20the`20name V`20of`20the`20board`20currently) X4.718`20F`20.521 X(displayed`20is`20shown`20on`20the`20second`20line`20of`20the`20screen,`20near V`20the`20left.)144`20108`20R X.521(The`20signi`5C214cance`20of`20these`20three)5.521`20F(boards`20is`20expla Vined`20below)144 X120`20Q(.)-.65`20E`20F1(Flags)108`20136.8`20Q`20F0`20.359 X(This`20area`20displays`20any`20special`20rules`20in`20ef)144`20136.8`20R`20.3 V59 X(fect`20for`20the`20game.)-.18`20F`20.36(Each`20special`20rule`20causes`20one V`20character)5.36`20F X(to`20be`20displayed.)144`20148.8`20Q(These`20are:)5`20E`2012.5(JJ)156.5`20160 V.8`20S(acoby`20rule) X176.78`20160.8`20Q`2012.5(CC)156.5`20172.8`20S(rawford`20rule)182.34`20172.8 V`20Q`2012.5(EE)156.5 X184.8`20S(uropean`20rule)181.22`20184.8`20Q`2012.5(PP)156.5`20196.8`20S(ermane Vnt`20game)180.12 X196.8`20Q`201.161(In`20addition,`20the`20Crawford`20rule`20indicator`20is`20sh Vown`20in`20reverse`20vid`5C Xeo`20if`20the`20Crawford`20rule`20game`20is)144`20208.8`20R(currently`20being V`20played.)144`20220.8`20Q XF1(Match`20Scor)108`20237.6`20Q(e)-.18`20E`20F0`20.414(The`20current`20match V`20score`20is`20displaye`5C Xd`20next`20to`20the`20board`20label,`20as`20is`20the`20number`20of`20points V`20the`20match)144`20249.6`20R X(plays`20to.)144`20261.6`20Q X(If`20the`20game`20being`20displayed`20is`20not`20part`20of`20a`20match,`20thi Vs`20area`20is`20blanked`20out.) X5`20E`20F1(Pip`20Count)108`20278.4`20Q`20F0(Near`20the`20right`20of`20the`20sc Vreen`20on`20the`20second`20lin`5C Xe`20is`20the`20pip`20count`20for`20the`20board`20being`20displayed.)144`20290. V4`20Q`20F1(Board)108 X307.2`20Q`20F0`201.023(The`20board`20is`20displayed`20near`20the`20left`20side V`20of`20the`20screen,`20and`20`5C Xtakes`20up`20most`20of`20the`20screen`20area.)9.33`20F(It)6.022`20E`20.473(con Vsists`20of`20an`20outlin`5C Xe,`20drawn`20with`20ASCII`20characters,`20and`2028`20"points"`20where`20pieces V`20can`20reside.)144 X319.2`20R(Of)5.473`20E`20.332(these,`2024`20are`20the`20normal`20points`20maki Vng`20up`20the`20main`20bod`5C Xy`20of`20the`20board`20`5C(numbered`201`5C25524`5C),`202`20are`20the)144`20331 V.2`20R`20.883("BAR"`20points,`20`5C Xlocated`20between`20the`20left`20and`20right`20halves`20of`20the`20main`20boar Vd,`20and`202`20are`20the`20"OF`5C XF")144`20343.2`20R`201.579(points`20`5C(where`20pieces`20go`20when`20they`20ar Ve`20borne`20of)144`20355.2 XR`201.579(f`5C),`20located`20to`20the`20left`20of`20the`20board.)-.18`20F`201. V578(Pieces`20are)6.578`20F X2.43(represented`20by`20upper`20or`20lower`20case`20letters.)144`20367.2`20R V`203.83`20-.7(To`20h)7.43 XH`202.43(elp`20you`20remember`20which`20direction`20you`20are).7`20F`20.561(pl Vaying,`20there`20are`20a`5C Xrrows`20drawn`20at`20the`20four`20corners`20of`20the`20board`20indicating`20yo Vur`20direction`20of`20play) X144`20379.2`20R(.)-.65`20E(The`20bar`20is`20indicated`20by`20the`20word`20"BAR V";`20this`20changes`20to`20"`5C X---"`20if`20neither`20player`20can`20hit.)144`20391.2`20Q`20F1(Doubling`20Cube V)108`20408`20Q`20F0`20.353 X(The`20current`20value`20of`20the`20doubling`20cube`20is`20displayed`20in`20re Vverse`20video`20on`20the`20l`5C Xeft`20side`20of`20the`20screen.)144`20420`20R`20.485(The`20cube`20will`20appea Vr`20next`20to`20the`20home`20b`5C Xoard`20of`20the`20owner`20of`20the`20cube,`20or`20in`20the`20middle`20if`20nei Vther)144`20432`20R`20.781 X(player`20has`20doubled.)144`20444`20R`20.782 X(For`20example,`20if`20the`20player`20whose`20home`20board`20is`20at`20the`20b Vottom`20of`20the`20screen) X5.781`20F(doubled`20last,`20the`20cube`20will`20appear`20beside`20the`20top V`20of`20the`20board.)144`20456 XQ`20F1(Move`20Blocks)108`20472.8`20Q`20F0`20.477 X(The`20move`20blocks`20are`20located`20on`20the`20right`20of`20the`20screen.)1 V44`20484.8`20R`20.477 X(There`20are`20two`20move`20blocks;`20one`20for`20you,)5.477`20F`20.53 X(and`20one`20for`20your`20opponent.)144`20496.8`20R`20-1(Yo)5.53`20G`203.03(uw V)1`20G`20.531 X(ill`20use`20your`20move`20block`20to`20enter`20your`20moves,`20and`20you`20wi Vll`20see)286.71`20496.8`20R X.911(your`20opponent')144`20508.8`20R`203.411(sm)-.55`20G`20.911 X(oves`20displayed`20in`20his`20move`20block.)220.822`20508.8`20R`203.411(Am)5. V911`20G`20.91 X(ove`20block`20consists`20of`20a`20header)385.249`20508.8`20R`203.41(,w)-.4 V`20G(hich)522.78`20508.8 XQ`20.085(identi`5C214es`20the`20owner`20of`20the`20move`20block,`20and`20two V`20columns`20of`20either`20two`5C X`20or`20four`20lines.)144`20520.8`20R`20.085(Each`20line`20in`20a)5.085`20F V`20.896(move`20block`20is`20one`5C X`20roll,`20and`20shows`20the`20value`20of`20the`20roll`20`5C(in`20the`20range V`201`5C2556`5C)`20and`20how`20that`20ro`5C Xll`20has)144`20532.8`20R`20.752(been`20used.)144`20544.8`20R`20.753(If`20doubl Ves`20were`20rolled,`20th`5C Xe`20third`20and`20fourth`20lines`20will`20also`20be`20used`20to`20display`20th Ve`20two)5.752`20F X(additional`20rolls`20that`20may`20be`20used.)144`20556.8`20Q`20F1(Command`20B Vox)108`20573.6`20Q`20F0 X1.038(The`20bottom`20right`20corner`20of`20the`20screen`20contains`20a`20small V`20box`20that`20displays`5C X`20the`20commands`20that`20are)144`20585.6`20R`20.483(legal`20at`20any`20given V`20time.)144`20597.6`20R`20-1 X(Yo)5.483`20G`202.983(uc)1`20G`20.483 X(an`20execute`20a`20command`20by`20typing`20the`20`5C214rst`20letter;`20you V`20should`20not`20hit)268.658 X597.6`20R`201.089(return`20afterwards.)144`20609.6`20R`201.089 X(There`20may`20be`20legal`20commands`20other`20than`20those`20shown`20in`20the V`20command`20box,)6.089`20F X(depending`20on`20the`20state`20the`20game`20is`20in.)144`20621.6`20Q X(Press`20"h"`20or`20"?"`20for`20a`20complete`20listing`20of`20legal`20commands V.)5`20E`20F1(Message`20Ar) X108`20638.4`20Q(ea)-.18`20E`20F0`20.863 X(The`20bottom`206`20lines`20of`20the`20screen`20are`20reserved`20for`20message Vs`20of`20various`20types.) X144`20650.4`20R`20.864(The`20bottom`20line`20is)5.864`20F`20.585 X(used`20for`20error`20and`20informative`20messages`20that`20occur`20as`20a`20g Vame`20is`20played.)144 X662.4`20R`20.585(The`20top`20line`20in`20this`20area)5.585`20F`201.279(display Vs`20messages`20pertain`5C Xing`20to`20the`20status`20of`20a`20game,`20such`20as`20blots`20hit`20by`20an V`20opponent')144`20674.4`20R`203.78 X(sm)-.55`20G(ove.)523.06`20674.4`20Q`201.206(The`20remaining`204`20lines`20are V`20used`20to`20enclose`5C X`20a`20message`20to`20your`20opponent`20with`20your`20move,`20and`20to)144`206 V86.4`20R`20.259 X(display`20the`20one`20your`20opponent`20sent`20to`20you.)144`20698.4`20R`20.2 V6 X(These`20messages`20may`20be`20up`20to`202`20lines`20of`2056`20characters.)5.2 V59`20F(October`206,`201992) X273.645`20768`20Q(4)535`20768`20Q`20EP X%%Page:`205`205 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`209/Times-Bold@0`20SF X(ST)72`2084`20Q(AR)-.666`20E(TUP`20FILE)-.315`20E`20F0`201.176(The`20`5C214rst V`20time`20you`20run)108 X96`20R/F2`2010/Times-Italic@0`20SF(ldb,)3.676`20E`20F0`201.176 X(it`20will`20ask`20you`20if`20you`20want`20to`20create`20a)3.676`20F`20F2(.ldb Vr)3.675`20E(c)-.37`20E`20F0 X3.675(`5C214le.`20Y)3.675`20F`201.175(ou`20should`20answer`20"yes",)-1`20F`20. V593 X(unless`20you`20have`20a`20reason`20not`20to.)108`20108`20R`20.593 X(If`20you`20want`20the`20ldb`20startup`20`5C214le`20to`20be`20named`20somethin Vg`20other`20than)5.593`20F`20F2 X(.ldbr)3.093`20E(c,)-.37`20E`20F0`20.036(you`20should`20set`20the`20environmen Vt`20variable`20LDBRC`5C X`20to`20the`20name`20you`20want`20before`20running`20ldb`20for`20the`20`5C214r Vst`20time.)108`20120`20R`20.44 X(If`20you`20do`20this,`20the`20LDBRC`20variable`20must`20be`20set`20every`20ti Vme`20you`20run`20ldb.)108`20132 XR`20F2(Ldb)5.441`20E`20F0`20.441(moves`20to`20the`20directory`20in`20the)2.941 V`20F`20.493 X(HOME`20environment`20variable,`20if`20it`20is`20set,`20before`20accessing`20a Vny`20`5C214les.)108`20144 XR`20.493(This`20makes`20all`20`5C214les`20`5C(including`20.ldbrc`5C))5.493`20F V(relative`20to`20$HOME.) X108`20156`20Q(The)108`20172.8`20Q`20F2(.ldbr)2.874`20E(c)-.37`20E`20F0`20.374( Vis`20or)2.874`20F`20.374 X(ganized`20as`20a`20sequence`20of`20name/value`20pairs,`20one`20per`20line, V`20in`20the`20format)-.18`20F XF2`20.375(name=value`20.)2.875`20F`20F0(There)5.375`20E`20.888(should`20be`20n Vo`20spaces`20before) X108`20184.8`20R`20F2(name)3.388`20E`20F0`20.888(or`20before`20or`20after`20the V`20equals`20sign.)3.388`20F X.887(Comments`20are`20indicated`20by`20a`20pound)5.888`20F X(sign`20`5C(#`5C)`20in`20column`201,`20and`20extend`20to`20the`20end`20of`20th Ve`20line.)108`20196.8`20Q X(The`20following`20names`20are`20de`5C214ned:)5`20E(myname)108`20213.6`20Q`201 V.478 X(This`20line`20is`20where`20you`20enter`20your`20`5C(human`5C)`20name.)144`202 V25.6`20R`201.479 X(It`20is`20sent`20to`20your`20opponent`20when`20a`20game`20is)6.478`20F`20.284 V X(started,`20to`20make`20things`20a`20little`20more`20personal.)144`20237.6`20R V`20-1(Yo)5.284`20G X2.784(uc)1`20G`20.284(an`20put`20anything`20you`20like`20here,`20of`20course, V`20but`20I)354.976`20237.6 XR`20.284(highly`20recommend`20you`20just`20stick`20to`20your`20name.)144`20249 V.6`20R(The)5.284`20E`20F2 X(myname)2.784`20E`20F0`20.285(line`20is`20mandatory;`20if`20you`20don')2.784 V`20F`202.785(tw)-.18`20G X(ant)527.78`20249.6`20Q`202.461(your`20name`20sent`20to`20people,`20you`20can V`20just`20put`20your`20emai`5C Xl`20address`20instead,`20but`20you`20must`20have)144`20261.6`20R(something.)14 V4`20273.6`20Q`202.95 X(myaddr`20This)108`20290.4`20R`201.085(line`20de`5C214nes`20your`20e`5C255mail V`20address.)3.585`20F X1.085(This`20is`20sent`20to`20your`20opponent`20when`20you`20start`20a`20game V`20so)6.085`20F`20.783 X(they`20know`20how`20to`20send`20mail`20back`20to`20you.)144`20302.4`20R`20.78 V2 X(For`20people`20with`20multiple`20mail`20paths,`20put`20the`20one`20here)5.782 V`20F`20.559(you`20use`20th`5C Xe`20most`20`5C(e.g.`20the`20Internet`20domain`5C255style`20path`5C),`20and`20f Vor`20games`20that`20need`20to`20`5C Xuse`20a`20dif)144`20314.4`20R(ferent)-.18`20E`20.147(address,`20use`20the)144 V`20326.4`20R`20F2 X(`5C255myaddr)2.647`20E`20F0`20.146(command`20line`20ar)2.647`20F`20.146 X(gument`20to`20override`20the`20path`20in)-.18`20F`20F2(.ldbr)2.646`20E`20.146 V X(c.`20Note`20that`20the`20`5C214rst)-.37`20F`20.257(time`20you`20start`20a`20g Vame)144`20338.4`20R`20F0`20.257 X(with`20someone,`20the`20address`20you`20use`20is`20saved`20in`20your`20people V`20`5C214le.)2.757`20F X(Subsequent)5.258`20E`20.47 X(games`20you`20start`20with`20this`20person`20automatically`20use`20this`20sam Ve`20address,`20so`20the) X144`20350.4`20R`20F2(`5C255myaddr)2.97`20E`20F0`20.47(option`20will)2.97`20F(b Ve`20unnecessary)144 X362.4`20Q`205(.T)-.65`20G(he)217.77`20362.4`20Q`20F2(myaddr)2.5`20E`20F0(line V`20is`20mandatory)2.5 XE(.)-.65`20E(people`5C214le)108`20379.2`20Q`20.533(This`20line`20sets`20the V`20`5C214le`20name`20that`20i`5C Xs`20used`20to`20store`20information`20about`20your`20opponents.)144`20391.2 V`20R`20.534 X(In`20addition`20to)5.534`20F`201.492(storing`20your`20opponents'`20names,`20a Vddresses,`20and`20al`5C Xiases,`20it`20records`20the`20number`20of`20games,`20points,)144`20403.2`20R V`201.978 X(gammons,`20backgammons,`20and`20matches`20you`20have`20won`20or`20lost`20to V`20that`20opponent.)144 X415.2`20R`201.979(It`20also`20stores)6.979`20F`20.117(something`20called`20the V)144`20427.2`20R`20F2 X(fence,)2.617`20E`20F0`20.117 X(which`20is`20the`20start`20time`20of`20the`20most`20recently`20`5C214nished V`20game.)2.617`20F`20.116 X(This`20allows)5.116`20F`201.335(start`20messages`20from`20old`20games`20to V`20be`20discarded.)144 X439.2`20R`201.336(The`20people`5C214le`20line`20is`20optional,`20and`20if`20it V`20is`20not)6.335`20F X(given,`20the`20people`20`5C214le`20defaults`20to)144`20451.2`20Q`20F2(.ldbpeo Vple.)2.5`20E`20F0 X(game`5C214le)108`20468`20Q`20.763 X(This`20line`20sets`20the`20`5C214le`20name`20that`20is`20used`20to`20store V`20games`20in`20progress.)144 X480`20R`20.762(It`20is`20optional,`20and`20if`20it`20is`20not)5.762`20F`20.427 V X(given,`20the`20game`20`5C214le`20defaults`20to)144`20492`20R`20F2(.ldbdata.)2 V.928`20E`20F0`20.428 X(My`20advice,`20if`20you`20care,`20is`20that`20you`20should`20avoid`20using V`20a)5.428`20F`201.884 X(`5C214le`20name`20containing`20the`20string)144`20504`20R`20F2(games)4.384 V`20E`20F0`201.884 X(or`20any`20other`20giveaway`20string`20that`20would`20let`20your`20boss,)4.38 V4`20F`20.997(sysadmin,`5C X`20or`20other`20local`20Nazi`5C255type`20know`20that`20you're`20using`20a`20ve Vry`20expensive`20piece`20of`20`5C Xhigh`5C255tech)144`20516`20R`20.726(equipment`20to`20goof`20of)144`20528`20R V`20.726 X(f,`20when`20you`20could`20do`20that`20with`20nothing`20more`20exotic`20than V`20a`20rubber`20band`20and)-.18 XF(some`20spitballs.)144`20540`20Q(backup`5C214le)108`20556.8`20Q`20.497 X(This`20is`20the`20`5C214le`20your`20old)144`20568.8`20R`20F2(game`5C214le)2.9 V97`20E`20F0`20.497 X(will`20be`20moved`20to`20just`20before`20a`20new`20one`20is`20created.)2.997 V`20F`20.497 X(It`20defaults`20to)5.497`20F`20F2(.oldldbdata.)144`20580.8`20Q`20F0`202.94(ma Vil`5C214le`20This)108 X597.6`20R`20.182(line`20is`20where`20you`20tell`20ldb`20how`20to`20`5C214nd V`20the`20mail`20messages`20your`20o`5C Xpponents`20have`20sent.)2.682`20F`20.181(There`20are)5.181`20F`20.171 X(several`20ways`20to`20do`20this.)144`20609.6`20R`20.172(The`20simplest`20one V`20is`20to`20just`20put`20som`5C Xe`20`5C214le`20name`20here`20`5C(the`20default`20is`20ldb.rcv`5C))5.171`20F V`20.737(and,`20when`20you`20recei`5C Xve`20mail`20containing`20an`20ldb`20move,`20just`20save`20it`20to`20this`20 V`5C214le.)144`20621.6`20R`20.737 X(When`20you`20are`20done)5.737`20F`20.52(reading`20your`20mail,`20run`20ldb, V`20and`20it`20will`20scan`20th`5C Xis`20`5C214le`20and`20extract`20all`20your`20incoming`20moves.)144`20633.6`20R V`20.521(If`20your)5.521`20F X1.384(mail`20program`20is`20like`20most,`20it`20will`20append`20messages`20if V`20the`20`5C214le`20you`20are`5C X`20saving`20to`20already`20exists,)144`20645.6`20R`20.458(which`20is`20just V`20what`20you`20want.)144 X657.6`20R`20F2(Ldb)5.458`20E`20F0`20.459 X(will`20silently`20ignore`20moves`20that`20it`20has`20already`20seen`20for`20g Vames`20in)2.958`20F`20.218 X(progress,`20so`20you`20don')144`20669.6`20R`202.718(th)-.18`20G`20.217 X(ave`20to`20clean`20them`20out`20of`20your`20mail`5C214le`20if`20you`20don')24 V1.072`20669.6`20R`202.717(tw) X-.18`20G`20.217(ant`20to.)452.979`20669.6`20R`20.217(Note`20however)5.217`20F V`20.181(that`20if`20any`5C Xthing`20happens`20to`20your`20people`20`5C214le,`20and`20you`20have`20old`20st Vart`20messages`20in`20your`20i`5C Xnput`20`5C214le,`20ldb)144`20681.6`20R`201.402 X(could`20start`20a`20spurious`20game`20`5C(i.e.`20one`20your`20opponent')144 V`20693.6`20R`203.902(sl) X-.55`20G`201.402(db`20knows`20nothing`20about`5C).)373.538`20693.6`20R`201.402 V(Also,`20if`20your) X6.402`20F`201.426 X(input`20`5C214le`20gets`20really`20long,`20ldb`20will`20take`20a`20while`20to V`20start`20up.)144`20705.6`20R X1.426(So`20the`20best`20course`20is`20to`20delete`20all)6.426`20F X(messages`20after`20ldb`20has`20read`20them.)144`20717.6`20Q(October`206,`2019 V92)273.645`20768`20Q(5) X535`20768`20Q`20EP X%%Page:`206`206 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V`201.312(For`20UNIX`20user`5C Xs,`20a`20much`20easier`20way`20is`20to`20set`20the`20mail`5C214le`20to`20point V`20to`20your`20actual`20mail`20`5C X`5C214le`20`5C(e.g.)144`2084`20R`20.852 X(/usr/spool/mail/$USER`5C),`20and`20let`20ldb`20scan`20your`20mail`20directly) V144`2096`20R`205.852 X(.T)-.65`20G`20.852(his`20will`20only`20work`20if`20your`20system)402.106`2096 V`20R`20.519 X(keeps`20mail`20in`20ASCII`20format,`20but`20many`20do.)144`20108`20R`20.518 X(Ldb`20will`20not`20delete`20these`20messages`20from`20your`20mail`20so)5.518 V`20F X(you`20will`20have`20to.)144`20120`20Q`20.156(The`20third`20option`20is`20to V`20set`20the`20mail`5C214le`20to`5C X`20a`20pattern`20instead`20of`20a`20`5C214lename.)144`20136.8`20R`20.157 X(Ldb`20will`20scan`20all`20matching)5.157`20F`20.048(`5C214les`20for`20moves.) V144`20148.8`20R`20.047 X(This`20is`20good`20for`20mailers`20that`20don')5.048`20F`202.547(ta)-.18`20G V`20.047 X(ppend`20on`20save,`20and`20don')354.834`20148.8`20R`202.547(ts)-.18`20G`20.04 V7 X(tore`20in`20ascii`20format,)461.539`20148.8`20R`20.076(such`20as`20on`20VMS.) V144`20160.8`20R`20.077(N`5C Xote`20that`20on`20VMS,`20if`20no`20version`20number`20is`20de`5C214ned,`20mail V`5C214le`20defaults`20to`20sca`5C Xnning)5.076`20F`20.325(all`20versions.)144`20172.8`20R`20.324(VMS`20users`20sh Vould`20read`20the`20se`5C Xction`20entitled`20"VMS`20NOTES"`20for`20more`20information`20on)5.325`20F(ext Vracting`20mail.)144 X184.8`20Q`203.5(delmail`20This)108`20201.6`20R`201.404(option`20causes`20any V`20mail`20`5C214les`20scan`5C Xned`20by`20ldb`20to`20be`20removed`20after`20they`20have`20been`20scanned.)3.9 V03`20F`20.381 X(This`20is`20a`20hideously`20dangerous`20option,`20so`20I`20recommend`20you V`20try`20it`20in`20a`20friend') X144`20213.6`20R`202.881(sa)-.55`20G`20.381(ccount`20`5C214rst.)462.467`20213.6 V`20R`20.381(It`20will) X5.381`20F`201.495(delete`20ANY`20`5C214le`20that`20matches`20the`20pattern`20s Vpeci`5C214ed`20in`20the`20ma`5C Xil`5C214le`20line,`20with`20the`20exception`20that,)144`20225.6`20R`20.485 X(under`20UNIX,`20it`20will`20refuse`20to`20delete`20any`20`5C214le`20starting V`20with`20"/".)144`20237.6`20R X.484(Use`20it`20with`20great`20care.)5.484`20F`20.484(This`20option)5.484`20F X(defaults`20to`20no;`20to`20enable`20it,`20set`20it`20to`20"yes".)144`20249.6 V`20Q`203.5 X(lock`5C214le`20This)108`20266.4`20R`20.254(line`20sets`20the`20name`20of`20th Ve`20ldb`20lock`20`5C214le.) X2.754`20F`20.254(It`20defaults`20to`20".ldb_lock",`20and`20there')5.254`20F V`202.755(sn)-.55`20G X2.755(or)477.865`20266.4`20S`20.255(eal`20reason`20to)488.95`20266.4`20R`20.81 V3(change`20it`20unle`5C Xss`20by`20some`20chance`20it`20con`5C215icts`20with`20a`20`5C214le`20name`20yo Vu`20might`20use.)144`20278.4`20R X.813(When`20ldb`20starts,`20it)5.813`20F`201.297 X(checks`20to`20see`20if`20this`20`5C214le`20exists;`20if`20it`20does,`20ldb V`20exits.)144`20290.4`20R`201.297 X(Otherwise,`20it`20creates`20it`20and`20goes`20on.)6.297`20F(This)6.297`20E V`201.889(prevents`20mor`5C Xe`20than`20one`20ldb`20from`20running`20in`20the`20same`20account`20at`20the V`20same`20time,`20and`20thereby) X144`20302.4`20R(garbling`20the`20data`20`5C214les.)144`20314.4`20Q(sendcmd)108 V`20331.2`20Q`20.704 X(This`20tells`20ldb`20how`20to`20send`20a`20`5C214le`20with`20your`20particula Vr`20mail`20command.)144 X343.2`20R`20.705(This`20string`20is`20passed`20to`20the)5.705`20F X(system,`20after`20making`20the`20following`20substitutions:)144`20355.2`20Q V`2025.56($a`20is) X120.5`20372`20R(substituted`20with`20the`20address`20to`20mail`20to.)2.5`20E V`2026.67($f`20is)120.5 X388.8`20R(substituted`20with`20the`20`5C214le`20containing`20the`20message.)2. V5`20E`2026.11($s`20is) X120.5`20405.6`20R(substituted`20with`20the`20subject`20of`20the`20message.)2.5 V`20E X(Most`20mail`20systems`20will`20work`20`5C214ne`20with`20the`20default,`20whic Vh`20is)133`20422.4`20Q X(mail`20`5C255s`20'$s'`20$a`20<`20$f)145.5`20434.4`20Q(or)133`20451.2`20Q`202. V5(,o)-.4`20G`202.5(nV) X150.93`20451.2`20S(MS,)165.65`20451.2`20Q(MAIL/SUBJECT="$s"`20$f`20IN%"""<$a>" V"")145.5 X463.2`20Q`20.365(Note`20that`20the`20$`20substitutions`20are`20made`20by`20ldb V,`20not`20by`20a`20shell,`20an`5C Xd`20thus`20are`20not`20subject`20to`20any`20quoting.)133`20480`20R`20.362 X(If`20you`20need`20a`20$`20in`20the`20string,`20use`20$$.)133`20492`20R`20.363 V X(VMS`20users`20may`20need`20to`20change`20the`20name`20of`20the`20SMTP`20maile Vr;)5.362`20F X(for`20example,`20to`20send`20mail`20using`20W)133`20504`20Q(ollongong`20TCP/I VP)-.8`20E`202.5(,y) X-1.11`20G(ou`20would`20use`20the`20string)352.2`20504`20Q X(MAIL/SUBJECT="$s"`20$f`20WINS%"""<$a>""")145.5`20532.8`20Q(temp`5C214le)108 V`20549.6`20Q X1.574(This`20line`20speci`5C214es`20a`20temporary`20`5C214le`20that`20ldb`20ca Vn`20use`20to`20compose`20mai`5C Xl`20messages.)133`20561.6`20R`201.574(The`20`5C214le`20will`20be)6.574`20F X(created`20in`20your`20home`20directory)133`20573.6`20Q`202.5(,t)-.65`20G X(hus`20avoiding`20`5C214le`20name`20con`5C215icts`20in`20/tmp.)263.43`20573.6 V`20Q X(It`20defaults`20to`20ldb.tmp.)5`20E(colors)108`20590.4`20Q`20.842(This`20is V`20a`20string`20of`20two`20u`5C Xpper`20or`20lower`20case`20letters,`20and`20de`5C214nes`20your`20preferred`20c Volors`20for`20any`20games) X133`20602.4`20R`20.705(you`20start.)133`20614.4`20R`20.705 X(The`20`5C214rst`20character`20in`20the`20string`20is`20the`20color`20you`20wi Vll`20play)5.705`20F`203.204 X(,a)-.65`20G`20.704(nd`20the`20second`20is`20the`20one`20your)419.126`20614.4 V`20R X(opponent`20will`20play)133`20626.4`20Q`205(.I)-.65`20G`202.5(td)218.18`20626. V4`20S X(efaults`20to`20"rw",`20and`20is`20overridden`20by`20the)228.46`20626.4`20Q/F1 V`2010/Times-Italic@0 XSF(`5C255color)2.5`20E`20F0(command`20line`20ar)2.5`20E(gument.)-.18`20E(direc Vtion)108`20643.2 XQ`20.535(This`20is`20either`20"up"`20or`20"down",`20and`20de`5C214nes`20your V`20preferred`20direction`20o`5C Xf`20play`20for`20games`20you`20start.)133`20655.2`20R(The)5.535`20E`20.804(dir Vection`20of`20play`20onl`5C Xy`20refers`20to`20whether`20you`20play`20toward`20increasing`20or`20decreasing V`20numbered`20points.) X133`20667.2`20R`201.005(Although`20by`20default`20upward`20play`20goes`20towar Vd`20the`20top`20of`20the`20s`5C Xcreen,`20this`20can`20be`20reversed`20`5C(for`20your)133`20679.2`20R`201.192 X(screen`20only`5C)`20by`20the`20"Invert"`20command`20in`20the`20Control`20menu V,`20accessible`20via`20the) X133`20691.2`20R`20F1(`5C255contr)3.691`20E(ol)-.37`20E`20F0(command)3.691`20E V`20.879(line`20ar)133 X703.2`20R`203.379(gument.`20The)-.18`20F`20.879 X(default`20for`20this`20line`20is`20"up",`20and`20is`20overridden`20by`20the)3 V.379`20F`20F1(`5C255dir) X3.38`20E(ection)-.37`20E`20F0`20.88(command`20line)3.38`20F(ar)133`20715.2`20Q V(gument.)-.18`20E X(October`206,`201992)273.645`20768`20Q(6)535`20768`20Q`20EP X%%Page:`207`207 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V(initialboard)108`2084 XQ`202.377(As`20was`20alluded`20to`20earlier)133`2096`20R`204.877(,y)-.4`20G V`202.377 X(our`20screen`20shows`20one`20of`20three`20possible`20board`20images`20at`20an Vy`20time.)253.905`2096`20R X1.091(Although`20the`20purpose`20for`20this`20will`20be`20explained`20later)13 V3`20108`20R`203.591(,t) X-.4`20G`201.091(his`20line`20allows`20you`20to`20select`20which`20of`20these)3 V59.619`20108`20R`20.432 X(three`20boards`20should`20be`20displayed`20initially)133`20120`20R`205.432(.T V)-.65`20G`20.431 X(he`20legal`20values`20are`20"before",`20"after",`20and`20"current".)313.262 V`20120`20R(The)5.431 XE(default`20is`20"current".)133`20132`20Q(autoroll)108`20148.8`20Q`20.156(If V`20you`20were`20the`20la`5C Xst`20to`20double,`20you`20have`20no`20option`20but`20to`20roll`20the`20dice V`20when`20it`20is`20your`20turn.)133 X160.8`20R`20.156(If`20autoroll)5.156`20F`20.306 X(is`20enabled,`20ldb`20will`20roll`20the`20dice`20for`20you`20automatically V`20in`20this`20case.)133 X172.8`20R`20.306(For`20those`20that`20prefer`20consistency)5.306`20F(,)-.65 V`20E`20.914(autoroll`20`5C Xmay`20be`20disabled,`20although`20attempting`20to`20double`20when`20you`20doub Vled`20last`20will`20caus`5C Xe`20an`20error)133`20184.8`20R`202.5(message.`20Possible)133`20196.8`20R X(values`20for`20autoroll`20are`20"yes"`20and`20"no",`20with`20"yes"`20being V`20the`20default.)2.5`20E X(automove)108`20213.6`20Q`20.357(Each`20time`20you`20roll`20the`20dice,`20ldb V`20determines`20how`20man`5C Xy`20legal`20ways`20there`20are`20for`20you`20to`20use`20your`20rolls.)133`2022 V5.6`20R`202.353(In`20the`20rel`5C Xatively`20unusual`20case`20where`20there`20is`20only`20one`20way`20for`20you V`20to`20use`20your`20rolls,`20ld`5C Xb`20can)133`20237.6`20R`20.859 X(automatically`20apply`20this`20move`20to`20your`20board`20before`20displaying V`20it.)133`20249.6`20R X.859(Automove`20is`20disabled`20by`20default)5.859`20F`201.222(because`20quite V`20frankly`20it') X133`20261.6`20R`203.723(sp)-.55`20G`201.223(retty`20annoying.)245.65`20261.6 V`20R`201.223 X(Possible`20values`20for`20automove`20are`20"yes"`20and`20"no",`20with)6.223 V`20F X("no"`20being`20the`20default.)133`20273.6`20Q(autodouble)108`20290.4`20Q`20.3 V54(One`20of`20the`20of) X133`20302.4`20R`20.353(`5C214cial`20rules`20of`20backgammon`20allows`20for`20a Vutomatically`20doublin`5C Xg`20the`20game`20value`20when`20the)-.18`20F`20.99(opening`20roll`20is`20a`20t Vie.)133`20314.4`20R`20.99 X(The`20rules`20go`20on`20to`20state`20that`20automatic`20doubling`20is`20only V`20to`20be`20used`20when`20the) X5.99`20F`202.923(players`20agree`20beforehand`20on`20its`20use`20and`20limitat Vions.)133`20326.4`20R X2.923(The`20method`20ldb`20uses`20to`20implement`20this)7.923`20F`20.546(somew Vhat`20vague`20rule`20i`5C Xs`20to`20allow`20each`20player`20to`20specify`20a`20maximum`20number`20of`20au Vtodoubles`20they`20are)133 X338.4`20R`20.747(willing`20to`20accept`20in)133`20350.4`20R/F1`2010/Times-Ital Vic@0`20SF(.ldbr) X3.247`20E(c,)-.37`20E`20F0`20.746 X(and`20for`20the`20maximum`20number`20of`20autodoubles`20applied`20to`20any V`20game`20to`20be)3.247`20F X.625(the`20lesser`20of`20the`20two`20players'`20speci`5C214ed`20limits.)133 V`20362.4`20R`20.626 X(For`20example,`20if`20you`20set)5.626`20F`20F1(autodouble=4)3.126`20E`20F0 V`20.626 X(in`20your`20.ldbrc,)3.126`20F`20.512(no`20game`20you`20play`20will`20ever`20b Ve`20autodoubled`20more`20t`5C Xhan`204`20times,`20although`20the`20number`20of`20tied`20opening)133`20374.4 V`20R`201.646 X(rolls`20is`20obviously`20not`20limited.)133`20386.4`20R(However)6.646`20E`204 V.146(,i)-.4`20G X4.146(fy)309.426`20386.4`20S`201.647 X(ou`20were`20to`20start`20a`20game`20with`20someone`20who`20had`20set)321.902 V`20386.4`20R`20F1`201.53 X(autodouble=2`20,)133`20398.4`20R`20F0`201.53 X(that`20game`20would`20be`20limited`20to`20at`20most`202`20autodoubles.)4.03 V`20F`201.529(If`20you`20don') X6.529`20F`204.029(tw)-.18`20G`201.529(ant`20to`20play)494.722`20398.4`20R X(automatic`20doubles,`20set`20autodouble=0,`20which`20is`20also`20the`20defaul Vt.)133`20410.4`20Q X(superkey)108`20427.2`20Q`202.052(If`20you`20live`20in`20fear`20of`20roving V`20supervisors`20`5C(or`20oth`5C Xer`20fun-impaired`20individuals`5C)`20running`20across`20you)133`20439.2`20R V`20.285(playing`20an`20i`5C Xnnocent`20game`20of`20backgammon,`20you`20may`20want`20to`20enable`20the`20sup Verkey`20function.)133 X451.2`20R`20.285(Just`20pick)5.285`20F`203.413(ak)133`20463.2`20S`20.913(ey V`20on`20the`20keyboard`20yo`5C Xu`20never`20use`20in`20ldb,`20such`20as`20the`20backquote,`20and`20put`20a`20l Vine`20in)145.853`20463.2`20R`20F1 X(.ldbr)3.413`20E(c)-.37`20E`20F0(setting)3.413`20E`20.368(superkey`20to`20the) V133`20475.2`20R`20F1 X.368(decimal`20ASCII`20code)2.868`20F`20F0`20.368 X(of`20the`20key`20you`20want;`20for`20example,`20to`20use`20the`20backquote V`20key)2.868`20F`202.867(,u) X-.65`20G(se)531.67`20475.2`20Q`203.502("superkey=96".`20Only)133`20487.2`20R V`201.002(single`5C X`5C255character`20keys`20are`20allowed,`20and`20the`20key`20you`20select`20wil Vl`20not`20be`20usable)3.502 XF(for`20normal`20purposes`20within`20ldb.)133`20499.2`20Q X(Make`20it`20one`20you`20can`20hit`20in`20a`20hurry)5`20E(.)-.65`20E(supercmd) V108`20516`20Q`201.258(If`20y`5C Xou'd`20rather`20have`20a`20program`20of`20your`20choice`20come`20up`20instead V`20of`20the`20shell`20when`20th`5C Xe`20superkey`20is)133`20528`20R`20.869(pressed,`20put`20it`20on`20this`20line. V)133`20540`20R`20.869 X(It`20will`20be`20passed`20unchanged`20to`20a`20shell`20via`20the`20system`5C( V`5C)`20function.)5.869`20F X(VMS)5.869`20E(users`20should`20read`20the`20note`20in`20the`20section`20title Vd`20"VMS`20NOTES"`20on`20s`5C Xupercmd`20functionality)133`20552`20Q(.)-.65`20E(checkpoint)108`20568.8`20Q V`20.269(This`20opti`5C Xon`20keeps`20the`20game`5C214le`20up`20to`20date`20by`20writing`20it`20out`20w Vhenever`20the`20dice`20are`20rol`5C Xled`20or`20a`20message)133`20580.8`20R`20.51(is`20sent.)133`20592.8`20R`20.51( VThis`20prevents`20game`20i`5C Xnformation`20from`20being`20lost`20if`20ldb`20crashes,`20your`20machine`20goes V`20down,`20or)5.51`20F X.413(what`20have`20you.)133`20604.8`20R`20.413(This`20option`20is`20enabled V`20by`20default,`20and`20I`20`5C Xhighly`20recommend`20you`20leave`20it`20that`20way)5.413`20F`205.412(.I)-.65 V`20G(f)536.67`20604.8`20Q X4.215(you`20just`20can')133`20616.8`20R`206.715(ts)-.18`20G`204.215 X(tand`20the`20thought`20of`20a`20few`20extra`20writes`20to`20disk,`20you`20can V`20disable`20it`20with) X206.295`20616.8`20R`202.5("checkpoint=no".`20On)133`20628.8`20R(your`20own`20h Vead`20be`20it.)2.5`20E X(timeout)108`20645.6`20Q`20.33(This`20option`20sets`20the`20number`20of`20days V`20ldb`20will`20wait`20for`5C X`20a`20reply`20from`20your`20opponent.)133`20657.6`20R`20.329(After`20this`20n Vumber)5.329`20F`20.076(o`5C Xf`20days`20passes,`20ldb`20will`20assume`20your`20last`20message`20was`20lost V`20and`20automatically`20re`5C Xsend`20it.)133`20669.6`20R`20.076(This`20prevents)5.076`20F`201.608 X(the`20situation`20where`20both`20players`20think`20they`20are`20waiting`20on V`20the`20other)133`20681.6 XR`204.108(,a)-.4`20G`201.608(nd`20eventually`20both`20players)429.356`20681.6 V`20R(for)133`20693.6 XQ`201.806(get`20they`20even`20have`20a`20game`20going.)-.18`20F`201.806 X(This`20option`20defaults`20to`207`20days;`20you`20can`20disable`20automatic)6 V.806`20F X(resends`20by`20setting`20it`20to`200.)133`20705.6`20Q(October`206,`201992)273 V.645`20768`20Q(7)535 X768`20Q`20EP X%%Page:`208`208 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V(keepold)108`2084`20Q X.482(This`20option`20sets`20the`20number`20of`20days`20ldb`20will`20keep`20a V`20game`20after`20it`20is`20over) X133`2096`20R`205.481(.T)-.55`20G`20.481(his`20can`20be`20handy`20in`20case)440 V.675`2096`20R`20.13 X(you`20need`20to`20resend`20the`20last`20move`20of`20a`20game.)133`20108`20R V`20.13 X(This`20option`20defaults`20to`207`20days;`20if`20you`20set`20it`20to`200,`20 V`5C214nished)5.13`20F X(games`20are`20deleted`20immediately)133`20120`20Q(.)-.65`20E(debug)108`20136. V8`20Q`202.358 X(This`20option`20enables`20various`20debug`20messages.)133`20148.8`20R`202.358 V X(It`20is`20a`20bitmap,`20with`20each`20set`20bit`20enabling`20debug)7.358`20F V`20.265 X(messages`20from`20a`20dif)133`20160.8`20R`20.265(ferent`20part`20of`20ldb.)-. V18`20F`20.265 X(Most`20people`20will`20want`20to`20leave`20it`20at`200,`20which`20is`20the V`20default.)5.265`20F(If)5.265 XE(you`20want`20debug`20messages,`20look`20for`20the`20de`5C214nitions`20of`20D VB_*`20in`20ldb.h.)133 X172.8`20Q/F1`209/Times-Bold@0`20SF(PEOPLE`20FILE)72`20194.4`20Q`20F0 X(Ldb`20maintains`20a`20list`20of`20all`20of`20the`20people`20you`20have`20ever V`20played.)108`20206.4`20Q X(This`20`5C214le`20is`20used`20for`20several`20purposes:)5`20E`2031(1I)108`202 V23.2`20S`203.29(ts)147.33 X223.2`20S`20.789(tores`20the`20number`20of`20games,`20points,`20gammons,`20bac Vkgammons,`20and`20matc`5C Xhes`20you`20have`20won`20and)157.29`20223.2`20R(lost`20to`20that`20person.)144 V`20235.2`20Q`2031(2I)108 X252`20S`203.169(ts)147.33`20252`20S`20.669(tores`20the`20address`20for`20that V`20person,`20and`20the`20ad`5C Xdress`20that`20person`20should`20use`20to`20get`20to`20you.)157.169`20252`20R V`20.67(It`20also)5.67`20F X.611(allows`20you`20to`20assign`20an`20alias`20to`20that`20person,`20and`20to V`20use`20that`20alias`20when`20`5C Xstarting`20a`20game`20instead`20of)144`20264`20R(the`20full`20e`5C255mail`20ad Vdress.)144`20276`20Q`2031 X(3I)108`20292.8`20S`202.5(ts)147.33`20292.8`20S(tores`20information`20that`20a Vllows`20ldb`20to`20rej`5C Xect`20start`20messages`20from`20defunct`20games.)156.5`20292.8`20Q(Normally)10 V8`20309.6`20Q`203.663 X(,y)-.65`20G`201.164(ou`20should`20never`20have`20to`20edit`20the`20people`20 V`5C214le,`20but`20it`20is`20des`5C Xcribed`20here`20in`20case`20you`20need`20to`20for)156.843`20309.6`20R(some`20r Veason.)108`20321.6`20Q X(It`20is`20in`20the`20same`20overall`20format`20as`20.ldbrc`20`5C(name/value V`20pairs`5C).)5`20E`2015.73 X(addr`20This)108`20338.4`20R`201.435(is`20the`20address`20of`20the`20opponent. V)3.935`20F`201.435 X(This`20is`20what`20uniquely`20de`5C214nes`20the`20record,`20in`20case`20you V`20are)6.435`20F X(playing`20two`20people`20with`20the`20same`20name.)144`20350.4`20Q`2011.84(na Vme`20This)108`20367.2`20R X(is`20the`20name`20of`20the`20opponent.)2.5`20E`2015.17(alias`20This)108`20384 V`20R`20.546 X(is`20a`20"nickname"`20you`20can`20assign`20to`20an`20opponent.)3.046`20F`20.5 V46 X(When`20a`20new`20opponent`20is`20found,`20the`20alias`20is)5.546`20F`20.83 X(initialized`20to`20the`20`5C214rst`20word`20of`20the`20opponent')144`20396 V`20R`203.329(sn)-.55`20G X.829(ame,`20with`20all`20upper`20case`20letters`20changed`20to`20lower)336.188 V`20396`20R(.)-.55`20E X-1(Yo)144`20408`20S`202.515(uc)1`20G`20.015(an`20change`20the`20alias`20to`20a Vny`20desired`20string`20wi`5C Xth`20a`20text`20editor`20`5C(just`20make`20sure`20ldb`20isn')167.175`20408`20R V`202.516(tr)-.18`20G`20.016 X(unning`20at)502.484`20408`20R(the`20time,`20or`20your`20changes`20will`20be V`20lost`5C).)144`20420`20Q X2.95(myaddr`20This)108`20436.8`20R`20.858 X(is`20the`20address`20that`20this`20opponent`20should`20use`20to`20mail`20to V`20you.)3.359`20F`20.858 X(This`20saves`20you`20from`20having`20to)5.858`20F`20.822(specify`20the`20-mya Vddr`20ar)144`20448.8`20R X.822(gument`20when`20starting`20a`20game,`20and`20is`20especially`20important V`20with`20permanent) X-.18`20F`201.089(games,`20since`20these`20games`20are`20started`20automaticall Vy`20without`20giving`5C X`20you`20a`20chance`20to`20change`20your)144`20460.8`20R`203.797(address.`20If V)144`20472.8`20R`201.298 X(you`20only`20have`20one`20e`5C255mail`20path,`20you`20can`20ignore`20this.)3. V797`20F`201.298 X(This`20`5C214eld`20is`20initialized`20to`20the)6.298`20F`20.079(value`20of V`20the)144`20484.8`20R/F2`2010 X/Times-Italic@0`20SF(`5C255myaddr)2.579`20E`20F0`20.079(option`20at`20the`20ti Vme`20the`20`5C214rst`20g`5C Xame`20with`20this`20opponent`20is`20started,`20or`20to`20the`20value)2.579`20F V X(of`20myaddr`20from`20.ldbrc`20if`20no)144`20496.8`20Q`20F2(`5C255myaddr)2.5 V`20E`20F0 X(option`20was`20used.)2.5`20E`2011.28(equiv`20The)108`20513.6`20R`201.119 X(presence`20of`20this`20`5C214eld`20`5C215ags`20this`20as`20an`20"equiv"`20rec Vord.)3.618`20F`201.119 X(Equiv`20records`20allow`20one`20opponent`20to)6.119`20F`201.503(have`20multip Vle`20e`5C255mail`20add`5C Xresses,`20but`20to`20cause`20all`20of`20them`20to`20refer`20to`20one`20people V`20record.)144`20525.6`20R X(Equiv)6.502`20E`20.435(records`20have`20no`20valid`20`5C214elds`20except)144 V`20537.6`20R`20F2(addr) X2.935`20E`20F0(and)2.935`20E`20F2(equiv)2.935`20E(,)-.74`20E`20F0`20.436 X(and`20must`20be`20preceded`20by`20the`20record`20they`20refer)2.935`20F X(to`20in`20the`20people`20`5C214le.)144`20549.6`20Q`2011.85(fence`20The)108 V`20566.4`20R`20.831(fence`20i`5C Xs`20de`5C214ned`20as`20the`20start`20time`20of`20the`20most`20recently`20start Ved`20game`20that`20has`20`5C214n`5C Xished.)3.331`20F`20.83(If`20that)5.83`20F`20.288(makes`20no`20sense,`20don')14 V4`20578.4`20R`202.788 X(tw)-.18`20G(orry)243.012`20578.4`20Q`202.788(,y)-.65`20G`20.288 X(ou`20should`20never`20have`20to`20mess`20with`20it.)269.31`20578.4`20R`20.289 V X(It`20is`20used`20to`20discard`20old`20start)5.289`20F(messages`20that`20you V`20for)144`20590.4`20Q X(got`20to`20clean`20out`20of`20your`20mail.)-.18`20E`2012.4(score`20This)108 V`20607.2`20R X(is`20an`20array`20of`2010`20numbers`20that`20represent,`20in`20order:)2.5`20E V`202.5(-G)156.5`20636`20S X(ames`20won)169.55`20636`20Q`202.5(-G)156.5`20648`20S(ames`20lost)169.55`20648 V`20Q`202.5(-P)156.5 X660`20S(oints`20won)167.89`20660`20Q`202.5(-P)156.5`20672`20S(oints`20lost)167 V.89`20672`20Q`202.5(-G) X156.5`20684`20S(ammons`20won)169.55`20684`20Q`202.5(-G)156.5`20696`20S(ammons V`20lost)169.55`20696`20Q X2.5(-B)156.5`20708`20S(ackgammons`20won)169`20708`20Q`202.5(-B)156.5`20720`20S V(ackgammons`20lost) X169`20720`20Q(October`206,`201992)273.645`20768`20Q(8)535`20768`20Q`20EP X%%Page:`209`209 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V`202.5(-M)156.5`2084`20S X(atches`20won)171.22`2084`20Q`202.5(-M)156.5`2096`20S(atches`20lost)171.22`209 V6`20Q +-+-+-+-+-+-+-+- END OF PART 5 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 6 -+-+-+-+-+-+-+-+ X(This`20information`20is`20stored`20purely`20for`20whatever`20purposes`20you V`20can`20think`20of.)144 X112.8`20Q`2019.06(end`20This)108`20129.6`20R`20.817 X(line`20is`20required`20to`20separate`20people`20records.)3.317`20F`20.816 X(If`20you`20hand`20enter`20a`20record,`20you`20must`20be`20sure`20to)5.817`20F V X(put`20an`20end`20marker`20or`20your`20record`20will`20mer)144`20141.6`20Q X(ge`20with`20the`20next`20one,`20which`20is`20not`20what`20you`20want.)-.18 V`20E/F1`209/Times-Bold@0`20SF X(ST)72`20163.2`20Q(AR)-.666`20E(TING`20A`20GAME)-.315`20E`20F0`202.54`20-.7(To V`20s)108`20175.2`20T`201.14 X(tart`20a`20game,`20you`20must`20use`20the).7`20F/F2`2010/Times-Italic@0`20SF( V`5C255start)3.64`20E`20F0 X1.141(command`20line`20ar)3.641`20F`201.141 X(gument,`20along`20with`20the`20e`5C255mail`20address`20of`20the)-.18`20F X(person`20you`20wish`20to`20play`20with.)108`20187.2`20Q(For`20example,)5`20E X(ldb`20`5C255start`20mybuddy@back.gammon.com)120.5`20199.2`20Q X(If`20you`20want`20to`20play`20'w',`20and`20make`20your`20opponent`20play)108 V`20211.2`20Q X(ldb`20`5C255color`20wb`20`5C255start`20black@blah.blah.blah)120.5`20223.2`20Q V`20.695 X(See`20the`20OPTIONS`20section`20for`20more`20details`20on`20the`20available V`20command`20line`20ar)108 X235.2`20R(guments.)-.18`20E`20F2(Ldb)5.694`20E`20F0`20.694(will`20not`20allow) V3.194`20F X(you`20to`20play`20with`20yourself,`20but`20that')108`20247.2`20Q`202.5(so)-.5 V5`20G`202.5(kb)258 X247.2`20S(ecause`20you'd`20probably`20lose.)270.5`20247.2`20Q`201.226(When`20y Vou`20start`20a`20game,`5C X`20ldb`20sends`20your`20e`5C255mail`20address`20to`20your`20opponent,`20along V`20with`20your`20opening`20ro`5C Xll.)108`20264`20R`20.238(When`20your`20opponent`20receives`20your`20message, V`20his`20ldb`20will`20roll`5C X`20his`20opening`20roll,`20and`20decide`20who`20won.)108`20276`20R`20.237(If V`20you)5.237`20F`20.755 X(won,`20his`20ldb`20will`20send`20your`20ldb`20a`20message`20to`20that`20ef)10 V8`20288`20R`20.755 X(fect,`20and`20the`20board`20will`20come`20up`20on`20your`20screen`20with)-.18 V`20F`201.444 X(that`20roll`20in`20your`20move`20block.)108`20300`20R`201.443 X(If`20he`20won,`20he`20will`20use`20the`20opening`20roll`20and`20his`20ldb`20w Vill`20send`20your`20ldb`20a)6.443 XF(message`20telling`20you`20how`20he`20moved.)108`20312`20Q(Either`20way)5`20E V`202.5(,t)-.65`20G X(he`20game`20is`20of)307.05`20312`20Q`202.5(fa)-.18`20G(nd`20running.)370.74 V`20312`20Q`20.172 X(If,`20by`20unfortunate`20chance,`20the`20opening`20roll`20is`20a`20tie,`20you Vr`20opponent')108`20328.8 XR`202.672(sl)-.55`20G`20.172(db`20will`20send`20your`20ldb`20a`20message`20to V`20that)382.524`20328.8`20R X(ef)108`20340.8`20Q`202.912(fect.`20This)-.18`20F`20.411 X(will`20cause`20a`20new`20opening`20roll`20sequence`20as`20described`20above.) V2.912`20F`202.911(Am) X5.411`20G`20.411(essage`20will`20be`20printed`20telling)423.366`20340.8`20R(yo Vu`20what')108`20352.8 XQ`202.5(sg)-.55`20G(oing`20on;`20just`20keep`20feeding`20the`20incoming`20mess Vages`20to`20ldb,`20and`20i`5C Xt`20will`20take`20care`20of`20everything.)159.11`20352.8`20Q`20F1(PLA)72`20374 V.4`20Q(YING`20A`20GAME) X-.828`20E`20F0`20.464(When`20it`20is`20your`20turn,`20the`20game`20will`20be V`20displayed`20on`20your`20scree`5C Xn,`20and`20you`20will`20be`20faced`20with`20three`20options:)108`20386.4`20R V`201.263 X(Roll,`20Double,`20or`20Concede.)108`20398.4`20R`201.263(Unless`20you`20are V`20very`20cocky)6.263`20F X3.762(,Iw)-.65`20G`201.262(ould`20not`20suggest`20doubling`20at`20this`20point V.)354.096`20398.4`20R X-1(Yo)6.262`20G(u)1`20E`20.179(could`20always`20concede,`20but`20I`20really V`20think`20that`20would`20b`5C Xe`20selling`20yourself`20short.)108`20410.4`20R`20.179(So`20you`20should`20cho Vose`20"Roll".)5.179`20F X.28(Just`20press`20"r",`20and`20watch`20your`20roll`20appear`20on`20your`20mov Ve`20block`20`5C(along`20the`20`5C Xright`20side`20of`20the`20screen,`20under`20the)108`20422.4`20R`201.116(word V`20"Y)108`20434.4`20R`203.616 X(ou"`5C).`20Y)-1`20F`201.116(ou`20should`20see`20two`20numbers`20appear`20`5C( Vfour`20if`20you`20rolled`20dou`5C Xbles`5C),`20and`20the`20word`20UNUSED)-1`20F`201.863(beside`20them.)108`20446. V4`20R`201.862(Decide`20w`5C Xhich`20of`20the`20rolls`20you`20want`20to`20use`20`5C214rst,`20and`20press`20t Vhe`20number`20of`20that`20roll.) X6.863`20F(For)6.862`20E`20.247(example,`20say`20you`20rolled`201`206,`20and V`20you`20want`20to`20move`20the`5C X`20obvious`208`5C2557,`2013`5C2557`20to`20make`20your`20bar`20point.)108`20458 V.4`20R`20.248(Just`20hit) X5.248`20F`203.104("6".`20Notice)108`20470.4`20R`20.603 X(the`20cursor`20jump`20up`20to`20your`20move`20block,`20beside`20the`20"6"`20r Voll?)3.104`20F`20.603 X(It`20is`20waiting`20for`20you`20to`20enter`20the)5.603`20F`20.355(point`20you V`20want`20to`20move`20from.) X108`20482.4`20R`20.355(Press`20"1"`20"3"`20`5C(don')5.355`20F`202.855(th)-.18 V`20G`20.355 X(it`20return`5C).)322.68`20482.4`20R`20-1(Yo)5.355`20G`202.855(us)1`20G`20.356 V X(hould`20see`20a`20piece`20move`20from`2013`20to`207,)389.125`20482.4`20R`20.5 V75 X(and`20this`20fact`20will`20be`20re`5C215ected`20in`20your`20move`20block`20as V`20well.)108`20494.4`20R(Now) X5.574`20E`203.074(,p)-.65`20G`20.574(ress`20"1".)378.672`20494.4`20R`20.574 X(Again`20the`20cursor`20jumps`20to`20the)5.574`20F`20.643(move`20block,`20and V`20you`20type`20"8".)108 X506.4`20R`20.644 X(The`20second`20entry`20in`20the`20move`20block`20re`5C215ects`20this`20move, V`20as`20does`20the`20board.) X5.643`20F`202.647(Happy?`20If)108`20518.4`20R`20.146(not,`20press`20"r";`20thi Vs`20will`20reset`20your`20`5C Xrolls`20to`20UNUSED`20and`20put`20the`20board`20back`20to`20how`20it`20was`20b Vefore)2.647`20F`20.421 X(you`20moved,`20and`20then`20you`20can`20enter`20some`20dif)108`20530.4`20R V`20.422(ferent`20moves.)-.18 XF`20.422(Otherwise,`20hit`20"s"`20`5C(not`20"q"!`5C))5.422`20F`20.422(to`20sen Vd`20the`20move.)5.422`20F X1.397(The`20cursor`20will`20jump`20down`20to`20the`20message`20area,`20where V`20you`20get`20a`20chance`20to`5C X`20enclose`20a`20message`20to`20your)108`20542.4`20R`20.907 X(opponent,`20perhaps`20to`20gloat`20over`20the`20great`20move`20you`20just`20m Vade.)108`20554.4`20R`20-1 X(Yo)5.907`20G`203.407(uo)1`20G`20.907(nly`20get`202`20lines`20of`2056`20charac Vters,`20so)397.011 X554.4`20R(keep`20it`20short.)108`20566.4`20Q(When`20you`20are`20done,`20press V`20.)5`20E`20-1 X(Yo)5`20G(ur`20move`20is`20on`20its`20way!)1`20E(There`20are`20three`20shortcu Vts`20you`20can`20use`20after`5C X`20you`20have`20entered`20your`20`5C214rst`20move:)108`20583.2`20Q`2026(1.`20Y V)108`20600`20R`20.163 X(ou`20can`20press`20,`20which`20will`20"repeat"`20your`20last`20move.) V-1`20F`20.163 X(That`20is,`20your`20next`20remaining`20roll`20will)5.163`20F`201.22 X(move`20from`20the`20same`20point`20as`20your`20last`20one`20moved`20from.)144 V`20612`20R`201.221 X(This`20is`20handy`20when`20using`20doubles`20to)6.221`20F X(move`20more`20than`20one`20piece`20from`20the`20same`20point.)144`20624`20Q V`2026(2.`20Y)108`20640.8`20R X.822(ou`20can`20press`20,`20which`20will`20"continue"`20your`20last`20m Vove.)-1`20F`20.822 X(That`20is,`20your`20next`20remaining`20roll)5.822`20F X(will`20move`20from`20the`20point`20your`20last`20move`20ended`20on.)144`20652 V.8`20Q`2026(3.`20Y)108 X669.6`20R`201.315(ou`20can`20press`20"p",`20which`20will`20attempt`20to`20make V`20the`20point`20your`20last`5C X`20move`20ended`20on.)-1`20F`201.316(In`20our`201`206)6.316`20F`20.181(example V`20above,`20you`20could`20ha`5C Xve`20just`20hit`20"p"`20after`20you`20moved`2013`5C2557,`20and`20ldb`20would V`20have`20`5C214gured`20out)144 X681.6`20R`20.922(that`20to`20make`20the`207`20point`20with`20the`20remaining V`20roll`20of`201,`20it`20would`20h`5C Xave`20to`20move`20a`20piece`20from`20the`208)144`20693.6`20R(point.)144`20705. V6`20Q`20.082 X(In`20addition,`20there`20is`20one`20more`20shortcut`20that`20may`20be`20used V`20with`20any`20roll.)108 X722.4`20R`20.082(If`20you`20want`20to`20use`20a`20roll`20to`20bear`20of)5.082 V`20F`202.582(fa)-.18`20G X(October`206,`201992)273.645`20768`20Q(9)535`20768`20Q`20EP X%%Page:`2010`2010 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V`20.062 X(piece,`20you`20can`20just`20hit`20"o".)108`2084`20R`20.062(Ldb`20will`20locat Ve`20the`20point`20`5C(if`20any`5C X`5C)`20from`20which`20pieces`20may`20be`20legally`20borne`20of)5.062`20F`202.5 V63(fb)-.18`20G(y)535`2084`20Q X(the`20next`20unused`20roll,`20and`20make`20that`20move`20automatically)108 V`2096`20Q`205(.Y)-.65`20G X(ou`20can`20also`20select`20a`20roll,`20then`20hit`20"o".)342.99`2096`20Q`20.7 V17(If`20you`20use`20your`20mov`5C Xes,`20hit`20"Send",`20and`20start`20to`20enter`20your`20message,`20then`20real Vize`20you`20made`20a`20mista`5C Xke,`20you)108`20112.8`20R`201.067(can`20press`20ESC`20to`20get`20out`20of`20se Vnd`20and`20back`20into`20the`20g`5C Xame,`20where`20you`20can`20use`20"Reset"`20and`20re`5C255enter`20your)108`2012 V4.8`20R(moves.)108 X136.8`20Q/F1`209/Times-Bold@0`20SF(DOUBLING)72`20158.4`20Q`20F0`20.018 X(If`20you`20decide`20to`20double,`20just`20choose`20"Double"`20instead`20of V`20"Roll".)108`20170.4`20R X-1(Yo)5.017`20G`202.517(uw)1`20G`20.017(ill`20get`20to`20enclose`20a`20message V,`20just`20like)393.781 X170.4`20R`201.086(when`20you`20send`20a`20move,`20then`20your`20message`20gets V`20sent.)108`20182.4`20R X1.086(Once`20you`20have`20doubled,`20you`20cannot`20double`20again)6.086`20F V`20.971(until`20your`20o`5C Xpponent`20does`20so,`20so`20ldb`20automatically`20selects`20"Roll"`20and`20sen Vds`20you`20to`20the`20next`5C X`20menu.)108`20194.4`20R`20.97(If`20you)5.97`20F(don')108`20206.4`20Q`202.5(tl V)-.18`20G X(ike`20this,`20you`20can`20disable`20it`20by`20setting)134.21`20206.4`20Q/F2 V`2010/Times-Italic@0`20SF X(autor)2.5`20E(oll=no)-.37`20E`20F0(in`20.ldbrc.)2.5`20E`20.307(If`20your`20op Vponent`20doubles,`20`5C Xyou`20will`20see`20a`20message`20just`20under`20the`20board`20to`20that`20ef)1 V08`20223.2`20R`20.307 X(fect,`20and`20a`20menu`20will`20come)-.18`20F`20.763 X(up`20allowing`20you`20to`20Accept`20or`20Decline`20the`20double.)108`20235.2 V`20R`20.763 X(Declining`20the`20double`20means`20you`20lose`20the`20game`20for`20the)5.763 V`20F`20.355 X(current`20game`20value.)108`20247.2`20R`20.356 X(Accepting`20means`20that`20the`20game`20continues,`20but`20its`20value`20is V`20doubled.)5.355`20F X.356(The`20current`20game)5.356`20F`20.922(value`20is`20shown`20to`20the`20lef Vt`20of`20the`20board.)108 X259.2`20R`20.922(After`20you`20accept,`20you`20should`20see`20this`20display V`20move`20next`20to`20your) X5.922`20F(home`20board,`20indicating`20that`20you`20own`20the`20doubling`20cub Ve.)108`20271.2`20Q(If`20`5C Xthe`20Crawford`20rule`20game`20is`20being`20played,`20doubling`20is`20illegal, V`20and`20will`20result`20i`5C Xn`20an`20error`20message.)108`20288`20Q`20F1(BOARDS)72`20309.6`20Q`20F2(Ldb)10 V8`20321.6`20Q`20F0 X(maintains`20three`20board`20images`20at`20all`20times.)2.5`20E(These`20are:)5 V`20E`2031(1T)108 X338.4`20S`20.525(he`20board`20before`20your`20opponent')150.11`20338.4`20R`203 V.025(sl)-.55`20G`20.525 X(ast`20move.)287.985`20338.4`20R`20.525(It`20is`20for`20display`20purposes`20o Vnly)5.525`20F`203.026 X(,s)-.65`20G`203.026(oy)462.916`20338.4`20S`20.526(ou`20can`20see`20your)475.9 V42`20338.4`20R X(opponent')144`20350.4`20Q`202.5(sm)-.55`20G(ove`20"before`20and`20after".)198 V.17`20350.4`20Q X(The`20pieces`20your`20opponent`20is`20going`20to`20move`20are`20highlighted.) V5`20E`2031(2T)108`20367.2 XS`202.497(he`20board`20after`20your`20opponent')150.11`20367.2`20R`204.997(sl) V-.55`20G`202.497 X(ast`20move.)290.625`20367.2`20R`202.496 X(It`20shows`20the`20condition`20of`20the`20board`20after`20your)7.497`20F(oppo Vnent')144`20379.2`20Q X2.5(sl)-.55`20G(ast`20move,`20with`20the`20pieces`20he`20moved`20highlighted.) V193.17`20379.2`20Q`2031 X(3T)108`20396`20S`20.808(he`20current`20board.)150.11`20396`20R`20.808 X(This`20is`20the`20"real"`20board`20that`20shows`20the`20current`20state`20of V`20the`20game.)5.808`20F X.809(Nothing`20is)5.809`20F(highlighted.)144`20408`20Q`20.575 X(By`20default,`20ldb`20displays`20the`20Current`20board`20at`20all`20times.)10 V8`20424.8`20R`20.575 X(If`20you`20want`20to`20see`20the`20other`20boards,`20use`20the`20Board)5.575 V`20F`20.007 X(command`20`5C(provided`20it`20is`20in`20the`20current`20menu`5C).)108`20436.8 V`20R`20.007 X(This`20will`20cycle`20through`20the`20three`20boards`20in`20the`20order`20the Vy`20are)5.007`20F`20.826 X(listed`20above.)108`20448.8`20R`20.826(The`20second`20line`20of`20the`20scree Vn`20tells`20you`20which`20`5C Xboard`20is`20displayed`20`5C(near`20the`20left`5C).)5.826`20F`20.825(When`20yo Vu)5.825`20F`20.139(roll,`5C X`20ldb`20automatically`20switches`20to`20the`20current`20board`20if`20it`20is V`20not`20already`20up.)108 X460.8`20R`20-1(Yo)5.14`20G`202.64(uc)1`20G`20.14(an`20set`20which`20of`20these V`20three)432.94`20460.8`20R X(boards`20is`20initially`20displayed`20via`20the)108`20472.8`20Q`20F2(initialb Voar)2.5`20E(d)-.37 XE`20F0(setting`20in`20.ldbrc.)2.5`20E`20F1(ENTERING`20COMMENTS)72`20494.4`20Q V`20F0`202.474(Wheneve`5C Xr`20you`20send`20a`20move`20to`20your`20opponent,`20you`20are`20given`20the V`20opportunity`20to`20enclose`20a`5C X`20two`20line)108`20506.4`20R`202.5(comment.`20While)108`20518.4`20R X(entering`20your`20comment,`20certain`20keys`20have`20special`20meaning.)2.5 V`20E(These`20are:)5`20E X(BS/DEL)108`20535.2`20Q`20.309(The`20backspace`20and`20delete`20`5C(or`20rubou Vt`5C)`20keys`20both`20eras`5C Xe`20the`20last`20character`20typed.)144`20547.2`20R`20-1(Yo)5.309`20G`202.809( Vuc)1`20G`20.309 X(an`20backspace)486.661`20547.2`20R(from`20one`20line`20to`20the`20previous V`20one.)144`20559.2`20Q X7.95(`5EW/`5EB`20The)108`20576`20R`202.441 X(`5EW`20and`20`5EB`20`5C(control-W`20and`20control-B`5C)`20keys`20both`20erase V`20the`20last`20word`20typed.) X4.941`20F`20-.8(Wo)7.44`20G`202.44(rds`20are).8`20F(delimited`20by`20spaces.)1 V44`20588`20Q`209.62 X(`5EX/`5EU`20The)108`20604.8`20R`20.833(`5EX`20and`20`5EU`20`5C(control-X`20an Vd`20control-U`5C)`20keys`20erase`20t`5C Xhe`20current`20line`20and`20move`20to`20the`20end`20of`20the)3.332`20F(previou Vs`20line,`20or`20to`20the`20be`5C Xginning`20of`20the`20`5C214rst`20line`20if`20used`20on`20the`20`5C214rst`20lin Ve.)144`20616.8`20Q(RETURN)108 X633.6`20Q`20.691(If`20you`20press`20return`20on`20an`20empty`20line,`20or`20on V`20the`20last`20line,`20the`20co`5C Xmment`20is`20`5C214nished.)144`20645.6`20R`20.69(Otherwise,`20the)5.69`20F X(cursor`20moves`20to`20the`20next`20line.)144`20657.6`20Q`2015.16(ESC`20The)10 V8`20674.4`20R`20.276(esc`5C Xape`20key`20aborts`20the`20operation`20`5C(e.g.`20Send`5C),`20restores`20the V`20previous`20comment,`20and`5C X`20returns`20to`20the)2.776`20F(previous`20menu.)144`20686.4`20Q X(This`20allows`20you`20to`20change`20your`20mind`20and`20back`20out`20of`20an V`20operation.)5`20E`20.174 X(All`20other`20keys`20are`20entered`20into`20the`20comment.)108`20703.2`20R V`20.174 X(When`20you`20reach`20the`20end`20of`20a`20line,`20ldb`20word-wraps`20to`20the V`20next)5.174`20F`201.235 X(line,`20or`20beeps`20if`20you`20are`20at`20the`20end`20of`20the`20last`20line V.)108`20715.2`20R`201.236 X(Note`20that`20the`20superkey`20is`20still`20active`20while`20entering)6.236 V`20F X(comments,`20and`20cannot`20be`20entered`20into`20a`20comment.)108`20727.2`20Q V(October`206,`201992) X273.645`20768`20Q(10)530`20768`20Q`20EP X%%Page:`2011`2011 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V/F1`209/Times-Bold@0`20SF X(CONTROLLING`20A`20GAME)72`2084`20Q`20F0(The)108`2096`20Q/F2`2010/Times-Italic V@0`20SF(`5C255contr) X3.375`20E(ol)-.37`20E`20F0`20.874 X(option`20permits`20you`20to`20control`20your`20games`20in`20certain`20ways.)3 V.375`20F`20.874 X(Each`20of`20your`20current`20games`20are)5.874`20F`202.038(displayed,`20one V`20at`20a`20time,`20just`20a`5C Xs`20they`20are`20when`20you`20are`20playing,`20allowing`20you`20to`20perform V`20any`20of`20the)108`20108`20R X(functions`20on`20the`20control`20menu.)108`20120`20Q X(The`20control`20menu`20has`20the`20following`20commands:)5`20E`209.62(Invert V`20This)108`20136.8`20R X1.419(allows`20you`20to`20invert`20the`20board`20for`20this`20game.)3.919`20F V`201.418 X(The`20board`20will`20invert`20immediately`20on`20your)6.419`20F`20.055 X(screen,`20so`20you`20can`20see`20if`20you`20like`20it.)144`20148.8`20R(Pressi Vng)5.055`20E`20F2(Invert) X2.555`20E`20F0`20.055(again`20will`20put`20it`20back`20to`20normal.)2.555`20F V`20.056(Inverting`20the) X5.056`20F`20.059(board`20does`20not`20af)144`20160.8`20R`20.059 X(fect`20the`20point`20numbering`20or`20the`20color`20you`20play)-.18`20F`202.5 V59(,i)-.65`20G`202.559 X(tm)405.228`20160.8`20S`20.059(erely`20draws`20the`20board`20with`20the)418.34 V7`20160.8`20R`201.215 X(low-numbered`20points`20at`20the`20top`20of`20the`20screen`20rather`20than V`20the`20bottom.)144`20172.8 XR`20-1(Yo)6.215`20G`203.716(um)1`20G`201.216(ay`20`5C214nd`20it`20easier`20to) V463.476`20172.8`20R X(make`20all`20of`20your`20games`20play`20a`20certain`20direction.)144`20184.8 V`20Q`204.06(Resend`20From) X108`20201.6`20R`201.989 X(time`20to`20time,`20messages`20may`20be`20lost`20due`20to`20faulty`20mailers V`20or`20human`20error)4.489 XF`206.988(.I)-.55`20G`204.488(fy)495.474`20201.6`20S`201.988(our`20last)508.29 V2`20201.6`20R`202.922 X(message`20gets`20lost,`20you`20can`20regenerate`20it`20with`20the)144`20213.6 V`20R`20F2(Resend)5.423 XE`20F0`205.423(command.`20There)5.423`20F`202.923(is`20no`20harm`20in)5.423 V`20F`201.621 X(regenerating`20messages,`20as`20ldb`20will`20ignore`20duplicate`20messages.)1 V44`20225.6`20R`201.62 X(If`20you`20and`20your`20opponent`20have)6.621`20F(for)144`20237.6`20Q`20.075( Vgotten`20whose`20move`20`5C Xit`20is,`20the`20easiest`20way`20to`20get`20going`20again`20is`20for`20both V`20of`20you`20to`20resend`20your`20la`5C Xst)-.18`20F`203.048(message.`20The)144`20249.6`20R`20.547 X(one`20that`20got`20lost`20will`20be`20accepted,`20and`20the`20game`20will`20b Ve`20of)3.048`20F`203.047(fa) X-.18`20G`20.547(nd`20running`20again.)452.529`20249.6`20R(So)5.547`20E`201.356 V(that`20you`20can`20re`5C Xsend`20the`20last`20move`20of`20a`20game,`20completed`20games`20are`20kept`20i Vn`20your`20.ldbdata`20for`201) X144`20261.6`20R`20.278(week,`20after`20which`20they`20are`20deleted.)144`20273 V.6`20R`20.277 X(They`20may`20be`20deleted`20sooner`20with`20the`20Delete`20Game`20command.)5. V277`20F`201.387(Note`20a`5C Xlso`20that`20games`20that`20have`20been`20waiting`20for`20your`20opponent`20fo Vr`20more`20than`201`20week`20h`5C Xave`20an)144`20285.6`20R(automatic`20resend`20performed`20whenever`20you`20run V`20ldb.)144`20297.6`20Q X(Resend`20is`20disabled`20if`20it`20is`20your`20turn.)5`20E(Get`20Resend)108 V`20314.4`20Q`20.933 X(This`20allows`20you`20to`20send`20a`20message`20to`20your`20opponent')144`203 V26.4`20R`203.433(sl)-.55 XG`20.933(db`20requesting`20a`20resend.)374.432`20326.4`20R`20.933(This`20saves V`20your)5.933`20F X2.216(opponent`20the`20trouble`20of`20getting`20into)144`20338.4`20R`20F2(`5C2 V55contr)4.716`20E X(ol,)-.37`20E`20F0`202.216(`5C214nding`20which`20game`20you're`20talking`20abo Vut,`20and)4.716`20F X3.835(resending.`20Instead,)144`20350.4`20R`201.335 X(he`20can`20just`20feed`20your`20resend`20request`20message`20into`20ldb`20lik Ve`20it`20was`20a`20regular) X3.835`20F`202.959(move.`20V)144`20362.4`20R`20.459(ersion`201.0`20of`20ldb`20n Vot`20only`20does`20not`20sup`5C Xport`20this`20feature,`20but`20will`20crash`20if`20a`20resend`20request)-1.11 V`20F`201.647 X(packet`20is`20sent`20to`20it,`20so)144`20374.4`20R`20F2(`5C255contr)4.147`20E V(ol)-.37`20E`20F0`201.646 X(will`20check`20to`20make`20sure`20your`20opponent`20is`20running`20the`20prop Ver)4.147`20F X(version`20before`20sending`20the`20message.)144`20386.4`20Q X("Get`20Resend"`20is`20disabled`20for`20games`20that`20are`20over)5`20E(.)-.55 V`20E(Screen`20Dump)108 X403.2`20Q`201.379(This`20command`20makes`20an`20exact`20copy`20of`20the`20scre Ven`20in`20the`20`5C214le`20"ld`5C Xb_screen.dmp".)144`20415.2`20R`201.379(This`20could`20be)6.379`20F X(useful`20if`20you`20want`20to`20mail`20the`20board`20to`20someone`20or`20prin Vt`20it`20out.)144`20427.2`20Q X(Delete`20Game)108`20444`20Q`20.977(This`20command`20marks`20a`20game`20for V`20deletion.)144`20456`20R X.976(The`20game`20is`20not`20deleted`20until`20you`20quit,`20and`20you`20can)5 V.977`20F`201.588 X(undelete`20it`20by`20pressing`20D`20again.)144`20468`20R(Normally)6.589`20E V`204.089(,y)-.65`20G X1.589(ou`20should`20not`20delete`20a`20game`20in`20this`20manner)334.449`20468 V`20R`204.089(,y)-.4`20G X(ou)530`20468`20Q`20.047(should`20play`20until`20someone`20wins`20or`20concede Vs.)144`20480`20R(The) X5.047`20E`20F2`20.046(Delete`20Game)2.547`20F`20F0`20.046(command`20can`20be V`20used`20to`20get`20rid`20of) X2.546`20F(games`20where`20your`20opponent`20doesn')144`20492`20Q`202.5(ta)-.18 V`20G X(nswer`20his`20mail,`20or`20doesn')295.73`20492`20Q`202.5(tw)-.18`20G(ant`20to V`20play)408.87`20492`20Q X2.5(,e)-.65`20G(tc.)459.88`20492`20Q(Next`20Game)108`20508.8`20Q X(The`20next`20game`20is`20displayed.)144`20520.8`20Q X(If`20there`20is`20no`20next`20game,`20this`20choice`20is`20equivalent`20to)5 V`20E`20F2(Quit.)2.5`20E`20F0 X15.72(Quit`20This)108`20537.6`20R`20.04(allows`20you`20to`20exit`20from)2.54 V`20F`20F2(`5C255contr) X2.54`20E`20.04(ol`20.)-.37`20F`20F0`20.041 X(If`20you`20made`20any`20changes`20to`20your`20games,`20you`20will`20be`20give Vn)5.04`20F X(the`20opportunity`20to`20save`20these`20changes,`20then`20ldb`20will`20exit.) V144`20549.6`20Q`20F1 X(VMS`20NOTES)72`20566.4`20Q`20F0(VMS`20users`20have`20a`20few`20unique`20consi Vderations:)108`20578.4 XQ(On`20VMS,`20the`20default`20`5C214le`20names`20are`20changed`20from`20.ldb* V`20to`20ldb.*.)108`20595.2`20Q X(This`20groups`20all`20ldb`20`5C214les`20together)5`20E(.)-.55`20E`20.079(VMS V`20mail`20doesn')108`20612 XR`202.579(ta)-.18`20G`20.079 X(ppend`20messages`20to`20an`20existing`20`5C214le,`20it`20creates`20new`20vers Vions.)188.887`20612`20R X1.478`20-.7(To`20a)5.078`20H`20.078(ccommodate`20this,`20vms-).7`20F`201.444 X(compiled`20executables`20will`20search`20all`20versions`20of`20a`20`5C214le V`20by`20default.)108`20624 XR`201.444(This`20applies`20to`20`5C214les`20speci`5C214ed`20on`20the)6.444`20F V`20.112 X(command`20line`20as`20well`20as`20the`20`5C214le`20speci`5C214ed`20in`20your V`20ldb.rc.)108`20636`20R`20-1 X(Yo)5.111`20G`202.611(uc)1`20G`20.111(an`20disable`20this`20in`20either`20case V`20by`20specifying`20a) X363.032`20636`20R`20.601(version`20number)108`20648`20R`203.101(,o)-.4`20G`203 V.101(rb)181.292`20648 XS`203.101(ys)192.723`20648`20S`20.602 X(pecifying`20version`20number`200`20to`20get`20the`20most`20current`20version. V)204.714`20648`20R`20.602 X(The`20default`20setting`20in)5.602`20F`20.978(ldb.rc`20is`20to`20scan`20sys$l Vogin:ldb.rcv;*.)108 X660`20R`20-1(Yo)5.978`20G`203.478(um)1`20G`20.977 X(ight`20want`20to`20change`20this`20to`20ldb.txt;*,`20since`20that`20is`20the V`20default)290.088`20660`20R X.254(extension`20added`20by`20mail`20when`20you`20extract`20a`20`5C214le.)108 V`20672`20R`20.254 X(If`20you`20use`20multiple`20versions,`20you`20should`20be`20careful`20not`20t Vo)5.254`20F X(PURGE`20until`20after`20you`20have`20run`20ldb.)108`20684`20Q`202.083(If`20yo Vu`20have`20the`20Eunice`20pa`5C Xckage,`20ldb`20will`20compile`20and`20run`20under`20it`20`5C214ne,`20but`20any V`20`5C214les`20created`20by`20th`5C Xe)108`20700.8`20R`201.204(Eunice`5C255compiled`20version`20`5C(most`20notably V`20the`20games`20`5C214le`5C X`5C)`20will`20be`20incompatible`20with`20the`20V)108`20712.8`20R`201.204(AX V`20C`5C255compiled)-1.29`20F X2.5(version.`20Use)108`20724.8`20R(the`20unixtovms`20command`20to`20convert.)2 V.5`20E X(October`206,`201992)273.645`20768`20Q`20-.37(11)530.37`20768`20S`20EP X%%Page:`2012`2012 XBP/F0`2010/Times-Roman@0`20SF`20402.18(LDB`5C(1`5C)`20LDB`5C(1`5C))72`2048`20R V`20.971 X(Ldb`20is`20available`20in`20vms_share`20format`20with`20the`20manual`20prefor Vmatted.)108`2084`20R X.971(If`20you`20have`20MMS,`20you`20can`20use`20the)5.971`20F X(make`5C214le.vms`20provided`20by`20entering:)108`2096`20Q`202.5($r)120.5`2010 V8`20S X(ename`20make`5C214le.vms`20make`5C214le.)131.33`20108`20Q`202.5($m)120.5`2012 V0`20S(ake)135.78 X120`20Q(If`20you`20don')108`20132`20Q`202.5(th)-.18`20G X(ave`20a`20make`20available,`20you`20can`20compile`20with:)163.09`20132`20Q V`202.5($@)120.5`20144`20S X(makeldb)137.21`20144`20Q X(After`20ldb`20is`20compiled,`20you'll`20probably`20want`20to`20de`5C214ne`20a V`20symbol`20such`20as:)108 X156`20Q`202.5($l)120.5`20168`20S(db`20:==`20$dua0:`5Bme.ldb`5Dldb)130.78`20168 V`20Q X(so`20you`20can`20run`20it.)108`20180`20Q`20.519(The`20VMS`20implementation V`20spawns`20a`20subprocess`20`5C Xwith`20no`20command`20when`20the`20superkey`20is`20pressed.)108`20196.8`20R V`20-1(Yo)5.519`20G`203.019 X(uc)1`20G(an)530.56`20196.8`20Q`201.674(enter`20LOGOUT`20or`20EOJ`20to`20retur Vn`20to`20the`20game.)108 X208.8`20R`201.673(If`20you`20de`5C214ne`20a`20command`20to`20run`20when`20the V`20superkey`20is)6.674`20F(pr`5C Xessed,`20the`20command`20will`20be`20run,`20but`20you`20will`20still`20need V`20to`20logout`20of`20the`20subpr`5C Xocess`20to`20return`20to`20ldb.)108`20220.8`20Q/F1`209/Times-Bold@0`20SF(BUGS) V72`20242.4`20Q`20F0 X2.784(Ag)108`20254.4`20S`20.284(ame`20`5C214le`20created`20by`20ldb`20under V`20Eunice`20must`20be`20run`20t`5C Xhrough`20"unixtovms"`20before`20the`20V)123.004`20254.4`20R`20.285(AX`5C255C V`20ldb`20can`20read)-1.29 XF(it.)108`20266.4`20Q`202.625 X(The`20superkey`20function`20only`20works`20when`20ldb`20is`20waiting`20for V`20a`20key)108`20283.2`20R X7.625(.I)-.65`20G`205.125(fl)406.035`20283.2`20S`202.625(db`20is`20doing`20som Vething`20time-) X417.27`20283.2`20R(consuming,`20such`20as`20calculating`20legal`20moves,`20the V`20superkey`20will`20n`5C Xot`20work`20until`20the`20calculation`20is`20complete.)108`20295.2`20Q`20.073( VThere`20should`20be`20a`20`5C Xway`20to`20play`20interactively`20`5C(using`20socket`20connections,`20for`20ex Vample`5C),`20rather`20th`5C Xan`20via`20e`5C255mail.)108`20312`20R`20.342(Under`20Eunice,`20there`20is`20a V`20bug`20when`20delmail`20is`20`5C Xenabled,`20received`20mail`20is`20in`20a`20`5C214le`20with`20multiple`20versio Vns,`20and)108`20328.8`20R X1.642(these`20versions`20are`20entered`20on`20the`20command`20line`20`5C(as V`20opposed`20to`20being`20spe`5C Xci`5C214ed`20by`20a`20pattern`20in`20.ldbrc`5C).)108`20340.8`20R`20.514(Eunice V`20handles`20multiple`20ve`5C Xrsions`20by`20appending`20a`20dot`20and`20the`20version`20number`20to`20all V`20versions`20of`20the`20`5C214le`5C X`20but)108`20352.8`20R`20.823(the`20newest`20version,`20to`20which`20it`20appe Vnds`20nothing.)108 X364.8`20R`20.824(When`20the`20most`20recent`20version`20is`20deleted,`20the V`20next`20older)5.823`20F X1.128(version`20becomes`20the`20most`20recent,`20and`20has`20no`20version`20su Vf)108`20376.8`20R`201.128 X(`5C214x`20attached.)-.18`20F`201.127(This`20`5C214le`20will`20be`20skipped, V`20since`20its)6.128`20F X1.556(name`20changed`20between`20the`20time`20the`20`5C214le`20list`20was`20cr Veated`20and`20the`20`5C214le`5C X`20is`20opened.)108`20388.8`20R`201.556(All`20other`20`5C214les`20will`20be)6. V556`20F`20.475 X(scanned`20properly)108`20400.8`20R`205.475(.T)-.65`20G`20.474(he`20work-aroun Vd`20for`20this`20is`20`5C Xto`20not`20use`20a`20pattern`20like`20'ldb`20ldb.txt*'`20on`20the`20command V`20line)190.5`20400.8`20R X1.291(to`20specify`20all`20versions`20of`20the`20`5C214le,`20but`20rather`20us Ve`20'ldb`20ldb.txt.*`20ldb`5C X.txt'`20so`20that`20the`20most`20recent`20version`20is)108`20412.8`20R`20.585 X(scanned`20`5C(and`20thus`20deleted`5C)`20last.)108`20424.8`20R(Alternatively) V5.585`20E`203.085(,t) X-.65`20G`20.585(he`20pattern`20can`20be`20quoted`20so`20that`20ldb`20interpret Vs`20it`20instead`20of) X301.66`20424.8`20R(the`20shell.)108`20436.8`20Q(The)108`20453.6`20Q/F2`2010/Ti Vmes-Italic@0`20SF X(`5C255myaddr)2.5`20E`20F0 X(command`20line`20option`20should`20override`20the`20myaddr`20line`20in`20the V`20people`20`5C214le.)2.5 XE`20-1.11(Ve)108`20470.4`20S`20.858(rsion`201.0`20of`20ldb`20only`20allowed V`20the`20colors`20red,`20whit`5C Xe,`20and`20black,`20represented`20by`20r)1.11`20F`203.359(,w)-.4`20G`203.359(, Va)455.313`20470.4`20S X.859(nd`20b,`20respectively)465.612`20470.4`20R(.)-.65`20E`20.181 X(Although`20ldb`201.0`20will`20allow`20games`20to`20be`20started`20and`20playe Vd`20correctly`20with`20dif) X108`20482.4`20R`20.18(ferent`20colors,`20the`20move`20blocks)-.18`20F`20.107(w Vill`20have`20the`20strin`5C Xg`20"*BAD`20COLOR*"`20displayed`20where`20the`20color`20should`20be,`20making V`20it`20dif)108`20494.4`20R X.107(`5C214cult`20to`20`5C214gure`20out)-.18`20F`201.592(which`20color`20you V`20are`20playing.)108 X506.4`20R`201.592(Upgrading`20to`20a`20newer`20ldb`20will`20`5C214x`20this.)6. V592`20F`201.591 X(Nevertheless,`20if`20you`20are`20playing)6.592`20F(someone`20who`20is`20using V`20ldb`201.0,`20you`20ma`5C Xy`20want`20to`20restrict`20your`20color`20choices`20to`20r)108`20518.4`20Q`202 V.5(,w)-.4`20G`202.5(,a) X432.75`20518.4`20S(nd`20b.)442.19`20518.4`20Q(Occasionally)108`20535.2`20Q`203 V.691(,l)-.65`20G X1.192(db`20will`20print`20a`20spurious`20message`20telling`20you`20that`20you V`20only`20have`20one`20lega`5C Xl`20move.)168.531`20535.2`20R(Usually)6.192`20E`20.388(when`20it`20prints`20th Vis,`20it`20is`20right,`5C X`20but`20in`20the`20special`20case`20where`20you`20have`20one`20piece`20left V`20to`20bear`20of)108`20547.2`20R X.387(f,`20one`20of`20your)-.18`20F`20.424(rolls`20is`20less`20than`20you`20nee Vd`20to`20bear`20it`20of)108 X559.2`20R`20.424(f,`20and`20the`20other`20roll`20is`20big`20enough`20to`20bear V`20of)-.18`20F`202.924(fb) X-.18`20G`202.925(yi)453.02`20559.2`20S`20.425(tself,`20ldb`20will`20want)463.7 V25`20559.2`20R`20.397 X(you`20to`20use`20the`20smaller`20die`20`5C214rst,`20then`20bear`20of)108`2057 V1.2`20R`202.897(fw)-.18`20G X.397(ith`20the`20bigger`20one.)298.15`20571.2`20R`20.396 X(This`20is`20consistent`20with`20the`20rules`20that`20say)5.397`20F`20.065 X(you`20must`20use`20both`20dice`20if`20you`20can,`20but`20is`20not`20correct V`20in`20this`20case.)108`20583.2 XR`20.066(Note`20that`20you`20can`20either`20use`20both`20dice`20like)5.065`20F V X(ldb`20wants,`20or`20ignore`20the`20message`20and`20bear`20of)108`20595.2`20Q V`202.5(fw)-.18`20G X(ith`20the`20lar)299.44`20595.2`20Q(ger`20die.)-.18`20E`20-1(Yo)5`20G X(ur`20move`20will`20be`20accepted`20either`20way)1`20E(.)-.65`20E(October`206, V`201992)273.645`20768`20Q X(12)530`20768`20Q`20EP X%%Trailer Xend $ call unpack LDB.PS;1 1862701850 "" $! $ create 'f' X#`20Makefile`20for`20ldb`20under`20vms`095/1/92 X# X#`20Copyright`201992`20`20Earle`20F.`20Ake X# X#`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20softw Vare`20and`20its X#`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to`20th Ve`20restrictions X#`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20by V`20reference. X#`20Any`20other`20use`20requires`20written`20permission`20from`20the`20author. V`20`20This`20software X#`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including`20any V`20implied X#`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X#`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20resulting V`20from`20the X#`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the`20use Vr`20agrees X#`20to`20these`20terms. X X#`20This`20makefile`20is`20for`20the`20vms`20make`20program`20written`20by`20T Vodd`20Aven`20and X#`20used`20by`20DECUS`20UUCP.`20`20This`20file`20should`20be`20renamed`20to V`20makefile. X#`20before`20it`20is`20used.`20`20If`20you`20do`20not`20have`20make`20on`20you Vr`20system,`20you X#`20can`20compile`20ldb`20with`20@makeldb.com.`20`20If`20you`20use`20this`20fi Vle,`20you X#`20shouldn't`20need`20to`20modify`20any`20of`20the`20installation`20options V`20below. X X###`20INSTALLATION`20OPTIONS`20### X#`20If`20your`20host`20uses`20an`20ancient`20version`20of`20curses`20(e.g.`20V VAX-C,`20Sequent), X#`20uncomment`20the`20following`20line.`20`20To`20tell`20if`20you`20need`20thi Vs`20option, X#`20first`20try`20compiling`20without`20it`20and`20see`20if`20your`20linker V`20complains X#`20about`20cbreak()`20and`20nocbreak()`20not`20being`20defined.`20`20If`20it V`20does, X#`20you`20need`20this`20option. X#OLDCURSES= X#OLDCURSES=-DOLD_CURSES X X#`20If`20your`20libc`20doesn't`20have`20a`20rename`20function,`20uncomment`20t Vhe X#`20following`20to`20use`20the`20one`20that's`20included.`20`20DO`20NOT`20use V`20this X#`20rename`20if`20your`20system`20already`20has`20one. X#RENAME= X#RENAME=rename.o X X#`20Uncomment`20the`20following`20lines`20only`20if`20you`20are`20using`20Euni Vce. X#`20If`20you`20don't`20know`20what`20it`20is,`20believe`20me,`20you're`20not V`20using`20it. X#UNIXTOVMS=true X#VMSTOUNIX=true X#`20UNIXTOVMS=unixtovms X#`20VMSTOUNIX=vmstounix X X#`20Put`20the`20name`20of`20the`20front-end`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20front-end`20(cur Vses). XFE_FILE=fe_curses X X#`20Put`20the`20name`20of`20the`20transport`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20transport`20(ema Vil). XT_FILE=t_email X X#`20Put`20the`20name`20of`20the`20dice`20roller`20you`20want`20to`20compile V`20in`20here. X#`20If`20you`20want`20to`20write`20your`20own`20dice`20roller,`20you`20can. V`20`20I`20would X#`20prefer`20people`20all`20used`20the`20same`20one,`20since`20that`20is`20mor Ve`20fair, X#`20but`20as`20long`20as`20it`20is`20really`20a`20random`20number`20generator, V`20you're`20ok. X#`20If`20you`20put`20in`20a`20fake`20dice`20roller`20(e.g.`20one`20that`20asks V`20you`20what X#`20roll`20you`20want),`20you`20are`20in`20violation`20of`20the`20copyright. V`20`20Read X#`20the`20README`20file`20for`20more`20information. XR_FILE=r_xrand X X#`20Put`20compiler`20flags`20here. XCFLAGS=/nolist X#LIBS=-lcurses`20-ltermcap X X#`20use`20these`202`20lines`20for`20SCO`20XENIX`20(also`20SCO`20UNIX?) X#CFLAGS=`20-O`20-Mle`20-LARGE`20-Zi`20-DM_TERMCAP`20$(OLDCURSES) X#LIBS=-lx`20-ltcap`20-ltermlib X#LINTFLAGS= X X#`20Name`20of`20ldb`20executable. X#LDB=ldb XLDB=ldb.exe X X#`20Page`20length`20to`20format`20manual`20with.`20`2062`20for`20VMS`20or`20Eu Vnice,`2066`20for`20most`20others. X#PAGELEN=66 X X#CC=cc X X###`20END`20OF`20INSTALLATION`20OPTIONS`20### X X*.obj`20:`09*.c X`09write`20sys$output`20"Compiling`20$*" X`09cc`20$(CFLAGS)`20$* X`09purge/nolog`20$*.obj X`09rename`20$*.obj`20*.*;1 X Xldb`20:`09$(LDB) X`09write`20sys$output`20"ldb`20Build`20finished." X Xldb_objs`20=`20board.obj,game.obj,main.obj,misc.obj,move.obj,process.obj,`5C X`09rcvop.obj,control.obj,`5C X`09check.obj,readmail.obj,save.obj,vars.obj,$(FE_FILE).obj,`5C X`09$(T_FILE).obj,$(R_FILE).obj,`5C X`09dohelp.obj,dostats.obj,flist_vms.obj,lock.obj X X# X#`09Include`20all`20the`20sources`20necessary`20to`20build`20under`20VMS`20or V`20unix X# X XSHARFILES=readme.,todo.,ldb.doc,ldb.man,ldb.ps,makefile.*,ldb.opt,makeldb.com, V*.c,*.h,ldbstarter.csh,ldb.tex X X$(LDB)`20:`20$(ldb_objs) X`09write`20sys$output`20"Linking`20$(LDB)" X`20`09link/exe=$(LDB)/notrace/nodebug/nomap`20$(ldb_objs),`5C X`09sys$share:vaxccurse.olb/library,`5C X`09sys$disk:`5B`5Dldb.opt/options X X$(ldb_objs)`20:`20ldb.h`20patchlevel.h X Xvms_share`20:`20$(SHARFILES) X`09vms_share`20$(SHARFILES)`20ldb_src $ call unpack MAKEFILE.;10 1031224315 "" $! $ create 'f' X#`20Makefile`20for`20ldb`098/3/91 X# X#`20Copyright`201991`20`20Perry`20R.`20Ross X# X#`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20softw Vare`20and`20its X#`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to`20th Ve`20restrictions X#`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20by V`20reference. X#`20Any`20other`20use`20requires`20written`20permission`20from`20the`20author. V`20`20This`20software X#`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including`20any V`20implied X#`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X#`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20resulting V`20from`20the X#`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the`20use Vr`20agrees X#`20to`20these`20terms. X X###`20INSTALLATION`20OPTIONS`20### X#`20If`20your`20host`20uses`20an`20ancient`20version`20of`20curses`20(e.g.`20V VAX-C,`20Sequent), X#`20uncomment`20the`20following`20line.`20`20To`20tell`20if`20you`20need`20thi Vs`20option, X#`20first`20try`20compiling`20without`20it`20and`20see`20if`20your`20linker V`20complains X#`20about`20cbreak()`20and`20nocbreak()`20not`20being`20defined.`20`20If`20it V`20does, X#`20you`20need`20this`20option. XOLDCURSES= X#OLDCURSES=-DOLD_CURSES X X#`20If`20your`20system`20uses`20index`20and`20rindex`20rather`20than`20strchr V`20and`20strrchr, X#`20uncomment`20the`20following`20line.`20`20If`20you`20don't`20know,`20just V`20try`20compiling X#`20and`20see`20if`20you`20get`20an`20error.`20`20These`20days`20most`20system Vs`20will`20take`20strchr X#`20and`20strrchr. XUSE_INDEX= X#USE_INDEX=-DUSE_INDEX X X#`20If`20your`20libc`20doesn't`20have`20a`20rename`20function,`20uncomment`20t Vhe X#`20following`20to`20use`20the`20one`20that's`20included.`20`20DO`20NOT`20use V`20this X#`20rename`20if`20your`20system`20already`20has`20one. XRENAME= X#RENAME=rename.o X X#`20Uncomment`20the`20following`20lines`20only`20if`20you`20are`20using`20Euni Vce. X#`20If`20you`20don't`20know`20what`20it`20is,`20believe`20me,`20you're`20not V`20using`20it. XUNIXTOVMS=true XVMSTOUNIX=true X#UNIXTOVMS=unixtovms X#VMSTOUNIX=vmstounix X X#`20Uncomment`20this`20line`20if`20your`20UNIX`20does`20not`20have`20the`20Ber Vkeley X#`20variable-length`20directory`20routines.`20`20These`20are`20opendir, X#`20readdir,`20closedir,`20etc. XNEED_READDIR= X#`20NEED_READDIR=-DNEED_READDIR X X#`20Put`20the`20name`20of`20the`20filename`20of`20the`20appropriate`20pattern V`20matcher`20here. X#`20For`20UNIX`20systems,`20this`20should`20be`20flist_unix.`20`20For`20VMS, V`20this`20should X#`20be`20flist_vms.`20`20If`20for`20some`20reason`20the`20flist`20file`20does V`20not`20work`20on X#`20your`20system,`201)`20please`20send`20me`20mail`20telling`20me,`20and`202) V`20you`20can X#`20plug`20in`20flist_none,`20which`20disables`20pattern`20matching`20but`20al Vlows X#`20ldb`20to`20compile. XFLIST=flist_unix X X#`20Put`20the`20name`20of`20the`20front-end`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20front-end`20(cur Vses). XFE_FILE=fe_curses X X#`20Put`20the`20name`20of`20the`20transport`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20transport`20(ema Vil). XT_FILE=t_email X X#`20Put`20the`20name`20of`20the`20dice`20roller`20you`20want`20to`20compile V`20in`20here. X#`20If`20you`20want`20to`20write`20your`20own`20dice`20roller,`20you`20can. V`20`20I`20would X#`20prefer`20people`20all`20used`20the`20same`20one,`20since`20that`20is`20mor Ve`20fair, X#`20but`20as`20long`20as`20it`20is`20really`20a`20random`20number`20generator, V`20you're`20ok. X#`20If`20you`20put`20in`20a`20fake`20dice`20roller`20(e.g.`20one`20that`20asks V`20you`20what X#`20roll`20you`20want),`20you`20are`20in`20violation`20of`20the`20copyright. V`20`20Read X#`20the`20README`20file`20for`20more`20information. XR_FILE=r_xrand X X#`20Put`20compiler`20flags`20here. XCFLAGS=-O`20$(OLDCURSES)`20$(NEED_READDIR) XLIBS=-lcurses`20-ltermcap X X#`20use`20these`202`20lines`20for`20SCO`20XENIX`20(also`20SCO`20UNIX?) X#CFLAGS=`20-O`20-Mle`20-LARGE`20-Zi`20-DM_TERMCAP`20$(OLDCURSES) X#LIBS=-lx`20-ltcap`20-ltermlib XLINTFLAGS= X X#`20Name`20of`20ldb`20executable. XLDB=ldb X#`20LDB=ldb.exe X X#`20Page`20length`20to`20format`20manual`20with.`20`2062`20for`20VMS`20or`20Eu Vnice,`2066`20for`20most`20others. XPAGELEN=66 X X#`20If`20you`20want`20to`20use`20gcc,`20plug`20it`20in`20here.`20`20Ldb`20has V`20been`20tested`20with X#`20gcc`202.3.3,`20should`20work`20with`20other`20versions.`20`20(?)`20`20Igno Vre`20warnings. XCC=cc X X###`20END`20OF`20INSTALLATION`20OPTIONS`20### X XCFILES=`09board.c`20game.c`20main.c`20misc.c`20move.c`20process.c`20rcvop.c V`20control.c`20`5C X`09check.c`20readmail.c`20save.c`20vars.c`20fe_curses.c`20t_email.c`20r_xrand. Vc`20`5C X`09dohelp.c`20dostats.c`20rename.c`20flist_unix.c`20flist_vms.c`20flist_none.c V`20`5C X`09lock.c XHFILES=ldb.h`20patchlevel.h XOFILES=`09board.o`20game.o`20main.o`20misc.o`20move.o`20process.o`20rcvop.o V`20control.o`20`5C X`09check.o`20readmail.o`20save.o`20vars.o`20$(FE_FILE).o`20$(T_FILE).o`20$(R_F VILE).o`20`5C X`09dohelp.o`20dostats.o`20$(RENAME)`20$(FLIST).o`20lock.o XSHARFILES=MANIFEST`20README`20TODO`20Makefile`20$(CFILES)`20$(HFILES)`20makefi Vle.vms`20`5C X`09makeldb.com`20ldb.man`20ldbstarter`20ldb.opt`20ldb.tex X X$(LDB):`20$(OFILES) X`09$(CC)`20$(CFLAGS)`20-s`20-o`20$(LDB)`20$(OFILES)`20$(LIBS) X Xall:`20$(LDB)`20ldb.doc X Xldb.doc:`20ldb.man X`09nroff`20-rT$(PAGELEN)`20-man`20ldb.man`20>ldb.doc X`09$(UNIXTOVMS)`20ldb.doc X Xldb.doc60:`20ldb.man X`09nroff`20-rT60`20-man`20ldb.man`20>ldb.doc60 X`09$(UNIXTOVMS)`20ldb.doc60 X Xldb.doc62:`20ldb.man X`09nroff`20-rT62`20-man`20ldb.man`20>ldb.doc62 X`09$(UNIXTOVMS)`20ldb.doc62 X Xldb.doc66:`20ldb.man X`09nroff`20-rT66`20-man`20ldb.man`20>ldb.doc66 X`09$(UNIXTOVMS)`20ldb.doc66 X Xlint:`20.XXX X`09lint`20$(LINTFLAGS)`20$(CFILES)`20>`20lint.out X Xclean:`20.XXX X`09rm`20-f`20$(OFILES)`20ldb`20*.obj`20ldb.exe`20make.out`20.mk`20lint.out`20M VANIFEST.BAK X Xshar:`20$(SHARFILES) X`09$(VMSTOUNIX)`20$(SHARFILES) X`09makekit`20-m X Xtar:`20$(SHARFILES) X`09tar`20cvf`20ldb.tar`20$(SHARFILES) X Xtags:`20.XXX X`09ctags`20$(CFILES) X`09sed`20's/Mmain/main/'`20.tags X`09mv`20.tags`20tags X X.XXX: $ call unpack MAKEFILE.UNIX;1 708428100 "" $! $ create 'f' X#`20Makefile`20for`20ldb`20under`20vms`095/1/92 X# X#`20Copyright`201992`20`20Earle`20F.`20Ake X# X#`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20softw Vare`20and`20its X#`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to`20th Ve`20restrictions X#`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20by V`20reference. X#`20Any`20other`20use`20requires`20written`20permission`20from`20the`20author. V`20`20This`20software X#`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including`20any V`20implied X#`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X#`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20resulting V`20from`20the X#`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the`20use Vr`20agrees X#`20to`20these`20terms. X X#`20This`20makefile`20is`20for`20the`20vms`20make`20program`20written`20by`20T Vodd`20Aven`20and X#`20used`20by`20DECUS`20UUCP.`20`20This`20file`20should`20be`20renamed`20to V`20makefile. X#`20before`20it`20is`20used.`20`20If`20you`20do`20not`20have`20make`20on`20you Vr`20system,`20you X#`20can`20compile`20ldb`20with`20@makeldb.com.`20`20If`20you`20use`20this`20fi Vle,`20you X#`20shouldn't`20need`20to`20modify`20any`20of`20the`20installation`20options V`20below. X X###`20INSTALLATION`20OPTIONS`20### X#`20If`20your`20host`20uses`20an`20ancient`20version`20of`20curses`20(e.g.`20V VAX-C,`20Sequent), X#`20uncomment`20the`20following`20line.`20`20To`20tell`20if`20you`20need`20thi Vs`20option, X#`20first`20try`20compiling`20without`20it`20and`20see`20if`20your`20linker V`20complains X#`20about`20cbreak()`20and`20nocbreak()`20not`20being`20defined.`20`20If`20it V`20does, X#`20you`20need`20this`20option. X#OLDCURSES= X#OLDCURSES=-DOLD_CURSES X X#`20If`20your`20libc`20doesn't`20have`20a`20rename`20function,`20uncomment`20t Vhe X#`20following`20to`20use`20the`20one`20that's`20included.`20`20DO`20NOT`20use V`20this X#`20rename`20if`20your`20system`20already`20has`20one. X#RENAME= X#RENAME=rename.o X X#`20Uncomment`20the`20following`20lines`20only`20if`20you`20are`20using`20Euni Vce. X#`20If`20you`20don't`20know`20what`20it`20is,`20believe`20me,`20you're`20not V`20using`20it. X#UNIXTOVMS=true X#VMSTOUNIX=true X#`20UNIXTOVMS=unixtovms X#`20VMSTOUNIX=vmstounix X X#`20Put`20the`20name`20of`20the`20front-end`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20front-end`20(cur Vses). XFE_FILE=fe_curses X X#`20Put`20the`20name`20of`20the`20transport`20you`20want`20to`20compile`20in V`20here. X#`20NOTE:`20there`20is`20currently`20only`20one`20available`20transport`20(ema Vil). XT_FILE=t_email X X#`20Put`20the`20name`20of`20the`20dice`20roller`20you`20want`20to`20compile V`20in`20here. X#`20If`20you`20want`20to`20write`20your`20own`20dice`20roller,`20you`20can. V`20`20I`20would X#`20prefer`20people`20all`20used`20the`20same`20one,`20since`20that`20is`20mor Ve`20fair, X#`20but`20as`20long`20as`20it`20is`20really`20a`20random`20number`20generator, V`20you're`20ok. X#`20If`20you`20put`20in`20a`20fake`20dice`20roller`20(e.g.`20one`20that`20asks V`20you`20what X#`20roll`20you`20want),`20you`20are`20in`20violation`20of`20the`20copyright. V`20`20Read X#`20the`20README`20file`20for`20more`20information. XR_FILE=r_xrand X X#`20Put`20compiler`20flags`20here. XCFLAGS=/nolist X#LIBS=-lcurses`20-ltermcap X X#`20use`20these`202`20lines`20for`20SCO`20XENIX`20(also`20SCO`20UNIX?) X#CFLAGS=`20-O`20-Mle`20-LARGE`20-Zi`20-DM_TERMCAP`20$(OLDCURSES) X#LIBS=-lx`20-ltcap`20-ltermlib X#LINTFLAGS= X X#`20Name`20of`20ldb`20executable. X#LDB=ldb XLDB=ldb.exe X X#`20Page`20length`20to`20format`20manual`20with.`20`2062`20for`20VMS`20or`20Eu Vnice,`2066`20for`20most`20others. X#PAGELEN=66 X X#CC=cc X X###`20END`20OF`20INSTALLATION`20OPTIONS`20### X X*.obj`20:`09*.c X`09write`20sys$output`20"Compiling`20$*" X`09cc`20$(CFLAGS)`20$* X`09purge/nolog`20$*.obj X`09rename`20$*.obj`20*.*;1 X Xldb`20:`09$(LDB) X`09write`20sys$output`20"ldb`20Build`20finished." X Xldb_objs`20=`20board.obj,game.obj,main.obj,misc.obj,move.obj,process.obj,`5C X`09rcvop.obj,control.obj,`5C X`09check.obj,readmail.obj,save.obj,vars.obj,$(FE_FILE).obj,`5C X`09$(T_FILE).obj,$(R_FILE).obj,`5C X`09dohelp.obj,dostats.obj,flist_vms.obj,lock.obj X X# X#`09Include`20all`20the`20sources`20necessary`20to`20build`20under`20VMS`20or V`20unix X# X XSHARFILES=readme.,todo.,ldb.doc,ldb.man,ldb.ps,makefile.*,ldb.opt,makeldb.com, V*.c,*.h,ldbstarter.csh,ldb.tex X X$(LDB)`20:`20$(ldb_objs) X`09write`20sys$output`20"Linking`20$(LDB)" X`20`09link/exe=$(LDB)/notrace/nodebug/nomap`20$(ldb_objs),`5C X`09sys$share:vaxccurse.olb/library,`5C X`09sys$disk:`5B`5Dldb.opt/options X X$(ldb_objs)`20:`20ldb.h`20patchlevel.h X Xvms_share`20:`20$(SHARFILES) X`09vms_share`20$(SHARFILES)`20ldb_src $ call unpack MAKEFILE.VMS;4 1031224315 "" $! $ create 'f' Xsys$share:vaxcrtl/share $ call unpack LDB.OPT;1 728066217 "" $! $ create 'f' X$`20set`20verify X$`20assign`20"sys$library"`20vaxc$include X$`20cc/nolist`20board X$`20cc/nolist`20check X$`20cc/nolist`20control X$`20cc/nolist`20dohelp X$`20cc/nolist`20dostats X$`20cc/nolist`20fe_curses X$`20cc/nolist`20flist_vms X$`20cc/nolist`20game X$`20cc/nolist`20lock X$`20cc/nolist`20main X$`20cc/nolist`20misc X$`20cc/nolist`20move X$`20cc/nolist`20process X$`20cc/nolist`20r_xrand X$`20cc/nolist`20rcvop X$`20cc/nolist`20readmail X$`20cc/nolist`20save X$`20cc/nolist`20t_email X$`20cc/nolist`20vars X$`20link/exe=ldb`20sys$input/opt Xboard,check,control,dohelp,dostats,fe_curses,flist_vms,game,lock,main Xmisc,move,process,r_xrand,rcvop,readmail,save,t_email,vars Xsys$share:vaxccurse.olb/library Xldb.opt/options X$`20set`20noverify X$`20exit $ call unpack MAKELDB.COM;1 1392851481 "" $! $ create 'f' X/*`20board.c`09`098/3/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular +-+-+-+-+-+-+-+- END OF PART 6 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+ V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09newboard`20--`20set`20up`20a`20board`20array`20for`20a`20new`20game X`20* X`20*`20This`20function`20initializes`20a`20board`20array`20so`20that`20it`20is V`20set`20up X`20*`20properly`20for`20a`20new`20game.`20`20It`20is`20passed`20two`20characte Vrs`20that`20are X`20*`20used`20to`20draw`20the`20pieces`20for`20the`20board.`20`20C1`20is`20the V`20color`20for`20the X`20*`20upbound`20player,`20and`20c2`20is`20the`20color`20for`20the`20downbound V`20player. X`20*---------------------------------------------------------------------- X`20*/ X Xnewboard(b,c1,c2) Xboard`20b; Xchar`20c1,`20c2; X`7B Xint`20i; X Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++)`20`7B X`09b`5Bi`5D.qty`20=`200;`09`09`09/*`20init`20to`20empty`20*/ X`09b`5Bi`5D.color`20=`20'-';`09`09/*`20init`20to`20invalid`20color`20*/ X`09`7D Xb`5B1`5D.qty`20=`202;`09`09`09`09/*`202`20c1's`20on`201`20point`20*/ Xb`5B1`5D.color`20=`20c1; Xb`5B6`5D.qty`20=`205;`09`09`09`09/*`205`20c2's`20on`206`20point`20*/ Xb`5B6`5D.color`20=`20c2; Xb`5B8`5D.qty`20=`203;`09`09`09`09/*`203`20c2's`20on`208`20point`20*/ Xb`5B8`5D.color`20=`20c2; Xb`5B12`5D.qty`20=`205;`09`09`09`09/*`205`20c1's`20on`2012`20point`20*/ Xb`5B12`5D.color`20=`20c1; Xb`5B13`5D.qty`20=`205;`09`09`09`09/*`205`20c2's`20on`2013`20point`20*/ Xb`5B13`5D.color`20=`20c2; Xb`5B17`5D.qty`20=`203;`09`09`09`09/*`203`20c1's`20on`2017`20point`20*/ Xb`5B17`5D.color`20=`20c1; Xb`5B19`5D.qty`20=`205;`09`09`09`09/*`205`20c1's`20on`2019`20point`20*/ Xb`5B19`5D.color`20=`20c1; Xb`5B24`5D.qty`20=`202;`09`09`09`09/*`202`20c2's`20on`2024`20point`20*/ Xb`5B24`5D.color`20=`20c2; X`7D X X X/*---------------------------------------------------------------------- X`20*`09copyboard`20--`20make`20a`20copy`20a`20board`20array X`20* X`20*`20This`20is`20a`20convenience`20function`20that`20copies`20an`20entire V`20board.`20The X`20*`20source`20is`20given`20as`20"f",`20and`20the`20destination`20as`20"t". X`20*---------------------------------------------------------------------- X`20*/ X Xcopyboard(f,t) Xboard`20f,`20t; X`7B Xint`20i; X Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++) X`09t`5Bi`5D`20=`20f`5Bi`5D; X`7D $ call unpack BOARD.C;1 560470732 "" $! $ create 'f' X/*`09check.c`09`0910/29/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*====================================================================== X`20*`20This`20file`20contains`20the`20functions`20that`20check`20for`20unused V`20moves. X`20*====================================================================== X`20*/ X X XPRIVATE`20int`20maxused,`20hiused,`20nlegal; X Xstruct`20legal`20*rmlegal(); X X/*---------------------------------------------------------------------- X`20*`09legalmoves`20--`20calculate`20all`20legal`20moves`20for`20a`20game X`20* X`20*`20This`20function`20is`20called`20after`20the`20dice`20have`20been`20roll Ved`20to`20search X`20*`20all`20possible`20combinations`20of`20moves`20to`20see`20which`20ones V`20are`20legal. X`20*`20While`20this`20function`20is`20working,`20it`20keeps`20a`20list`20of V`20legal`20moves, X`20*`20but`20this`20list`20is`20deleted`20before`20returning.`20`20For`20the V`20purposes X`20*`20of`20checking`20a`20move,`20it`20suffices`20to`20only`20keep`20the`20nu Vmber`20of`20usable X`20*`20dice`20and`20the`20highest`20numbered`20usable`20dice.`20`20Any`20move V`20that`20uses`20as X`20*`20many`20dice`20as`20can`20be`20used,`20and`20uses`20the`20highest`20usab Vle`20dice,`20is X`20*`20legal.`20`20These`20values`20are`20stored`20in`20the`20maxused`20and V`20hiused`20fields X`20*`20of`20the`20game`20structure. X`20* X`20*`20legalmoves`20performs`20an`20exhaustive`20search`20of`20all`20possible V`20move X`20*`20combinations,`20storing`20the`20combinations`20that`20are`20not`20rejec Vted X`20*`20by`20apply()`20in`20an`20instance`20of`20struct`20legal,`20which`20is V`20linked`20into X`20*`20the`20doubly-linked`20list`20headed`20by`20lhead.`20`20Note`20that,`20a Vt`20this`20point, X`20*`20this`20list`20may`20contain`20many`20combinations`20that`20are`20not V`20legal`20because X`20*`20they`20do`20not`20use`20all`20possible`20dice,`20or`20they`20use`20a V`20smaller`20dice`20when X`20*`20a`20larger`20one`20is`20usable.`20`20These`20illegal`20combinations`20a Vre`20trimmed`20from X`20*`20the`20list`20by`20trimunused()`20and`20trimlowused().`20`20Finally,`20d Vuplicate`20combinations X`20*`20are`20removed`20from`20the`20list`20by`20trimequal().`20`20Duplicate V`20moves`20are`20those`20that X`20*`20use`20the`20same`20rolls`20to`20move`20from`20the`20same`20points,`20bu Vt`20possibly`20in`20a X`20*`20different`20order,`20for`20example`20(3/8`201/6)`20and`20(1/6`203/8). V`20`20This`20allows X`20*`20detection`20of`20the`20case`20where`20there`20is`20only`20one`20legal V`20move,`20in`20which X`20*`20case`20this`20move`20is`20automatically`20applied`20(if`20rc.automove V`20is`20set). X`20*`20If`20the`20list`20is`20empty,`20there`20are`20no`20legal`20moves.`20 V`20Otherwise,`20the X`20*`20highest`20roll`20used`20in`20the`20list`20is`20stored`20in`20g->hiused, V`20and`20the`20largest X`20*`20number`20of`20rolls`20used`20in`20the`20list`20is`20stored`20in`20g->ma Vxused.`20`20This`20information X`20*`20is`20used`20by`20check(). X`20*---------------------------------------------------------------------- X`20*/ X Xlegalmoves(g) Xstruct`20game`20*g; X`7B Xstruct`20game`20tmp; Xint`20i; Xstruct`20legal`20*l; X Xtmp`20=`20*g;`09`09`09/*`20we`20don't`20want`20to`20change`20actual`20game`20* V/ Xfor`20(i`20=`200;`20i`20<`204;`20tmp.mvs`5Bi++`5D.pt`20=`20-1);`09/*`20mark V`20all`20unused`20*/ Xmaxused`20=`20-1;`09`09`09/*`20init`20to`20not`20all`20used`20*/ Xhiused`20=`200;`09`09`09/*`20init`20to`200`20*/ Xnlegal`20=`200;`09`09`09/*`20init`20to`20no`20legal`20moves*/ Xlhead`20=`20NULL; Xltail`20=`20NULL; Xif`20(tmp.mvs`5B0`5D.roll`20==`20tmp.mvs`5B1`5D.roll) X`09scanmvs(`26tmp,0,3);`09/*`20there`20is`20only`20one`20ordering`20*/ Xelse`20`7B X`09scanmvs(`26tmp,0,1);`09`09/*`20scan`20for`20one`20ordering`20*/ X`09i`20=`20tmp.mvs`5B0`5D.roll;`09/*`20reverse`20rolls`20*/ X`09tmp.mvs`5B0`5D.roll`20=`20tmp.mvs`5B1`5D.roll; X`09tmp.mvs`5B1`5D.roll`20=`20i; X`09for`20(i`20=`200;`20i`20<`204;`20tmp.mvs`5Bi++`5D.pt`20=`20-1);`09/*`20mark V`20all`20unused`20*/ X`09scanmvs(`26tmp,0,1);`09`09/*`20scan`20for`20other`20ordering`20*/ X`09`7D Xtrimunused();`09`09/*`20zap`20combinations`20that`20leave`20usable`20rolls`20u Vnused`20*/ Xtrimlowused();`09`09/*`20zap`20combinations`20that`20use`20the`20wrong`20die V`20*/ Xtrimequal();`09`09/*`20zap`20duplicates`20*/ Xg->maxused`20=`20maxused;`09/*`20store`20maxused`20and`20hiused`20into`20the V`20game`20structure`20*/ Xg->hiused`20=`20hiused; Xif`20(nlegal`20==`200)`20`7B`09/*`20check`20for`20no`20legal`20moves`20*/ X`09if`20(g->dispmsg`20!=`20NULL) X`09`09free(g->dispmsg); X`09g->dispmsg`20=`20save("You`20don't`20have`20any`20legal`20moves."); X`09`7D Xelse`20if`20(nlegal`20==`201)`20`7B`09/*`20check`20for`20only`20one`20legal V`20move`20*/ X`09if`20(g->dispmsg`20!=`20NULL) X`09`09free(g->dispmsg); X`09g->dispmsg`20=`20save("You`20only`20have`20one`20legal`20move."); X`09if`20(*rc.automove`20==`20'y')`20`7B`09/*`20you`20want`20the`20move`20appli Ved?`20*/ X`09`09if`20(`20(lhead->nmove==0)`20`26`26`20(lhead->mvs`5B0`5D.roll!=g->mvs V`5B0`5D.roll)) X`09`09`09g->mvs`5B1`5D`20=`20g->mvs`5B0`5D; X`09`09for`20(i`20=`200;`20i`20<=`20lhead->nmove;`20i++)`20`7B X`09`09`09g->mvs`5Bi`5D`20=`20lhead->mvs`5Bi`5D; X`09`09`09apply(g,WHO_ME,i,0,NULL); X`09`09`09`7D X`09`09`7D X`09`7D X X`09/*`20we`20have`20no`20use`20for`20the`20legal`20moves`20list,`20so`20free V`20it`20*/ X`09/*`20maybe`20in`20the`20future`20we`20will`20have`20a`20use`20for`20it`20*/ V X Xfor`20(l`20=`20lhead;`20l`20!=`20NULL;`20l`20=`20l->next) X`09free(l); Xlhead`20=`20NULL; Xltail`20=`20NULL; X`7D X X X/*---------------------------------------------------------------------- X`20*`09scanmvs`20--`20search`20for`20all`20possible`20combinations`20of`20a V`20move X`20* X`20*`20This`20function`20takes`20a`20single`20die`20and`20tries`20to`20use`20i Vt`20on`20every`20point X`20*`20of`20the`20board.`20`20For`20every`20point`20it`20is`20successful,`20it V`20adds`20the X`20*`20combination`20to`20the`20legal`20moves`20list`20and`20performs`20a`20re Vcursive`20descent X`20*`20searching`20for`20all`20legal`20combinations`20of`20the`20remaining`20d Vice. X`20*---------------------------------------------------------------------- X`20*/ Xscanmvs(g,mn,max) Xstruct`20game`20*g; Xint`20mn,`20max; X`7B Xint`20i; Xboard`20sv; X Xcopyboard(g->board,sv);`09`09/*`20save`20the`20board`20*/ Xfor`20(i`20=`200;`20i`20<=`2024;`20i++)`20`7B X`09if`20(i`20==`200) X`09`09g->mvs`5Bmn`5D.pt`20=`20BARPT(g->mydir);`09/*`20use`20correct`20barpt V`20*/ X`09else X`09`09g->mvs`5Bmn`5D.pt`20=`20i; X`09if`20(apply(g,WHO_ME,mn,0,NULL)`20<`200)`09/*`20can't`20move`20from`20this V`20pt`20*/ X`09`09continue; X`09addlegal(mn,g->mvs`5Bmn`5D.roll,g->mvs`5Bmn`5D.pt);`09/*`20add`20to`20list V`20*/ X`09if`20(mn`20<`20max) X`09`09scanmvs(g,mn+1,max);`09`09/*`20try`20all`20remaining`20comb's`20*/ X`09copyboard(sv,g->board);`09`09`09/*`20restore`20board`20*/ X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09addlegal`20--`20add`20a`20move`20combination`20to`20the`20list X`20* X`20*`20This`20function`20adds`20an`20instance`20of`20struct`20legal`20to`20the V`20legal`20moves`20list. X`20*`20The`20arguments`20to`20addlegal`20only`20specify`20the`20usage`20of`20o Vne`20particular X`20*`20die,`20by`20specifying`20its`20"move`20number".`20`20For`20example,`20f Vor`20a`20roll`20of X`20*`205`202,`20the`205`20is`20move`20number`200`20and`20the`202`20is`20move V`20number`201.`20`20The`20usage X`20*`20of`20all`20lower`20numbered`20rolls`20is`20copied`20from`20the`20previo Vus`20entry`20in`20the X`20*`20moves`20list`20(since`20that`20entry`20was`20added`20by`20the`20higher V`20level`20scanmvs X`20*`20before`20the`20current`20scanmvs`20was`20called),`20and`20all`20higher- Vnumbered`20rolls X`20*`20are`20marked`20unused. X`20*---------------------------------------------------------------------- X`20*/ X Xaddlegal(mn,r,pt) Xint`20mn,`20r,`20pt; X`7B Xint`20i; Xstruct`20legal`20*n; X Xif`20(`20(n`20=`20(struct`20legal`20*)`20calloc(sizeof(struct`20legal),1))`20= V=`20NULL) X`09fatal("Out`20of`20memory!"); Xclearmvs(n->mvs); Xif`20(ltail`20!=`20NULL) X`09for`20(i`20=`200;`20i`20<`20mn;`20i++)`09`09/*`20copy`20prefix`20from`20pre Vv`20move`20*/ X`09`09n->mvs`5Bi`5D`20=`20ltail->mvs`5Bi`5D; Xn->mvs`5Bmn`5D.roll`20=`20r;`09`09/*`20copy`20in`20this`20move`20*/ Xn->mvs`5Bmn`5D.pt`20=`20pt; Xn->next`20=`20NULL;`09`09`09/*`20this`20is`20end`20of`20list`20*/ Xif`20(lhead`20==`20NULL)`20`7B`09`09/*`20link`20into`20list`20*/ X`09n->prev`20=`20NULL; X`09lhead`20=`20n; X`09ltail`20=`20n; X`09`7D Xelse`20`7B X`09n->prev`20=`20ltail; X`09ltail->next`20=`20n; X`09ltail`20=`20n; X`09`7D Xn->himove`20=`200; Xfor`20(i`20=`200;`20i`20<=`20mn;`20i++)`09/*`20search`20for`20highest`20used V`20move`20*/ X`09if`20(n->mvs`5Bi`5D.roll`20>`20n->himove) X`09`09n->himove`20=`20n->mvs`5Bi`5D.roll; Xif`20(mn`20>`20maxused)`09`09/*`20keep`20track`20of`20whether`20it`20is`20poss Vible`20*/ X`09maxused`20=`20mn;`09/*`20to`20use`20all`20of`20the`20rolls`20*/ Xnlegal++; Xn->nmove`20=`20mn;`09`09/*`20store`20number`20of`20moves`20used`20by`20this V`20entry`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09trimunused`20--`20remove`20moves`20that`20do`20not`20use`20all`20possib Vle`20rolls X`20* X`20*`20This`20function`20scans`20the`20move`20list`20and`20deletes`20combinati Vons`20that X`20*`20leave`20usable`20rolls`20unused. X`20*---------------------------------------------------------------------- X`20*/ X Xtrimunused() X`7B Xstruct`20legal`20*l; X Xl`20=`20lhead; Xwhile`20(l`20!=`20NULL)`20`7B X`09if`20(l->nmove`20<`20maxused) X`09`09l`20=`20rmlegal(l); X`09else X`09`09l`20=`20l->next; X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09trimlowused`20--`20remove`20moves`20that`20do`20not`20use`20the`20large Vst`20possible`20roll X`20* X`20*`20This`20function`20scans`20the`20move`20list`20and`20deletes`20combinati Vons`20that X`20*`20do`20not`20use`20the`20highest`20usable`20roll. X`20*---------------------------------------------------------------------- X`20*/ X Xtrimlowused() X`7B Xstruct`20legal`20*l; X Xl`20=`20lhead; Xwhile`20(l`20!=`20NULL)`20`7B X`09if`20(l->himove`20<`20hiused) X`09`09l`20=`20rmlegal(l); X`09else X`09`09l`20=`20l->next; X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09trimequal`20--`20remove`20duplicate`20moves X`20* X`20*`20This`20function`20scans`20the`20move`20list`20and`20deletes`20combinati Vons`20that X`20*`20are`20duplicates. X`20*---------------------------------------------------------------------- X`20*/ X Xtrimequal() X`7B Xstruct`20legal`20*l,`20*p; Xstruct`20mv`20m1`5B4`5D,`20m2`5B4`5D; Xint`20i,`20n; X Xfor`20(l`20=`20lhead;`20l`20!=`20NULL;`20l`20=`20l->next)`20`7B X`09extractmvs(l,m1); X`09n`20=`20l->nmove; X`09p`20=`20l->next; X`09while`20(p`20!=`20NULL)`20`7B X`09`09if`20(p->nmove`20!=`20n)`20`7B X`09`09`09p`20=`20p->next; X`09`09`09continue; X`09`09`09`7D X`09`09extractmvs(p,m2); X`09`09for`20(i`20=`200;`20i`20<=`20n;`20i++) X`09`09`09if`20((m1`5Bi`5D.roll`20!=`20m2`5Bi`5D.roll)`7C`7C(m1`5Bi`5D.pt`20!= V`20m2`5Bi`5D.pt)) X`09`09`09`09break; X`09`09if`20(i`20<=`20n) X`09`09`09p`20=`20p->next; X`09`09else X`09`09`09p`20=`20rmlegal(p); X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09rmlegal`20--`20remove`20a`20struct`20legal`20from`20the`20move`20list X`20* X`20*`20This`20function`20unlinks`20an`20entry`20from`20the`20move`20list`20and V`20free's`20it. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20legal`20*rmlegal(l) Xstruct`20legal`20*l; X`7B Xstruct`20legal`20*t; X Xt`20=`20l; Xif`20(l`20==`20lhead)`20`7B X`09lhead`20=`20l->next; X`09l`20=`20lhead; X`09`7D Xelse`20`7B X`09if`20(`20(l->prev->next`20=`20l->next)`20!=`20NULL) X`09`09l->next->prev`20=`20l->prev; X`09l`20=`20l->next; X`09`7D Xfree(t); Xnlegal--; Xreturn(l); X`7D X X X/*---------------------------------------------------------------------- X`20*`09extractmvs`20--`20extract`20a`20struct`20legal`20into`20a`20struct`20mv V X`20* X`20*`20This`20function`20copies`20the`20information`20from`20a`20move`20list V`20entry`20into X`20*`20an`20instance`20of`20struct`20mv,`20and`20then`20sorts`20the`20rolls V`20in`20the`20struct`20mv X`20*`20by`20increasing`20dice`20value`20(and`20by`20increasing`20point`20numbe Vr`20for`20equal X`20*`20rolls).`20`20Sorting`20the`20rolls`20makes`20it`20easier`20for`20trimeq Vual`20to`20check X`20*`20for`20duplicate`20entries,`20it`20has`20no`20value`20as`20far`20as`20th Ve`20game`20is`20concerned. X`20*---------------------------------------------------------------------- X`20*/ X Xextractmvs(l,m) Xstruct`20legal`20*l; Xstruct`20mv`20*m; X`7B Xint`20i,`20n,`20s; Xstruct`20mv`20tmp; X Xclearmvs(m); Xfor`20(i`20=`200;`20i`20<=`20l->nmove;`20i++)`09`09/*`20extract`20the`20moves V`20*/ X`09m`5Bi`5D`20=`20l->mvs`5Bi`5D; Xn`20=`20l->nmove; Xdo`20`7B`09`09`09/*`20sort`20by`20increasing`20roll`20then`20increasing`20poin Vt`20*/ X`09s`20=`200; X`09for`20(i`20=`200;`20i`20<`20n;`20i++)`20`7B`09`09/*`20long`20live`20bubbles Vort`20*/ X`09`09if`20(m`5Bi`5D.roll`20<`20m`5Bi+1`5D.roll) X`09`09`09continue; X`09`09else`20if`20(`20(m`5Bi`5D.roll`20==`20m`5Bi+1`5D.roll)`20`26`26`20(m`5Bi V`5D.pt`20<`20m`5Bi+1`5D.pt)`20) X`09`09`09continue; X`09`09tmp`20=`20m`5Bi`5D; X`09`09m`5Bi`5D`20=`20m`5Bi+1`5D; X`09`09m`5Bi+1`5D`20=`20tmp; X`09`09s`20=`201; X`09`09`7D X`09n--; X`09`7D`20while`20(s); X`7D X X X/*---------------------------------------------------------------------- X`20*`09checkused`20--`20check`20that`20a`20move`20uses`20the`20correct`20rolls V X`20* X`20*`20This`20function`20is`20called`20just`20before`20a`20move`20is`20sent V`20to`20the X`20*`20opponent.`20`20It`20uses`20the`20values`20stored`20in`20g->maxused`20an Vd`20g->hiused X`20*`20to`20make`20sure`20that`20the`20move`20uses`20all`20usable`20rolls,`20a Vnd`20that`20it X`20*`20uses`20the`20highest`20usable`20roll.`20`20As`20a`20special`20case,`20i Vt`20considers X`20*`20to`20be`20legal`20any`20move`20where`20all`20pieces`20are`20borne`20off V.`20`20This X`20*`20takes`20care`20of`20the`20special`20case`20where`20there`20is`20one`20p Viece X`20*`20left`20to`20bear`20off,`20and`20two`20rolls,`20one`20of`20which`20is V`20too`20small X`20*`20to`20bear`20off.`20`20Normally,`20ldb`20would`20insist`20that`20the`20s Vmaller X`20*`20roll`20be`20used,`20then`20the`20larger`20one,`20so`20that`20both`20rol Vls X`20*`20would`20be`20used.`20`20If`20one`20roll`20is`20large`20enough`20to`20be Var`20the`20last X`20*`20man`20off,`20though,`20there`20is`20no`20need`20to`20force`20the`20othe Vr`20roll`20to`20be`20used. X`20*---------------------------------------------------------------------- X`20*/ X Xcheckused(g) Xstruct`20game`20*g; X`7B Xint`20h,`20i; X Xif`20(g->board`5BOFFPT(g->mydir)`5D.qty`20==`2015)`09/*`20special`20case,`20if V`20all`20pcs`20*/ X`09return(0);`09`09/*`20are`20off,`20then`20all`20rolls`20have`20been`20used V`20*/ Xh`20=`200; Xfor`20(i`20=`200;`20i`20<=`20g->maxused;`20i++)`20`7B X`09if`20(g->mvs`5Bi`5D.pt`20<`200)`20`7B X`09`09FeMessage("You`20left`20a`20roll`20unused."); X`09`09return(1); X`09`09`7D X`09if`20(h`20<`20g->mvs`5Bi`5D.roll) X`09`09h`20=`20g->mvs`5Bi`5D.roll; X`09`7D Xif`20(g->hiused`20>`20h)`20`7B X`09FeMessage("You`20can`20use`20the`20higher`20roll."); X`09return(1); X`09`7D Xreturn(0); X`7D $ call unpack CHECK.C;1 421838177 "" $! $ create 'f' X/*`09control.c`09`099/12/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09control`20--`20control`20a`20game X`20* X`20*`20This`20function`20is`20called`20to`20process`20the`20-control`20command V`20line`20option. X`20*`20It`20currently`20allows`20the`20following: X`20*`20`20`20`20-`09The`20board`20may`20be`20inverted.`20`20The`20points`20are V`20still`20numbered`20the X`20*`09same,`20the`20board`20is`20merely`20drawn`20upside`20down.`20`20This V`20can`20help`20users X`20*`09who`20are`20playing`20a`20number`20of`20games`20simultaneously`20by`20a Vllowing`20him X`20*`09to`20make`20all`20of`20his`20games`20move`20in`20the`20same`20direction V`20on`20the`20screen. X`20*`20`20`20`20-`20The`20last`20packet`20sent`20may`20be`20resent.`20`20This V`20is`20useful`20when`20moves X`20*`09are`20lost`20in`20the`20mail,`20or`20if`20players`20forget`20whose`20tu Vrn`20it`20is. X`20*`09Ldb`20rejects`20packets`20that`20have`20already`20been`20received,`20so V`20both X`20*`09players`20may`20simply`20resend`20their`20last`20packet,`20and`20ldb V`20will`20display X`20*`09the`20board`20to`20the`20player`20who`20is`20supposed`20to`20move. X`20*---------------------------------------------------------------------- X`20*/ X Xcontrol() X`7B Xregister`20struct`20game`20*g; Xstatic`20char`20*m`5B`5D`20=`20`7B"Invert","Resend","Get`20Resend","Screen`20D Vump","Delete`20Game", X`09`09`09"Next`20Game","Quit",NULL`7D; Xchar`20buf`5B60`5D,`20c,`20done; Xint`20mod; Xchar`20pm`20=`20'`5C0'; Xstatic`20char`20oldmsg`5B`5D`20=`20"Your`20opponent's`20ldb`20does`20not`20sup Vport`20resend`20requests."; Xstatic`20char`20gmover`5B`5D`20=`20"This`20game`20is`20over`20--`20you`20canno Vt`20request`20a`20resend."; X Xif`20(ghead`20==`20NULL)`20`7B X`09printf("You`20don't`20have`20any`20games`20in`20progress.`5Cn"); X`09printf("Use`20the`20-start`20option`20to`20start`20one.`5Cn"); X`09usage(0); X`09ldbexit(STAT_ABORT); X`09`7D Xmod`20=`200;`09`09`09`09/*`20init`20to`20no`20mods`20*/ Xrc.chkpt`20=`20"no";`09`09`09/*`20disable`20checkpoint`20in`20sendpkt`20*/ XFeInitialize();`09`09`09`09/*`20initialize`20front`20end`20*/ XFeDrawScreen();`09`09`09`09/*`20draw`20board`20outline`20*/ Xdone`20=`200; Xfor`20(g`20=`20ghead;`20(done`20<`202)`20`26`26`20(g`20!=`20NULL);`20g`20=`20g V->next)`20`7B/*`20for`20all`20games`20*/ X`09g->curbd`20=`20BD_CUR;`09`09/*`20make`20sure`20we`20draw`20the`20current V`20bd`20*/ X`09FeDrawGame(g); X`09FeDrawMenu(m); X`09sprintf(buf,"Current`20state:`20%s",states`5Bg->state`5D); X`09FeMessage(buf); X`09done`20=`200; X`09GameState`20=`20STATE_CONTROL; X`09while`20(!`20done)`20`7B X`09`09c`20=`20FeMenu(m,0,0,"`20`5Cn`5Cr",pm); X`09`09pm`20=`20c; X`09`09switch`20(c)`20`7B X`09`09case`20'I':`09`09`09/*`20invert`20board`20*/ X`09`09`09g->flags`20`5E=`20F_INVERT;`09/*`20toggle`20invert`20bit`20*/ X`09`09`09FeDrawGame(g);`09`09/*`20redraw`20the`20screen`20*/ X`09`09`09mod++;`09`09`09/*`20games`20have`20been`20modified`20*/ X`09`09`09break; X`09`09case`20'R':`09`09`09/*`20resend`20last`20packet`20*/ X`09`09`09if`20((g->state>=OPSTATES)`26`26(g->state!=ST_GAMEOVER))`20`7B X`09`09`09`09FeMessage("Can't`20resend`20--`20it`20is`20your`20move."); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09resendpkt(g); X`09`09`09FeMessage("Last`20packet`20re-sent."); X`09`09`09break; X`09`09case`20'G': X`09`09`09if`20(g->state`20==`20ST_GAMEOVER)`20`7B X`09`09`09`09FeMessage(gmover); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09if`20(g->opver`20<`20110)`20`7B X`09`09`09`09FeMessage(oldmsg); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09sendpkt(g,RESEND); X`09`09`09FeMessage("Resend`20requested."); X`09`09`09break; X`09`09case`20'S':`09`09`09/*`20dump`20screen`20*/ X`09`09`09FeMessage(buf);`09`09/*`20restore`20state`20msg`20*/ X`09`09`09FeDumpScreen("ldb_screen.dmp");`09/*`20do`20the`20dump`20*/ X`09`09`09FeMessage("Screen`20dumped`20to`20ldb_screen.dmp"); X`09`09`09break; X`09`09case`20'D':`09`09`09/*`20delete`20game`20*/ X`09`09`09mod++;`09`09`09/*`20games`20have`20been`20modified`20*/ X`09`09`09if`20(g->flags`20`26`20F_DELETE)`20`7B`09/*`20undelete`20*/ X`09`09`09`09g->flags`20`26=`20`7EF_DELETE; X`09`09`09`09FeMessage("Game`20undeleted."); X`09`09`09`09`7D X`09`09`09else`20`7B X`09`09`09`09g->flags`20`7C=`20F_DELETE;`09/*`20delete`20*/ X`09`09`09`09FeMessage( X`09`09`09`09`20"Game`20deleted`20--`20press`20D`20again`20to`20undelete."); X`09`09`09`09`7D X`09`09`09break; X`09`09case`20'Q':`09`09`09/*`20exit`20ldb`20*/ X`09`09`09done`20=`202;`09`09/*`202`20means`20Really`20done`20*/ X`09`09`09break; X`09`09case`20'`20': X`09`09case`20'`5Cn': X`09`09case`20'`5Cr': X`09`09`09FeOnMenuItem(m,'N');`09/*`20highlight`20Next`20Game`20item`20*/ X`09`09`09pm`20=`20'N';`09`09/*`20remember`20to`20unhighlight`20*/ X`09`09`09/*`20Fall`20through`20*/ X`09`09case`20'N': X`09`09`09done`20=`201;`09/*`201`20means`20just`20done`20with`20this`20game`20* V/ X`09`09`09break;`09`09/*`20go`20to`20next`20game`20*/ X`09`09`09`7D X`09`09`7D X`09`7D XFeFinishSession(); Xwhile`20(mod)`20`7B X`09printf("Save`20changes?`20`5Byn`5D:`20"); X`09fflush(stdout); X`09if`20(`20(`20(c`20=`20getchar())`20==`20'y')`20`7C`7C`20(c`20==`20'Y')`20) V`20`7B X`09`09writegames(rc.gfile,rc.gbackup,rc.pfile); X`09`09break; X`09`09`7D X`09if`20(`20(c`20==`20'n')`20`7C`7C`20(c`20==`20'N')`20)`20`7B X`09`09printf("Changes`20discarded.`5Cn"); X`09`09break; X`09`09`7D X`09if`20(`20(c`20!=`20'`5Cn')`20`26`26`20(c`20!=`20EOF)`20) X`09`09while`20(`20(`20(c`20=`20getchar())`20!=`20'`5Cn')`20`26`26`20(c`20!= V`20EOF)`20); X`09printf("Please`20respond`20with`20y`20or`20n.`5Cn"); X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09recons`20--`20reconstruct`20games`20from`20opponent's`20.ldbdata X`20* X`20*`20This`20function`20allows`20a`20game`20to`20be`20reconstructed`20when V`20the`20.ldbdata X`20*`20file`20has`20been`20irretrievably`20lost.`20`20The`20opponent`20merely V`20mails X`20*`20his`20.ldbdata`20file,`20and`20we`20scan`20it`20for`20all`20the`20impor Vtant`20information. X`20*`20Games`20that`20are`20in`20the`20OPSTART`20or`20GAMEOVER`20states`20cann Vot`20be`20reconstructed X`20*`20due`20to`20the`20lack`20of`20adequate`20information,`20but`20these`20ga Vmes`20either`20have X`20*`20not`20started`20or`20are`20already`20over.`20`20If`20the`20game`20is V`20in`20state`20OPSTART X`20*`20because`20the`20next`20game`20of`20a`20match`20is`20being`20started, V`20the`20match`20can X`20*`20be`20rescued`20by`20starting`20a`20new`20match`20that`20plays`20up`20to V`20the`20number`20of X`20*`20points`20remaining`20in`20the`20old`20match. X`20* X`20*`20Before`20sending`20the`20.ldbdata`20file,`20your`20opponent`20should V`20incorporate X`20*`20any`20moves`20you`20sent`20before`20you`20lost`20your`20file.`20`20If V`20your`20move`20is`20lost X`20*`20as`20well,`20it`20may`20be`20necessary`20for`20you`20to`20replay`20your V`20last`20move,`20with X`20*`20a`20new`20roll.`20`20This`20should`20not`20be`20considered`20cheating, V`20as`20it`20is`20unavoidable. X`20*`20Alternatively,`20if`20you`20remember`20your`20last`20roll,`20you`20coul Vd`20plug`20the`20rolls X`20*`20into`20your`20.ldbdata`20after`20the`20reconstruct. X`20* X`20*`20You`20will`20have`20to`20edit`20the`20mail`20header`20off`20the`20file V`20before`20feeding`20it X`20*`20to`20-reconstruct.`20`20The`20first`20line`20of`20the`20file`20MUST`20b Ve`20the`20first`20line X`20*`20of`20the`20data`20file. X`20* X`20*`20Because`20data`20fields`20are`20frequently`20added`20to`20data`20files V`20between X`20*`20revisions,`20-reconstruct`20is`20only`20guaranteed`20to`20work`20when V`20you X`20*`20are`20using`20the`20same`20ldb`20revision`20as`20your`20opponent. X`20* X`20*`20If`20you`20started`20the`20game`20being`20reconstructed,`20and`20you V`20used`20the X`20*`20-myaddr`20argument`20when`20you`20started`20it,`20you`20will`20need`20t Vo`20use X`20*`20the`20-myaddr`20argument`20when`20you`20reconstruct`20it. X`20*---------------------------------------------------------------------- X`20*/ X Xrecons(file) Xchar`20*file; X`7B XFILE`20*fp; Xchar`20c; Xint`20i,`20j; Xstruct`20mv`20m; Xstruct`20game`20*g; Xstruct`20people`20*p; Xchar`20*s; Xchar`20buf`5B80`5D; X Xif`20(`20(fp`20=`20fopen(file,"r"))`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20cannot`20open`20%s`20for`20reconstruct`5Cn",file); V X`09ldbexit(STAT_ABORT); X`09`7D Xg`20=`20addgame();`09`09`09/*`20get`20a`20game`20structure`20*/ Xwhile`20(`20(c`20=`20getc(fp))`20!=`20EOF)`20`7B X`09ungetc(c,fp);`09`09`09/*`20put`20char`20back`20*/ X`09nvscan(fp,nv_gfile,g); X`09if`20(strcmp(g->opaddr,rc.myaddr))`09/*`20this`20game`20wasn't`20with`20me V`20*/ X`09`09continue; X`09if`20(`20(g->state`20==`20ST_OPSTART)`20`7C`7C`20(g->state`20==`20ST_GAMEOV VER)`20) X`09`09continue;`09`09/*`20can't`20handle`20these`20*/ X`09printf("`5Cn---`20Reconstruct`20found`20game`20%s`20---`5Cn",g->gameid); X`09s`20=`20g->gameid;`09`09`09/*`20copy`20out`20gameid`20*/ X`09g->gameid`20=`20"";`09`09`09/*`20temporarily`20delete`20gameid`20field`20*/ V X`09if`20(findgame(s)`20!=`20NULL)`20`7B X`09`09printf("ERROR:`20This`20game`20already`20exists`20--`20ignoring.`5Cn"); X`09`09continue; X`09`09`7D X`09g->gameid`20=`20s;`09`09`09/*`20restore`20gameid`20field`20*/ X`09printf("Enter`20opponent`20address`20or`20alias:`20"); X`09if`20(fgets(buf,sizeof(buf),stdin)`20==`20NULL)`20`7B X`09`09printf("`5Cn---`20Reconstruct`20deleting`20game`20%s`20---`5Cn",g->gamei Vd); X`09`09continue; X`09`09`7D X`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09`09/*`20clobber`20newline`20*/ X`09if`20(`20(p`20=`20findppl(buf,P_ADDR`7CP_ALIAS))`20==`20NULL)`20`7B/*`20not V`20in`20ppl`20file`20*/ X`09`09g->opaddr`20=`20save(buf);`09`09/*`20save`20address`20in`20game`20*/ X`09`09printf("Enter`20opponent`20name:`20"); X`09`09if`20(fgets(buf,sizeof(buf),stdin)`20==`20NULL)`20`7B X`09`09`09printf("`5Cn---`20Reconstruct`20deleting`20game`20%s`20---`5Cn", X`09`09`09`09g->gameid); X`09`09`09continue; X`09`09`09`7D X`09`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09/*`20clobber`20newline`20*/ X`09`09g->opname`20=`20save(buf);`09`09/*`20save`20opponent's`20name`20*/ X`09`09newppl(g);`09`09/*`20generate`20a`20new`20people`20rec`20*/ X`09`09`7D X`09else`20`7B`09`09`09`09/*`20it`20was`20an`20alias`20*/ X`09`09g->opname`20=`20save(p->name);`09/*`20copy`20name`20from`20people`20rec V`20*/ X`09`09g->opaddr`20=`20save(p->addr);`09/*`20address`20too`20*/ X`09`09g->ppl`20=`20p;`09`09`09/*`20store`20people`20pointer`20*/ X`09`09`7D X`09g->dispmsg`20=`20NULL; X`09g->myaddr`20=`20save(rc.myaddr); X`09for`20(i`20=`200;`20i`20<`204;`20i++)`20`7B X`09`09g->blot`5Bi`5D`20=`200;`09`09/*`20clear`20blot`20array`20*/ X`09`09m`20=`20g->mvs`5Bi`5D;`09`09/*`20switch`20mvs`20and`20opmvs`20fields`20* V/ X`09`09g->mvs`5Bi`5D`20=`20g->opmvs`5Bi`5D; X`09`09g->opmvs`5Bi`5D`20=`20m; X`09`09`7D X`09for`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09`09j`20=`20g->rolls`5Bi`5D;`09/*`20switch`20rolls`20and`20oprolls`20*/ X`09`09g->rolls`5Bi`5D`20=`20g->oprolls`5Bi`5D; X`09`09g->oprolls`5Bi`5D`20=`20j; X`09`09j`20=`20g->doubles`5Bi`5D;`09/*`20switch`20doubles`20and`20opdoubles`20* V/ X`09`09g->doubles`5Bi`5D`20=`20g->opdoubles`5Bi`5D; X`09`09g->opdoubles`5Bi`5D`20=`20j; X`09`09`7D X`09i`20=`20g->mydir;`09`09`09/*`20switch`20mydir`20and`20opdir`20*/ X`09g->mydir`20=`20g->opdir; X`09g->opdir`20=`20i; X`09i`20=`20g->mycolor;`09`09`09/*`20switch`20mycolor`20and`20opcolor`20*/ X`09g->mycolor`20=`20g->opcolor; X`09g->opcolor`20=`20i; X`09s`20=`20g->mycmt; X`09g->mycmt`20=`20g->opcmt; X`09g->opcmt`20=`20s; X`09s`20=`20g->mycmt2; X`09g->mycmt2`20=`20g->opcmt2; X`09g->opcmt2`20=`20s; X`09i`20=`20g->mcurrent`5BWHO_ME`5D;`09`09/*`20switch`20match`20scores`20*/ X`09g->mcurrent`5BWHO_ME`5D`20=`20g->mcurrent`5BWHO_OPP`5D; X`09g->mcurrent`5BWHO_OPP`5D`20=`20i; X`09copyboard(g->mybd,g->opbd);`09/*`20my`20before`20bd`20==`20op's`20after`20b Vd`20*/ X`09if`20(g->state`20<`20OPSTATES)`20`7B`09/*`20I'm`20sending`20next`20*/ X`09`09g->seq++;`09/*`20set`20seq#`20to`20what`20opp`20expects`20in`20next`20pk Vt`20*/ X`09`09copyboard(g->board,g->mybd);`09/*`20my`20after`20bd`20==`20cur`20board V`20*/ X`09`09`7D X`09else`20`7B`09`09`09`09/*`20he's`20sending`20next`20*/ X`09`09g->seq--;`09/*`20set`20seq#`20to`20what`20we're`20expecting`20*/ X`09`09copyboard(g->mybd,g->board);`09/*`20erase`20his`20moves`20*/ X`09`09`7D X`09g->lastop`20=`20START;`09`09/*`20has`20to`20be`20set`20to`20something`20*/ X`09switch`20(g->state)`20`7B`09`09/*`20invert`20state`20*/ X`09case`20ST_OPTURN: X`09`09g->state`20=`20ST_MYTURN;`09/*`20it's`20my`20turn`20*/ X`09`09break; X`09case`20ST_OPACCEPT: X`09`09g->state`20=`20ST_MYACCEPT;`09/*`20waiting`20for`20me`20to`20accept`20do Vuble`20*/ X`09`09break; X`09case`20ST_MYTURN: X`09case`20ST_MYMOVE: X`09`09g->state`20=`20ST_OPTURN;`09/*`20waiting`20for`20op`20to`20move`20*/ X`09`09break; X`09case`20ST_MYACCEPT: X`09`09g->state`20=`20ST_OPACCEPT;`09/*`20waiting`20for`20op`20to`20accept`20do Vuble`20*/ X`09`09break; X`09`09`7D X`09printf("---`20Reconstructed`20game`20%s`20---`5Cn",g->gameid); X`09g`20=`20addgame();`09`09/*`20get`20new`20buffer`20to`20read`20into`20*/ X`09`7D Xdeletegame(g);`09`09`09/*`20get`20rid`20of`20buffer`20*/ Xwritegames(rc.gfile,rc.gbackup,rc.pfile);`09/*`20save`20new`20games`20*/ X`7D $ call unpack CONTROL.C;1 155352402 "" $! $ create 'f' X/*`20dohelp.c`09`093/27/92 X`20* X`20*`20Copyright`201992`20`20Earle`20F.`20Ake X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20* X`20*`20Original`20coding`20by`20Earle`20F.`20Ake`20`20- V`2027`20March`201992. X`20* X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09dohelp`20--`20display`20online`20help`20for`20the`20user X`20* X`20*`20This`20function`20creates`20a`20new`20curses`20window`20and`20displays V`20command`20help X`20*`20to`20the`20user.`20`20The`20user`20then`20presses`20any`20key`20to`20re Vturn`20to`20the`20game. X`20*---------------------------------------------------------------------- X`20*/ X Xdohelp() X`7B XWINDOW`20*helpwin; Xint`20row; X Xhelpwin`20=`20newwin(0,0,0,0);`09/*`20get`20a`20new`20window`20to`20post`20hel Vp`20to`20*/ X Xmvwaddstr(helpwin,0,30,"ldb`20Command`20Summary");`09`09/*`20print`20title`20* V/ Xmvwaddstr(helpwin,1,30,"-------------------");`09`09/*`20underline`20title`20* V/ Xrow`20=`203; X Xif(GameState`20==`20STATE_MYACPT)`20`7B X`09mvwaddstr(helpwin,row,0,"Accept`20-"); X`09mvwaddstr(helpwin,row++,15,"Accept`20the`20double`20and`20the`20game`20cont Vinues."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Decline`20-"); X`09mvwaddstr(helpwin,row++,15,"You`20decline`20the`20double`20and`20lose`20the V`20game`20for`20the`20current"); X`09mvwaddstr(helpwin,row++,15,"game`20value."); X`09row++; X`09`7D X Xif(GameState`20==`20STATE_CONTROL)`20`7B X`09mvwaddstr(helpwin,row,0,"Invert`20-"); X`09mvwaddstr(helpwin,row++,15,"Invert`20the`20board`20for`20this`20game.`20 V`20Pressing`20Invert`20again`20will"); X`09mvwaddstr(helpwin,row++,15,"put`20it`20back`20to`20normal.`20`20Inverting V`20the`20board`20does`20not`20affect"); X`09mvwaddstr(helpwin,row++,15,"point`20numbering."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Resend`20-"); X`09mvwaddstr(helpwin,row++,15,"Resend`20your`20last`20move`20command`20to`20yo Vur`20opponent."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Get`20Resend`20-"); X`09mvwaddstr(helpwin,row++,15,"Request`20a`20resend`20from`20your`20opponent." V); X`09row++; X`09mvwaddstr(helpwin,row,0,"Screen`20Dump`20-"); X`09mvwaddstr(helpwin,row++,15,"Dump`20the`20screen`20to`20ldb_screen.dmp"); X`09row++; X`09mvwaddstr(helpwin,row,0,"Delete`20Game`20-"); X`09mvwaddstr(helpwin,row++,15,"This`20marks`20a`20game`20for`20deletion.`20 V`20The`20game`20is`20not`20deleted"); X`09mvwaddstr(helpwin,row++,15,"until`20you`20quit`20and`20you`20can`20undelete V`20it`20by`20pressing`20D`20again."); X`09row++; X`09`7D X Xif(GameState`20==`20STATE_MYTURN)`20`7B X`09mvwaddstr(helpwin,row,0,"Roll`20-"); X`09mvwaddstr(helpwin,row++,15,"Roll`20the`20dice.`20`20Your`20roll`20will`20ap Vpear`20in`20your`20move`20block."); X`09mvwaddstr(helpwin,row++,15,"You`20will`20see`20two`20numbers`20appear`20or V`20four`20if`20you`20have"); X`09mvwaddstr(helpwin,row++,15,"rolled`20doubles."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Double`20-"); X`09mvwaddstr(helpwin,row++,15,"Choose`20to`20double`20the`20current`20game`20v Value.`20`20A`20message`20will"); X`09mvwaddstr(helpwin,row++,15,"be`20sent`20to`20your`20opponent`20and`20ldb V`20then`20will`20automatically"); X`09mvwaddstr(helpwin,row++,15,"select`20roll."); X`09row++; X`09`7D X Xif(GameState`20==`20STATE_MYMOVE)`20`7B X`09mvwaddstr(helpwin,row,0,"Point`20-"); X`09mvwaddstr(helpwin,row++,15,"Attempt`20to`20make`20the`20point`20your`20last V`20move`20ended`20on."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Off`20-"); X`09mvwaddstr(helpwin,row++,15,"Bear`20off`20a`20piece`20by`20using`20the`20nex Vt`20UNUSED`20roll."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Reset`20-"); X`09mvwaddstr(helpwin,row++,15,"Reset`20your`20rolls`20to`20UNUSED`20and`20put V`20the`20board`20back`20how`20it`20was"); X`09mvwaddstr(helpwin,row++,15,"before`20you`20moved.`20`20You`20can`20then`20e Vnter`20some`20different`20moves."); X`09row++; X`09mvwaddstr(helpwin,row,0,"Send`20-"); X`09mvwaddstr(helpwin,row++,15,"Send`20your`20move`20to`20your`20opponent.`20 V`20You`20will`20be`20able`20to"); X`09mvwaddstr(helpwin,row++,15,"enter`202`20lines`20of`2056`20characters`20to V`20send`20with`20your`20move."); X`09row++; X`09`7D X Xif(GameState`20!=`20STATE_CONTROL)`20`7B X`09mvwaddstr(helpwin,row,0,"Board`20-"); X`09mvwaddstr(helpwin,row++,15,"Cycle`20between`20the`20current`20board,`20the V`20board`20before`20your"); X`09mvwaddstr(helpwin,row++,15,"opponent's`20last`20move,`20and`20the`20board V`20after`20your`20opponent's"); X`09mvwaddstr(helpwin,row++,15,"last`20move."); X`09row++; X`09`7D X Xif((GameState`20==`20STATE_MYTURN)`20`7C`7C`20(GameState`20==`20STATE_MYMOVE)) V`20`7B X`09mvwaddstr(helpwin,row,0,"Concede`20-"); X`09mvwaddstr(helpwin,row++,15,"Concede`20the`20current`20game."); X`09row++; X`09`7D X Xmvwaddstr(helpwin,row,0,"Next`20Game`20-"); Xmvwaddstr(helpwin,row++,15,"The`20next`20game`20is`20displayed.`20`20If`20ther Ve`20is`20no`20next`20game,`20quit."); Xrow++; Xmvwaddstr(helpwin,row,0,"Quit`20-"); Xmvwaddstr(helpwin,row++,15,"Quit`20the`20current`20ldb`20session."); X Xmvwaddstr(helpwin,23,25,"Press`20`20to`20continue:`20"); X Xtouchwin(helpwin);`09`09/*`20Make`20sure`20the`20screen`20is`20updated`20*/ Xwrefresh(helpwin);`09`09/*`20update`20the`20help`20window`20clearing`20screen V`20*/ Xwgetch(helpwin);`09`09/*`20Wait`20for`20user`20response`20*/ Xwclear(helpwin);`09`09/*`20clear`20the`20help`20window`20*/ Xwrefresh(helpwin);`09`09/*`20update`20the`20help`20window`20clearing`20screen V`20*/ Xdelwin(helpwin);`09`09/*`20delete`20the`20help`20window`20*/ X`7D $ call unpack DOHELP.C;1 1229486700 "" $! $ create 'f' X/*`20dostats.c`09`094/20/92 X`20* X`20*`20Copyright`201992`20`20Earle`20F.`20Ake X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20* X`20*`20Original`20coding`20by`20Earle`20F.`20Ake`20`20- V`2020`20April`201992. X`20* X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09dostats`20--`20display`20online`20statistics`20of`20dice`20rolls X`20* X`20*`20This`20function`20creates`20a`20new`20curses`20window`20and`20displays V`20dice`20statistics X`20*`20to`20the`20user.`20`20The`20user`20then`20presses`20any`20key`20to`20re Vturn`20to`20the`20game. X`20*---------------------------------------------------------------------- X`20*/ X Xdostats(g) Xstruct`20game`20*g; X`7B XWINDOW`20*statwin; Xint`20row,`20i,`20col,`20rolls,`20dice; Xint`20mypip,`20oppip; Xchar`20temp`5B80`5D; Xchar`20c; Xint`20Total`20=`200,`20OpTotal`20=`200; X Xstatwin`20=`20newwin(0,0,0,0);`09/*`20get`20a`20new`20window`20to`20post`20hel Vp`20to`20*/ X Xmvwaddstr(statwin,0,30,"ldb`20Dice`20Statistics");`09`09/*`20print`20title`20* V/ Xmvwaddstr(statwin,1,30,"-------------------");`09`09/*`20underline`20title`20* V/ Xrow`20=`203; X Xmvwaddstr(statwin,row++,0,"You:"); Xmvwaddstr(statwin,row++,0,"----"); X Xrow++; Xmvwaddstr(statwin,row++,0,"Singles`20`20`201`20`202`20`203`20`204`20`205`20 V`206`20`20Doubles`20`20`201`20`202`20`203`20`204`20`205`20`206"); Xtemp`5B0`5D`20=`20'`5C0'; Xfor`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09sprintf(temp,`20"%s%3d",`20temp,`20g->rolls`5Bi`5D); X`09Total`20+=`20(g->rolls`5Bi`5D`20*`20(i+1)); X`09`7D Xsprintf(temp,`20"%s`20`20`20`20`20`20`20`20`20`20",temp); Xfor`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09sprintf(temp,`20"%s%3d",`20temp,`20g->doubles`5Bi`5D); X`09Total`20+=`20(g->doubles`5Bi`5D`20*`20(i+1)`20*`204); X`09`7D X Xmvwaddstr(statwin,row++,8,temp); Xrow++; Xpipcount(g->board,g,`26mypip,`26oppip); Xsprintf(temp,"Total`20of`20your`20dice`20rolls`20=`20%-3d`20`20`20`20`20`20 V`20`20Pips`20remaining`20=`20%-3d", X`09Total,mypip); Xmvwaddstr(statwin,row++,0,temp); Xrow++; Xrow++; X Xmvwaddstr(statwin,row++,0,"Opponent:"); Xmvwaddstr(statwin,row++,0,"---------"); X Xrow++; Xmvwaddstr(statwin,row++,0,"Singles`20`20`201`20`202`20`203`20`204`20`205`20 V`206`20`20Doubles`20`20`201`20`202`20`203`20`204`20`205`20`206"); Xtemp`5B0`5D`20=`20'`5C0'; Xfor`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09sprintf(temp,`20"%s%3d",`20temp,`20g->oprolls`5Bi`5D); X`09OpTotal`20+=`20(g->oprolls`5Bi`5D`20*`20(i+1)); X`09`7D Xsprintf(temp,`20"%s`20`20`20`20`20`20`20`20`20`20",temp); Xfor`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09sprintf(temp,`20"%s%3d",`20temp,`20g->opdoubles`5Bi`5D); X`09OpTotal`20+=`20(g->opdoubles`5Bi`5D`20*`20(i+1)`20*`204); X`09`7D X Xmvwaddstr(statwin,row++,8,temp); Xrow++; Xsprintf(temp,"Total`20of`20opponent`20dice`20rolls`20=`20%-3d`20`20`20`20Pips V`20remaining`20=`20%-3d", X`09OpTotal,oppip); Xmvwaddstr(statwin,row++,0,temp); X X Xmvwaddstr(statwin,23,16,"Press`20H`20for`20histogram`20or`20`20to`20co Vntinue:`20"); X Xtouchwin(statwin);`09`09/*`20Make`20sure`20the`20screen`20is`20updated`20*/ Xwrefresh(statwin);`09`09/*`20update`20the`20window`20clearing`20screen`20*/ Xc`20=`20wgetch(statwin)`20`26`200x7f;`09/*`20Wait`20for`20user`20response`20*/ V X Xif`20(c`20==`20'h'`20`7C`7C`20c`20==`20'H')`20`7B`09/*`20Histogram`20wanted V`20*/ X`09wclear(statwin);`09`09/*`20clear`20the`20window`20*/ X X/* X`20*`20Draw`20the`20axis`20themselves X`20* X`20*/ X X X`09for`20(i`20=`202;`20i`20<`2018;`20i++)`20`7B`09`09/*`20Vertical`20axis`20*/ V X`09`09mvwaddstr(statwin,i,11,"`7C"); X`09`09mvwaddstr(statwin,i,44,"`7C"); X`09`09`7D X X`09for`20(i`20=`2012;`20i`20<`2041;`20i++)`20`7B`09`09/*`20Horizontal`20axis V`20*/ X`09`09mvwaddstr(statwin,17,i,"-"); X`09`09mvwaddstr(statwin,17,i+33,"-"); X`09`09`7D X X/* X`20*`20Number`20the`20vertical`20axis X`20* X`20*/ X X`09mvwaddstr(statwin,2,8,"15"); X`09mvwaddstr(statwin,2,41,"15"); X X`09mvwaddstr(statwin,7,8,"10"); X`09mvwaddstr(statwin,7,41,"10"); X X`09mvwaddstr(statwin,12,9,"5"); X`09mvwaddstr(statwin,12,42,"5"); X X/* X`20*`20Put`20the`20numbers`20across`20the`20bottom`20of`20the`20axis X`20* X`20*/ X X`09col`20=`2013; X`09for`20(i`20=`201;`20i`20<`207;`20i++)`20`7B X`09`09sprintf(temp,"%d",`20i); X`09`09mvwaddch(statwin,18,col,temp`5B0`5D); X`09`09mvwaddch(statwin,18,col+33,temp`5B0`5D); X`09`09col`20+=`205; X`09`09`7D X X/* X`20*`20Label`20the`20top`20and`20bottom`20of`20the`20graph X`20* X`20*/ X X`09mvwaddstr(statwin,0,17,"H`20i`20s`20t`20o`20g`20r`20a`20m`20`20`20o`20f`20 V`20`20D`20I`20C`20E`20`20`20R`20o`20l`20l`20s"); X`09mvwaddstr(statwin,19,20,"S`20I`20N`20G`20L`20E`20S"); X`09mvwaddstr(statwin,19,53,"D`20O`20U`20B`20L`20E`20S"); X`09mvwaddstr(statwin,21,4,"Legend:"); X`09sprintf(temp,"X`20=`20You,`20dice`20total`20=`20%3d",`20Total); X`09sprintf(temp,"%s`20`20`20`20`20O`20=`20Opponent,`20dice`20total`20=`20%3d", V`20temp,`20OpTotal); X`09mvwaddstr(statwin,21,14,temp); X`09wmove(statwin,22,23); X`09wprintw(statwin,"pips`20`20`20`20`20`20`20=`20%3d",mypip); X`09wmove(statwin,22,58); X`09wprintw(statwin,"pips`20`20`20`20`20`20`20=`20%3d",oppip); X X/* X`20*`20Label`20the`20left`20side`20of`20the`20graph X`20* X`20*/ X X`09sprintf(temp,"Number"); X`09for`20(i`20=`200;`20i`20<`20strlen(temp);`20i++) X`09`09mvwaddch(statwin,7+i,0,temp`5Bi`5D); X X`09sprintf(temp,"of"); X`09for`20(i`20=`200;`20i`20<`20strlen(temp);`20i++) X`09`09mvwaddch(statwin,9+i,3,temp`5Bi`5D); X X`09sprintf(temp,"Occurrences"); X`09for`20(i`20=`200;`20i`20<`20strlen(temp);`20i++) X`09`09mvwaddch(statwin,5+i,6,temp`5Bi`5D); X X/* X`20*`20Now`20that`20we`20have`20the`20axis`20drawn`20and`20labeled,`20fill`20i Vn`20the`20data X`20* X`20*/ X X`09for`20(dice`20=`200;`20dice`20<`206;`20dice++)`20`7B X`09`09for`20(i`20=`200;`20i`20<`204;`20i++)`20`7B X`09`09`09switch`20(i)`20`7B X`09`09`09case`200: X`09`09`09`09rolls`20=`20g->rolls`5Bdice`5D; X`09`09`09`09col`20=`2012`20+`20dice`20*`205; X`09`09`09`09c`20=`20'X'; X`09`09`09`09break; X`09`09`09case`201: X`09`09`09`09rolls`20=`20g->oprolls`5Bdice`5D; X`09`09`09`09col`20=`2014`20+`20dice`20*`205; X`09`09`09`09c`20=`20'O'; X`09`09`09`09break; X`09`09`09case`202: X`09`09`09`09rolls`20=`20g->doubles`5Bdice`5D; X`09`09`09`09col`20=`2045`20+`20dice`20*`205; X`09`09`09`09c`20=`20'X'; X`09`09`09`09break; X`09`09`09case`203: X`09`09`09`09rolls`20=`20g->opdoubles`5Bdice`5D; X`09`09`09`09col`20=`2047`20+`20dice`20*`205; X`09`09`09`09c`20=`20'O'; X`09`09`09`09break; X`09`09`09`09`7D X`09 X/* X`20*`20Special`20case.`20`20If`20we`20have`20more`20than`2030`20of`20one`20rol Vl,`20put`20a`20*`20at`20the X`20*`20top`20of`20the`20second`20column`20and`20show`2029`20X's`20or`20O's. X`20* X`20*/ X X`09`09`09row`20=`2016; X`09`09`09if`20(rolls`20>`2030)`20`7B X`09`09`09`09rolls`20=`2029; X`09`09`09`09mvwaddch(statwin,2,col+1,'*'); X`09`09`09`09`7D X X/* X`20*`20While`20the`20roll`20counter`20is`20greater`20than`20zero,`20put`20out V`20X's`20or`20O's. X`20* X`20*/ X X`09`09`09while`20(rolls`20>`200)`20`7B X`09`09`09`09mvwaddch(statwin,row--,col,c); X`09`09`09`09rolls--; X`09`09`09`09if`20(row`20<`202)`20`7B`09/*`20move`20to`202nd`20column`20*/ X`09`09`09`09`09row`20=`2016; X`09`09`09`09`09col++; X`09`09`09`09`09`7D X`09`09`09`09`7D X`09`09`09`7D X`09`09`7D X X/* X`20*`20We`20are`20done`20with`20the`20graph.`20`20Refresh`20and`20wait`20for V`20a`20keypress X`20* X`20*/ X X`09mvwaddstr(statwin,23,25,"Press`20`20to`20continue:`20"); X`09touchwin(statwin);`09`09/*`20Make`20sure`20the`20screen`20is`20updated`20*/ V X`09wrefresh(statwin);`09`09/*`20update`20the`20window`20clearing`20screen`20*/ V X`09wgetch(statwin);`09`09/*`20Wait`20for`20user`20response`20*/ X`09`7D X Xwclear(statwin);`09`09/*`20clear`20the`20window`20*/ Xwrefresh(statwin);`09`09/*`20update`20the`20window`20clearing`20screen`20*/ +-+-+-+-+-+-+-+- END OF PART 7 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 8 -+-+-+-+-+-+-+-+ Xdelwin(statwin);`09`09/*`20delete`20the`20window`20*/ X`7D $ call unpack DOSTATS.C;1 404862844 "" $! $ create 'f' X/*`09fe_curses.c`09`099/5/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*====================================================================== X`20*`20This`20file`20is`20the`20"curses"`20front-end`20for`20ldb.`20`20It`20pe Vrforms`20all X`20*`20display`20output`20and`20keyboard`20input`20in`20a`20way`20that`20will V`20(hopefully) X`20*`20allow`20other`20front-ends`20to`20be`20added`20later.`20`20These`20coul Vd`20include X`20*`20MAC's`20(blech),`20IBM`20PC's`20(double`20blech),`20and`20X,`20although V`20it`20must X`20*`20be`20stated`20that,`20as`20of`20this`20writing,`20ldb`20is`20not`20orga Vnized`20in`20an X`20*`20event-driven`20manner,`20so`20it`20will`20take`20more`20work`20to`20por Vt`20to`20X`20than X`20*`20just`20writing`20fe_motif.c`20or`20what`20have`20you.`20`20But`20I'm V`20working`20on`20it. X`20* X`20*`20All`20publicly-accessible`20functions`20in`20the`20front-end`20begin V`20with`20Fe. X`20*`20These`20are`20the`20functions`20that`20must`20be`20written`20to`20imple Vment`20a`20new X`20*`20front-end.`20`20There`20are`20a`20few`20private`20functions`20in`20this V`20file,`20which X`20*`20begin`20with`20P.`20`20These`20are`20used`20internally`20by`20fe_curses V.c`20and`20need`20not X`20*`20be`20implemented`20in`20other`20front-ends. X`20* X`20*`20The`20front-end`20is`20activated`20by`20calling`20FeInitialize.`20`20In V`20addition`20to X`20*`20performing`20any`20required`20initialization,`20it`20is`20mandatory`20f Vor`20FeInitialize X`20*`20to`20set`20FeIsActive`20to`20non-zero.`20`20The`20front-end`20is`20clos Ved`20down`20by X`20*`20calling`20FeFinishSession,`20which`20must`20set`20FeIsActive`20to`200. V`20`20No`20calls X`20*`20to`20any`20Fe`20functions`20may`20be`20made`20while`20FeIsActive`20is V`200. X`20*====================================================================== X`20*/ X XPRIVATE`20char`20PGetChr(); XPRIVATE`20PGetString(); XPRIVATE`20PDrawComment(); XPRIVATE`20PReverseText(); XPRIVATE`20PEndReverse(); X XPRIVATE`20struct`20game`20*Current_Game`20=`20NULL; X X X/*`20VAX`20C`20doesn't`20have`20tgetstr,`20but`20if`20you're`20using`20vax-c, V`09*/ X/*`20you're`20probably`20using`20a`20DEC`20terminal`20anyway.`09`09`09*/ X#ifdef`20vaxc X#define`20PClearScreen()`20fputs("`5C33`5BH`5C33`5B2J",stdout);fflush(stdout) X#else XPRIVATE`20PClearScreen(); X#endif X X X/*---------------------------------------------------------------------- X`20*`09FeInitialize`20--`20initialize`20the`20front`20end X`20* X`20*`20This`20function`20initializes`20the`20curses`20package,`20turns`20off V`20echo, X`20*`20turns`20on`20cbreak`20mode`20(to`20allow`20reading`20one`20character V`20at`20a`20time), X`20*`20turns`20off`20mapping`20return`20to`20newline,`20and`20sets`20the`20FeI VsActive`20flag. X`20*`20If`20FeWaitInit`20is`20set,`20the`20user`20is`20prompted`20to`20press V`20`20before X`20*`20the`20screen`20is`20cleared.`20`20FeWaitInit`20is`20set`20by`20message( V)`20to`20indicate X`20*`20that`20there`20are`20messages`20on`20the`20screen`20that`20the`20user V`20will`20want`20to X`20*`20read`20before`20the`20screen`20is`20cleared. X`20*---------------------------------------------------------------------- X`20*/ X XFeInitialize() X`7B Xchar`20buf`5B80`5D; X Xif`20(FeIsActive) X`09return; Xif`20(FeWaitInit)`20`7B X`09fprintf(stderr,"Press`20`20to`20continue..."); X`09fflush(stdout); X`09fflush(stderr); X`09fgets(buf,sizeof(buf),stdin); X`09FeWaitInit`20=`200; X`09`7D Xinitscr(); Xnoecho(); Xcbreak(); Xnonl(); XFeIsActive`20=`201; XCurrent_Game`20=`20NULL; X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeFinishSession`20--`20shut`20down`20the`20front`20end X`20* X`20*`20This`20function`20clears`20the`20screen,`20closes`20down`20the`20curses V`20package, X`20*`20and`20clears`20the`20FeIsActive`20flag. X`20*---------------------------------------------------------------------- X`20*/ X XFeFinishSession() X`7B X Xif`20(FeIsActive)`20`7B X`09clear(); X`09refresh(); X`09endwin(); X`09FeIsActive`20=`200; X`09Current_Game`20=`20NULL; X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawScreen`20--`20draw`20the`20constant`20parts`20of`20the`20screen X`20* X`20*`20This`20function`20draws`20the`20parts`20of`20the`20screen`20that`20don' Vt`20change`20for X`20*`20each`20game.`20`20This`20includes`20the`20board`20outline`20and`20a`20f Vew`20other X`20*`20miscellaneous`20things. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawScreen() X`7B Xstatic`20char`20horz`5B`5D`20=`20"____________________________________________ V_________"; Xint`20i; X Xclear(); Xmvaddstr(2,5,horz); Xmvaddstr(17,5,horz); Xfor`20(i`20=`203;`20i`20<`2018;`20i++)`20`7B X`09mvaddch(i,5,'`7C'); X`09mvaddch(i,29,'`7C'); X`09mvaddch(i,33,'`7C'); X`09mvaddch(i,57,'`7C'); X`09`7D Xmvaddstr(3,61,"----------------"); Xmvaddstr(4,63,"Roll`20`20Move"); Xmvaddstr(12,61,"----------------"); Xmvaddstr(13,63,"Roll`20`20Move"); Xmvaddstr(18,62,"------`5B`20`5D------"); Xfor`20(i`20=`2019;`20i`20<`2024;`20i++) X`09mvaddch(i,62,'`7C'); Xmvaddstr(18,0,"Messages:"); Xmvaddstr(19,0,"Sent:"); Xmvaddstr(21,0,"Rcvd:"); Xrefresh(); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09FeDrawGame`20--`20draw`20all`20items`20associated`20with`20a`20game X`20* X`20*`20This`20function`20displays`20all`20information`20related`20to`20a`20spe Vcific`20game. X`20*`20This`20includes`20the`20point`20labels,`20move`20blocks,`20cube;`20shoo Vt,`20just X`20*`20about`20everything`20you`20can`20think`20of. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawGame(g) Xstruct`20game`20*g; X`7B Xint`20i,`20p,`20r1,`20r2; Xchar`20blots`5B12`5D,`20tmp`5B60`5D,`20*n; Xchar`20addr`5B68`5D;`09`09/*`20all`20of`20e-mail`20address`20that`20will`20fit V`20on`20top`20line`20*/ Xint`20bgflag;`09`09/*`201`20=`20gammon,`202`20=`20backgammon,`200`20=`20neithe Vr`20*/ Xint`20gval;`09`09/*`20game`20value`20(when`20game`20is`20over)`20*/ Xstatic`20char`20pts1`5B`5D`20=`20"`201`20`20`202`20`20`203`20`20`204`20`20`205 V`20`20`206`20`7C`20`20`20`7C`207`20`20`208`20`20`209`20`2010`20`2011`20`2012"; V Xstatic`20char`20pts2`5B`5D`20=`20"24`20`2023`20`2022`20`2021`20`2020`20`2019 V`20`7C`20`20`20`7C18`20`2017`20`2016`20`2015`20`2014`20`2013"; Xstatic`20char`20*events`5B`5D`20=`20`7B`20"",`20"Gammon!`20`20",`20"Backgammon V!`20`20"`20`7D; X XCurrent_Game`20=`20g; Xmove(0,0); Xclrtoeol(); Xmove(0,0); Xn`20=`20(g->opname`20!=`20NULL)`20?`20g->opname`20:`20"UNKNOWN"; Xi`20=`20sizeof(addr)`20-`20strlen(n)`20-`201;`20`20/*`20longest`20e-mail`20add Vr`20we`20can`20display`20*/ Xif`20(strlen(g->opaddr)`20>`20i)`20`7B`09/*`20too`20long,`20truncate`20*/ X`09strncpy(addr,g->opaddr,i-3);`09/*`20leave`20space`20for`20...`20*/ X`09strcpy(`26addr`5Bi-3`5D,"...");`09/*`20add`20ellipsis`20`26`20null`20termin Vate`20*/ X`09`7D Xelse X`09strcpy(addr,g->opaddr); Xprintw("Playing:`20%s`20(%s)",n,addr);`09`09/*`20who`20am`20I`20playing?`20*/ Xif`20(g->flags`20`26`20F_INVERT)`20`7B`09`09/*`20board`20is`20inverted?`20`20* V/ X`09mvaddstr(16,6,pts2);`09`09/*`20draw`20inverted`20point`20labels`20*/ X`09mvaddstr(4,6,pts1); X`09r1`20=`2011;`09`09`09/*`20remember`20which`20move`20block`20to`20use`20*/ X`09r2`20=`202; X`09p`20=`201; X`09`7D Xelse`20`7B X`09mvaddstr(4,6,pts2);`09`09/*`20draw`20normal`20point`20labels`20*/ X`09mvaddstr(16,6,pts1); X`09r1`20=`202;`09`09`09`09/*`20remember`20which`20move`20block`20to`20use`20*/ V X`09r2`20=`2011; X`09p`20=`200; X`09`7D Xif`20(g->mydir`20>`200)`20`7B`09`09/*`20I'm`20playing`20up,`20switch`20move V`20blocks`20*/ X`09i`20=`20r1; X`09r1`20=`20r2; X`09r2`20=`20i; X`09p`20=`201`20-`20p; X`09`7D Xmove(r1,63); Xprintw("Opponent`20`20(%c)",g->opcolor); Xmove(r2,63); Xprintw("You`20`20`20`20`20`20`20(%c)",g->mycolor); X Xswitch`20(g->curbd)`20`7B`09`09`09/*`20which`20board`20should`20I`20draw?`20*/ V Xcase`20BD_BEFOP: X`09FeDrawBoard(g->opbd,g->opmvs,g->opdir,0,g->flags`20`26`20F_INVERT); X`09FeDrawPip(g->opbd,g); X`09break; Xcase`20BD_AFTOP: X`09FeDrawBoard(g->mybd,g->opmvs,g->opdir,1,g->flags`20`26`20F_INVERT); X`09FeDrawPip(g->mybd,g); X`09break; Xcase`20BD_CUR: X`09FeDrawBoard(g->board,NULL,g->mydir,0,g->flags`20`26`20F_INVERT); X`09FeDrawPip(g->board,g); X`09break; X`09`7D XFeLabelBoard(g); Xmvaddch(5,59,'`7C');`09`09`09/*`20draw`20those`20little`20arrows`20*/ Xmvaddch(4,59,'-'); Xmvaddch(14,59,'`7C');`09`09`09/*`20that`20tell`20us`20which`20direction`20*/ Xmvaddch(15,59,'`7C');`09`09`09/*`20we`20are`20going`20*/ Xmvaddch(16,59,'-'); Xif`20(p`20==`200)`20`7B X`09mvaddstr(4,1,"-->"); X`09mvaddch(4,58,'-'); X`09mvaddch(6,59,'V'); X`09mvaddch(16,58,'<'); X`09mvaddstr(16,1,"<--"); X`09mvaddstr(13,58,"`20`20`20"); X`09mvaddch(12,59,'`20'); X`09mvaddstr(4,30,"-->"); X`09mvaddstr(16,30,"<--"); X`09`7D Xelse`20`7B X`09mvaddstr(4,1,"<--"); X`09mvaddch(4,58,'<'); X`09mvaddch(6,59,'`7C'); X`09mvaddch(16,58,'-'); X`09mvaddstr(16,1,"-->"); X`09mvaddstr(13,58,"/`7C`5C`5C"); X`09mvaddch(12,59,'.'); X`09mvaddstr(16,30,"-->"); X`09mvaddstr(4,30,"<--"); X`09`7D X*blots`20=`20'`5C0';`09`09`09`09/*`20did`20any`20of`20our`20blots`20get`20hit? V`20*/ Xfor`20(i`20=`200,`20p`20=`200;`20i`20<`204;`20i++)`20`7B X`09FeDrawMove(g,WHO_ME,i);`09`09/*`20draw`20my`20moves`20*/ X`09FeDrawMove(g,WHO_OPP,i);`09/*`20draw`20opponent's`20moves`20*/ X`09if`20(g->blot`5Bi`5D`20>`200)`20`7B X`09`09strcat(blots,"`20");`09/*`20add`20a`20blot`20to`20the`20list`20*/ X`09`09sprintf(tmp,"%d",g->blot`5Bi`5D); X`09`09strcat(blots,tmp); X`09`09p++; X`09`09`7D X`09`7D XFeDrawCube(g);`09`09/*`20draw`20the`20current`20game`20value`20*/ XPDrawComment(WHO_ME,`20g);`09/*`20draw`20my`20old`20comment`20*/ XPDrawComment(WHO_OPP,`20g);`09/*`20draw`20opponent's`20comment`20*/ Xif`20(g->state`20==`20ST_MYACCEPT) X`09strcpy(tmp,"Opponent`20has`20doubled."); Xelse`20if`20(g->state`20==`20ST_GAMEOVER)`20`7B`09/*`20game`20is`20over,`20fin Vd`20out`20why`20*/ X`09bgflag`20=`20gvalue(g,`26gval);`09`09/*`20calculate`20game`20value`20*/ X`09switch`20(g->term)`20`7B X`09case`20T_IWIN:`09`09/*`20I`20won,`20check`20for`20gammon/backgammon`20*/ X`09`09sprintf(tmp,"%sYou`20win`20%d`20point%s.",events`5Bbgflag`5D, X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09case`20T_ILOSE:`09`09/*`20I`20lost,`20check`20for`20gammon/backgammon`20*/ X`09`09sprintf(tmp,"%sYou`20lose`20%d`20point%s.",events`5Bbgflag`5D, X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09case`20T_ICONCEDE:`09`09`09/*`20I`20wimped`20out`20*/ X`09`09sprintf(tmp,"You`20conceded.`20`20You`20lose`20%d`20point%s.", X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09case`20T_OPCONCEDE:`09`09`09/*`20Opponent`20wimped`20out`20*/ X`09`09sprintf(tmp,"Opponent`20conceded.`20`20You`20win`20%d`20point%s.", X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09case`20T_IDECLINE:`09`09`09/*`20I`20declined`20the`20double`20*/ X`09`09sprintf(tmp,"Double`20declined.`20`20You`20lose`20%d`20point%s.", X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09case`20T_OPDECLINE:`09`09/*`20Opponent`20declined`20my`20double`20*/ X`09`09sprintf(tmp,"Double`20declined.`20`20You`20win`20%d`20point%s.", X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s"); X`09`09break; X`09`09`7D X`09`7D Xelse`20if`20(*blots) X`09sprintf(tmp,"Blot%s`20hit:%s",(p`20==`201)`20?`20""`20:`20"s",blots); Xelse X`09*tmp`20=`20'`5C0'; XFeStatusLine(tmp); XFeMessage(g->dispmsg);`09`09/*`20put`20message`20(if`20any)`20on`20message`20l Vine`20*/ Xif`20(g->dispmsg`20!=`20NULL)`20`7B`09/*`20if`20there`20was`20a`20message,`20i Vt`20has`20been`20*/ X`09free(g->dispmsg);`09/*`20displayed,`20so`20it`20can`20thrown`20away`20*/ X`09g->dispmsg`20=`20NULL; X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawPip`20--`20display`20the`20PIP`20count X`20* X`20*`20This`20function`20displays`20the`20current`20pip`20count. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawPip(b,g) Xboard`20b;`09`09`09/*`20the`20current`20board`20array`20*/ Xstruct`20game`20*g;`09`09`09/*`20the`20current`20game`20structure`20*/ X`7B Xint`20mypip,`20oppip; X Xpipcount(b,g,`26mypip,`26oppip); Xmove(1,29); Xclrtoeol(); Xmove(1,29); Xprintw("You:`20%3d`20`20Op:`20%3d`20`20",`20mypip,`20oppip); Xif`20(mypip`20>`20oppip) X`09printw("(%d`20behind)",`20mypip`20-`20oppip); Xelse`20if`20(oppip`20>`20mypip) X`09printw("(%d`20ahead)",`20oppip`20-`20mypip); Xelse X`09printw("(even)"); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawPoint`20--`20draw`20all`20pieces`20on`20a`20point X`20* X`20*`20This`20function`20redraws`20all`2015`20slots`20on`20a`20point.`20`20It V`20is`20passed`20a X`20*`20board`20image`20and`20the`20index`20of`20the`20point`20to`20draw,`20fro Vm`20which`20it X`20*`20extracts`20the`20number`20of`20pieces`20on`20that`20point`20and`20the V`20character`20used X`20*`20to`20represent`20pieces.`20`20It`20will`20draw`20as`20many`20of`20these V`20pieces`20as X`20*`20exist`20on`20the`20point,`20and`20will`20draw`20blanks`20over`20the`20r Vemaining`20slots X`20*`20to`20erase`20any`20pieces`20that`20may`20have`20existed`20before. X`20*`20If`20the`20nh`20argument`20is`20greater`20than`200,`20it`20specifies V`20how`20many`20of X`20*`20the`20pieces`20drawn`20should`20be`20highlighted.`20`20This`20is`20used V`20to`20highlight X`20*`20pieces`20moved`20by`20the`20opponent. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawPoint(b,pt,nh,inv) Xboard`20b;`09`09/*`20the`20board`20array`20*/ Xint`20pt;`09`09`09/*`20which`20point`20are`20we`20to`20draw`20*/ Xint`20nh;`09`09`09/*`20how`20many`20pieces`20should`20be`20highlighted`20*/ Xint`20inv;`09`09/*`20is`20the`20board`20inverted?`20*/ X`7B Xstatic`20int`20cols`5BBOARDSIZE`5D`20=`20`7B`20`2031,7,11,15,19,23,27,35,39,43 V,47,51,55, X`09`09`09`0955,51,47,43,39,35,27,23,19,15,11,7,31,2,2`7D; Xint`20sr,`20r;`09`09/*`20the`20row`20we`20are`20at`20*/ Xint`20c;`09`09/*`20the`20column`20we`20are`20at`20*/ Xint`20d;`09`09/*`20which`20direction`20does`20the`20column`20grow`201/-1`20*/ Xint`20i;`09`09/*`20counter`20*/ Xchar`20x;`09`09/*`20char`20to`20draw`20piece`20with`20*/ Xint`20nn;`09`09/*`20number`20of`20normal`20pieces`20*/ X Xif`20(`20(pt`20>`2012)`20`26`26`20(pt`20!=`20DOWNOFF))`20`7B X`09sr`20=`20inv`20?`2015`20:`205;`09/*`20starting`20row`20is`205`20(unless`20i Vnverted)`20*/ X`09d`20=`20inv`20?`20-1`20:`201;`09/*`20direction`20is`20down`20(unless`20inve Vrted)`20*/ X`09`7D Xelse`20`7B X`09sr`20=`20inv`20?`205`20:`2015;`09/*`20starting`20row`20is`2015`20(unless V`20inverted)`20*/ X`09d`20=`20inv`20?`201`20:`20-1;`09/*`20direction`20is`20up`20(unless`20invert Ved)`20*/ X`09`7D Xc`20=`20cols`5Bpt`5D; Xx`20=`20b`5Bpt`5D.color;`09`09/*`20char`20to`20draw`20piece`20with`20*/ Xif`20(nh`20<`200) X`09nh`20=`200; Xelse`20if`20(nh`20>`20b`5Bpt`5D.qty) X`09nh`20=`20b`5Bpt`5D.qty; Xnn`20=`20b`5Bpt`5D.qty`20-`20nh;`09`09/*`20how`20many`20normal`20pcs`20*/ Xr`20=`20sr; Xfor`20(i`20=`200;`20i`20<`2015;`20i++)`20`7B`09`09/*`20draw`20all`2015`20slots V`20on`20this`20point`20*/ X`09if`20(nn`20<=`200)`20`7B`09`09/*`20no`20more`20normal`20pieces`20*/ X`09`09if`20(nh`20<=`200)`09/*`20and`20no`20highlighted`20pieces`20*/ X`09`09`09x`20=`20'`20';`09/*`20so`20draw`20blanks`20*/ X`09`09else`20`7B X`09`09`09PReverseText(); X`09`09`09nh--; X`09`09`09`7D X`09`09`7D X`09else X`09`09nn--; X`09mvaddch(r,c,x);`09`09`09/*`20draw`20this`20piece`20*/ X`09PEndReverse(); X`09if`20(i`20==`204)`20`7B X`09`09r`20=`20sr;`09`09`09/*`20reset`20row`20*/ X`09`09c--;`09`09`09/*`20use`20col`20to`20left`20of`20first`20row`20*/ X`09`09`7D X`09else`20if`20(i`20==`209)`20`7B X`09`09r`20=`20sr;`09`09`09/*`20reset`20row`20*/ X`09`09c`20+=`202;`09`09`09/*`20use`20col`20to`20right`20of`20first`20row`20*/ X`09`09`7D X`09else X`09`09r`20+=`20d;`09`09`09/*`20bump`20row`20number`20*/ X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawMove`20--`20draw`20a`20line`20in`20a`20move`20block X`20* X`20*`20This`20function`20draws`20one`20line`20in`20a`20move`20block.`20`20This V`20consists`20of`20the X`20*`20value`20of`20the`20roll,`20the`20starting`20and`20ending`20position`20o Vf`20the`20piece X`20*`20moved,`20and`20an`20asterisk`20if`20the`20move`20was`20from`20the`20opp Vonent`20and`20hit X`20*`20one`20of`20our`20blots. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawMove(g,who,mn) Xstruct`20game`20*g;`09`09`09/*`20the`20game`20structure`20*/ Xint`20who;`09`09`09/*`20WHO_ME`20or`20WHO_OPP`20*/ Xint`20mn;`09`09`09`09/*`20which`20move`20to`20draw`20*/ X`7B Xint`20p,`20r,`20d; Xstruct`20mv`20*m; X Xd`20=`20(who`20==`20WHO_ME)`20?`20g->mydir`20:`20g->opdir;/*`20this`20move`20u Vpbound`20or`20downbound?`20*/ Xp`20=`20(d`20>`200);`09`09`09`09/*`20upper`20or`20lower`20block?`20*/ Xif`20(g->flags`20`26`20F_INVERT)`09`09/*`20inverted`20board`20*/ X`09p`20=`20!p;`09`09`09`09/*`20switch`20move`20blocks`20*/ Xr`20=`20mn`20+`20(p`20?`205`20:`2014);`09`09`09/*`20figure`20out`20the`20row V`20number`20*/ Xm`20=`20(who`20==`20WHO_ME)`20?`20`26g->mvs`5Bmn`5D`20:`20`26g->opmvs`5Bmn`5D; V/*`20find`20the`20move`20structure`20*/ Xmove(r,64); Xclrtoeol();`09`09`09`09/*`20clear`20the`20old`20move`20*/ Xif`20(m->roll`20>`200)`20`7B X`09move(r,64); X`09printw("%d",m->roll);`09`09/*`20draw`20the`20roll`20*/ X`09move(r,69); X`09if`20(m->pt`20<`200)`20`7B`09`09/*`20if`20it`20is`20unused,`20say`20so`20*/ V X`09`09addstr("UNUSED"); X`09`09return; X`09`09`7D X`09if`20(`20(`20(p`20=`20m->pt)`20==`20UPBAR)`20`7C`7C`20(m->pt`20==`20DOWNBAR V)`20)`20`7B X`09`09p`20=`20BARPT(d);`09`09/*`20if`20coming`20off`20bar,`20say`20so`20*/ X`09`09printw("BAR-"); X`09`09`7D X`09else X`09`09printw("%d-",m->pt);`09/*`20draw`20starting`20point`20*/ X`09if`20(`20(`20(p`20+=`20d*m->roll)`20<=`200)`20`7C`7C`20(p`20>=`2025)`20) X`09`09printw("OFF");`09`09/*`20if`20bearing`20off,`20say`20so`20*/ X`09else X`09`09printw("%d",p);`09`09/*`20draw`20ending`20point`20*/ X`09if`20(`20(who`20==`20WHO_OPP)`20`26`26`20g->blot`5Bmn`5D)`09/*`20if`20op V`20move`20hit`20a`20blot`20*/ X`09`09mvaddch(r,76,'*');`09/*`20mark`20it`20*/ X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawBoard`20--`20draw`20all`20points`20on`20a`20board X`20* X`20*`20This`20is`20a`20convenience`20function`20that`20calls`20FeDrawPoint`20f Vor`20all X`20*`20points`20on`20a`20board.`20`20It`20takes`20as`20an`20argument`20an`20ar Vray`20of`20moves, X`20*`20as`20well`20as`20an`20argument`20that`20determines`20whether`20DrawPoin Vt`20should`20be X`20*`20instructed`20to`20highlight`20the`20source`20of`20those`20moves,`20the V`20destination, X`20*`20or`20nothing. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawBoard(b,mvs,dir,sd,inv) Xboard`20b;`09`09`09/*`20board`20image`20*/ Xstruct`20mv`20mvs`5B4`5D;`09`09/*`20moves`20to`20highlight`20(NULL`20=`20none) V`20*/ Xint`20dir;`09`09`09/*`20direction`20*/ Xint`20sd;`09`09`09`09/*`200=highlight`20source,`201=dest`20*/ Xint`20inv;`09`09`09/*`20is`20the`20board`20inverted?`20*/ X`7B Xint`20i,`20s,`20e; Xstatic`20char`20hcnt`5BBOARDSIZE`5D;`09/*`20number`20of`20pieces`20to`20highli Vght`20*/ X Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++) X`09hcnt`5Bi`5D`20=`200;`09`09/*`20init`20to`20no`20highlight`20*/ Xif`20(mvs`20!=`20NULL)`20`7B`09/*`20find`20all`20points`20that`20should`20be V`20highlighted`20*/ X`09for`20(i`20=`200;`20i`20<`204;`20i++)`20`7B X`09`09if`20(`20(mvs`5Bi`5D.roll`20<=`200)`20`7C`7C`20(`20(s`20=`20mvs`5Bi`5D.p Vt)`20<`200)`20) X`09`09`09continue;`09/*`20this`20move`20is`20unused`20*/ X`09`09if`20(`20(s`20<`201)`20`7C`7C`20(s`20>`2024)`20)`09/*`20if`20coming`20of Vf`20bar`20*/ X`09`09`09s`20=`20BARPT(dir);`09`09/*`20use`20correct`20bar`20point`20*/ X`09`09e`20=`20s`20+`20dir*mvs`5Bi`5D.roll;`09/*`20add`20in`20the`20roll`20used V`20*/ X`09`09if`20(`20(e`20<`201)`20`7C`7C`20(e`20>`2024)`20)`09/*`20off`20the`20boar Vd`20*/ X`09`09`09e`20=`20OFFPT(dir);`09/*`20use`20correct`20off`20point`20*/ X`09`09if`20(sd`20>`200)`20`7B`09`09`09/*`20we`20are`20showing`20dest`20*/ X`09`09`09hcnt`5Be`5D++;`09`09/*`20inc`20destination`20count`20*/ X`09`09`09hcnt`5Bs`5D--;`09`09/*`20handle`20continued`20moves`20*/ X`09`09`09`7D X`09`09else`20`7B`09`09`09`09/*`20we`20are`20showing`20start`20*/ X`09`09`09hcnt`5Bs`5D++;`09`09/*`20inc`20start`20count`20*/ X`09`09`09hcnt`5Be`5D--;`09`09/*`20handle`20continued`20moves`20*/ X`09`09`09`7D X`09`09`7D X`09`7D Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++)`09`09/*`20draw`20each`20point V`20*/ X`09FeDrawPoint(b,i,hcnt`5Bi`5D,inv); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeLabelBoard`20--`20draw`20board`20info X`20* X`20*`20This`20function`20displays`20information`20about`20the`20board`20curren Vtly X`20*`20being`20displayed.`20`20This`20includes`20its`20label,`20any`20special V`20rule`20flags, X`20*`20and`20the`20current`20match`20score. X`20*---------------------------------------------------------------------- X`20*/ X XFeLabelBoard(g) Xstruct`20game`20*g; X`7B Xint`20i; Xstatic`20char`20*bdlbl`5B`5D`20=`20`7B"Bef",`20"Aft",`20"Cur"`7D; X Xmvaddstr(1,5,BLANKS(24));`09`09/*`20clear`20old`20stuff`20*/ Xmvaddstr(1,5,bdlbl`5Bg->curbd`5D);`09`09/*`20draw`20the`20board`20label`20*/ Xif`20(g->flags`20`26`20F_JACOBY)`09`09/*`20label`20special`20rules`20flags`20* V/ X`09mvaddch(1,10,'J'); Xif`20(g->flags`20`26`20F_CRAWFORD)`20`7B X`09if`20(g->flags`20`26`20F_CRGAME)`09/*`20if`20this`20is`20crawford`20rule V`20game`20*/ X`09`09PReverseText();`09`09/*`20highlight`20the`20C`20indicator`20*/ X`09mvaddch(1,11,'C'); X`09if`20(g->flags`20`26`20F_CRGAME) X`09`09PEndReverse(); X`09`7D Xif`20(g->flags`20`26`20F_EUROPE) X`09mvaddch(1,12,'E'); Xif`20(g->flags`20`26`20F_PERM) X`09mvaddch(1,13,'P'); Xif`20(g->mtotal`20>`200)`20`7B`09`09`09/*`20if`20this`20is`20a`20match`20*/ X`09move(1,16);`09`09`09/*`20draw`20the`20match`20score`20*/ X`09printw("%02d:%02d`20to`20%2d", X`09`09g->mcurrent`5BWHO_ME`5D,`20g->mcurrent`5BWHO_OPP`5D,`20g->mtotal); X`09`7D XFeCheckContact(g); X`7D X X X X X/*---------------------------------------------------------------------- X`20*`09FeCheckContact`20--`20check`20for`20contact`20after`20a`20move`20is`20m Vade. X`20* X`20*`20This`20routine`20keeps`20the`20BAR`20indicator`20up`20to`20date`20as V`20moves`20are`20made. X`20*`20The`20BAR`20indicator`20changes`20to`20"---"`20when`20no`20further`20co Vntact`20is X`20*`20possible`20for`20a`20game.`20`20Note`20that`20the`20BAR`20indicator`20o Vnly`20reflects X`20*`20the`20value`20of`20the`20current`20board,`20and`20is`20not`20affected V`20by`20which X`20*`20board`20is`20being`20displayed. X`20*---------------------------------------------------------------------- X`20*/ X XFeCheckContact(g) Xstruct`20game`20*g; X`7B X Xif`20(iscontact(g))`09`09`09/*`20if`20contact`20is`20possible`20*/ X`09mvaddstr(10,30,"BAR");`09`09/*`20draw`20BAR`20label`20*/ Xelse`09`09`09`09`09/*`20change`20BAR`20indicator`20to`20*/ X`09mvaddstr(10,30,"---");`09`09/*`20no`20contact`20indicator`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeGetPoint`20--`20read`20a`20point`20number`20from`20the`20user X`20* X`20*`20This`20function`20prompts`20the`20user`20for`20a`20point`20number.`20 V`20The`20user`20types X`20*`20the`20input`20on`20the`20line`20of`20the`20move`20block`20corresponding V`20to`20the X`20*`20roll`20being`20used.`20`20Normally,`20the`20input`20is`20a`20number`20b Vetween`201`20and`2024.`20`20 X`20*`20Point`20numbers`20are`20two`20digits`20unless: X`20*`09-`20The`20first`20digit`20is`203`20..`209. X`20*`20OR`09-`20The`20first`20digit`20is`201`20and`20there`20is`20no`20point V`20in`2010`20..`2019 X`20*`09`20`20that`20could`20use`20the`20selected`20roll. X`20*`20OR`09-`20The`20first`20digit`20is`202`20and`20there`20is`20no`20point V`20in`2020`20..`2024 X`20*`09`20`20that`20could`20use`20the`20selected`20roll. X`20*`20Otherwise,`20there`20must`20be`20a`20non-digit`20entered`20to`20finish V`20a`201-digit X`20*`20point`20number.`20`20Alternatively,`20the`20user`20may`20enter`20them X`20*`20with`20a`20leading`200.`20`20There`20are`20a`20number`20of`20special V`20characters`20that X`20*`20are`20also`20recognized: X`20*`09char`09`09`09return`20value X`20*`09--------------------------------------------------------------- X`20*`09space`09`09`09the`20"spdflt"`20argument. X`20*`09return/linefeed`09`09the`20"crdflt"`20argument. X`20*`09DEL/ESC/BS`09`09cancel`20move. X`20*`09p/P`09`09`09the`20point`20from`20which`20a`20piece`20would`20have X`20*`09`09`09`09to`20be`20moved`20to`20land`20on`20spdflt. X`20*`09o/O`09`09`09The`20point`20from`20which`20the`20selected`20roll X`20*`09`09`09`09could`20be`20used`20to`20bear`20off.`20`20If`20that`20point X`20*`09`09`09`09is`20unoccupied,`20the`20next`20lower`20occupied X`20*`09`09`09`09point`20is`20returned. X`20*`20If`20there`20are`20pieces`20on`20the`20bar,`20the`20bar`20point`20is V`20returned`20immediately, X`20*`20since`20there`20could`20be`20no`20other`20possible`20choice`20the`20use Vr`20would`20make. X`20*---------------------------------------------------------------------- X`20*/ X XFeGetPoint(g,r,crdflt,spdflt) Xstruct`20game`20*g;`09`09`09`09/*`20game`20structure`20*/ Xint`20r;`09`09`09`09`09/*`20which`20row`20in`20move`20block`20*/ Xint`20crdflt;`09`09`09`09/*`20what`20to`20return`20for`20cr/nl`20*/ Xint`20spdflt;`09`09`09`09/*`20what`20to`20return`20for`20space`20*/ X`7B Xint`20n,`20row; Xchar`20buf`5B4`5D; X X Xif`20(g->board`5BBARPT(g->mydir)`5D.qty`20>`200)`09/*`20pieces`20on`20the`20ba Vr`20*/ X`09return(BARPT(g->mydir));`09/*`20no`20need`20to`20even`20ask`20*/ Xrow`20=`20r; Xif`20(g->flags`20`26`20F_INVERT)`09`09/*`20which`20move`20block`20do`20I`20use V?`20*/ X`09row`20+=`20(g->mydir`20<`200)`20?`205`20:`2014;`09/*`20inverted`20board`20* V/ Xelse X`09row`20+=`20(g->mydir`20>`200)`20?`205`20:`2014;`09/*`20normal`20board`20*/ Xmove(row,69); Xclrtoeol(); Xmove(row,69); Xrefresh(); X*buf`20=`20PGetChr(0,1); Xif`20(`20(*buf`20==`20'`5Cn')`20`7C`7C`20(*buf`20==`20'`5Cr')`20)`09/*`20retur Vn`20means`20repeat`20move`20*/ X`09return(crdflt); Xif`20(*buf`20==`20'`20')`09`09`09/*`20space`20means`20continue`20move`20*/ X`09return(spdflt); Xif`20(`20(*buf`20==`20'`5C177')`20`7C`7C`20(*buf`20==`20'`5C033')`20`7C`7C`20( V*buf`20==`20'`5Cb')`20) X`09return(-1);`09`09`09/*`20DEL/ESC/BS`20means`20cancel`20move`20*/ Xif`20(`20(*buf`20==`20'b')`20`7C`7C`20(*buf`20==`20'B')`20)`09/*`20bar`20*/ X`09return(BARPT(g->mydir)); Xif`20(`20(*buf`20==`20'p')`20`7C`7C`20(*buf`20==`20'P')`20)`20`7B`09/*`20P`20m Veans`20spdflt`20-`20roll*dir`20*/ X`09n`20=`20spdflt`20-`20g->mvs`5Br`5D.roll*g->mydir;`09/*`20make`20point`20*/ X`09if`20(`20(n`20<`201)`20`7C`7C`20(n`20>`2024)`20)`09`09/*`20not`20on`20board V`20*/ X`09`09n`20=`2099;`09`09`09`09/*`20force`20invalid`20point`20*/ X`09return(n); X`09`7D Xif`20(`20(*buf`20==`20'o')`20`7C`7C`20(*buf`20==`20'O')`20)`20`7B`09/*`20O`20m Veans`20bear`20a`20piece`20off`20*/ X`09n`20=`20(`20(g->mydir`20>`200)`20?`2025`20:`200`20)`20-`20g->mydir*g->mvs V`5Br`5D.roll; X`09while`20(`20(n`20>`200)`20`26`26`20(n`20<=`2024)`20`26`26 X`09`20`20`20(`20(g->board`5Bn`5D.qty`20<=`200)`20`7C`7C`20(g->board`5Bn`5D.col Vor`20!=`20g->mycolor))`20) X`09`09n`20+=`20g->mydir; X`09if`20(`20(n`20<`201)`20`7C`7C`20(n`20>`2024)`20)`09/*`20no`20piece`20found V`20*/ X`09`09n`20=`2099;`09`09`09/*`20force`20invalid`20point`20*/ X`09return(n); X`09`7D Xif`20(`20!`20isdigit(*buf)) X`09return(99);`09`09`09/*`20force`20invalid`20point`20message`20*/ Xif`20(`20(*buf`20>=`20'3')`20`26`26`20(*buf`20<=`20'9')`20)`09/*`203`20..`209 V`20*/ X`09return(*buf`20-`20'0');`09`09/*`20don't`20bother`20with`202nd`20digit`20*/ Xif`20(*buf`20==`20'1')`20`7B`09`09`09/*`20look`20for`20valid`20move`20in`2010 V`20..`2019`20*/ X`09if`20(canmove(g,r,10,19)`20==`200)`09/*`20no`20valid`20move`20*/ X`09`09return(1);`09`09/*`20don't`20bother`20with`20second`20digit`20*/ X`09`7D Xelse`20if`20(*buf`20==`20'2')`20`7B`09`09`09/*`20look`20for`20valid`20move`20i Vn`2020`20..`2024`20*/ X`09if`20(canmove(g,r,20,24)`20==`200)`09/*`20no`20valid`20move`20*/ X`09`09return(2);`09`09/*`20don't`20bother`20with`20second`20digit`20*/ X`09`7D Xaddch(*buf);`09`09`09`09/*`20echo`20the`20char`20*/ Xrefresh(); Xbuf`5B1`5D`20=`20PGetChr(0,1); Xbuf`5B2`5D`20=`20'`5C0';`09`09`09`09/*`20null`20terminate`20*/ Xif`20(`20((n`20=`20atoi(buf))`20==`20UPBAR)`20`7C`7C`20(n`20==`20DOWNBAR)`20) X`09return(BARPT(g->mydir)); Xreturn(n); X`7D X X X/*---------------------------------------------------------------------- X`20*`09PGetChr`20--`20get`20a`20single`20character X`20* X`20*`20This`20function`20gets`20one`20character`20from`20the`20user`20and`20re Vturns`20it. X`20*`20If`20the`20"e"`20argument`20is`20non-zero,`20the`20character`20is`20ech Voed`20at`20the X`20*`20current`20cursor`20position.`20`20If`20the`20"h"`20argument`20is`20non- Vzero,`20the X`20*`20online`20help`20is`20displayed`20by`20pressing`20"H",`20"h",`20or`20"?" V.`20`20The`20`5EL`20and`20`5ER X`20*`20characters`20are`20intercepted`20and`20cause`20the`20screen`20to`20be V`20redrawn`20without X`20*`20returning`20from`20PGetChr.`20`20Null`20characters`20are`20discarded. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20char`20PGetChr(e,h) Xint`20e,`20h; X`7B Xchar`20c; Xint`20y,`20x; X X#ifdef`20VMS Xchar`20Prompt`5B4`5D`20=`20"_$`20"; Xstruct`20dsc$descriptor_s`20*cmd`20=`200,`20*prmpt=0; X$DESCRIPTOR(cm_dsc,rc.supercmd); X$DESCRIPTOR(prmpt_dsc,Prompt); X#endif X Xloop: Xif`20(`20(c`20=`20getch()`20`26`200x7f)`20==`20'`5C0') X`09goto`20loop; Xif`20(`20(c`20==`200x0c)`20`7C`7C`20(c`20==`200x12)`20)`20`7B`09/*`20`5EL`20or V`20`5ER?`20*/ X`09clearok(curscr,`20TRUE); X`09wrefresh(curscr);`09/*`20repaint`20current`20screen`20*/ X`09goto`20loop;`09`09/*`20and`20get`20another`20char`20*/ X`09`7D Xif`20(c`20==`20rc.superkey)`20`7B`09`09`09/*`20uh`20oh,`20we're`20busted`20*/ X`09getyx(stdscr,y,x);`09`09/*`20save`20old`20cursor`20postition`20*/ X`09PClearScreen();`09`09`09/*`20get`20the`20screen`20cleared`20fast`20*/ X`09nl();`09`09`09`09/*`20set`20tty`20back`20to`20normal`20*/ X`09nocbreak(); X`09echo(); X#ifdef`20VMS X`09cm_dsc.dsc$w_length`20=`20strlen(rc.supercmd);`09/*`20length`20of`20cmd`20* V/ X`09cmd`20=`20`26cm_dsc;`09`09`09/*`20set`20up`20the`20command`20argument`20*/ X`09prmpt_dsc.dsc$w_length`20=`20strlen(Prompt); X`09prmpt`20=`20`26prmpt_dsc;`09`09`09/*`20set`20up`20the`20command`20argument V`20*/ X`09lib$spawn(cmd,0,0,0,0,0,0,0,0,0,prmpt,0);`09/*`20spawn`20a`20subprocess`20* V/ X#else X`09system(rc.supercmd);`09`09/*`20run`20the`20supervisor`20command`20*/ X#endif X`09noecho(); X`09cbreak(); X`09nonl();`09`09`09`09/*`20ok,`20we're`20safe`20again`20*/ X`09PClearScreen();`09`09`09/*`20clear`20old`20junk`20*/ X`09clearok(curscr,`20TRUE); X`09wrefresh(curscr);`09`09/*`20repaint`20current`20screen`20*/ X`09move(y,x);`09`09`09/*`20put`20cursor`20back`20where`20it`20was`20*/ X`09refresh(); X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/ X`09`7D Xif`20(h`20`26`26`20(c`20==`20'?'`20`7C`7C`20c`20==`20'h'`20`7C`7C`20c`20==`20' VH'))`20`7B`09/*`20user`20needs`20help`20*/ X`09dohelp();`09`09`09/*`20give`20it`20to`20'em`20*/ X`09touchwin(stdscr);`09`09/*`20Make`20sure`20the`20screen`20gets`20updated`20* V/ X`09wrefresh(stdscr);`09`09/*`20Now`20refresh`20it`20*/ X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/ X`09`7D Xif`20(h`20`26`26`20(c`20==`20'%'`20`7C`7C`20c`20==`20'#'))`20`7B`09/*`20user V`20wants`20stats`20*/ X`09dostats(Current_Game);`09`09/*`20give`20it`20to`20'em`20*/ X`09touchwin(stdscr);`09`09/*`20Make`20sure`20the`20screen`20gets`20updated`20* V/ X`09wrefresh(stdscr);`09`09/*`20Now`20refresh`20it`20*/ X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/ X`09`7D Xif`20(e`20`26`26`20isprint(c))`20`7B`09`09/*`20echo`20char?`20*/ X`09addch(c);`09`09/*`20yup`20*/ X`09refresh(); X`09`7D Xreturn(c); X`7D X X X/*---------------------------------------------------------------------- X`20*`09PClearScreen`20--`20clear`20the`20screen`20somehow X`20* X`20*`20This`20function`20clears`20the`20physical`20display`20without`20affecti Vng`20what X`20*`20the`20curses`20package`20thinks`20is`20there.`20`20If`20the`20"cl"`20(c Vlear`20screen) X`20*`20capability`20is`20defined,`20it`20uses`20that.`20`20If`20that`20fails, V`20it`20tries X`20*`20to`20move`20to`200,0`20and`20use`20the`20"cd"`20(clear`20to`20end`20of V`20display). X`20*`20Failing`20that,`20it`20goes`20to`20the`20bottom`20of`20the`20screen`20a Vnd`20scrolls X`20*`20it`2024`20times. X`20*---------------------------------------------------------------------- X`20*/ X X#ifndef`20vaxc XPRIVATE`20PClearScreen() X`7B Xchar`20*s,`20*x,`20buf`5B80`5D; X Xx`20=`20buf; Xif`20(`20(s`20=`20tgetstr("cl",`26x))`20==`20NULL)`20`7B`09`09/*`20no`20clear V`20screen`20*/ X`09if`20(`20(s`20=`20tgetstr("cd",`26x))`20!=`20NULL)`20`7B`09/*`20do`20we`20h Vave`20clr`20to`20end?`20*/ X`09`09move(0,0);`09`09/*`20yup,`20use`20it`20*/ X`09`09refresh(); X`09`09fputs(s,stdout); X`09`09`7D X`09else`20`7B`09`09`09/*`20well,`20do`20it`20the`20hard`20way`20*/ X`09`09move(23,0); X`09`09refresh(); X`09`09printf("`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn V`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn"); X`09`09`7D X`09`7D Xelse X`09fputs(s,stdout);`09/*`20send`20clear`20screen`20*/ Xfflush(stdout);`09`09`09/*`20git`20along,`20li'l`20characters`20*/ X`7D X#endif X X X/*---------------------------------------------------------------------- X`20*`09FeGetComment`20--`20prompt`20for`20a`20comment`20to`20send`20along`20wi Vth`20a`20move X`20* X`20*`20This`20function`20allows`20the`20user`20to`20enter`20a`202-line`20comme Vnt.`20`20If`20the X`20*`20user`20types`20a`20non-empty`20string,`20it`20is`20stored`20in`20the V`20mycmt/mycmt2 X`20*`20fields`20of`20the`20game`20structure`20passed`20as`20an`20argument.`20 V`20The`20previous`20comment, X`20*`20if`20any,`20is`20discarded.`20`20The`20number`20of`20lines`20read`20is V`20returned, X`20*`20or`20-1`20if`20PGetString`20was`20terminated`20by`20ESC.`20`20This`20ha Vs`20the`20effect`20of X`20*`20aborting`20the`20Send`20command. X`20*---------------------------------------------------------------------- X`20*/ X XFeGetComment(g) Xstruct`20game`20*g; X`7B Xchar`20buf`5B120`5D; Xchar`20*lptrs`5B2`5D; Xint`20n; X Xn`20=`20PGetString(buf,56,lptrs,2,19,6);`09/*`20get`20new`20comment`20*/ Xif`20(n`20<`200)`20`7B`09`09`09/*`20user`20hit`20escape,`20back`20out`20of`20s Vend`20*/ X`09PDrawComment(WHO_ME,`20g);`09`09/*`20put`20my`20old`20comment`20back`20*/ X`09return(-1);`09`09`09/*`20return`20"escape"`20code`20*/ X`09`7D Xif`20(g->mycmt`20!=`20NULL)`09`09/*`20throw`20away`20old`20comment`20*/ X`09free(g->mycmt); Xif`20(g->mycmt2`20!=`20NULL) X`09free(g->mycmt2); Xif`20(n`20>`200) X`09g->mycmt`20=`20save(lptrs`5B0`5D);`09/*`20save`20first`20line`20*/ Xelse X`09g->mycmt`20=`20NULL;`09/*`20mark`20comment`20as`20empty`20*/ Xif`20(n`20>`201) X`09g->mycmt2`20=`20save(lptrs`5B1`5D);`09/*`20save`20second`20line`20*/ Xelse X`09g->mycmt2`20=`20NULL; Xreturn(n); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09PGetString`20--`20read`20a`20multi-line`20string`20from`20the`20user X`20* X`20*`20This`20function`20allows`20the`20user`20to`20enter`20multiple`20lines V`20of`20a`20fixed`20maximum X`20*`20length.`20`20The`20normal`20line`20editing`20characters`20are`20recogni Vzed`20and X`20*`20processed.`20`20These`20include: X`20*`09DEL/BS`09`09The`20character`20before`20the`20cursor`20is`20deleted. X`20*`09`5EX/`5EU`09`09The`20entire`20line`20is`20erased. X`20*`09`5EL/`5ER`09`09The`20screen`20is`20redrawn. X`20*`09`5EW/`5EB`09`09The`20word`20before`20the`20cursor`20is`20erased. X`20*`20Typing`20past`20the`20end`20of`20a`20line`20automatically`20causes`20a V`20word- X`20*`20wrap`20to`20the`20next`20line.`20`20Words`20are`20delimited`20by`20spac Ves.`20`20Typing X`20*`20a`20carriage`20return`20or`20line`20feed`20on`20the`20last`20line,`20or V`20on`20an`20empty X`20*`20line,`20terminates`20PGetString;`20otherwise,`20it`20moves`20to`20the V`20next`20line. X`20*`20ESC`20terminates`20PGetString`20regardless`20of`20the`20cursor`20positi Von. X`20*`20Backspacing`20from`20the`20beginning`20of`20one`20line`20to`20the`20end V`20of`20the`20previous X`20*`20is`20allowed.`20`20PGetString`20returns`20the`20number`20of`20lines`20e Vntered, X`20*`20or`20-1`20if`20it`20was`20terminated`20by`20an`20ESC. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20PGetString(buf,len,lines,nls,y,x) Xchar`20*buf,`20*lines`5B`5D; Xint`20len,`20nls,`20y,`20x; X`7B Xchar`20c,`20*bp,`20*p; Xint`20cl,`20l; X Xfor`20(cl`20=`200;`20cl`20<`20nls;`20cl++)`20`7B X`09lines`5Bcl`5D`20=`20NULL;`09`09/*`20clear`20line`20pointers`20*/ X`09mvaddstr(y+cl,x,BLANKS(len));`09/*`20clear`20line`20*/ X`09`7D Xcl`20=`200;`09`09`09`09`09/*`20current`20line`20=`200`20*/ Xl`20=`200;`09`09`09`09/*`20length`20of`20current`20line`20*/ Xmove(y,x);`09`09`09/*`20go`20to`20first`20location`20in`20field`20*/ Xbp`20=`20buf;`09`09`09/*`20ptr`20to`20next`20storage`20location`20*/ Xlines`5B0`5D`20=`20buf;`09`09`09/*`20init`20first`20line`20pointer`20*/ Xrefresh(); Xwhile`20(1)`20`7B X`09switch`20(c`20=`20PGetChr(0,0))`20`7B X`09case`20'`5C177':`09`09/*`20DEL`20*/ X`09case`20'`5Cb':`09`09/*`20BS`20*/ X`09`09if`20(l`20<=`200)`20`7B`09/*`20at`20beginning`20of`20line`20*/ X`09`09`09if`20(cl`20<=`200)`09/*`20on`20first`20line`20*/ X`09`09`09`09break;`09`09/*`20nothing`20to`20delete`20*/ X`09`09`09cl--;`09`09/*`20back`20up`20one`20line`20*/ X`09`09`09*--bp`20=`20'`5C0';`09/*`20back`20up`20buffer`20pointer`20*/ X`09`09`09l`20=`20strlen(lines`5Bcl`5D);`09/*`20load`20line`20length`20*/ X`09`09`09move(y+cl,x+l);`09/*`20move`20cursor`20to`20end`20of`20prev`20line V`20*/ X`09`09`09`7D X`09`09else`20`7B X`09`09`09bp--;`09`09/*`20back`20up`20buffer`20pointer`20*/ X`09`09`09l--;`09`09/*`20decrement`20length`20*/ X`09`09`09move(y+cl,x+l); X`09`09`09addch('`20');`09/*`20erase`20the`20char`20from`20the`20screen`20*/ X`09`09`09move(y+cl,x+l); X`09`09`09`7D X`09`09refresh(); X`09`09break; X`09case`20'`5C2':`09`09/*`20`5EB`20--`20erase`20previous`20character`20*/ X`09case`20'`5C27':`09`09/*`20`5EW`20*/ X`09`09if`20(l`20<=`200)`20`7B`09`09/*`20beginning`20of`20line`20*/ X`09`09`09if`20(cl`20<=`200)`09/*`20on`20first`20line`20*/ X`09`09`09`09break;`09`09/*`20nothing`20to`20delete`20*/ X`09`09`09cl--;`09`09/*`20back`20up`20one`20line`20*/ X`09`09`09*--bp`20=`20'`5C0';`09/*`20back`20up`20buffer`20pointer`20*/ X`09`09`09l`20=`20strlen(lines`5Bcl`5D);`09/*`20load`20line`20length`20*/ X`09`09`09`7D X`09`09while`20(l`20>`200)`20`7B`09`09/*`20skip`20leading`20spaces,`20if`20any V`20*/ X`09`09`09if`20(*--bp`20!=`20'`20')`20`7B X`09`09`09`09bp++; X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09l--; X`09`09`09*bp`20=`20'`5C0'; X`09`09`09`7D X`09`09while`20(l`20>`200)`20`7B`09`09/*`20delete`20to`20last`20space`20*/ X`09`09`09if`20(*--bp`20==`20'`20')`20`7B X`09`09`09`09bp++; X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09*bp`20=`20'`5C0'; X`09`09`09l--; X`09`09`09mvaddch(y+cl,x+l,'`20'); X`09`09`09`7D X`09`09move(y+cl,x+l); X`09`09refresh(); X`09`09break; X`09case`20'`5C33':`09`09/*`20ESC`20*/ X`09`09*bp++`20=`20'`5C0';`09`09/*`20terminate`20the`20string`20*/ X`09`09return(-1);`09`09/*`20return`20abort`20code`20*/ X`09case`20'`5Cr':`09`09/*`20CR`20*/ X`09case`20'`5Cn':`09`09/*`20NL`20*/ X`09`09*bp++`20=`20'`5C0';`09/*`20terminate`20the`20string`20*/ X`09`09if`20(l`20<=`200)`09`09/*`20empty`20line`20*/ X`09`09`09return(cl);`09/*`20don't`20include`20it`20in`20#lines`20*/ X`09`09if`20(cl`20>=`20nls-1)`09`09/*`20last`20line`20*/ X`09`09`09return(cl+1);`09/*`20return`20number`20of`20lines`20*/ X`09`09lines`5B++cl`5D`20=`20bp;`09/*`20go`20to`20next`20line`20*/ X`09`09l`20=`200; X`09`09move(y+cl,x); X`09`09refresh(); X`09`09break; X`09case`20'`5C30':`09`09/*`20`5EX`20--`20erase`20entire`20line`20`26`20goto V`20prev`20line`20*/ X`09case`20'`5C25':`09`09/*`20`5EU`20*/ X`09`09mvaddstr(y+cl,x,BLANKS(len)); X`09`09if`20(cl`20>`200)`20`7B`09/*`20back`20up`20one`20line`20*/ X`09`09`09bp`20=`20lines`5Bcl--`5D`20-`201; X`09`09`09l`20=`20strlen(lines`5Bcl`5D); X`09`09`09`7D X`09`09else`20`7B`09`09/*`20already`20on`20top`20line,`20go`20to`20beginning V`20*/ X`09`09`09bp`20=`20buf; X`09`09`09l`20=`200; X`09`09`09`7D X`09`09move(y+cl,x+l); X`09`09refresh(); X`09`09break; X`09case`20'`5Ct':`09`09`09/*`20convert`20tab`20to`20a`20space`20*/ X`09`09c`20=`20'`20'; X`09`09/*`20fall`20through`20*/ X`09default: X`09`09if`20(iscntrl(c))`7B`09`09/*`20bad`20char`20*/ X`09`09`09fputc('`5C7',stderr);`09/*`20beep`20*/ X`09`09`09fflush(stderr); X`09`09`09break;`09`09`09/*`20`26`20ignore`20character`20*/ X`09`09`09`7D X`09`09if`20(l`20>=`20len)`20`7B`09`09/*`20typed`20up`20to`20end`20of`20line V`20*/ X`09`09`09if`20(cl`20>=`20nls-1)`20`7B`09/*`20last`20line,`20can't`20go`20on V`20*/ X`09`09`09`09fputc('`5C7',stderr);`09/*`20beep`20*/ X`09`09`09`09fflush(stderr); X`09`09`09`09break;`09`09/*`20`26`20ignore`20character`20*/ X`09`09`09`09`7D X`09`09`09*bp++`20=`20c;`09`09/*`20store`20rcvd`20char`20*/ X`09`09`09for`20(p`20=`20bp-1;`20(l`20>`200)`20`26`26`20(!`20isspace(*p));`20p- V-,`20l--); X`09`09`09if`20(`20(p`20<=`20buf)`20`7C`7C`20(*p`20==`20'`5C0')`20)`20`7B X`09`09`09`09*bp++`20=`20'`5C0'; X`09`09`09`09lines`5B++cl`5D`20=`20bp;`09/*`20didn't`20find`20word`20*/ X`09`09`09`09l`20=`200; X`09`09`09`09`7D X`09`09`09else`20`7B X`09`09`09`09*p++`20=`20'`5C0';`09/*`20terminate`20previous`20line`20*/ X`09`09`09`09mvaddstr(y+cl,x,BLANKS(len));`09/*`20redraw`20*/ X`09`09`09`09mvaddstr(y+cl,x,lines`5Bcl`5D);`09/*`20w/o`20word`20*/ X`09`09`09`09lines`5B++cl`5D`20=`20p;`09/*`20start`20new`20line`20*/ X`09`09`09`09*bp`20=`20'`5C0';`09`09/*`20terminate`20word`20*/ X`09`09`09`09l`20=`20strlen(p);`09`09/*`20set`20line`20len`20*/ X`09`09`09`09mvaddstr(y+cl,x,p);`09/*`20draw`20word`20*/ X`09`09`09`09`7D X`09`09`09move(y+cl,x+l); X`09`09`09`7D X`09`09else`20`7B X`09`09`09*bp++`20=`20c;`09`09/*`20put`20char`20in`20string`20*/ X`09`09`09l++;`09`09`09/*`20bump`20length`20*/ X`09`09`09addch(c);`09`09/*`20echo`20char`20to`20screen`20*/ X`09`09`09`7D X`09`09refresh(); X`09`09break; X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawMenu`20--`20draw`20menu`20choices`20in`20menu`20box X`20* X`20*`20This`20function`20takes`20an`20array`20of`20strings,`20terminated`20by V`20a`20NULL X`20*`20pointer,`20and`20writes`20each`20string`20into`20successive`20lines`20o Vf`20the X`20*`20menu`20box`20in`20the`20bottom`20right`20corner`20of`20the`20screen. V`20`20If`20there`20are X`20*`20more`20strings`20than`20will`20fit`20in`20the`20box,`20the`20extra`20st Vrings`20are X`20*`20ignored.`20`20If`20NULL`20is`20passed`20as`20the`20menu`20array,`20the V`20menu`20box X`20*`20is`20cleared. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawMenu(m) Xchar`20*m`5B`5D; X`7B Xint`20i; X Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B`09`09/*`20clear`20all`20lines`20in V`20menu`20box`20*/ X`09move(19+i,63); X`09clrtoeol(); X`09`7D Xif`20(m`20==`20NULL)`09`09`09`09/*`20no`20menu`20to`20display`20*/ X`09return; Xfor`20(i`20=`200;`20(m`5Bi`5D`20!=`20NULL)`20`26`26`20(i`20<`205);`20i++)`20 V`7B X`09if`20(strlen(m`5Bi`5D)`20>`2015)`09`09/*`20menu`20string`20is`20too`20long V`20*/ X`09`09m`5B15`5D`20=`20'`5C0';`09`09/*`20so`20shorten`20it`20*/ X`09mvaddstr(19+i,64,m`5Bi`5D);`09`09/*`20put`20string`20in`20menu`20area`20*/ X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeMenu`20--`20get`20menu`20choice`20from`20user X`20* X`20*`20This`20function`20accepts`20a`20menu`20choice`20from`20the`20user.`20 V`20The`20menu`20choices X`20*`20are`20passed`20as`20an`20array`20of`20strings,`20terminated`20by`20a V`20NULL`20pointer. X`20*`20Users`20select`20one`20of`20these`20strings`20by`20typing`20the`20first V`20letter`20of`20the X`20*`20string,`20thus`20the`20first`20letter`20of`20the`20strings`20must`20be V`20unique. X`20* X`20*`20FeMenu`20also`20handles`20two`20special`20cases: X`20*`091.`20The`20user`20types`20a`20number`20between`201`20and`206`20(a`20rol Vl) X`20*`092.`20The`20user`20types`20some`20character`20that`20the`20caller`20wish Ves X`20*`09`20`20`20to`20handle`20directly. X`20*`20If`20a`20roll`20entry`20is`20valid,`20the`20caller`20may`20pass`20up V`20to`20two`20different X`20*`20rolls`20that`20are`20valid`20in`20the`20r1`20and`20r2`20arguments.`20 V`20Any`20characters X`20*`20the`20caller`20wishes`20to`20handle`20are`20passed`20as`20a`20string V`20in`20the X`20*`20"extra"`20argument.`20`20These`20typically`20include`20space`20and`20ne Vwline. X`20* X`20*`20When`20a`20menu`20item`20is`20selected,`20it`20is`20highlighted`20befor Ve`20FeMenu X`20*`20returns.`20`20If`20the`20caller`20calls`20FeMenu`20again`20without`20po Vsting`20a X`20*`20new`20menu`20(via`20FeDrawMenu),`20the`20character`20returned`20by`20Fe VMenu X`20*`20on`20the`20first`20call`20should`20be`20passed`20in`20the`20"prev"`20ar Vgument`20so X`20*`20that`20choice`20can`20be`20un-highlighted.`20`20If`20there`20is`20no V`20previous X`20*`20choice`20to`20unhighlight,`20prev`20can`20be`20'`5C0'. X`20*---------------------------------------------------------------------- X`20*/ X Xchar`20FeMenu(m,r1,r2,extra,prev) Xchar`20*m`5B`5D;`09`09`09/*`20array`20of`20menu`20choices`20*/ Xint`20r1,`20r2;`09`09`09/*`20rolls`20(pass`200`20if`20no`20roll`20valid)`20*/ Xchar`20*extra;`09`09`09/*`20chars`20that`20caller`20wants`20to`20handle`20*/ Xchar`20prev;`09`09`09/*`20previous`20choice`20we`20should`20un-highlight`20*/ X`7B Xint`20i; Xchar`20c,`20x; X XFeOffMenuItem(m,prev); Xwhile`20(1)`20`7B X`09mvaddch(18,69,'`20'); X`09move(18,69);`09`09`09/*`20put`20cursor`20in`20its`20little`20box`20*/ X`09refresh(); X`09c`20=`20PGetChr(1,1);`09`09/*`20get`20a`20character`20*/ X`09FeMessage(NULL);`09`09/*`20clear`20message`20line`20*/ X`09if`20(`20(extra`20!=`20NULL)`20`26`26`20(strchr(extra,c)`20!=`20NULL)`20) X`09`09return(c);`09`09/*`20these`20chars`20are`20handled`20by`20caller`20*/ X`09if`20(`20(c`20>=`20'1')`20`26`26`20(c`20<=`20'6')`20)`20`7B`09/*`20handle V`20digits`20differently`20*/ X`09`09if`20(r1`20<=`200)`20`7B X`09`09`09FeMessage("Roll`20not`20valid`20here."); X`09`09`09continue; X`09`09`09`7D X`09`09x`20=`20c`20-`20'0';`09`09/*`20convert`20to`20number`20*/ X`09`09if`20(`20(x`20==`20r1)`20`7C`7C`20(x`20==`20r2)`20)`09/*`20is`20it`20a V`20valid`20roll?`20*/ X`09`09`09return(c);`09`09/*`20yup,`20return`20it`20*/ X`09`09FeMessage("No`20such`20roll."); X`09`09continue; X`09`09`7D X`09if`20(islower(c))`09`09`09/*`20ignore`20case`20*/ X`09`09c`20=`20toupper(c); X`09for`20(i`20=`200;`20m`5Bi`5D`20!=`20NULL;`20i++)`20`7B`09/*`20search`20menu V`20strings`20*/ X`09`09x`20=`20*m`5Bi`5D; X`09`09if`20(islower(x))`09`09`09/*`20ignore`20case`20*/ X`09`09`09x`20=`20toupper(x); X`09`09if`20(c`20!=`20x)`09`09`09/*`20this`20isn't`20it`20*/ +-+-+-+-+-+-+-+- END OF PART 8 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 9 -+-+-+-+-+-+-+-+ X`09`09`09continue;`09`09/*`20keep`20looking`20*/ X`09`09FeOnMenuItem(m,c);`09`09/*`20highlight`20selection`20*/ X`09`09return(c); X`09`09`7D X`09FeMessage("Invalid`20command."); X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeMessage`20--`20print`20a`20highlighted`20message`20on`20bottom`20line V X`20* X`20*`20This`20function`20prints`20a`20string`20in`20reverse`20video`20on`20lin Ve`2023. X`20*`20The`20message`20length`20is`20restricted`20to`2062`20characters`20to V`20avoid X`20*`20running`20into`20the`20menu`20box.`20`20If`20NULL`20is`20passed`20as V`20a`20message, X`20*`20the`20message`20line`20is`20cleared. X`20*---------------------------------------------------------------------- X`20*/ X XFeMessage(s) Xchar`20*s; X`7B Xchar`20c`20=`200; X Xmvaddstr(23,0,BLANKS(62));`09`09/*`20clear`20message`20line`20*/ Xif`20(s`20!=`20NULL)`20`7B`09`09/*`20if`20we`20have`20a`20message`20to`20print V`20*/ X`09if`20(strlen(s)`20>`2062)`20`7B`09/*`20check`20that`20it's`20not`20too`20lo Vng`20*/ X`09`09c`20=`20s`5B62`5D;`09/*`20save`20char`20at`20this`20position`20*/ X`09`09s`5B62`5D`20=`20'`5C0';`09/*`20and`20end`20the`20string`20*/ X`09`09`7D X`09move(23,0); X`09PReverseText(); X`09addstr(s);`09`09/*`20print`20the`20message`20*/ X`09PEndReverse(); X`09if`20(c`20!=`20'`5C0')`09`09/*`20if`20we`20shortened`20it,`20restore`20it V`20*/ X`09`09s`5B62`5D`20=`20c; X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeStatusLine`20--`20draw`20string`20on`20status`20line X`20* X`20*`20This`20function`20puts`20a`20string`20on`20line`2018`20in`20reverse`20v Video.`20`20It`20is X`20*`20used`20to`20display`20blots`20hit,`20double`20offers,`20etc. X`20*---------------------------------------------------------------------- X`20*/ X XFeStatusLine(s) Xchar`20*s; X`7B Xchar`20c`20=`200; Xint`20l; X Xmvaddstr(18,10,BLANKS(50));`09/*`20clear`20status`20line`20*/ Xif`20(s`20!=`20NULL)`20`7B`09`09/*`20if`20we`20have`20a`20message`20to`20print V`20*/ X`09if`20(`20(l`20=`20strlen(s))`20>`2050)`20`7B`09/*`20check`20that`20it's`20n Vot`20too`20long`20*/ X`09`09c`20=`20s`5B50`5D;`09/*`20save`20char`20at`20this`20position`20*/ X`09`09s`5B50`5D`20=`20'`5C0';`09/*`20and`20end`20the`20string`20*/ X`09`09l`20=`2050; X`09`09`7D X`09move(18,(50`20-`20l)/2`20+`2010); X`09PReverseText(); X`09addstr(s);`09`09/*`20print`20the`20message`20*/ X`09PEndReverse(); X`09if`20(c`20!=`20'`5C0')`09`09/*`20if`20we`20shortened`20it,`20restore`20it V`20*/ X`09`09s`5B50`5D`20=`20c; X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawCube`20--`20draw`20doubling`20cube X`20* X`20*`20This`20function`20draws`20the`20doubling`20cube.`20`20The`20cube`20is V`20displayed`20beside X`20*`20the`20inner`20table`20of`20the`20player`20who`20owns`20it`20(i.e.`20the V`20one`20who`20didn't X`20*`20double`20last).`20`20If`20neither`20player`20has`20doubled,`20the`20cub Ve`20is`20drawn X`20*`20in`20the`20middle`20of`20the`20board. X`20*---------------------------------------------------------------------- X`20*/ X XFeDrawCube(g) Xstruct`20game`20*g; X`7B Xint`20r,`20c; Xchar`20buf`5B8`5D; X Xmvaddstr(3,0,"`20`20`20`20");`09`09/*`20clear`20all`20cube`20locations`20*/ Xmvaddstr(10,0,"`20`20`20`20"); Xmvaddstr(17,0,"`20`20`20`20"); Xif`20(g->gameval`20==`20(1`20<<`20g->adcnt))`09/*`20nobody`20has`20doubled`20* V/ X`09r`20=`2010;`09`09`09/*`20cube`20is`20in`20the`20middle`20of`20the`20board V`20*/ Xelse`20`7B`09`09`09/*`20assume`20I`20didn't`20double`20last,`20mydir`20is`20up V,`20*/ X`09r`20=`200;`09`09/*`20and`20board`20is`20not`20inverted`20*/ X`09if`20(g->flags`20`26`20F_IDOUBLED)`09/*`20if`20I`20did`20double`20last`20*/ V X`09`09r`20=`201`20-`20r;`09`09/*`20switch`20rows`20*/ X`09if`20(g->mydir`20<`200)`09`09/*`20if`20my`20direction`20is`20down`20*/ X`09`09r`20=`201`20-`20r;`09`09/*`20switch`20rows`20*/ X`09if`20(g->flags`20`26`20F_INVERT)`09/*`20if`20board`20is`20inverted`20*/ X`09`09r`20=`201`20-`20r;`09`09/*`20switch`20rows`20*/ X`09r`20=`20r`20?`2017`20:`203;`09`09`09/*`20which`20row`20am`20I`20left`20with V?`20*/ X`09`7D X Xsprintf(buf,"%d",g->gameval);`09`09/*`20generate`20the`20game`20value`20*/ Xif`20(`20(c`20=`204`20-`20strlen(buf))`20<`200)`20`7B`09/*`20doubled`20past V`204`20digits?`20*/ X`09strcpy(buf,"****");`09`09/*`20we`20are`20out`20of`20columns`20*/ X`09c`20=`200; X`09`7D Xmove(r,c); XPReverseText(); Xmvaddstr(r,c,buf);`09`09/*`20go`20there`20and`20draw`20game`20value`20*/ XPEndReverse(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09PDrawComment`20--`20print`20a`20comment`20stored`20in`20a`20game X`20* X`20*`20This`20function`20takes`20a`20pointer`20to`20a`20game`20and`20draws`20t Vhe`20comment X`20*`20strings`20to`20the`20screen.`20`20If`20"who"`20is`20WHO_ME,`20the`20"my Vcmt"`20strings X`20*`20are`20drawn`20on`20lines`2019`20and`2020.`20`20Otherwise,`20the`20"opcm Vt"`20strings X`20*`20are`20drawn`20on`20lines`2021`20and`2022.`20`20Any`20unused`20space`20o Vn`20these`20lines X`20*`20is`20cleared. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20PDrawComment(who,g) Xint`20who; Xstruct`20game`20*g; X`7B Xint`20line; Xchar`20*s1,`20*s2; X Xline`20=`20(who`20==`20WHO_OPP)`20?`2021`20:`2019; Xs1`20=`20(who`20==`20WHO_OPP)`20?`20g->opcmt`20:`20g->mycmt; Xs2`20=`20(who`20==`20WHO_OPP)`20?`20g->opcmt2`20:`20g->mycmt2; Xmvaddstr(line,6,BLANKS(56)); Xmvaddstr(line+1,6,BLANKS(56)); Xif`20(s1`20!=`20NULL)`20`7B X`09if`20(strlen(s1)`20>`2056) X`09`09s1`5B56`5D`20=`20'`5C0'; X`09mvaddstr(line,6,s1); X`09`7D Xif`20(s2`20!=`20NULL)`20`7B X`09if`20(strlen(s2)`20>`2056) X`09`09s2`5B56`5D`20=`20'`5C0'; X`09mvaddstr(line+1,6,s2); X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09PReverseText`20--`20go`20into`20reverse`20video`20mode X`20* X`20*`20This`20function`20goes`20into`20what`20is`20hopefully`20reverse`20video V.`20`20It X`20*`20uses`20the`20standout()`20call`20from`20curses,`20which`20actually`20on Vly X`20*`20does`20whatever`20:so`20is`20set`20to`20in`20termcap`20(or`20the`20equi Vvalent X`20*`20in`20terminfo).`20`20This`20is`20not`20necessarily`20reverse,`20but`20t Vhe X`20*`20only`20way`20to`20be`20sure`20of`20getting`20reverse`20(setattr)`20is V`20not X`20*`20portable.`20`20For`20VMS,`20the`20standout`20call`20uses`20bold`20rathe Vr`20than X`20*`20reverse,`20so`20we`20use`20setattr. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20PReverseText() X`7B X X#ifdef`20VMS Xsetattr(_REVERSE); X#else Xstandout(); X#endif X`7D X X X/*---------------------------------------------------------------------- X`20*`09PEndReverse`20--`20go`20back`20to`20normal`20text X`20* X`20*`20This`20function`20reverses`20PReverseText,`20going`20back`20to`20unhigh Vlighted`20text. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20PEndReverse() X`7B X X#ifdef`20VMS Xclrattr(_REVERSE); X#else Xstandend(); X#endif X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeOnMenuItem`20--`20highlight`20a`20menu`20item X`20* X`20*`20This`20function`20highlights`20a`20menu`20item.`20`20This`20is`20used V`20to`20show`20the`20menu X`20*`20selection`20that`20was`20picked.`20`20It`20stays`20highlighted`20until V`20FeOffMenuItem X`20*`20is`20called`20or`20a`20new`20menu`20is`20displayed. X`20*---------------------------------------------------------------------- X`20*/ X XFeOnMenuItem(m,p) Xchar`20*m`5B`5D; Xchar`20p; X`7B Xint`20i; X Xfor`20(i`20=`200;`20m`5Bi`5D`20`26`26`20(i`20<`205);`20i++)`20`7B X`09if`20(*m`5Bi`5D`20==`20p)`20`7B X`09`09move(19+i,63); X`09`09clrtoeol(); X`09`09move(19+i,64); X`09`09PReverseText(); X`09`09addstr(m`5Bi`5D); X`09`09PEndReverse(); X`09`09`7D X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeOffMenuItem`20--`20unhighlight`20a`20menu`20item X`20* X`20*`20This`20function`20un-highlights`20a`20menu`20item.`20`20This`20is`20use Vd`20when`20another X`20*`20pick`20is`20going`20to`20be`20made`20from`20the`20same`20menu. X`20*---------------------------------------------------------------------- X`20*/ X XFeOffMenuItem(m,p) Xchar`20*m`5B`5D; Xchar`20p; X`7B Xint`20i; X Xfor`20(i`20=`200;`20m`5Bi`5D`20`26`26`20(i`20<`205);`20i++)`20`7B X`09if`20(*m`5Bi`5D`20==`20p)`20`7B X`09`09move(19+i,63); X`09`09clrtoeol(); X`09`09move(19+i,64); X`09`09addstr(m`5Bi`5D); X`09`09`7D X`09`7D Xrefresh(); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDumpScreen`20--`20copy`20screen`20image`20to`20a`20file X`20* X`20*`20This`20function`20reads`20all`20characters`20off`20the`20screen`20and V`20copies X`20*`20them`20to`20a`20file.`20`20It`20uses`20the`20inch()`20function`20from V`20the`20curses X`20*`20library`20to`20read`20the`20screen.`20`20It`20returns`201`20for`20succe Vss,`200`20for`20failure. X`20*---------------------------------------------------------------------- X`20*/ X XFeDumpScreen(fn) Xchar`20*fn; X`7B XFILE`20*fp; Xint`20x,`20y; X Xif`20(`20(fp`20=`20fopen(fn,"w"))`20==`20NULL) X`09return(0); Xfor`20(y`20=`200;`20y`20<`2024;`20y++)`20`7B X`09for`20(x`20=`200;`20x`20<`2080;`20x++)`20`7B X`09`09move(y,x); X`09`09putc(inch(),fp); X`09`09`7D X`09putc('`5Cn',fp); X`09`7D Xfclose(fp); X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeYesNo`20--`20see`20if`20user`20knows`20what`20he's`20doing X`20* X`20*`20This`20function`20displays`20a`20message`20and`20waits`20for`20a`20sing Vle`20character X`20*`20from`20the`20user.`20`20If`20it`20is`20Y`20or`20y,`201`20is`20returned, V`20otherwise X`20*`200`20is`20returned. X`20*---------------------------------------------------------------------- X`20*/ XFeYesNo(msg) Xchar`20*msg; X`7B Xchar`20c; X Xif`20(msg`20==`20NULL) X`09msg`20=`20"Are`20you`20sure?`20`5Byn`5D"; XFeMessage(msg); Xc`20=`20PGetChr(0,0); XFeMessage(NULL); Xreturn(`20(c`20==`20'y')`20`7C`7C`20(c`20==`20'Y')`20); X`7D $ call unpack FE_CURSES.C;1 1900969471 "" $! $ create 'f' X/*`09flist_none.c`09`094/24/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09filelist`20--`20generate`20a`20list`20of`20all`20matching`20files. X`20* X`20*`20This`20is`20a`20dummy`20function`20that`20can`20be`20used`20to`20disabl Ve`20filename X`20*`20matching.`20`20It`20just`20copies`20the`20pattern`20into`20a`201-elemen Vt`20list X`20*`20and`20returns`20it.`20`20This`20can`20be`20used`20if`20flist_unix`20doe Vs`20not`20work, X`20*`20or`20if`20filename`20matching`20is`20not`20desired. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20flist`20*filelist(ptn) Xchar`20*ptn; X`7B Xstruct`20flist`20*cur; X Xif`20(`20(cur`20=`20(struct`20flist`20*)`20calloc(sizeof(struct`20flist),1)) V`20==`20NULL) X`09fatal("Out`20of`20memory!"); Xcur->name`20=`20save(ptn); Xreturn(cur); X`7D $ call unpack FLIST_NONE.C;1 2135181073 "" $! $ create 'f' X/*`09flist_unix.c`09`094/24/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X/*`20This`20file`20uses`20the`20"regex-glob"`20routines,`20written`20by`20John V`20Kercheval,`20and X`20*`20posted`20to`20comp.sources.misc.`20`20The`20code`20appears`20at`20the V`20end`20of`20this X`20*`20file`20with`20all`20original`20comments. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09filelist`20--`20generate`20a`20list`20of`20all`20matching`20files. X`20* X`20*`20This`20function`20generates`20a`20list`20of`20all`20files`20that`20matc Vh`20a`20pattern. X`20*`20Each`20file`20is`20stored`20in`20an`20instance`20of`20struct`20flist, V`20which`20just X`20*`20links`20the`20names`20in`20a`20linked`20list.`20`20A`20pointer`20to`20t Vhe`20beginning`20of X`20*`20the`20list`20is`20returned.`20`20It`20is`20the`20callers`20responsibili Vty`20to`20free X`20*`20the`20list`20when`20it`20is`20no`20longer`20needed. X`20* X`20*`20This`20function`20will`20only`20recognize`20wildcards`20in`20file`20nam Ves,`20NOT X`20*`20the`20directories`20leading`20up`20to`20them.`20`20For`20example,`20nut Vs/ldb*.txt`20is X`20*`20fine,`20but`20*ts/ldb*.txt`20is`20not. X`20* X`20*`20This`20function`20uses`20the`20"new"`20directory`20routines`20(i.e.`20o Vpendir, X`20*`20readdir,`20et.`20al).`20`20If`20these`20are`20not`20on`20your`20system, V`20you`20should X`20*`20have`20defined`20NEED_READDIR`20in`20your`20Makefile. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20flist`20*filelist(ptn) Xchar`20*ptn; X`7B Xstruct`20flist`20*head,`20*tail,`20*cur; XDIR`20*dp; Xchar`20*s; Xchar`20*dn,`20*pn; Xstruct`20direct`20*p; X Xhead`20=`20NULL; Xif`20(is_pattern(ptn)`20==`200)`20`7B`09/*`20no`20wildcards,`20just`20a`20file V`20name`20*/ X`09if`20(`20(cur`20=`20(struct`20flist`20*)`20calloc(sizeof(struct`20flist),1) V)`20==`20NULL) X`09`09fatal("Out`20of`20memory!"); X`09head`20=`20cur; X`09tail`20=`20cur; X`09cur->name`20=`20save(ptn); X`09return(cur); X`09`7D Xif`20(`20(s`20=`20strrchr(ptn,'/'))`20!=`20NULL)`20`7B`09/*`20strip`20off`20di Vrectory`20name`20*/ X`09*s`20=`20'`5C0'; X`09dn`20=`20save(ptn);`09`09/*`20dir`20=`20everything`20before`20last`20/`20 V`20*/ X`09pn`20=`20save(s+1);`09`09/*`20pattern`20=`20everything`20after`20last`20/ V`20`20*/ X`09*s`20=`20'/'; X`09`7D Xelse`20`7B X`09dn`20=`20save("."); X`09pn`20=`20save(ptn); X`09`7D Xif`20(`20(dp`20=`20opendir(dn))`20==`20NULL)`20`7B X`09free(dn); X`09free(pn); X`09return(NULL); X`09`7D Xwhile`20(`20(p`20=`20readdir(dp))`20!=`20NULL)`20`7B X`09if`20(`20(strcmp(p->d_name,".")`20==`200)`20`7C`7C`20(strcmp(p->d_name,".." V)`20==`200)`20) X`09`09continue; X`09if`20(match(pn,p->d_name)`20==`200) X`09`09continue; X`09if`20(`20(cur`20=`20(struct`20flist`20*)`20calloc(sizeof(struct`20flist),1) V)`20==`20NULL) X`09`09fatal("Out`20of`20memory!"); X`09if`20(head`20==`20NULL)`20`7B X`09`09head`20=`20cur; X`09`09tail`20=`20cur; X`09`09`7D X`09else`20`7B X`09`09tail->next`20=`20cur; X`09`09tail`20=`20cur; X`09`09`7D X`09if`20(strcmp(dn,".")`20==`200)`09/*`20file`20in`20current`20dir`20*/ X`09`09cur->name`20=`20save(p->d_name);`09/*`20just`20save`20name`20*/ X`09else`20`7B`09`09`09`09/*`20include`20directory`20name`20*/ X`09`09cur->name`20=`20(char`20*)`20malloc(strlen(dn)+strlen(p->d_name)+2); X`09`09if`20(cur->name`20==`20NULL) X`09`09`09fatal("Out`20of`20memory!"); X`09`09sprintf(cur->name,"%s/%s",dn,p->d_name); X`09`09`7D X`09`7D Xclosedir(dp); Xfree(dn); Xfree(pn); Xreturn(head); X`7D X X X/*`20regex-glob`20code`20follows:`20(de-ansified`20by`20P.`20Ross`20--`20sorry V)`20*/ X X/* X`20EPSHeader X X`20`20`20File:`20match.c X`20`20`20Author:`20J.`20Kercheval X`20`20`20Created:`20Sat,`2001/05/1991`20`2022:21:49 X*/ X/* X`20EPSRevision`20History X X`20`20`20J.`20Kercheval`20`20Wed,`2002/20/1991`20`2022:29:01`20`20Released`20t Vo`20Public`20Domain X*/ X X/* X`20`20`20Wildcard`20Pattern`20Matching X*/ X X X/*`20#include`20"match.h"`20--`20match.h`20included`20here`20for`20simplicity V`20`20P.`20Ross`20*/ X X/* X`20EPSHeader X X`20`20`20File:`20match.h X`20`20`20Author:`20J.`20Kercheval X`20`20`20Created:`20Sat,`2001/05/1991`20`2022:27:18 X*/ X/* X`20EPSRevision`20History X X`20`20`20J.`20Kercheval`20`20Wed,`2002/20/1991`20`2022:28:37`20`20Released`20t Vo`20Public`20Domain X*/ X X/* X`20`20`20Wildcard`20Pattern`20Matching X*/ X X#ifndef`20BOOLEAN X#`20define`20BOOLEAN`20int X#undef`20TRUE X#undef`20FALSE X#`20define`20TRUE`201 X#`20define`20FALSE`200 X#endif X X/*---------------------------------------------------------------------------- V X* X*`20`20Match`20the`20pattern`20PATTERN`20against`20the`20string`20TEXT; X*`20`20return`20TRUE`20if`20it`20matches,`20FALSE`20otherwise. X* X*`20`20A`20match`20means`20the`20entire`20string`20TEXT`20is`20used`20up`20in V`20matching. X* X*`20`20In`20the`20pattern`20string: X*`20`20`20`20`20`20`20`60*'`20matches`20any`20sequence`20of`20characters X*`20`20`20`20`20`20`20`60?'`20matches`20any`20character X*`20`20`20`20`20`20`20`5BSET`5D`20matches`20any`20character`20in`20the`20speci Vfied`20set, X*`20`20`20`20`20`20`20`5B!SET`5D`20or`20`5B`5ESET`5D`20matches`20any`20charact Ver`20not`20in`20the`20specified`20set. X* X*`20`20Note:`20the`20standard`20regex`20character`20'+'`20(one`20or`20more) V`20should`20by X*`20`20`20`20`20`20`20`20simulated`20by`20using`20"?*"`20which`20is`20equivela Vnt`20here. X* X*`20`20A`20set`20is`20composed`20of`20characters`20or`20ranges;`20a`20range V`20looks`20like X*`20`20character`20hyphen`20character`20(as`20in`200-9`20or`20A-Z). X*`20`20`5B0-9a-zA-Z_`5D`20is`20the`20set`20of`20characters`20allowed`20in`20C V`20identifiers. X*`20`20Any`20other`20character`20in`20the`20pattern`20must`20be`20matched`20ex Vactly. X* X*`20`20To`20suppress`20the`20special`20syntactic`20significance`20of`20any`20o Vf`20`60`5B`5D*?!`5E-`5C', X*`20`20and`20match`20the`20character`20exactly,`20precede`20it`20with`20a`20 V`60`5C'. X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20match`20(`20/*`20char`20*pattern,`20char`20*text`20*/`20); X X/*---------------------------------------------------------------------------- V X* X*`20Return`20TRUE`20if`20PATTERN`20has`20any`20special`20wildcard`20characters V X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20is_pattern`20(`20/*`20char`20*pattern`20*/`20); X X/*`20--`20end`20of`20match.h`20`20P.`20Ross`20--`20*/ X X#define`20ABORT`202`20`20`20`20`20/*`20end`20of`20search`20indicator`20*/ X XBOOLEAN`20regex_match_after_star`20(`20/*`20char`20*pattern,`20char`20*text V`20*/`20); X X/*---------------------------------------------------------------------------- V X* X*`20Return`20TRUE`20if`20PATTERN`20has`20any`20special`20wildcard`20characters V X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20is_pattern`20(p) Xchar`20*p; X`7B X`20`20`20`20while`20(`20*p`20)`20`7B X`20`20`20`20`20`20`20`20switch`20(`20*p++`20)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20case`20'?': X`20`20`20`20`20`20`20`20`20`20`20`20case`20'*': X`20`20`20`20`20`20`20`20`20`20`20`20case`20'`5B': X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20TRUE; X`20`20`20`20`20`20`20`20`20`20`20`20case`20'`5C`5C': X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20!*p++`20)`20return V`20FALSE; X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`7D X`20`20`20`20return`20FALSE; X`7D X X X/*---------------------------------------------------------------------------- V X* X*`20`20Match`20the`20pattern`20PATTERN`20against`20the`20string`20TEXT; X*`20`20return`20TRUE`20if`20it`20matches,`20FALSE`20otherwise. X* X*`20`20A`20match`20means`20the`20entire`20string`20TEXT`20is`20used`20up`20in V`20matching. X* X*`20`20In`20the`20pattern`20string: X*`20`20`20`20`20`20`20`60*'`20matches`20any`20sequence`20of`20characters X*`20`20`20`20`20`20`20`60?'`20matches`20any`20character X*`20`20`20`20`20`20`20`5BSET`5D`20matches`20any`20character`20in`20the`20speci Vfied`20set, X*`20`20`20`20`20`20`20`5B!SET`5D`20or`20`5B`5ESET`5D`20matches`20any`20charact Ver`20not`20in`20the`20specified`20set. X* X*`20`20Note:`20the`20standard`20regex`20character`20'+'`20(one`20or`20more) V`20should`20by X*`20`20`20`20`20`20`20`20simulated`20by`20using`20"?*"`20which`20is`20equivela Vnt`20here. X* X*`20`20A`20set`20is`20composed`20of`20characters`20or`20ranges;`20a`20range V`20looks`20like X*`20`20character`20hyphen`20character`20(as`20in`200-9`20or`20A-Z). X*`20`20`5B0-9a-zA-Z_`5D`20is`20the`20set`20of`20characters`20allowed`20in`20C V`20identifiers. X*`20`20Any`20other`20character`20in`20the`20pattern`20must`20be`20matched`20ex Vactly. X* X*`20`20To`20suppress`20the`20special`20syntactic`20significance`20of`20any`20o Vf`20`60`5B`5D*?!`5E-`5C', X*`20`20and`20match`20the`20character`20exactly,`20precede`20it`20with`20a`20 V`60`5C'. X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20regex_match`20(p,`20t) Xregister`20char`20*p; Xregister`20char`20*t; X`7B X`20`20`20`20register`20char`20range_start,`20range_end;`20`20/*`20start`20and V`20end`20in`20range`20*/ X X`20`20`20`20BOOLEAN`20invert;`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20is V`20this`20`5B..`5D`20or`20`5B!..`5D`20*/ X`20`20`20`20BOOLEAN`20member_match;`20`20`20`20`20`20`20/*`20have`20I`20matche Vd`20the`20`5B..`5D`20construct?`20*/ X`20`20`20`20BOOLEAN`20loop;`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20s Vhould`20I`20terminate?`20*/ X X`20`20`20`20for`20(`20;`20*p;`20p++,`20t++`20)`20`7B X X`20`20`20`20`20`20`20`20/*`20if`20this`20is`20the`20end`20of`20the`20text`20th Ven`20this`20is`20the`20end`20of`20the`20match`20*/ X`20`20`20`20`20`20`20`20if`20(!*t)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20return`20(`20*p`20==`20'*'`20`26`26`20*++p V`20==`20'`5C0'`20)`20?`20TRUE`20:`20ABORT; X`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20/*`20determine`20and`20react`20to`20pattern`20type`20* V/ X`20`20`20`20`20`20`20`20switch`20(`20*p`20)`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20single`20any`20character`20match`20*/ V X`20`20`20`20`20`20`20`20`20`20`20`20case`20'?': X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20break; X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20multiple`20any`20character`20match V`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20case`20'*': X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20regex_match_after_sta Vr`20(p,`20t); X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20`5B..`5D`20construct,`20single`20memb Ver/exclusion`20character`20match`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20case`20'`5B':`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20move`20to`20beginning`20o Vf`20range`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20p++; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20check`20if`20this`20is V`20a`20member`20match`20or`20exclusion`20match`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20invert`20=`20FALSE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20*p`20==`20'!'`20`7C V`7C`20*p`20==`20'`5E')`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20invert`20=`20TRUE; V X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20p++; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20closing`20bracket V`20here`20or`20at`20range`20start`20then`20we`20have`20a X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20malformed`20pattern V`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20*p`20==`20'`5D'`20) V`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20ABORT; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20member_match`20=`20FALSE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20loop`20=`20TRUE; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20while`20(`20loop`20)`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20end`20of V`20construct`20then`20loop`20is`20done`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(*p`20==`20' V`5D')`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20loop V`20=`20FALSE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20contin Vue; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20matching`20a V`20'!',`20'`5E',`20'-',`20'`5C'`20or`20a`20'`5D'`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20*p`20== V`20'`5C`5C'`20)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20range_ Vstart`20=`20range_end`20=`20*++p; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20else`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20range_ Vstart`20=`20range_end`20=`20*p; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20end`20of V`20pattern`20then`20bad`20pattern`20(Missing`20'`5D')`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(!range_start V) X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return V`20ABORT; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20move`20to`20n Vext`20pattern`20char`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20p++; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20check`20for V`20range`20bar`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(*p`20==`20'- V')`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20g Vet`20the`20range`20end`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20range_ Vend`20=`20*++p; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20s Vpecial`20character`20range`20end`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( Vrange_end`20==`20'`5C`5C') X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20range_end`20=`20*++p; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20i Vf`20end`20of`20pattern`20or`20construct`20then`20bad`20pattern`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( Vrange_end`20==`20'`5C0'`20`7C`7C`20range_end`20==`20'`5D') X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20return`20ABORT; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20the`20te Vxt`20character`20is`20in`20range`20then`20match`20found. X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20make`20su Vre`20the`20range`20letters`20have`20the`20proper X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20relations Vhip`20to`20one`20another`20before`20comparison`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20range_sta Vrt`20<`20range_end`20`20)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( V*t`20>=`20range_start`20`26`26`20*t`20<=`20range_end)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20member_match`20=`20TRUE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20loop`20=`20FALSE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20else`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( V*t`20>=`20range_end`20`26`26`20*t`20<=`20range_start)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20member_match`20=`20TRUE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20loop`20=`20FALSE; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20there`20was`20a`20ma Vtch`20in`20an`20exclusion`20set`20then`20no`20match`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20there`20was`20no`20m Vatch`20in`20a`20member`20set`20then`20no`20match`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20((invert`20`26`26`20membe Vr_match)`20`7C`7C X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20!(invert`20`7C`7C`20m Vember_match)) X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20FALSE; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20this`20is`20not`20an V`20exclusion`20then`20skip`20the`20rest`20of`20the`20`5B...`5D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20construct`20that V`20already`20matched.`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(member_match)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20while`20(*p`20!= V`20'`5D')`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20b Vad`20pattern`20(Missing`20'`5D')`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( V!*p) X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20return`20ABORT; X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20s Vkip`20exact`20match`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20( V*p`20==`20'`5C`5C')`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20p++; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20m Vove`20to`20next`20pattern`20char`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20p++; X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20break; X`20`20`20`20`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20next`20character`20is`20quoted`20and V`20must`20match`20exactly`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20case`20'`5C`5C': X X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20/*`20move`20pattern`20pointer V`20to`20quoted`20char`20and`20fall`20through`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20p++; X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20must`20match`20this`20character`20exa Vctly`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20default: X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20if`20(*p`20!=`20*t) X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20FALSE; X`20`20`20`20`20`20`20`20`7D X`20`20`20`20`7D X X`20`20`20`20/*`20if`20end`20of`20text`20not`20reached`20then`20the`20pattern V`20fails`20*/ X`20`20`20`20return`20!*t; X`7D X X X/*---------------------------------------------------------------------------- V X* X*`20recursively`20call`20regex_match`20with`20final`20segment`20of`20PATTERN V`20and`20of`20TEXT. X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20regex_match_after_star`20(p,`20t) Xregister`20char`20*p; Xregister`20char`20*t; X`7B X`20`20`20`20register`20BOOLEAN`20match; X`20`20`20`20register`20nextp; X X`20`20`20`20/*`20pass`20over`20existing`20?`20and`20*`20in`20pattern`20*/ X`20`20`20`20while`20(`20*p`20==`20'?'`20`7C`7C`20*p`20==`20'*'`20)`20`7B X X`20`20`20`20`20`20`20`20/*`20take`20one`20char`20for`20each`20?`20*/ X`20`20`20`20`20`20`20`20if`20(`20*p`20==`20'?'`20)`20`7B X X`20`20`20`20`20`20`20`20`20`20`20`20/*`20if`20end`20of`20text`20then`20no`20ma Vtch`20*/ X`20`20`20`20`20`20`20`20`20`20`20`20if`20(`20!*t++`20)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20return`20ABORT; X`20`20`20`20`20`20`20`20`20`20`20`20`7D X`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20/*`20move`20to`20next`20char`20in`20pattern`20*/ X`20`20`20`20`20`20`20`20p++; X`20`20`20`20`7D X X`20`20`20`20/*`20if`20end`20of`20pattern`20we`20have`20matched`20regardless V`20of`20text`20left`20*/ X`20`20`20`20if`20(`20!*p`20)`20`7B X`20`20`20`20`20`20`20`20return`20TRUE; X`20`20`20`20`7D X X`20`20`20`20/*`20get`20the`20next`20character`20to`20match`20which`20must`20be V`20a`20literal`20or`20'`5B'`20*/ X`20`20`20`20nextp`20=`20*p; X`20`20`20`20if`20(`20nextp`20==`20'`5C`5C'`20) X`20`20`20`20`20`20`20`20nextp`20=`20p`5B1`5D; X X`20`20`20`20/*`20Continue`20until`20we`20run`20out`20of`20text`20or`20definite V`20result`20seen`20*/ X`20`20`20`20match`20=`20FALSE; X`20`20`20`20while`20(`20match`20==`20FALSE`20)`20`7B X X`20`20`20`20`20`20`20`20/*`20a`20precondition`20for`20matching`20is`20that`20t Vhe`20next`20character X`20`20`20`20`20`20`20`20`20`20`20in`20the`20pattern`20match`20the`20next`20cha Vracter`20in`20the`20text`20or`20that X`20`20`20`20`20`20`20`20`20`20`20the`20next`20pattern`20is`20the`20beginning V`20of`20a`20range.`20`20Increment`20text X`20`20`20`20`20`20`20`20`20`20`20pointer`20as`20we`20go`20here`20*/ X`20`20`20`20`20`20`20`20if`20(`20*p`20==`20*t`20`7C`7C`20nextp`20==`20'`5B' V`20)`20`7B X`20`20`20`20`20`20`20`20`20`20`20`20match`20=`20regex_match(p,`20t); X`20`20`20`20`20`20`20`20`7D X X`20`20`20`20`20`20`20`20/*`20if`20the`20end`20of`20text`20is`20reached`20then V`20no`20match`20*/ X`20`20`20`20`20`20`20`20if`20(`20!*t++`20)`20match`20=`20ABORT; X`20`20`20`20`7D X X`20`20`20`20/*`20return`20result`20*/ X`20`20`20`20return`20match; X`7D X X/*---------------------------------------------------------------------------- V X* X*`20This`20is`20a`20shell`20to`20regex_match`20to`20return`20only`20a`20true V`20BOOLEAN`20value X* X----------------------------------------------------------------------------*/ V X XBOOLEAN`20match(p,`20t) Xchar`20*p; Xchar`20*t; X`7B X`20`20`20`20return`20(`20regex_match(p,t)`20==`20TRUE`20)`20?`20TRUE`20:`20FAL VSE; X`7D $ call unpack FLIST_UNIX.C;1 1711290471 "" $! $ create 'f' X/*`09flist_vms.c`09`094/24/92 X`20* X`20*`20Copyright`201992`20`20Earle`20Ake`20and`20Perry`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09filelist`20--`20generate`20a`20list`20of`20all`20matching`20files. X`20* X`20*`20This`20function`20generates`20a`20list`20of`20all`20files`20that`20matc Vh`20a`20pattern. X`20*`20Each`20file`20is`20stored`20in`20an`20instance`20of`20struct`20flist, V`20which`20just X`20*`20links`20the`20names`20in`20a`20linked`20list.`20`20A`20pointer`20to`20t Vhe`20beginning`20of X`20*`20the`20list`20is`20returned.`20`20It`20is`20the`20callers`20responsibili Vty`20to`20free X`20*`20the`20list`20when`20it`20is`20no`20longer`20needed. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20flist`20*filelist(ptn) Xchar`20*ptn; X`7B Xchar`20nextfile`5B257`5D; Xint`20context`20=`200; Xstruct`20flist`20*head,`20*tail,`20*cur; X Xhead`20=`20NULL; Xwhile`20(1)`20`7B X`09if`20(scan_files(ptn,`26nextfile,`26context)`20==`200) X`09`09return(head); X`09if`20(`20(cur`20=`20(struct`20flist`20*)`20calloc(sizeof(struct`20flist),1) V)`20==`20NULL) X`09`09fatal("Out`20of`20memory!"); X`09if`20(head`20==`20NULL)`20`7B X`09`09head`20=`20cur; X`09`09tail`20=`20cur; X`09`09`7D X`09else`20`7B X`09`09tail->next`20=`20cur; X`09`09tail`20=`20cur; X`09`09`7D X`09cur->name`20=`20save(nextfile); X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09scan_files`20--`20find`20the`20next`20file`20matching`20a`20pattern X`20* X`20*`20This`20function`20finds`20the`20next`20(or`20first)`20file`20matching V`20a`20given X`20*`20pattern.`20`20The`20pattern`20is`20interpreted`20in`20the`20same`20way V`20as`20DCL. X`20*`20If`20the`20pattern`20does`20not`20specify`20a`20version`20number,`20';* V'`20is X`20*`20the`20default.`20`20scan_files`20returns`201`20if`20a`20file`20was`20fo Vund, X`20*`200`20if`20there`20are`20no`20more`20matching`20files. X`20*---------------------------------------------------------------------- X`20*/ X Xint`20scan_files(itm_files,nextfile,context) X`09char`20*itm_files,`20*nextfile; X`09int`20*context; X`7B X`09char`20*def_spec`20=`20";*"; X`09int`20status; X`09unsigned`20key`5B2`5D; X`09char`20fnam`5B257`5D,`20*s; X`09static`20struct`20RAB`20itmrab; X`09static`20struct`20dsc$descriptor`20itm_dsc,`20defspec_dsc; X`09$DESCRIPTOR(fnam_dsc,fnam); X X`09if`20(*context`20==`200)`20`7B X`09`09itm_dsc.dsc$w_length`20=`20strlen(itm_files); X`09`09itm_dsc.dsc$b_dtype`20=`20DSC$K_DTYPE_T; X`09`09itm_dsc.dsc$b_class`20=`20DSC$K_CLASS_S; X`09`09itm_dsc.dsc$a_pointer`20=`20itm_files; X X`09`09defspec_dsc.dsc$w_length`20=`20strlen(def_spec); X`09`09defspec_dsc.dsc$b_dtype`20=`20DSC$K_DTYPE_T; X`09`09defspec_dsc.dsc$b_class`20=`20DSC$K_CLASS_S; X`09`09defspec_dsc.dsc$a_pointer`20=`20def_spec; X X`09`09itmrab.rab$l_kbf`20=`20(char`20*)`20key; X`09`09itmrab.rab$b_krf`20=`200; X`09`09itmrab.rab$b_ksz`20=`208; X`09`09itmrab.rab$l_rop`20=`20RAB$M_RRL`20`7C`20RAB$M_NLK`20; X`09`09itmrab.rab$b_rac`20=`20RAB$C_KEY; X`09`7D X X`09if`20((status`20=`20lib$find_file(`26itm_dsc,`26fnam_dsc,context, X`09`09`26defspec_dsc,0,0,0))`20`26`201)`20`7B X X`09`09fnam`5B256`5D`20=`20'`5C0'; X X`09`09if`20(s`20=`20strchr(fnam,'`20'))`20*s`20=`20'`5C0'; X`09`09strcpy(nextfile,`26fnam); X`09`09return`201; X`09`09`7D X`09else`20`7B X`09`09lib$find_file_end(context); X`09`7D X`09return`200; X`7D $ call unpack FLIST_VMS.C;1 573836067 "" $! $ create 'f' X/*`09game.c`09`098/3/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09startgame`20--`20start`20a`20game X`20* X`20*`20This`20function`20is`20called`20in`20response`20to`20the`20-start`20com Vmand`20line X`20*`20option`20to`20start`20a`20game`20with`20another`20user.`20`20It`20alloc Vates`20a`20game X`20*`20record`20and`20fills`20it`20in,`20then`20sends`20a`20START`20packet`20t Vo`20the`20opponent. X`20*`20The`20arguments`20are: X`20*`09The`20email`20address`20of`20the`20opponent X`20*`09The`20direction`20I`20want`20to`20play X`20*`09The`20color`20I`20want`20to`20play X`20*`09The`20color`20I`20want`20the`20opponent`20to`20play X`20*`09The`20F_JACOBY/F_CRAWFORD/F_EUROPE/F_INVERT/F_PERM`20flags,`20if`20desi Vred. X`20*`09The`20match`20value`20(number`20of`20points`20to`20play`20to) X`20*`09The`20time`20to`20use`20as`20the`20start`20time`20of`20the`20game`20(0 V`20=`20current`20time) X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20game`20*startgame(addr,d,mc,oc,flgs,mch,stime) Xchar`20*addr;`09`09`09/*`20path`20to`20opponent`20*/ Xint`20d;`09`09`09`09/*`20my`20direction`20*/ Xchar`20mc,`20oc;`09`09`09/*`20my`20color,`20opponent's`20color`20*/ Xint`20flgs;`09`09`09/*`20flags`20(F_*)`20*/ Xint`20mch;`09`09`09/*`20match`20score`20*/ Xlong`20stime;`09`09`09/*`20start`20time`20(0`20=`20current`20time)`20*/ X`7B Xstruct`20game`20*g; Xchar`20c1,`20c2,`20*newid; Xstruct`20people`20*ppl; X Xnewid`20=`20makeid();`09`09/*`20give`20it`20a`20unique`20id`20*/ Xg`20=`20addgame();`09`09`09/*`20allocate`20new`20game`20*/ Xg->gameid`20=`20newid;`09`09/*`20store`20new`20id`20*/ Xif`20(rc.debug`20`26`20DB_GSTART)`20`7B X`09message("DB-startgame:`5Ctstarted`20game`20%s`5Cn",newid); X`09message("`5Ct`5Ctwith`20%s`20flags=%04x`20match=%d`5Cn",addr,flgs,mch); X`09`7D Xif`20(`20(ppl`20=`20findppl(addr,P_ADDR`7CP_ALIAS))`20!=`20NULL)`20`7B`09/* V`20we`20know`20this`20guy`20*/ X`09g->opaddr`20=`20save(ppl->addr);`09/*`20copy`20out`20people`20info`20*/ X`09g->opname`20=`20save(ppl->name); X`09g->myaddr`20=`20save(ppl->myaddr); X`09g->ppl`20=`20ppl; X`09`7D Xelse`20`7B`09`09`09`09`09/*`20new`20opponent`20*/ X`09g->opaddr`20=`20save(addr);`09`09/*`20save`20his`20address`20*/ X`09g->opname`20=`20NULL;`09`09/*`20don't`20know`20his`20name`20yet`20*/ X`09g->myaddr`20=`20save(rc.myaddr);`09/*`20store`20my`20return`20address`20*/ X`09newppl(g);`09`09`09/*`20make`20up`20a`20people`20record`20*/ X`09`7D Xg->mycolor`20=`20mc;`09`09/*`20set`20starting`20colors`20*/ Xg->opcolor`20=`20oc; Xg->mydir`20=`20d;`09`09`09/*`20set`20starting`20directions`20*/ Xg->opdir`20=`20REV(d); Xg->gameval`20=`201;`09`09`09/*`20no`20doubles`20yet`20*/ Xg->adcnt`20=`200;`09`09`09/*`20no`20autodoubles`20yet`20*/ Xg->admax`20=`20rc.autodouble;`09/*`20max`20allowed`20autodoubles`20*/ Xg->flags`20=`20flgs`20`26`20(F_JACOBY`7CF_CRAWFORD`7CF_PERM`7CF_EUROPE`7CF_INV VERT); Xg->state`20=`20ST_OPSTART;`09`09/*`20need`20to`20send`20first`20roll`20*/ Xg->seq`20=`201;`09`09`09/*`20start`20with`20sequence`20number`20=`201`20*/ Xg->notify`20=`20notify;`09`09/*`20copy`20notify`20address`20(if`20any)`20*/ Xif`20(d`20>`200)`20`7B X`09c1`20=`20mc;`09/*`20upbound`20color`20is`20mine`20*/ X`09c2`20=`20oc;`09/*`20downbound`20color`20is`20opponent's`20*/ X`09`7D Xelse`20`7B X`09c1`20=`20oc;`09/*`20upbound`20color`20is`20opponent's`20*/ X`09c2`20=`20mc;`09/*`20downbound`20color`20is`20mine`20*/ X`09`7D Xclearmvs(g->mvs); Xclearmvs(g->opmvs); Xnewboard(g->opbd,c1,c2);`09/*`20set`20up`20boards`20for`20new`20game`20*/ Xnewboard(g->mybd,c1,c2); Xnewboard(g->board,c1,c2); Xg->mtotal`20=`20mch; Xg->mvs`5B0`5D.roll`20=`20Rolldie();`09/*`20roll`20an`20initial`20die`20*/ Xif`20(stime`20==`200L) X`09g->starttime`20=`20time(`20(long`20*)`200); Xelse X`09g->starttime`20=`20stime;`09/*`20hack`20to`20detect`20duplicate`20remotesta Vrt`20pkts`20*/ Xg->lastacc`20=`20g->starttime; Xsendpkt(g,START);`09`09/*`20send`20the`20start`20message`20*/ Xreturn(g);`09`09`09/*`20and`20return`20pointer`20to`20new`20game`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09makeid`20--`20create`20a`20unique`20game`20identifier. X`20* X`20*`20This`20function`20creates`20a`20string`20that`20is`20guaranteed`20uniqu Ve`20among`20all X`20*`20ldb`20games`20worldwide,`20provided`20that`20email`20addresses`20are V`20unique. X`20*`20This`20should`20be`20a`20good`20assumption,`20since`20if`20there`20is V`20a`20duplicate, X`20*`20the`20users`20with`20the`20duplicate`20id's`20will`20have`20a`20great V`20deal`20of`20difficulty X`20*`20getting`20mail`20delivered,`20and`20therefore`20won't`20be`20able`20to V`20play`20ldb`20anyway. X`20*`20To`20make`20id's`20created`20by`20the`20same`20user`20unique,`20the`20t Vime`20is X`20*`20appended`20to`20the`20mail`20address;`20to`20make`20sure`20the`20time V`20is`20unique`20when X`20*`20the`20user`20creates`20more`20than`201`20game`20per`20second,`20the`20g Vames`20list`20is`20searched X`20*`20for`20a`20new`20id`20before`20it`20is`20returned`20and,`20if`20it`20is V`20found,`20we`20sleep`20for X`20*`201`20second`20and`20try`20again. X`20*---------------------------------------------------------------------- X`20*/ X Xchar`20*makeid() X`7B Xchar`20*n; X Xif`20(`20(n`20=`20calloc(strlen(rc.myaddr)+10,1))`20==`20NULL) X`09fatal("ERROR:`20Out`20of`20memory!"); Xdo`20`7B X`09sprintf(n,"%s`7C%08x",rc.myaddr,time((long`20*)0)); X`09if`20(findgame(n)`20==`20NULL) X`09`09return(n); X`09sleep(1); X`09`7D`20while`20(1); X`7D X X X/*--------------------------------------------------------------------------- X`20*`09addgame`20--`20allocate`20a`20game`20struct`20and`20link`20it`20into V`20the`20game`20list X`20* X`20*`20This`20function`20allocates`20a`20game`20structure`20and`20links`20it V`20into`20the X`20*`20doubly-linked`20game`20list.`20`20The`20head`20of`20this`20list`20is V`20ghead,`20and`20the X`20*`20tail`20is`20gtail. X`20* X`20*`20NOTE:`20the`20memory-zeroing`20feature`20of`20calloc`20is`20depended V`20on`20to X`20*`09`20initialize`20the`20allocated`20game`20struct. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xstruct`20game`20*addgame() X`7B Xstruct`20game`20*g; X Xif`20(`20(g`20=`20(struct`20game`20*)calloc(sizeof(struct`20game),1))`20==`20N VULL) X`09fatal("Out`20of`20memory!"); Xg->next`20=`20NULL; Xif`20(gtail`20==`20NULL)`20`7B`09`09/*`20this`20is`20the`20first`20game`20in V`20the`20list`20*/ X`09ghead`20=`20g; X`09gtail`20=`20g; X`09g->prev`20=`20NULL; X`09`7D Xelse`20`7B X`09g->prev`20=`20gtail;`09/*`20link`20onto`20end`20of`20list`20*/ X`09gtail->next`20=`20g; X`09gtail`20=`20g; X`09`7D Xreturn(g); X`7D X X X/*---------------------------------------------------------------------- X`20*`09deletegame`20--`20delete`20a`20game`20from`20the`20game`20list X`20* X`20*`20This`20function`20removes`20a`20game`20from`20the`20game`20list`20by V`20linking`20around X`20*`20it,`20then`20frees`20the`20memory`20associated`20with`20the`20game`20st Vructure. X`20*---------------------------------------------------------------------- X`20*/ X Xdeletegame(g) Xstruct`20game`20*g; X`7B X Xif`20(g`20==`20ghead)`20`7B`09`09/*`20deleting`20first`20game`20in`20list`20*/ V X`09ghead`20=`20g->next;`09/*`20move`20head`20pointer`20to`20next`20game`20*/ X`09if`20(ghead`20==`20NULL)`09/*`20we`20just`20deleted`20the`20last`20game`20* V/ X`09`09gtail`20=`20NULL;`09/*`20set`20both`20ptrs`20to`20NULL`20*/ X`09else X`09`09ghead->prev`20=`20NULL;`09/*`20first`20in`20list`20has`20no`20prev`20*/ X`09`7D Xelse`20if`20(g`20==`20gtail)`20`7B`09`09/*`20deleting`20last`20game`20in`20lis Vt`20*/ +-+-+-+-+-+-+-+- END OF PART 9 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 10 -+-+-+-+-+-+-+-+ X`09gtail`20=`20g->prev;`09/*`20move`20tail`20pointer`20back`20*/ X`09gtail->next`20=`20NULL;`09/*`20last`20game`20has`20no`20next`20*/ X`09`7D Xelse`20`7B X`09g->next->prev`20=`20g->prev;`09/*`20link`20back`20link`20around`20g`20*/ X`09g->prev->next`20=`20g->next;`09/*`20and`20forward`20link`20too`20*/ X`09`7D Xif`20(g->gameid`20!=`20NULL) X`09free(g->gameid);`09`09/*`20free`20string`20space`20*/ Xif`20(g->opname`20!=`20NULL) X`09free(g->opname); Xif`20(g->opaddr`20!=`20NULL) X`09free(g->opaddr); Xif`20(g->mycmt`20!=`20NULL) X`09free(g->mycmt); Xif`20(g->mycmt2`20!=`20NULL) X`09free(g->mycmt2); Xif`20(g->opcmt`20!=`20NULL) X`09free(g->opcmt); Xif`20(g->opcmt2`20!=`20NULL) X`09free(g->opcmt2); Xif`20(g->dispmsg`20!=`20NULL) X`09free(g->dispmsg); Xfree(g);`09`09`09/*`20free`20the`20memory`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09findgame`20--`20find`20a`20game`20based`20on`20its`20game`20id X`20* X`20*`20This`20function`20performs`20a`20linear`20search`20through`20the`20game V`20list X`20*`20for`20a`20game`20id.`20`20It`20returns`20a`20pointer`20to`20the`20game, V`20or`20NULL`20if X`20*`20the`20game`20does`20not`20exist. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20game`20*findgame(gid) Xchar`20*gid; X`7B Xstruct`20game`20*g; X Xfor`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next) X`09if`20(strcmp(gid,g->gameid)`20==`200)`09`09/*`20is`20this`20it?`20*/ X`09`09return(g);`09`09`09/*`20return`20it`20*/ Xreturn(NULL);`09`09`09`09`09/*`20no`20such`20game`20*/ X`7D X X X/*--------------------------------------------------------------------------- X`20*`09addppl`20--`20allocate`20a`20people`20struct`20and`20link`20it`20into V`20the`20list X`20* X`20*`20This`20function`20allocates`20a`20people`20structure`20and`20links`20it V`20into`20the X`20*`20people`20list.`20`20The`20head`20of`20this`20list`20is`20phead. X`20* X`20*`20NOTE:`20the`20memory-zeroing`20feature`20of`20calloc`20is`20depended V`20on`20to X`20*`09`20initialize`20the`20allocated`20people`20struct. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xstruct`20people`20*addppl() X`7B Xstruct`20people`20*p,`20*t; X Xfor`20(t`20=`20NULL,`20p`20=`20phead;`20p`20!=`20NULL;`20t`20=`20p,`20p`20= V`20p->next);`20/*`20t`20=`20end`20of`20list`20*/ Xif`20(`20(p`20=`20(struct`20people`20*)calloc(sizeof(struct`20people),1))`20== V`20NULL) X`09fatal("Out`20of`20memory!"); Xif`20(t`20==`20NULL) X`09phead`20=`20p; Xelse X`09t->next`20=`20p; Xp->next`20=`20NULL; Xreturn(p); X`7D X X X/*---------------------------------------------------------------------- X`20*`09findppl`20--`20find`20a`20people`20struct`20by`20address`20or`20alias X`20* X`20*`20This`20function`20performs`20a`20linear`20search`20through`20the`20peop Vle`20list X`20*`20searching`20for`20an`20address`20(if`20flag`20`26`20P_ADDR)`20or`20an V`20alias`20(if`20flag`20`26`20P_ALIAS). X`20*`20It`20returns`20a`20pointer`20to`20the`20struct,`20or`20NULL`20if`20the V`20address`20does`20not`20exist. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20people`20*findppl(a,flag) Xchar`20*a; Xint`20flag; X`7B Xint`20i; Xstruct`20people`20*p; X Xif`20(a`20==`20NULL) X`09fatal("NULL`20address`20in`20findppl"); Xrescan: Xfor`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`20`7B X`09if`20(`20(flag`20`26`20P_ADDR)`20`26`26`20(strcmp(a,p->addr)`20==`200)`20) V`20`7B`20`20`20/*`20check`20addr`20*/ X`09`09if`20(p->equiv`20!=`20NULL)`20`7B`09`09/*`20if`20equiv`20record,`20*/ X`09`09`09a`20=`20p->equiv;`09`09/*`20go`20look`20for`20base`20record`20*/ X`09`09`09goto`20rescan; X`09`09`09`7D X`09`09return(p);`09`09`09/*`20return`20it`20*/ X`09`09`7D X`09if`20(p->equiv`20!=`20NULL)`09`09/*`20equiv`20records`20don't`20have`20alia Vses`20*/ X`09`09continue; X`09if`20(`20(flag`20`26`20P_ALIAS)`20`26`26`20(strcmp(a,p->alias)`20==`200) V`20)`20/*`20check`20alias`20*/ X`09`09return(p); X`09`7D Xreturn(NULL);`09`09`09`09`09/*`20no`20such`20record`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09newppl`20--`20create`20a`20new`20people`20struct`20for`20a`20game X`20* X`20*`20This`20function`20creates`20a`20new`20people`20record`20for`20a`20new V`20opponent.`20`20It`20takes X`20*`20a`20game`20structure,`20extracts`20the`20necessary`20information,`20and V`20inserts X`20*`20the`20new`20record`20into`20the`20people`20list,`20as`20well`20as`20sto Vring`20a`20pointer X`20*`20to`20the`20new`20people`20struct`20into`20the`20game's`20ppl`20pointer. V X`20* X`20*`20The`20alias`20field`20is`20initialized`20to`20the`20first`20word`20of V`20g->opname X`20*`20with`20all`20upper`20case`20converted`20to`20lower. X`20* X`20*`20To`20handle`20people`20with`20more`20than`20one`20e-mail`20address,`20t Vhe`20people`20list X`20*`20is`20scanned`20for`20identical`20name`20fields.`20`20If`20one`20is`20fo Vund,`20the X`20*`20user`20is`20asked`20if`20these`20people`20are`20the`20same.`20`20If`20h Ve`20answers`20yes, X`20*`20the`20"equiv"`20field`20is`20set`20to`20the`20name`20of`20the`20existin Vg`20people X`20*`20record,`20and`20the`20rest`20of`20the`20record`20is`20zeroed`20out. X`20*---------------------------------------------------------------------- X`20*/ X Xstruct`20people`20*newppl(g) Xstruct`20game`20*g; X`7B Xchar`20*a; Xregister`20struct`20people`20*p,`20*q; Xchar`20buf`5B80`5D; X Xif`20(g->opname`20==`20NULL)`20`7B`09/*`20return`20a`20struct,`20but`20don't V`20put`20in`20list`20*/ X`09if`20(`20(p`20=`20(struct`20people`20*)`20calloc(sizeof(struct`20people),1) V)`20==`20NULL) X`09`09fatal("Out`20of`20memory!"); X`09p->addr`20=`20g->opaddr;`09/*`20this`20will`20keep`20everyone`20happy`20unt Vil`20*/ X`09p->name`20=`20"UNKNOWN";`09/*`20we`20find`20out`20what`20his`20name`20is V`20*/ X`09p->alias`20=`20"NONE"; X`09g->ppl`20=`20p; X`09return(p); X`09`7D Xp`20=`20addppl();`09`09`09`09/*`20create`20new`20people`20struct`20*/ Xp->addr`20=`20save(g->opaddr);`09`09/*`20copy`20opponent's`20address`20*/ Xfor`20(q`20=`20phead;`20q`20!=`20NULL;`20q`20=`20q->next)`20`7B X`09if`20(`20(q->name`20!=`20NULL)`20`26`26`20(strcmp(q->name,g->opname)`20== V`200)`20)`20`7B X`09`09printf("The`20following`20e-mail`20addresses:`5Cn`5Cn`5Ct%s`5Cn`5Ct%s V`5Cn`5Cn", X`09`09`09q->addr,g->opaddr); X`09`09printf("have`20the`20same`20name.`20`5B%s`5D`5Cn",g->opname); X`09`09printf("Do`20they`20refer`20to`20the`20same`20person?`20`5Bdefault=yes V`5D`20`20"); X`09`09fgets(buf,sizeof(buf),stdin); X`09`09if`20(`20(*buf`20==`20'n')`20`7C`7C`20(*buf`20==`20'N')`20) X`09`09`09break; X`09`09p->equiv`20=`20save(q->addr); X`09`09g->ppl`20=`20q; X`09`09return(q); X`09`09`7D X`09`7D Xp->equiv`20=`20NULL; Xp->name`20=`20save(g->opname);`09`09/*`20copy`20opponent's`20name`20*/ Xif`20(`20(a`20=`20strchr(g->opname,'`20'))`20!=`20NULL)`09/*`20create`20defaul Vt`20alias`20*/ X`09*a`20=`20'`5C0'; Xp->alias`20=`20save(g->opname);`09`09/*`20first`20word`20of`20opponent's`20nam Ve`20*/ Xif`20(a`20!=`20NULL) X`09*a`20=`20'`20'; Xfor`20(a`20=`20p->alias;`20*a;`20a++)`09`09/*`20converted`20to`20lower`20case V`20*/ X`09if`20(isupper(*a)) X`09`09*a`20=`20tolower(*a); Xp->myaddr`20=`20save(g->myaddr);`09`09/*`20copy`20out`20my`20address`20*/ Xp->fence`20=`200L;`09`09`09`09/*`20no`20fence`20time`20yet`20*/ Xg->ppl`20=`20p;`09`09`09`09/*`20side`20pointer`20from`20game`20struct`20*/ Xreturn(p); X`7D X X X/*---------------------------------------------------------------------- X`20*`09printscore`20--`20print`20the`20cumulative`20score`20for`20each`20oppon Vent X`20* X`20*`20This`20function`20scans`20the`20people`20file`20printing`20the`20conten Vts`20of`20the X`20*`20score`20field`20for`20each`20opponent.`20`20It`20also`20prints`20the V`20total`20over X`20*`20all`20opponents`20at`20the`20end.`20`20For`20the`20following: X`20*`09points X`20*`09games X`20*`09matches X`20*`09gammons X`20*`09backgammons X`20*`20the`20number`20won/lost/net`20is`20printed.`20`20Games`20in`20progress V`20are`20not`20counted, X`20*`20but`20games`20that`20have`20been`20completed`20are,`20even`20if`20they V`20are`20part`20of X`20*`20a`20match`20that`20has`20not`20completed. X`20*---------------------------------------------------------------------- X`20*/ X Xprintscore() X`7B Xregister`20struct`20people`20*p; Xregister`20int`20i; Xint`20total`5B10`5D;`09`09`09/*`20to`20store`20the`20total`20for`20all`20oppon Vent's`20*/ X Xif`20(phead`20==`20NULL)`09`09/*`20nothing`20to`20print`20*/ X`09return; Xprintf("opponent`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20point Vs`20`20`20`20`20games`20`20`20`20`20`20gammons`20`20backgammons`20`20matches V`5Cn"); Xprintf("---------------------------------------------------------------------- V--------`5Cn"); Xfor`20(i`20=`200;`20i`20<`2010;`20i++) X`09total`5Bi`5D`20=`200; Xfor`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`20`7B X`09if`20(p->equiv`20!=`20NULL) X`09`09continue;`09`09/*`20skip`20equiv`20records`20*/ X`09pscore(p->name,p->score);`09/*`20print`20this`20opponent`20*/ X`09for`20(i`20=`200;`20i`20<`2010;`20i++)`09/*`20keep`20running`20total`20*/ X`09`09total`5Bi`5D`20+=`20p->score`5Bi`5D; X`09`7D Xpscore("total",total);`09`09`09/*`20print`20the`20total`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09pscore`20--`20print`20the`20score`20for`20one`20opponent X`20* X`20*`20This`20function`20is`20called`20by`20printscore`20to`20print`20each`20o Vpponent. X`20*`20The`20opponent`20name`20is`20in`20"name",`20and`20the`20score`20table V`20is`20in`20"score". X`20*---------------------------------------------------------------------- X`20*/ X Xpscore(name,score) Xchar`20*name; Xint`20score`5B10`5D; X`7B Xstatic`20int`20sc_idx`5B`5D`20=`20`7B`202,`200,`204,`206,`208`20`7D;`09/*`20or Vder`20to`20print`20p->score`5B`5D`20*/ Xregister`20int`20i,`20diff; Xchar`20buf`5B30`5D; Xchar`20c; X Xif`20(strlen(name)`20>`2025)`20`7B`09/*`20truncate`20name`20to`2025`20chars V`20*/ X`09c`20=`20name`5B25`5D; X`09name`5B25`5D`20=`20'`5C0'; X`09`7D Xelse X`09c`20=`20'`5C0'; Xprintf("%-25s",name); Xif`20(c`20!=`20'`5C0') X`09name`5B25`5D`20=`20c;`09`09/*`20restore`20name`20*/ Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B X`09sprintf(buf,"%d/%d",score`5Bsc_idx`5Bi`5D`5D,score`5Bsc_idx`5Bi`5D+1`5D); X`09buf`5B9`5D`20=`20'`5C0';`09`09/*`20truncate`20to`209`20chars`20*/ X`09if`20(strcmp(buf,"0/0")`20==`200)`09/*`20none`20won`20or`20lost`20*/ X`09`09*buf`20=`20'`5C0';`09`09/*`20just`20leave`20it`20blank`20*/ X`09printf("`20`20%-9s",buf);`09/*`20print`20with`20field`20width`20of`209`20*/ V X`09`7D Xprintf("`5Cn%21s",""); Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B X`09diff`20=`20score`5Bsc_idx`5Bi`5D`5D`20-`20score`5Bsc_idx`5Bi`5D+1`5D; X`09if`20(diff`20==`200)`20`7B X`09`09if`20(`20(score`5Bsc_idx`5Bi`5D`5D`20==`200)`20`26`26`20(score`5Bsc_idx V`5Bi`5D+1`5D`20==`200)`20) X`09`09`09printf("`20`20`20`20`20`20`20`20`20`20`20"); X`09`09else X`09`09`09printf("`20`20`20`20`20`20even`20"); X`09`09`7D X`09else X`09`09printf("`20`20`20`20`20`20%+-5d",`20diff); X`09`7D Xprintf("`5Cn`5Cn"); X`7D X X Xilose(g,term,rsflag) Xstruct`20game`20*g; Xint`20term;`09`09`09/*`20T_*`20*/ Xint`20rsflag;`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/ X`7B Xint`20bg,`20gv; X Xg->state`20=`20ST_GAMEOVER; Xg->term`20=`20term; Xbg`20=`20gvalue(g,`26gv); Xg->mcurrent`5BWHO_OPP`5D`20+=`20gv;`09`09/*`20bump`20match`20count`20*/ Xg->ppl->score`5BSC_GAMESLOST`5D++;`09`09/*`20inc`20games`20lost`20*/ Xg->ppl->score`5BSC_PTSLOST`5D`20+=`20gv; Xif`20(bg`20==`201)`09`09`09/*`20gammon`20*/ X`09g->ppl->score`5BSC_GMNLOST`5D++; Xelse`20if`20(bg`20==`202) X`09g->ppl->score`5BSC_BGLOST`5D++; Xendgame(g,rsflag); X`7D X X Xiwin(g,term,rsflag) Xstruct`20game`20*g; Xint`20term;`09`09`09/*`20T_*`20*/ Xint`20rsflag;`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/ X`7B Xint`20bg,`20gv; X Xg->state`20=`20ST_GAMEOVER; Xg->term`20=`20term; Xbg`20=`20gvalue(g,`26gv); Xg->mcurrent`5BWHO_ME`5D`20+=`20gv;`09`09/*`20bump`20match`20count`20*/ Xg->ppl->score`5BSC_GAMESWON`5D++;`09`09/*`20inc`20games`20lost`20*/ Xg->ppl->score`5BSC_PTSWON`5D`20+=`20gv; Xif`20(bg`20==`201)`09`09`09/*`20gammon`20*/ X`09g->ppl->score`5BSC_GMNWON`5D++; Xelse`20if`20(bg`20==`202) X`09g->ppl->score`5BSC_BGWON`5D++; Xendgame(g,rsflag); X`7D X X Xendgame(g,rsflag) Xstruct`20game`20*g; Xint`20rsflag;`09`09`09`09/*`201`20=`20restart`20game`20if`20necessary`20*/ X`7B X Xif`20(g->ppl->fence`20<`20g->starttime)`20`20`20/*`20if`20newer`20than`20fence V`20*/ X`09g->ppl->fence`20=`20g->starttime;`09/*`20move`20up`20fence`20*/ Xif`20(rsflag`20`26`26`20(g->flags`20`26`20F_PERM)`20`26`26`20(g->mcurrent`5BWH VO_OPP`5D`20>=`20g->mtotal)`20)`20`7B X`09message("Restarted`20game`20with`20%s`20(%s).`5Cn",g->opname,g->opaddr); X`09notify`20=`20NULL; X`09startgame(g->opaddr,g->mydir,g->mycolor,g->opcolor, X`09`20`20`20g->flags`20`26`20(F_JACOBY`7CF_CRAWFORD`7CF_PERM`7CF_EUROPE`7CF_IN VVERT), X`09`20`20`20g->mtotal,0); X`09`7D Xif`20(`20(g->notify`20!=`20NULL)`20`26`26`20(g->mcurrent`5BWHO_OPP`5D`20>=`20g V->mtotal)`20) X`09sendpkt(g,NOTIFY); X`7D $ call unpack GAME.C;1 1430388055 "" $! $ create 'f' X/*`09lock.c`09`094/28/92 X`20* X`20*`20Copyright`201992`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09get_lock`20--`20attempt`20to`20open`20a`20lock`20file,`20exit`20if`20it V`20exists X`20* X`20*`20This`20function`20attempts`20to`20create`20a`20file`20in`20such`20a`20w Vay`20that, X`20*`20if`20the`20file`20exists,`20the`20create`20will`20fail.`20`20If`20the V`20create`20succeeds, X`20*`20we`20"own"`20the`20ldb`20lock,`20and`20have`20the`20exclusive`20right V`20to`20access X`20*`20the`20ldb`20data`20files`20in`20this`20directory.`20`20If`20the`20creat Ve`20fails, X`20*`20some`20other`20ldb`20already`20has`20the`20lock`20and`20we`20exit. X`20* X`20*`20This`20uses`20the`20O_EXCL`20flag`20to`20open,`20which`20as`20far`20as V`20I`20know`20is X`20*`20supported`20on`20all`20UNIX`20flavors.`20`20If`20it`20isn't`20on`20your Vs: X`20*`09a.`20Please`20mail`20me`20at`20ross@emf780.den.mmc.com`20and`20tell`20m Ve X`20*`09`20`20`20what`20your`20system`20is. X`20*`09b.`20try`20replacing`20open(fn,O_...,0644)`20with`20creat(fn,0444). X`20*---------------------------------------------------------------------- X`20*/ X Xget_lock(fn) Xchar`20*fn; X`7B Xint`20fd; Xstruct`20stat`20s; X Xif`20(`20(fd`20=`20open(fn,O_WRONLY`7CO_CREAT`7CO_EXCL,0644))`20<`200)`20`7B X`09printf("ERROR:`20Ldb`20is`20already`20running`20in`20this`20account`20-- V`20exiting.`5Cn`5Cn"); X`09printf("If`20you`20are`20sure`20no`20other`20ldb`20is`20active,`20you`20can V`20remove`5Cn"); X`09printf("the`20lock`20with`20the`20following`20command:`5Cn`5Cn"); X#ifdef`20VMS X`09printf("`5Ct$`20delete`20sys$login:%s;*`5Cn",fn); X#else X`09if`20(*fn`20==`20'/') X`09`09printf("`5Ct$`20rm`20%s`5Cn",fn); X`09else X`09`09printf("`5Ct$`20rm`20$HOME/%s`5Cn",fn); X#endif X`09printf( X`09"`5CnPlease`20be`20certain`20no`20other`20ldb`20is`20running`20before`20doi Vng`20this.`5Cn`5Cn"); X`09if`20(stat(fn,`26s)`20>=`200) X`09`09printf("The`20lock`20file`20was`20created`20%s`5Cn",ctime(`26s.st_ctime) V); X`09exit(STAT_ABORT);`09/*`20DON'T`20call`20ldbexit,`20it`20calls`20release_loc Vk`20*/ X`09`7D Xclose(fd);`09`09/*`20success,`20close`20the`20file`20and`20return`20*/ X`7D $ call unpack LOCK.C;1 1409310034 "" $! $ create 'f' X/*`09main.c`09`098/3/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*============================================================================ V X`20*`09ldb`20--`09Long`20Distance`20Backgammon X`20* X`20*`20The`20following`20arguments`20are`20recognized: X`20*`09-read`09`09Mail`20is`20read,`20and`20the`20games`20are`20updated`20and V`20saved. X`20*`09`09`09The`20user`20is`20not`20prompted`20for`20his`20moves. X`20*`09-play`09`09Any`20games`20that`20are`20waiting`20for`20local`20input`20a Vre X`20*`09`09`09displayed`20for`20the`20user`20to`20process.`20`20No`20mail`20is V`20read. X`20*`09-color`20xy`09The`20colors`20for`20any`20games`20started`20are`20set V`20to`20x`20and`20y. X`20*`09`09`09The`20first`20color`20is`20played`20by`20the`20local`20user,`20an Vd`20the X`20*`09`09`09other`20is`20played`20by`20the`20opponent.`20`20Legal`20color X`20*`09`09`09characters`20are`20upper`20and`20lower`20case`20letters. X`20*`09`09`09The`20default`20is`20"-color`20rw". X`20*`09-direction`20up/down X`20*`09`09`09The`20direction`20of`20play`20for`20the`20local`20user`20is`20set V X`20*`09`09`09to`20the`20specified`20value.`20`20The`20default`20is X`20*`09`09`09"-direction`20up". X`20*`09-myaddr`20addr`09Override`20the`20"myaddr"`20field`20of`20.ldbrc`20for V`20any X`20*`09`09`09games`20started`20by`20this`20invocation`20of`20ldb.`20`20This X`20*`09`09`09is`20effective`20only`20for`20games`20started`20by`20-start X`20*`09`09`09and`20only`20for`20-start's`20that`20appear`20after`20the`20-myad Vdr X`20*`09`09`09on`20the`20command`20line. X`20*`09-start`20user`09A`20game`20is`20started`20with`20the`20specified`20user V.`20`20User`20may X`20*`09`09`09be`20either`20an`20e-mail`20address`20or`20an`20alias`20for`20an X`20*`09`09`09opponent`20that`20has`20been`20played`20previously. X`20*`09-remotestart`20user1`20user2 X`20*`09`09`09A`20game`20is`20started`20between`20user1`20and`20user2.`20`20The V`20local X`20*`09`09`09host`20sends`20a`20remote`20start`20message`20to`20user1`20instru Vcting X`20*`09`09`09it`20to`20start`20a`20game`20with`20user2.`20`20The`20local`20hos Vt X`20*`09`09`09does`20not`20participate`20thereafter`20in`20the`20game. X`20*`09`09`09For`20the`20purposes`20of`20the`20-color`20and`20-direction`20opt Vions, X`20*`09`09`09user1`20is`20considered`20the`20local`20user. X`20*`09-broadcast`20file X`20*`09`09`09A`20file`20is`20mailed`20to`20all`20opponents.`20`20This`20is`20u Vseful X`20*`09`09`09for`20announcing`20vacation`20absences,`20etc. X`20*`09-help`09`09A`20summary`20of`20available`20options`20is`20printed.`20 V`20This X`20*`09`09`09list`20may`20be`20more`20up`20to`20date`20than`20these`20comments V. X`20*`09-jacoby`09`09Enables`20the`20jacoby`20rule`20for`20any`20games`20subseq Vuently X`20*`09`09`09started.`20`20This`20rule`20states`20that`20gammons`20or`20backga Vmmons X`20*`09`09`09only`20count`20as`201`20when`20neither`20player`20doubled`20durin Vg X`20*`09`09`09the`20game. X`20*`09-crawford`09Enables`20the`20crawford`20rule`20for`20any`20games`20subse Vquently X`20*`09`09`09started.`20`20This`20rule`20prevents`20doubling`20when`20either X`20*`09`09`09player`20is`20within`201`20point`20of`20winning`20the`20match. X`20*`09-european`09Enables`20european`20scoring`20for`20any`20subsequently X`20*`09`09`09created`20games.`20`20This`20rule`20makes`20backgammons`20count X`20*`09`09`09as`20double`20games,`20rather`20than`20triple. X`20*`09-permanent`09Marks`20any`20subsequently`20created`20games`20as`20perman Vent. X`20*`09`09`09Permanent`20games`20will`20be`20restarted`20whenever`20they X`20*`09`09`09end.`20`20This`20is`20for`20people`20you`20play`20all`20the`20tim Ve. X`20*`09`09`09Permanent`20games`20must`20be`20deleted`20via`20-control. X`20*`09-match`20points`09Marks`20any`20subsequently`20created`20games`20as`20m Vatches X`20*`09`09`09that`20play`20to`20the`20specified`20number`20of`20points. X`20*`09`09`09Games`20will`20be`20restarted`20until`20one`20player`20wins X`20*`09`09`09this`20number`20of`20points. X`20*`09-control`09Enters`20control`20mode.`20`20No`20games`20may`20be`20starte Vd X`20*`09`09`09or`20played.`20`20Each`20game`20is`20displayed,`20along`20with X`20*`09`09`09a`20menu`20that`20allows`20various`20administrative X`20*`09`09`09functions`20to`20be`20performed. X`20*`09-reconstruct`20file X`20*`09`09`09This`20option`20allows`20you`20to`20recover`20your`20.ldbdata X`20*`09`09`09file`20even`20if`20you`20lose`20all`20copies.`20`20Simply`20have X`20*`09`09`09all`20your`20opponents`20send`20you`20their`20.ldbdata`20files X`20*`09`09`09and,`20one`20by`20one,`20feed`20them`20into`20ldb`20with`20the X`20*`09`09`09-reconstruct`20option.`20`20Ldb`20will`20scan`20the`20file, X`20*`09`09`09find`20any`20games`20that`20have`20your`20name`20as`20the X`20*`09`09`09opponent,`20and`20rebuild`20your`20game`20data`20using`20the X`20*`09`09`09data`20in`20that`20game. X`20*`09-score`09`09Print`20the`20cumulative`20score`20for`20all`20your`20oppon Vents. X`20* X`20*`20If`20neither`20-read`20or`20-play`20is`20given,`20the`20default`20is V`20to`20do`20both;`20incoming`20mail X`20*`20is`20read,`20then`20any`20games`20requiring`20the`20user's`20attention V`20are`20displayed. X`20* X`20*`20Note`20that`20the`20-start`20and`20-remotestart`20options`20use`20the V`20color`20and`20direction X`20*`20options`20that`20have`20been`20set`20*at`20the`20time`20the`20argument V`20is`20processed*. X`20*`20Thus, X`20* X`20*`09ldb`20-start`20joe@momma`20-color`20rb X`20* X`20*`20will`20NOT`20use`20the`20colors`20r`20and`20b`20for`20the`20game`20with V`20joe,`20but X`20* X`20*`09ldb`20-color`20rb`20-start`20joe@momma X`20* X`20*`20will.`20`20The`20color`20and`20direction`20arguments`20may`20be`20chang Ved`20between`20-start X`20*`20and`20-remotestart`20arguments.`20`20For`20example, X`20* X`20*`09ldb`20-color`20wr`20-direction`20down`20-start`20user1`20-direction`20u Vp`20-start`20user2 X`20* X`20*`20will`20start`20a`20game`20with`20user1`20with`20your`20direction`20bein Vg`20down,`20and`20one`20with X`20*`20user2`20with`20your`20direction`20being`20up. X`20* X`20*-------------------------------------------------------------------------- V-- X`20*`09`09`09`09REVISION`20HISTORY X`20***`20Version`2001`20`20`20Rev`200`20`20`20Patch`200 X`20*`201.`09Initial`20release.`20`20Countless`20helpful`20suggestions`20from V`20Karen`20Ward. X`20* X`20***`20Version`2001`20`20`20Rev`201`20`20`20Patch`200 X`20*`201.`09The`20personal`20name`20and`20e-mail`20address`20printed`20on`20th Ve`20top`20line X`20*`09were`20switched.`20`20It`20makes`20more`20sense`20to`20be`20playing`20a V`20person`20rather X`20*`09than`20an`20address.`20`20If`20the`20e-mail`20address`20is`20too`20long V`20to`20fit`20on X`20*`09the`20top`20line,`20it`20is`20truncated`20and`20an`20ellipsis`20is`20ad Vded. X`20*`202.`09Pressing`20ESC`20while`20entering`20a`20comment`20now`20returns V`20you`20to`20the X`20*`09previous`20menu`20and`20discards`20the`20comment.`20`20This`20allows V`20you`20to X`20*`09change`20your`20mind`20after`20hitting`20"Send",`20for`20example.`20 V`20Suggested X`20*`09by`20Franc,ois`20Pinard. X`20*`203.`09The`20checkpoint`20code`20was`20moved`20to`20sendpkt(),`20where V`20the`20games X`20*`09are`20saved`20before`20the`20packet`20is`20sent.`20`20This`20removes V`20a`20window X`20*`09where`20a`20packet`20could`20be`20sent`20but`20ldb`20could`20croak`20be Vfore`20saving X`20*`09the`20game.`20`20Suggested`20by`20Earle`20Ake. X`20*`204.`09Ldb`20will`20not`20ask`20for`20the`20second`20digit`20of`20a`20poi Vnt`20number`20when: X`20*`09`09The`20first`20digit`20is`203`20-`209, X`20*`09`09The`20first`20digit`20is`201`20and`20there`20is`20no`20point`20in V`2010`20-`2019 X`20*`09`09`09that`20could`20use`20the`20selected`20roll,`20or X`20*`09`09The`20first`20digit`20is`202`20and`20there`20is`20no`20point`20in V`2020`20-`2024 X`20*`09`09`09that`20could`20use`20the`20selected`20roll. X`20*`09Suggested`20by`20Earle`20Ake`20and`20Franc,ois`20Pinard. X`20*`205.`09When`20a`20roll`20is`20selected`20and`20a`20piece`20is`20on`20the V`20bar,`20no`20point`20is X`20*`09prompted`20for,`20since`20moving`20off`20the`20bar`20is`20the`20only V`20legal`20move. X`20*`09Suggested`20by`20Franc,ois`20Pinard. X`20*`206.`09The`20Makefile`20now`20used`20$(CC)`20instead`20of`20cc.`20`20Sugg Vested`20by X`20*`09Franc,ois`20Pinard. X`20*`207.`09A`20number`20of`20patches`20to`20make`20ldb`20run`20under`20SCO V`20Xenix`20(and`20probably X`20*`09SCO`20UNIX`20as`20well)`20were`20sent`20by`20Dinesh`20Vichare. X`20*`208.`09A`20bare`20bones`20rename`20function`20is`20included`20for`20those V`20systems`20that X`20*`09don't`20have`20one.`20`20Suggested`20by`20Franc,ois`20Pinard. X`20*`209.`09Comments`20are`20now`20rot13'd`20before`20they`20are`20sent.`20 V`20This`20keeps X`20*`09them`20from`20being`20read`20while`20mail`20is`20extracted.`20`20They V`20are X`20*`09rotated`20back`20when`20ldb`20displays`20them.`20`20This`20is`20disable Vd`20if`20the X`20*`09opponent`20is`20using`20the`20old`20(1.0)`20ldb`20version,`20so`201.1 V`20and`201.0 X`20*`09ldb's`20will`20still`20work`20together.`20`20The`20only`20catch`20is V`20when`20you`20switch X`20*`09from`201.0`20to`201.1`20with`20games`20in`20progress,`20your`20opponent Vs`20won't`20know X`20*`09you've`20switched`20until`20you`20send`20them`20a`20move.`20`20As`20a V`20result,`20the X`20*`09comment`20from`20their`20next`20message`20will`20be`20garbled.`20`20To V`20avoid`20this, X`20*`09do`20"ldb`20-read"`20under`201.0,`20then`20switch`20to`201.1`20to`20pla Vy.`20`20This`20is X`20*`09only`20necessary`20once,`20after`20that`20your`20opponent's`20will`20kn Vow`20you X`20*`09are`20using`201.1`20and`20the`20messages`20will`20work`20normally. X`20*`09Suggested`20by`20Franc,ois`20Pinard. X`20*`2010.`09Ldb`20now`20clears`20the`20screen`20before`20exiting.`20`20Keeps V`20wandering X`20*`09manager`20types`20from`20seeing`20the`20remnants`20of`20a`20game. X`20*`2011.`09The`20sequence`20number`20warning`20was`20removed`20for`20leftove Vr`20messages X`20*`09from`20dead`20games. X`20*`2012.`09There`20is`20now`20a`20"Press`20`20to`20continue"`20befor Ve`20the`20screen X`20*`09is`20drawn`20if`20any`20messages`20were`20printed.`20`20This`20lets`20y Vou`20read X`20*`09the`20messages`20before`20the`20screen`20is`20cleared.`20`20Suggested V`20by X`20*`09practically`20everybody. X`20*`2013.`09Default`20file`20names`20for`20vms`20are`20now`20ldb.rc,`20ldb.da Vta,`20`20and`20ldb.olddata. X`20*`09This`20keeps`20the`20ldb`20files`20together`20and`20out`20of`20the`20wa Vy,`20since`20vms X`20*`09doesn't`20treat`20filenames`20with`20a`20leading`20'.'`20like`20UNIX V`20does. X`20*`09Suggested`20by`20Earle`20Ake. X`20*`2014.`09There`20is`20now`20a`20debug`20setting`20in`20.ldbrc.`20`20It`20i Vs`20a`20mask,`20with`20each X`20*`09bit`20enabling`20debug`20info`20from`20a`20different`20piece`20of`20cod Ve.`20`20The X`20*`09bits`20are`20defined`20as`20DB_*`20in`20ldb.h`20Suggested`20by`20Earle V`20Ake. X`20*`2015.`09A`20sum`20of`20all`20rolls`20is`20kept`20in`20the`20"rolls"`20and V`20"doubles"`20fields X`20*`09of`20the`20game`20structure.`20`20This`20counts`20the`20number`20of`20e Vach`20type`20of X`20*`09roll`20you`20get,`20and`20the`20number`20of`20doubles`20of`20each`20typ Ve. X`20*`09The`20same`20is`20true`20for`20your`20opponent's`20rolls`20and`20double Vs`20in X`20*`09the`20oprolls`20and`20opdoubles`20fields.`20`20Suggested`20by`20Earle V`20Ake. X`20*`2016.`09The`20crawford`20and`20jacoby`20rules`20are`20now`20supported. V`20`20They`20are`20activated X`20*`09by`20the`20-crawford`20and`20-jacoby`20command`20line`20options,`20and V`20can`20only X`20*`09be`20enabled`20by`20whoever`20starts`20the`20game.`20`20If`20they`20are V`20used`20to`20start X`20*`09a`20game`20with`20a`20version`20of`20ldb`20that`20does`20not`20support V`20them,`20a`20message X`20*`09is`20printed`20and`20they`20are`20disabled. X`20*`2017.`09Ldb`20now`20allows`20a`20game`20to`20be`20declared`20"permanent", V`20meaning`20that X`20*`09it`20is`20automatically`20restarted`20when`20it`20is`20over.`20`20This V`20is`20activated X`20*`09the`20the`20-permanent`20command`20line`20option,`20and`20can`20only V`20be`20enabled X`20*`09by`20whoever`20starts`20the`20game. X`20*`2018.`09Ldb`20now`20supports`20match`20play.`20`20This`20is`20activated V`20by`20the`20-match X`20*`09command`20line`20options,`20which`20takes`20a`20numeric`20argument`20sp Vecifying X`20*`09how`20many`20points`20the`20match`20plays`20to.`20`20When`20a`20game V`20that`20is`20part`20of X`20*`09a`20match`20ends,`20and`20the`20specified`20number`20of`20points`20has V`20not`20been`20reached, X`20*`09the`20game`20is`20restarted. X`20*`2019.`09The`20"buttons"`20in`20the`20menu`20in`20fe_curses`20now`20light V`20up`20to`20show`20the X`20*`09item`20that`20was`20chosen. X`20*`2020.`09Ldb`20now`20supports`20the`20"european`20rule",`20which`20states V`20that`20backgammons X`20*`09only`20count`20double,`20not`20triple,`20the`20game`20value. X`20*`2021.`09Ldb`20now`20creates`20a`20lock`20file`20when`20it`20starts`20in V`20such`20a`20way`20as`20to X`20*`09prevent`20multiple`20ldb`20processes`20from`20running`20in`20the`20same V`20account`20at`20the X`20*`09same`20time.`20`20The`20lock`20code`20does`20not`20depend`20on`20any V`20operating`20system X`20*`09locking`20features,`20other`20than`20O_EXCL,`20and`20so`20should`20be V`20fairly`20portable. X`20*`2022.`09There`20is`20now`20an`20option`20in`20.ldbrc`20to`20automatically V`20delete`20mail X`20*`09files`20after`20they`20have`20been`20read.`20`20It`20will`20refuse`20to V`20delete X`20*`09files`20that`20begin`20with`20'/'`20(on`20UNIX`20only)`20to`20help`20pr Vevent X`20*`09catastrophic`20mistakes.`20`20This`20option`20is`20off`20by`20default, X`20*`09and`20should`20only`20be`20used`20with`20great`20care. X`20*`09You`20should`20also`20read`20the`20disclaimer`20at`20the`20top`20of`20t Vhis`20(and`20all X`20*`09other)`20files,`20where`20it`20says`20I'm`20not`20responsible.`20`20Cav Veat`20User. X`20*`2023.`09A`20"timeout"`20setting`20has`20been`20added`20to`20.ldbrc.`20 V`20Games`20that`20have X`20*`09not`20been`20accessed`20for`20more`20than`20"timeout"`20days`20(default V`207), X`20*`09and`20are`20waiting`20on`20remote`20input,`20have`20the`20last`20packet V`20automatically X`20*`09resent.`20`20If`20timeout`20is`20set`20to`200,`20automatic`20resends V`20are`20disabled. X`20*`2024.`09A`20"keepold"`20setting`20has`20been`20added`20to`20.ldbrc.`20 V`20Games`20that`20are`20over X`20*`09are`20retained`20in`20.ldbdata`20for`20"keepold"`20days`20(default`207) V,`20allowing X`20*`09time`20for`20the`20last`20move`20to`20be`20resent`20if`20necessary.`20 V`20If`20"keepold"`20is X`20*`09set`20to`200,`20games`20are`20deleted`20as`20soon`20as`20they`20are`20o Vver. X`20*`2025.`09Old`20start`20packets`20are`20now`20rejected.`20`20To`20do`20this V,`20a`20new`20file X`20*`09called`20the`20"people"`20file`20is`20maintained.`20`20This`20file`20is V`20organised X`20*`09by`20opponent`20address,`20and`20stores`20the`20start`20time`20of`20the V`20newest`20completed X`20*`09game,`20called`20the`20"fence".`20`20Any`20start`20packets`20not`20newe Vr`20than`20the X`20*`09fence`20are`20discarded.`20`20The`20only`20way`20a`20legitimate`20start V`20packet`20would`20be X`20*`09rejected`20is`20if`20it`20were`20not`20fed`20to`20ldb`20until`20after V`20another`20game`20with X`20*`09the`20same`20opponent`20had`20been`20started`20and`20finished.`20`20Thi Vs`20should`20never X`20*`09happen,`20but`20if`20it`20did,`20all`20that`20would`20be`20required`20t Vo`20fix`20it`20would X`20*`09be`20to`20have`20the`20opponent`20resend`20the`20start`20packet`20via V`20-control. X`20*`2026.`09The`20people`20file`20also`20stores`20the`20opponent's`20name`20a Vnd X`20*`09an`20alias,`20or`20nickname,`20for`20the`20opponent.`20`20The`20alias V`20is`20initialized X`20*`09to`20the`20first`20word`20of`20the`20opponent's`20name`20with`20all`20c Vapitals`20changed X`20*`09to`20lower`20case.`20`20To`20change`20an`20opponent's`20alias,`20a`20te Vxt`20editor`20may X`20*`09be`20used`20on`20the`20people`20file.`20`20The`20-start`20command`20wil Vl`20take`20an X`20*`09alias`20in`20place`20of`20an`20e-mail`20address.`20`20There`20is`20no V`20check`20for X`20*`09duplicate`20aliases,`20and`20if`20one`20is`20used`20in`20a`20-start`20c Vommand,`20the X`20*`09game`20will`20be`20started`20with`20the`20first`20record`20found`20in V`20the`20people X`20*`09file`20with`20that`20alias. X`20*`2027.`09The`20people`20file`20also`20stores`20a`20record`20of`20all`20gam Ves`20won/lost`20to X`20*`09that`20opponent.`20`20The`20data`20stored`20includes`20games`20won/lost V,`20points X`20*`09won/lost,`20gammons`20won/lost,`20backgammons`20won/lost,`20and`20match Ves`20won/lost. X`20*`09There`20is`20currently`20no`20utility`20to`20print`20these`20out,`20but V`20they`20can X`20*`09be`20extracted`20from`20the`20people`20file`20manually.`20`20See`20the V`20definitions X`20*`09for`20SC_*`20in`20ldb.h`20to`20see`20which`20number`20is`20which. X`20*`2028.`09There`20is`20now`20a`20way`20to`20reconstruct`20the`20.ldbdata V`20file`20from`20your X`20*`09opponents'`20.ldbdata`20files.`20`20Just`20have`20them`20mail`20their V`20ldbdata X`20*`09files`20to`20you,`20remove`20the`20mail`20header,`20and`20run: X`20*`09`09ldb`20-reconstruct`20file X`20*`09where`20file`20is`20the`20file`20containing`20the`20opponent's`20ldbdat Va`20file. X`20*`09Each`20game`20in`20that`20file`20showing`20you`20as`20the`20opponent V`20is`20extracted X`20*`09and`20inserted`20into`20your`20game`20list.`20`20You`20will`20be`20prom Vpted`20for`20the X`20*`09address`20of`20your`20opponent`20(and`20name,`20if`20they`20are`20not V`20in`20the X`20*`09people`20file)`20for`20each`20game`20found. X`20*`2029.`09The`20people`20file`20has`20a`20method`20for`20handling`20people V`20with`20multiple X`20*`09e-mail`20addresses.`20`20When`20a`20new`20opponent`20is`20found`20with V`20the X`20*`09same`20name`20as`20an`20existing`20one,`20but`20a`20different`20address V,`20the X`20*`09user`20is`20asked`20if`20these`20addresses`20refer`20to`20the`20same V`20person. X`20*`09If`20they`20do,`20an`20"equiv"`20record`20is`20added`20to`20the`20peopl Ve`20file, X`20*`09which`20merely`20records`20that`20the`20second`20address`20refers`20to V`20the X`20*`09same`20person`20as`20the`20first.`20`20If`20they`20don't`20(e.g.`20John V`20Smith), X`20*`09two`20separate`20people`20records`20are`20created`20for`20the`20differe Vnt`20people. X`20*`2030.`09There`20is`20now`20a`20way`20to`20request`20a`20resend`20from`20y Vour`20opponent`20under X`20*`09-control.`20`20The`20menu`20item`20is`20"Get`20Resend",`20since`20"Requ Vest`20Resend" X`20*`09would`20have`20used`20the`20same`20first`20letter`20as`20"Resend".`20(o Vh`20well) X`20*`09A`20special`20packet`20is`20sent`20to`20your`20opponent;`20when`20his V`20ldb`20receives`20it, X`20*`09it`20will`20perform`20a`20resend`20automatically.`20`20This`20feature V`20is`20disabled X`20*`09if`20the`20opversion`20field`20of`20the`20game`20structure`20indicates V`20your X`20*`09opponent`20is`20using`20a`20pre-1.1`20version`20of`20ldb.`20`20Sending V`20the`20resend X`20*`09packet`20to`20an`20ldb`20older`20than`201.1`20would`20cause`20it`20to V`20abort.`20`20Oops. X`20*`2031.`09Any`20upper`20or`20lower`20case`20letters`20may`20now`20be`20used V`20to`20draw`20the X`20*`09pieces`20on`20the`20board.`20`20Previously`20only`20r,`20w,`20and`20b V`20were`20used. X`20*`09As`20r,`20w,`20and`20b`20stood`20for`20red,`20white,`20and`20black,`20t Vhe`20option X`20*`09to`20set`20them`20was`20called`20-color.`20`20While`20the`20letters`20n Vo`20longer X`20*`09(necessarily)`20represent`20colors,`20the`20option`20is`20still`20-colo Vr. X`20*`2032.`09A`20screen`20dump`20of`20a`20game`20may`20be`20obtained`20via`20t Vhe`20-control`20menu. X`20*`09The`20dump`20goes`20to`20ldb_screen.dmp. X`20* X`20*`20---`20`20The`20following`20modifications`20made`20by`20Earle`20Ake. X`20* X`20*`201.`09A`20context-sensitive`20help`20function`20was`20added`20that`20is V`20activated`20by X`20*`09pressing`20'h'`20or`20'?'`20at`20any`20time`20other`20than`20while`20co Vmposing`20a`20message. X`20*`202.`09The`20redraw`20key`20now`20works`20under`20VMS.`20`20Clearok()`20n Veeded`20to`20be`20called X`20*`09to`20force`20a`20redraw. X`20*`203.`09The`20superkey`20function`20now`20works`20under`20VMS.`20`20It`20w Vas`20rewritten`20to X`20*`09spawn`20a`20subprocess`20and`20execute`20the`20supercmd`20if`20specifie Vd. X`20*`09The`20user`20must`20logout`20of`20the`20subprocess`20to`20resume`20the V`20game. X`20*`204.`09The`20.ldbrc`20file`20now`20contains`20reasonable`20defaults`20for V`20VMS`20when X`20*`09the`20VMS-compiled`20ldb`20creates`20it.`20`20The`20sendcmd`20setting V`20calls X`20*`09the`20IN%`20mailer`20by`20default. X`20*`205.`09Old`20versions`20of`20.oldldbdata`20are`20now`20purged. X`20*`206.`09setattr()`20and`20clrattr()`20are`20used`20instead`20of`20standout V()`20and X`20*`09standend()`20to`20get`20reverse`20video`20on`20VMS.`20`20standout()`20o Vn`20VMS X`20*`09used`20bold`20instead`20of`20reverse`20video,`20which`20made`20the`20cu Vbe X`20*`09look`20non-cubical. X`20*`207.`09The`20current`20pip`20count`20for`20you`20and`20your`20opponent V`20are`20displayed X`20*`09above`20the`20board.`20`20These`20change`20depending`20on`20which`20boa Vrd`20is X`20*`09displayed,`20and`20are`20updated`20as`20you`20move. X`20*`208.`09An`20extensive`20display`20of`20statistics`20regarding`20the`20num Vber`20and X`20*`09frequency`20of`20rolls`20and`20doubles`20for`20both`20users`20can`20be V`20displayed X`20*`09by`20pressing`20the`20%`20or`20#`20keys.`20`20This`20data`20can`20also V`20be`20displayed X`20*`09as`20a`20histogram. X`20* X`20***`20Version`2001`20`20`20Rev`202`20`20`20Patch`200 X`20***`20Note`20Rev`202`20was`20never`20officially`20released.`20`20A`20number V`20of`20beta`20versions X`20***`20of`201.2`20were`20distributed,`20and`20this`20led`20to`20so`20much V`20confusion`20that`20the X`20***`20official`20release`20was`20called`201.3. X`20*`201.`09The`20"Get`20Resend"`20option`20in`20-control`20is`20disabled`20fo Vr`20games X`20*`09that`20are`20over.`20`20Patch`20by`20Earle`20Ake. X`20*`202.`09All`20occurrences`20of`20"gets"`20have`20been`20replaced`20by`20"f Vgets"`20to X`20*`09avoid`20buffer`20overrun`20problems. X`20*`203.`09Ldb`20now`20detects`20games`20where`20no`20further`20contact`20is V`20possible`20and X`20*`09changes`20the`20"BAR"`20indicator`20to`20"---". X`20*`204.`09The`20"Resend"`20option`20in`20-control`20is`20disabled`20for`20ga Vmes`20that`20are`20in X`20*`09a`20"local"`20state`20(i.e.`20it`20is`20the`20local`20player's`20turn). V X`20*`205.`09The`20cumulative`20score`20from`20the`20people`20file`20can`20now V`20be`20displayed X`20*`09via`20the`20-score`20command`20line`20argument.`20`20This`20is`20simila Vr`20to`20a X`20*`09system`20implemented`20by`20Doug`20Parisek,`20but`20uses`20the`20info V`20from`20the X`20*`09people`20file`20rather`20than`20from`20a`20separate`20standings`20file. V X`20*`206.`09An`20option`20has`20been`20added`20to`20make`20ldb`20notify`20the V`20game`20starter X`20*`09when`20a`20game`20started`20by`20-remotestart`20has`20ended.`20`20If V`20a X`20*`09-notify`20`20option`20is`20on`20the`20command`20line`20before`20t Vhe X`20*`09-remotestart,`20the`20ldb`20from`20both`20players`20will`20send`20a`20m Vessage X`20*`09to`20`20when`20the`20game`20ends.`20`20This`20message`20will`20lo Vok`20like X`20*`09a`20normal`20ldb`20packet,`20but`20the`20opcode`20will`20be`20NOTIFY, V`20and X`20*`09the`20comment`20field`20will`20contain`20three`20numbers;`20these`20are V X`20*`09the`20termination`20code`20(T_*`20in`20ldb.h),`20the`20game`20value, V`20and X`20*`09the`20backgammon`20flag`20(1`20=`20gammon,`202`20=`20backgammon,`200 V`20=`20neither). X`20*`09Note`20that`20the`20integer`20values`20of`20the`20termination`20codes V`20changed X`20*`09between`20rev`201.0`20and`20rev`201.1`20--`20the`20one`20in`20the`20com Vment`20field X`20*`09corresponds`20to`20the`20new`20codes`20(the`20ones`20found`20in`20ldb.h V`20from X`20*`09rev`201.1`20or`20higher).`20`20The`20comment2`20field`20contains`20the V`20address X`20*`09of`20the`20opponent`20played.`20`20Ldb`20itself`20has`20no`20provisions V`20to`20read X`20*`09notify`20packets,`20and`20would`20not`20be`20able`20to`20do`20anything V`20useful X`20*`09with`20them`20if`20it`20could.`20`20They`20are`20purely`20for`20the`20u Vse`20of`20a X`20*`09game`20starter,`20if`20anyone`20feels`20like`20writing`20one. X`20*`207.`09Remote`20start`20packets`20left`20in`20the`20mail`20file`20no`20lo Vnger`20start X`20*`09a`20new`20game`20every`20time`20ldb`20is`20run.`20`20This`20is`20done V`20by`20scanning X`20*`09the`20game`20list`20for`20a`20game`20where`20both`20opaddr`20and`20star Vttime`20match X`20*`09those`20shown`20in`20the`20remotestart`20packet,`20and`20discarding`20i Vt`20if X`20*`09one`20is`20found.`20`20If`20it`20is`20not`20found,`20the`20address`20is V`20looked`20up`20in X`20*`09the`20people`20list`20and`20the`20fence`20time,`20if`20any,`20is`20chec Vked. X`20*`09This`20catches`20the`20case`20where`20the`20game`20started`20by`20that V`20remotestart X`20*`09packet`20has`20already`20finished.`20`20Bug`20found`20by`20Mark`20Rubin V. X`20*`208.`09The`20-remotestart`20option`20now`20supports`20the`20crawford,`20j Vacoby,`20europe, X`20*`09and`20permanent`20options,`20as`20well`20as`20match`20play. X`20*`209.`09The`20crawford`20rule`20code`20has`20been`20rewritten.`20`20It`20n Vow`20(correctly) X`20*`09only`20disallows`20doubling`20for`20the`20first`20game`20after`20either V`20player X`20*`09reaches`20match`20score`20-`201.`20`20Subsequent`20games`20allow`20doub Vling. X`20*`09During`20the`20crawford`20rule`20game,`20the`20C`20indicator`20above V`20the`20board X`20*`09is`20drawn`20in`20reverse`20video. X`20*`2010.`09Concede`20now`20scores`20a`20gammon`20if`20the`20loser`20has`20no Vt`20borne`20off`20any X`20*`09pieces,`20and`20a`20backgammon`20if`20the`20loser`20has`20any`20pieces V`20in`20the`20winners X`20*`09inner`20table.`20`20This`20fixes`20a`20bug`20where`20Concede`20could V`20be`20used`20to X`20*`09avoid`20a`20gammon/backgammon. X`20*`2011.`09Ldb`20now`20scans`20the`20mail`20file(s)`20before`20checking`20fo Vr`20access`20timeouts. X`20*`09Previously,`20it`20would`20perform`20automatic`20resends`20for`20games V`20when X`20*`09a`20message`20for`20that`20game`20was`20waiting`20in`20the`20mail,`20re Vsulting`20in`20an X`20*`09unnecessary`20resend.`20`20This`20was`20common`20when`20returning`20fro Vm`20vacation, X`20*`09for`20example,`20when`20all`20games`20would`20time`20out. X`20*`2012.`09The`20error`20messages`20displayed`20when`20a`20move`20is`20rejec Vted`20have`20been X`20*`09made`20more`20understandable.`20`20Previously`20the`20same`20set`20of V`20messages X`20*`09were`20used`20for`20the`20local`20player`20and`20for`20received`20moves V,`20and`20the X`20*`09wording`20was`20somewhat`20awkward`20to`20allow`20this`20double`20usage V.`20`20Local X`20*`09errors`20now`20use`20the`20messages`20in`20rejlcl`5B`5D,`20while`20rece Vived`20moves`20still X`20*`09use`20the`20messages`20in`20rejmsg`5B`5D. X`20*`2013.`09A`20serious`20bug`20was`20fixed`20in`20rcvop.c.`20`20restart() V`20and`20mstart()`20did`20not X`20*`09call`20legalmoves()`20to`20regenerate`20the`20maxused`20and`20hiused V`20fields`20of X`20*`09the`20game`20structure.`20`20The`20consequence`20of`20this`20for`20rest Vart()`20is`20that X`20*`09move`20checking`20will`20not`20work`20for`20the`20first`20move`20of`20a Vny`20game`20that`20had X`20*`09a`20tie`20on`20an`20opening`20roll.`20`20For`20mstart(),`20which`20star Vts`20the`20next X`20*`09game`20of`20a`20match,`20maxused`20and`20hiused`20will`20still`20be`20w Vhatever`20they X`20*`09were`20for`20the`20last`20move`20of`20the`20previous`20game,`20which V`20could`20result`20in X`20*`09either`20allowing`20an`20illegal`20move`20or`20disallowing`20a`20legal V`20one. X`20*`09Bug`20found`20by`20Earle`20Ake. X`20*`2014.`09Cbreak`20is`20now`20turned`20off`20during`20the`20supercmd. X`20*`2015.`09Any`20printing`20character`20(other`20than`20space)`20is`20allowe Vd`20to`20be`20used X`20*`09to`20draw`20game`20pieces.`20`20These`20can`20be`20upper`20or`20lower V`20case`20letters, X`20*`09numbers,`20or`20punctuation.`20`20The`20only`20restriction`20is`20that V`20the`20characters X`20*`09used`20may`20not`20be`20the`20same`20for`20both`20players.`20`20This V`20includes`20using X`20*`09the`20upper`20and`20lower`20case`20of`20the`20same`20letter. X`20*`2016.`09Command`20line`20options`20may`20now`20be`20abbreviated`20by`20th Ve`20shortest X`20*`09unique`20string. X`20*`2017.`09If`20the`20-broadcast`20option`20is`20given`20without`20a`20file V`20argument,`20it X`20*`09reads`20from`20stdin.`20`20-broadcast`20also`20reads`20the`20people`20f Vile`20instead X`20*`09of`20the`20game`20file,`20so`20duplicate`20messages`20are`20not`20sent V`20to`20opponents X`20*`09with`20more`20than`20one`20game`20in`20progress. X`20*`2018.`09The`20-start`20and`20-remotestart`20options`20are`20deferred`20un Vtil`20after`20all X`20*`09options`20have`20been`20scanned.`20`20This`20removes`20order`20dependen Vcies`20in X`20*`09command`20line`20options,`20so`20that: X`20*`09`09ldb`20-match`207`20-start`20joe X`20*`09and`09ldb`20-start`20joe`20-match`207 X`20*`09have`20identical`20effect.`20`20Because`20of`20this`20change,`20only V`20one`20-start`20and X`20*`09one`20-remotestart`20may`20be`20used`20per`20run`20of`20ldb.`20`20Sugge Vsted`20by`20Earle`20Ake. X`20***`20Version`2001`20`20`20Rev`202`20`20`20Patch`200 X`20*`201.`09A`20warning`20is`20printed`20if`20the`20crawford`20rule`20is`20use Vd`20with`20a`20pre-1.3 X`20*`09version`20of`20ldb.`20`20The`20Crawford`20rule`20was`20fixed`20during V`201.2,`20but`20many X`20*`09beta`20versions`20were`20distributed`20before`20this`20fix`20was`20incl Vuded. X`20*========================================================================== V== X`20*/ X Xmain(argc,argv) Xint`20argc; Xchar`20*argv`5B`5D; X`7B Xstruct`20game`20*g; Xstruct`20people`20*p; XFILE`20*fp; Xchar`20subj`5B128`5D; Xchar`20*bcfile; Xint`20i,`20j; Xchar`20c,`20c2; Xint`20done; Xint`20ldbsignal(); Xint`20flags,`20match; Xchar`20*start_addr; Xchar`20*rst1,`20*rst2; X Xghead`20=`20NULL;`09`09`09/*`20init`20game`20list`20to`20empty`20*/ Xgtail`20=`20NULL; Xsignal(SIGINT,ldbsignal);`09/*`20set`20up`20interrupt`20trap`20to`20save`20gam Ves`20*/ XRflag`20=`201;`09`09/*`20should`20we`20try`20to`20extract`20incoming`20mail? V`20*/ XPflag`20=`201;`09`09/*`20should`20we`20process`20waiting`20games?`20*/ XRandomInit(time((long`20*)0));`09/*`20seed`20the`20random`20number`20generator V`20*/ X Xreadldbrc();`09`09/*`20read`20startup`20file`20*/ X Xget_lock(rc.lockfile);`09/*`20is`20another`20ldb`20already`20running?`20*/ X Xcr_mycolor`20=`20rc.defclrs`5B0`5D;`09/*`20default`20color`20when`20creating V`20games`20*/ Xcr_opcolor`20=`20rc.defclrs`5B1`5D; Xcr_mydir`20=`20(*rc.defdir`20==`20'u')`20?`201`20:`20-1;`09/*`20default`20dire Vction`20*/ X Xreadgames();`09`09/*`20load`20games`20in`20progress`20*/ X Xmatch`20=`200;`09`09/*`20default`20to`20no`20match`20play`20*/ Xflags`20=`200;`09`09/*`20default`20to`20no`20special`20rules`20or`20perm`20gam Ves`20*/ Xnotify`20=`20NULL;`09`09/*`20default`20to`20no`20notify`20address`20*/ Xstart_addr`20=`20NULL;`09/*`20default`20to`20no`20game`20started`20*/ Xrst1`20=`20NULL;`09`09/*`20default`20to`20no`20remote`20start`20game`20*/ Xrst2`20=`20NULL; Xfor`20(i`20=`201;`20(i`20<`20argc)`20`26`26`20(argv`5Bi`5D`5B0`5D`20==`20'-'); V`20i++)`20`7B +-+-+-+-+-+-+-+- END OF PART 10 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 11 -+-+-+-+-+-+-+-+ X`09j`20=`20optlookup(`26argv`5Bi`5D`5B1`5D); X`09if`20(j`20==`20-2)`20`7B X`09`09printf("%s:`5Ctambiguous`20option:`20%s`5Cn`5Cn",*argv,argv`5Bi`5D); X`09`09usage(0);`09`09/*`20print`20short`20help`20*/ X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09if`20(j`20<`200)`20`7B X`09`09printf("%s:`5Ctunrecognized`20option:`20%s`5Cn`5Cn",*argv,argv`5Bi`5D); X`09`09usage(0);`09`09/*`20print`20short`20help`20*/ X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09switch`20(options`5Bj`5D.index)`20`7B X`09case`20OPT_START:`09`09`09/*`20start`20a`20game`20*/ X`09`09i++; X`09`09if`20(argv`5Bi`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-start`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09if`20(start_addr`20!=`20NULL)`20`7B X`09`09`09printf("%s:`20only`20one`20-start`20allowed.`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09start_addr`20=`20argv`5Bi`5D; X`09`09break; X`09case`20OPT_RSTART:`09`09/*`20remote`20start`20*/ X`09`09i++; X`09`09if`20(`20(argv`5Bi`5D`20==`20NULL)`20`7C`7C`20(argv`5Bi+1`5D`20==`20NULL V)`20)`20`7B X`09`09`09printf("%s:`20-remotestart`20needs`20two`20arguments`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09if`20(rst1`20!=`20NULL)`20`7B X`09`09`09printf("%s:`20only`20one`20-remotestart`20allowed.`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09rst1`20=`20argv`5Bi`5D; X`09`09rst2`20=`20argv`5Bi+1`5D; X`09`09i++; X`09`09break; X`09case`20OPT_READ: X`09`09Pflag`20=`200;`09`09/*`20just`20read,`20no`20processing`20*/ X`09`09break; X`09case`20OPT_PLAY: X`09`09Rflag`20=`200;`09`09/*`20just`20process,`20no`20read`20*/ X`09`09break; X`09case`20OPT_MYADDR:`09`09/*`20set`20my`20e-mail`20address`20*/ X`09`09i++; X`09`09if`20(argv`5Bi`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-myaddr`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09strcpy(rc.myaddr,argv`5Bi`5D);`09/*`20copy`20in`20new`20address`20*/ X`09`09break; X`09case`20OPT_HELP:`09`09`09/*`20print`20long`20help`20*/ X`09`09usage(1); X`09`09ldbexit(STAT_NORM); X`09case`20OPT_NOTIFY: X`09`09i++; X`09`09if`20(argv`5Bi`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-notify`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09notify`20=`20argv`5Bi`5D; X`09`09break; X`09case`20OPT_COLOR:`09`09`09/*`20set`20colors`20*/ X`09`09if`20(argv`5B++i`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-color`20option`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09cr_mycolor`20=`20argv`5Bi`5D`5B0`5D;`09/*`20first`20char`20is`20my`20col Vor`20*/ X`09`09cr_opcolor`20=`20argv`5Bi`5D`5B1`5D;`20/*`20second`20char`20is`20opponen Vt's`20color`20*/ X`09`09if`20(`20(!`20isprint(cr_mycolor))`20`7C`7C`20(cr_mycolor`20==`20'`20') V`20)`20`7B X`09`09`09printf("%s:`20invalid`20color:`20%d`5Cn",*argv,cr_mycolor); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09if`20(`20(!`20isprint(cr_opcolor))`20`7C`7C`20(cr_opcolor`20==`20'`20') V`20)`20`7B X`09`09`09printf("%s:`20invalid`20color:`20%d`5Cn",*argv,cr_opcolor); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09c`20=`20cr_mycolor; X`09`09if`20(isupper(c)) X`09`09`09c`20=`20tolower(c); X`09`09c2`20=`20cr_opcolor; X`09`09if`20(isupper(c2)) X`09`09`09c2`20=`20tolower(c2); X`09`09if`20(c`20==`20c2)`20`7B X`09`09`09printf("%s:`20duplicate`20color:`20%c`5Cn",*argv,cr_mycolor); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09break; X`09case`20OPT_DIRECTION:`09`09/*`20set`20direction`20*/ X`09`09if`20(argv`5B++i`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-direction`20option`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09c`20=`20argv`5Bi`5D`5B0`5D; X`09`09if`20(isupper(c)) X`09`09`09c`20=`20tolower(c); X`09`09if`20(c`20==`20'u') X`09`09`09cr_mydir`20=`201;`09`09/*`20I`20play`20up`20*/ X`09`09else`20if`20(c`20==`20'd') X`09`09`09cr_mydir`20=`20-1;`09`09/*`20I`20play`20down`20*/ X`09`09else`20`7B X`09`09`09printf("%s:`20invalid`20direction:`20%s`5Cn",*argv,argv`5Bi`5D); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09break; X`09case`20OPT_JACOBY: X`09`09flags`20`7C=`20F_JACOBY; X`09`09break; X`09case`20OPT_CRAWFORD: X`09`09flags`20`7C=`20F_CRAWFORD; X`09`09break; X`09case`20OPT_EUROPE: X`09`09flags`20`7C=`20F_EUROPE; X`09`09break; X`09case`20OPT_PERM: X`09`09flags`20`7C=`20F_PERM; X`09`09break; X`09case`20OPT_MATCH: X`09`09if`20(argv`5B++i`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-match`20option`20needs`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09if`20(!`20isdigit(*argv`5Bi`5D))`20`7B X`09`09`09printf("%s:`20-match`20needs`20numeric`20argument`5Cn",*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09match`20=`20atoi(argv`5Bi`5D); X`09`09break; X`09case`20OPT_SCORE: X`09`09if`20(start_addr`20!=`20NULL) X`09`09`09printf("warning:`20-start`20not`20processed.`5Cn"); X`09`09if`20(rst1`20!=`20NULL) X`09`09`09printf("warning:`20-remotestart`20not`20processed.`5Cn"); X`09`09printscore(); X`09`09ldbexit(STAT_NORM); X`09case`20OPT_BCAST:`09`09`09`09/*`20broadcast`20a`20message`20*/ X`09`09if`20(argv`5B++i`5D`20==`20NULL)`20`7B`09/*`20no`20arg,`20read`20stdin V`20*/ X`09`09`09if`20(`20(fp`20=`20fopen(rc.tempfile,"w"))`20==`20NULL)`20`7B X`09`09`09`09printf("%s:`20can't`20write`20temp`20file`20%s`5Cn", X`09`09`09`09`09*argv,rc.tempfile); X`09`09`09`09ldbexit(STAT_ABORT); X`09`09`09`09`7D X`09`09`09while`20(fgets(subj,sizeof(subj),stdin)`20!=`20NULL) X`09`09`09`09fputs(subj,fp); X`09`09`09fclose(fp); X`09`09`09bcfile`20=`20rc.tempfile; X`09`09`09`7D X`09`09else X`09`09`09bcfile`20=`20argv`5Bi`5D;`09/*`20just`20read`20named`20file`20*/ X`09`09sprintf(subj,"LDB`20Broadcast`20Message`20from`20%s",rc.myname); X`09`09for`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`09`7B`20/*`20f Vor`20all`20people`20*/ X`09`09`09if`20(p->equiv`20!=`20NULL)`09/*`20it's`20an`20equiv`20record`20*/ X`09`09`09`09continue;`09/*`20skip`20it`20*/ X`09`09`09for`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next)`09/*`20cur V`20opp?`20*/ X`09`09`09`09if`20(strcmp(g->opaddr,p->addr)`20==`200) X`09`09`09`09`09break; X`09`09`09if`20(g`20==`20NULL)`09/*`20not`20a`20current`20opponent`20*/ X`09`09`09`09continue;`09/*`20skip`20it`20*/ X`09`09`09TSendFile(p->addr,bcfile,subj);`20/*`20send`20msg`20*/ X`09`09`09`7D X`09`09break; X`09case`20OPT_CONTROL:`09`09`09/*`20control`20my`20games`20*/ X`09`09control(); X`09`09if`20(start_addr`20!=`20NULL) X`09`09`09printf("warning:`20-start`20not`20processed.`5Cn"); X`09`09if`20(rst1`20!=`20NULL) X`09`09`09printf("warning:`20-remotestart`20not`20processed.`5Cn"); X`09`09ldbexit(STAT_NORM); X`09case`20OPT_RECONS:`09`09`09/*`20reconstruct`20a`20game`20*/ X`09`09if`20(argv`5B++i`5D`20==`20NULL)`20`7B X`09`09`09printf("%s:`20-reconstruct`20option`20needs`20argument`5Cn", X`09`09`09`09*argv); X`09`09`09usage(0); X`09`09`09ldbexit(STAT_ABORT); X`09`09`09`7D X`09`09recons(argv`5Bi`5D); X`09`09if`20(start_addr`20!=`20NULL) X`09`09`09printf("warning:`20-start`20not`20processed.`5Cn"); X`09`09if`20(rst1`20!=`20NULL) X`09`09`09printf("warning:`20-remotestart`20not`20processed.`5Cn"); X`09`09ldbexit(STAT_NORM); X`09default: X`09`09fprintf(stderr, X`09`09`20`20`20"Sorry,`20the`20%s`20option`20is`20not`20implemented`20yet.`5Cn V", X`09`09`09options`5Bj`5D.name); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09`7D X Xif`20(start_addr`20!=`20NULL) X`09startgame(start_addr,cr_mydir,cr_mycolor,cr_opcolor,flags,match,0); Xif`20(rst1`20!=`20NULL) X`09remotestart(rst1,rst2,flags,match); X Xif`20(`20(Pflag`20==`200)`20`26`26`20(Rflag`20==`200)`20)`20`7B`09/*`20user V`20gave`20both`20-play`20and`20-read`20*/ X`09Pflag`20=`201;`09`09`09/*`20turn`20both`20back`20on`20*/ X`09Rflag`20=`201; X`09`7D Xwhile`20(i`20<`20argc)`09`09/*`20if`20files`20given`20on`20command`20line,`20r Vead`20them`20*/ X`09readmail(argv`5Bi++`5D); Xif`20(Rflag)`09`09`09/*`20if`20we`20are`20supposed`20to`20read`20default`20fil Ve`20*/ X`09readmail(rc.mfile);`09/*`20do`20that`20too`20*/ Xi`20=`200; Xfor`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next)`09`7B`20/*`20does V`20any`20game`20need`20our`20input?`20*/ X`09check_timeout(g);`09/*`20check`20for`20access`20timeouts`20*/ X`09if`20(`20(g->state`20>=`20OPSTATES)`20`26`26 X`09`20`20`20`20`20!`20(`20(g->state`20==`20ST_GAMEOVER)`20`26`26`20(g->flags V`20`26`20F_DISPLAYED)`20)`20) X`09`09i++; X`09`7D Xif`20(`20(i`20==`200)`20`7C`7C`20(Pflag`20==`200)`20)`20`7B`09`09/*`20if`20not V,`20exit`20*/ X`09writegames(rc.gfile,rc.gbackup,rc.pfile);`09/*`20save`20games`20*/ X`09ldbexit(STAT_NORM); X`09`7D XTInitialize();`09`09`09`09`09/*`20fire`20up`20the`20transport`20*/ XFeInitialize();`09`09`09`09`09/*`20fire`20up`20the`20front`20end`20*/ XFeDrawScreen();`09`09`09`09/*`20draw`20the`20screen`20outline`20*/ Xfor`20(g`20=`20ghead,`20done`20=`200;`20(g`20!=`20NULL)`20`26`26`20(done`20>= V`200);`20g`20=`20g->next) X`09while`20(`20(done`20=`20process(g))`20>`200);`09/*`20process`20game`20til V`20done`20*/ XFeFinishSession();`09`09`09`09/*`20close`20down`20the`20front`20end`20*/ XTFinishSession();`09`09`09`09/*`20close`20down`20the`20transport`20*/ Xwritegames(rc.gfile,rc.gbackup,rc.pfile);`09/*`20save`20the`20games`20in`20a V`20file`20*/ Xldbexit(STAT_NORM); X`7D X X X/*---------------------------------------------------------------------- X`20*`09ldbsignal`20--`20signal`20handler X`20* X`20*`20This`20function`20is`20called`20when`20the`20user`20hits`20the`20interr Vupt`20character. X`20*`20It`20is`20currently`20a`20very`20simple`20function;`20it`20saves`20the V`20games`20in`20the X`20*`20INTGFILE`20file,`20closes`20down`20the`20front`20end`20and`20the`20tran Vsport,`20and`20exits. X`20*---------------------------------------------------------------------- X`20*/ X Xldbsignal() X`7B X Xwritegames(INTGFILE,NULL,INTPFILE); XFeFinishSession();`09/*`20let`20front-end`20close`20down`20gracefully`20*/ XTFinishSession();`09/*`20let`20transport`20close`20down`20gracefully`20*/ Xfprintf(stderr,"WARNING:`20games`20saved`20in`20%s`20and`20%s`5Cn",INTGFILE,IN VTPFILE); Xldbexit(STAT_ABORT); X`7D X X X/*---------------------------------------------------------------------- X`20*`09usage`20--`20print`20command`20line`20options. X`20* X`20*`20This`20function`20prints`20a`20help`20message.`20`20This`20can`20be`20e Vither`20in`20the X`20*`20short`20or`20long`20format.`20`20The`20short`20format`20merely`20lists V`20all`20options X`20*`20in`20a`20very`20dense`20format.`20`20The`20long`20format`20prints`20eac Vh`20option`20on X`20*`20a`20separate`20line,`20along`20with`20a`20short`20explanation`20of`20it Vs`20purpose. X`20*---------------------------------------------------------------------- X`20*/ X Xusage(help) Xint`20help;`09`09/*`200`20=`20short`20message,`201`20=`20long`20message`20*/ X`7B Xstruct`20opt`20*o; Xint`20l; X Xprintf("options:`5Cn"); Xif`20(help)`20`7B`09`09/*`20print`20out`20the`20whole`20shootin'`20match`20*/ X`09for`20(o`20=`20options;`20o->name`20!=`20NULL;`20o++) X`09`09printf("`5Ct-%s%s%s`5Cn",o->name,o->args,o->help); X#if`20PATCHLEVEL`20==`200 X`09printf("`5CnLdb`20version`20%d.%d`20by`20Perry`20R.`20Ross.`20`20Mail`20com Vments`5Cn", X`09`09VERSION,REVISION); X#else X`09printf( X`09"`5CnLdb`20version`20%d.%d`20(patch`20%d)`20by`20Perry`20R.`20Ross.`20`20Ma Vil`5Cncomments", X`09VERSION,REVISION,PATCHLEVEL); X#endif X`09printf("or`20suggestions`20to`20`5C"%s`5C".`5Cn",AUTHOR_EMAIL); X`09`7D Xelse`20`7B X`09l`20=`200; X`09printf("`5Ct"); X`09for`20(o`20=`20options;`20o->name`20!=`20NULL;`20o++)`20`7B X`09`09if`20(`20(l`20+=`20(strlen(o->name)+strlen(o->args)+3))`20>`2055)`20`7B X`09`09`09printf("`5Cn`5Ct"); X`09`09`09l`20=`200; X`09`09`09`7D X`09`09printf("`5B-%s%s`5D`20",o->name,o->args); X`09`09`7D X`09printf("`5Cn`5Cn"); X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09remotestart`20--`20start`20a`20game`20between`20two`20other`20people X`20* X`20*`20This`20function`20tells`20a`20user`20to`20start`20a`20game`20with`20ano Vther`20user. X`20*`20Neither`20user`20needs`20to`20be`20the`20one`20running`20remotestart; V`20although X`20*`20this`20would`20work,`20-start`20is`20a`20more`20efficient`20way`20to V`20do`20that. X`20*`20Remotestart`20could`20be`20used`20to`20start`20games`20between`20oppone Vnts`20in X`20*`20a`20tournament,`20or`20to`20set`20up`20a`20pickup`20game`20facility, V`20where`20people X`20*`20wanting`20to`20play`20would`20mail`20to`20a`20central`20machine,`20whic Vh`20would X`20*`20pair`20players`20by`20some`20criteria`20(such`20as`20ability)`20and`20s Vtart`20a X`20*`20game`20between`20them. X`20*---------------------------------------------------------------------- X`20*/ X Xremotestart(u1,u2,flags,match) Xchar`20*u1,`20*u2; Xint`20flags; Xint`20match; X`7B Xstruct`20packet`20p; Xchar`20colors`5B4`5D; Xchar`20mbuf`5B8`5D; X Xp.version`20=`20LDB_VER;`09`09/*`20fill`20in`20a`20packet`20*/ Xp.timestamp`20=`20time(`20(long`20*)0);`09/*`20give`20it`20a`20timestamp`20*/ Xp.gameid`20=`20"REMOTESTART";`09/*`20give`20it`20a`20phony`20gameid`20*/ Xp.opcode`20=`20RSTART;`09`09/*`20remote`20start`20opcode`20*/ Xp.name`20=`20NULL;`09`09`09/*`20we`20don't`20need`20to`20send`20a`20name`20*/ Xp.addr`20=`20u2;`09`09`09/*`20put`20opponent's`20address`20in`20packet`20*/ Xp.comment`20=`20NULL;`09`09/*`20don't`20have`20a`20comment`20*/ Xp.comment2`20=`20NULL; Xp.seq`20=`201;`09`09`09/*`20start`20with`20sequence`20number`201`20*/ Xp.notify`20=`20notify;`09`09/*`20send`20notify`20address`20if`20any`20*/ Xclearmvs(p.mvs);`09`09/*`20no`20moves`20to`20send`20*/ Xsprintf(colors,"%c%c",cr_mycolor,cr_opcolor); Xp.colors`20=`20colors; Xp.dir`20=`20(cr_mydir`20>`200)`20?`20"up"`20:`20"down"; Xp.autodbl`20=`20NULL; Xp.jacoby`20=`20(flags`20`26`20F_JACOBY)`20?`20"yes"`20:`20NULL;`09`09/*`20jaco Vby`20rule?`20*/ Xp.crawford`20=`20(flags`20`26`20F_CRAWFORD)`20?`20"yes"`20:`20NULL;`09/*`20cra Vwford`20rule?`20*/ Xp.european`20=`20(flags`20`26`20F_EUROPE)`20?`20"yes"`20:`20NULL;`09`09/*`20eu Vropean`20scoring?`20*/ Xp.perm`20=`20(flags`20`26`20F_PERM)`20?`20"yes"`20:`20NULL;`09`09/*`20perm`20g Vame?`20*/ Xif`20(match`20>`200)`20`7B`09`09/*`20match`20play`20*/ X`09sprintf(mbuf,"%d",match);`09/*`20make`20it`20a`20string`20*/ X`09p.match`20=`20mbuf;`09`09`09/*`20and`20put`20it`20in`20the`20packet`20*/ X`09`7D Xelse X`09p.match`20=`20NULL;`09`09`09/*`20not`20a`20match,`20omit`20this`20field`20* V/ Xp.gameptr`20=`20NULL;`09`09/*`20just`20in`20case`20*/ XTSendPacket(`26p,u1);`09`09/*`20send`20the`20remote`20start`20command`20to`20u V1`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09optlookup`20--`20find`20command`20line`20option`20in`20options`20table X`20* X`20*`20This`20function`20looks`20up`20a`20command`20line`20switch`20in`20the V`20options`20table, X`20*`20returning`20the`20index`20into`20options`5B`5D.`20`20It`20returns`20-1 V`20if`20the`20option X`20*`20was`20not`20found,`20and`20-2`20if`20the`20option`20was`20ambiguous. V`20`20Options`20may`20be X`20*`20abbreviated`20to`20the`20shortest`20unique`20substring`20of`20the`20opt Vion. X`20*---------------------------------------------------------------------- X`20*/ X Xoptlookup(optstr) Xchar`20*optstr; X`7B Xint`20i,`20j,`20l,`20n; X Xn`20=`200; Xif`20(`20(l`20=`20strlen(optstr))`20==`200)`09`09`09/*`20empty`20option`20stri Vng`20*/ X`09return(-1);`09`09`09`09/*`20that's`20no`20good`20*/ Xfor`20(i`20=`200;`20options`5Bi`5D.name`20!=`20NULL;`20i++)`09/*`20look`20for V`20arg`20*/ X`09if`20(strncmp(options`5Bi`5D.name,optstr,l)`20==`200)`20`7B`09/*`20found V`20it`20*/ X`09`09j`20=`20i;`09`09`09`09/*`20remember`20index`20*/ X`09`09n++;`09`09`09`09/*`20count`20how`20many`20*/ X`09`09`7D Xif`20(n`20==`200)`09`09`09`09`09/*`20didn't`20find`20it`20*/ X`09return(-1);`09`09`09`09/*`20return`20error`20*/ Xif`20(n`20>`201)`09`09`09`09`09/*`20found`20more`20than`201`20match`20*/ X`09return(-2);`09`09`09`09/*`20return`20error`20*/ Xreturn(j);`09`09`09`09`09/*`20return`20the`20index`20*/ X`7D $ call unpack MAIN.C;1 1400802312 "" $! $ create 'f' X/*`09misc.c`09`098/8/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09rolldice`20--`20roll`20two`20dice X`20* X`20*`20This`20function`20calls`20Rolldie`20twice`20and`20fills`20in`20the`20ga Vme`20structure X`20*`20with`20the`20resulting`20values.`20`20If`20the`20two`20calls`20to`20Rol Vldie`20return`20the X`20*`20same`20number,`20the`20mvs`20field`20is`20filled`20in`20so`20that`20the V`20user`20has`204`20rolls X`20*`20to`20use,`20otherwise`20the`20rolls`20are`20stored`20in`20the`20first V`20two`20elements X`20*`20of`20the`20mvs`20field`20and`20the`20last`20two`20are`20marked`20unused V. X`20*---------------------------------------------------------------------- X`20*/ X Xrolldice(g) Xstruct`20game`20*g; X`7B X Xclearmvs(g->mvs);`09`09`09/*`20clear`20old`20stuff`20*/ Xg->mvs`5B0`5D.roll`20=`20Rolldie();`20`20`20`20`20`20`20`20`20`20`20`20`20/* V`20roll`20the`20dice`20*/ Xg->mvs`5B1`5D.roll`20=`20Rolldie(); Xg->rolls`5Bg->mvs`5B0`5D.roll`20-`201`5D++;`09`09/*`20keep`20count`20of`20what V`20rolls`20we`20got`20*/ Xg->rolls`5Bg->mvs`5B1`5D.roll`20-`201`5D++; Xif`20(g->mvs`5B0`5D.roll`20==`20g->mvs`5B1`5D.roll)`20`7B`09/*`20hot`20damn, V`20we`20got`20doubles`20*/ X`09g->mvs`5B2`5D.roll`20=`20g->mvs`5B0`5D.roll;`09/*`20copy`20roll`20into`20tw Vo`20*/ X`09g->mvs`5B3`5D.roll`20=`20g->mvs`5B0`5D.roll;`09/*`20more`20moves`20*/ X`09g->doubles`5Bg->mvs`5B1`5D.roll`20-`201`5D++;`09/*`20keep`20track`20of`20do Vubles`20*/ X`09`7D Xlegalmoves(g);`09`09`09/*`20calculate`20the`20#`20of`20moves`20`26`20hi`20roll V`20*/ X`7D X X X X/*---------------------------------------------------------------------- X`20*`09sendpkt`20--`20send`20a`20packet`20to`20the`20opponent X`20* X`20*`20This`20function`20fills`20in`20the`20fields`20of`20a`20packet`20and`20p Vasses`20that X`20*`20packet`20to`20the`20transport`20using`20TSendPacket.`20`20It`20also`20s Vtores`20the X`20*`20opcode`20sent`20in`20the`20lastop`20field`20of`20the`20game,`20so`20the V`20packet X`20*`20can`20be`20regenerated`20if`20necessary.`20`20Sendpkt`20returns`201`20i Vf`20the X`20*`20packet`20was`20sent,`20and`200`20if`20an`20error`20occurred. X`20*---------------------------------------------------------------------- X`20*/ X Xsendpkt(g,op) Xstruct`20game`20*g; Xchar`20op; X`7B Xstatic`20char`20colors`5B4`5D,`20adbl`5B10`5D,`20mch`5B10`5D; Xchar`20cmt`5B60`5D,`20cmt2`5B60`5D,`20*sendaddr; Xint`20i,`20status; X Xif`20(FeIsActive) X`09FeMessage("Sending..."); Xsendaddr`20=`20g->opaddr;`09`09/*`20this`20is`20overridden`20for`20NOTIFY`20*/ V Xif`20(`20(op`20!=`20RESEND)`20`26`26`20(op`20!=`20NOTIFY)`20) X`09g->lastop`20=`20op;`09`09`09/*`20save`20last`20op`20for`20resend`20*/ Xfor`20(i`20=`200;`20i`20<`204;`20i++) X`09g->blot`5Bi`5D`20=`200;`09`09`09/*`20clear`20blots`20hit`20*/ Xif`20(*rc.chkpt`20==`20'y')`20`7B X`09writegames(rc.gfile,rc.gbackup,rc.pfile); X`09rc.gbackup`20=`20NULL;`09/*`20only`20backup`20old`20file`20once`20*/ X`09`7D XP.version`20=`20LDB_VER;`09`09`09/*`20these`20fields`20go`20in`20all`20packets V`20*/ XP.gameid`20=`20g->gameid; XP.opcode`20=`20op; XP.seq`20=`20g->seq; XP.jacoby`20=`20NULL; XP.crawford`20=`20NULL; XP.european`20=`20NULL; XP.perm`20=`20NULL; XP.match`20=`20NULL; Xif`20(g->opver`20>`20100)`20`7B`09/*`20versions`20after`201.0`20rot13`20commen Vts`20*/ X`09if`20(g->mycmt`20!=`20NULL)`20`7B X`09`09strncpy(cmt,g->mycmt,sizeof(cmt));`09/*`20make`20copy`20*/ X`09`09cmt`5Bsizeof(cmt)-1`5D`20=`20'`5C0';`09`09/*`20null`20term`20*/ X`09`09P.comment`20=`20cmt;`09`09`09/*`20save`20pointer`20*/ X`09`09rotate(P.comment);`09`09`09/*`20rot13`20the`20copy`20*/ X`09`09`7D X`09else X`09`09P.comment`20=`20NULL; X`09if`20(g->mycmt2`20!=`20NULL)`20`7B X`09`09strncpy(cmt2,g->mycmt2,sizeof(cmt2));`09/*`20make`20copy`20*/ X`09`09cmt2`5Bsizeof(cmt2)-1`5D`20=`20'`5C0';`09`09/*`20null`20term`20*/ X`09`09P.comment2`20=`20cmt2;`09`09`09/*`20save`20pointer`20*/ X`09`09rotate(P.comment2);`09`09`09/*`20rot13`20the`20copy`20*/ X`09`09`7D X`09else X`09`09P.comment2`20=`20NULL; X`09`7D Xelse`20`7B`09`09`09`09/*`20version`201.0`20sends`20comments`20as`20cleartext V`20*/ X`09P.comment`20=`20g->mycmt; X`09P.comment2`20=`20g->mycmt2; X`09`7D Xif`20(g->flags`20`26`20F_SENTNAME)`20`7B X`09P.name`20=`20NULL; X`09P.notify`20=`20NULL; X`09`7D Xelse`20`7B X`09P.name`20=`20rc.myname; X`09P.notify`20=`20g->notify; X`09g->flags`20`7C=`20F_SENTNAME; X`09`7D XP.addr`20=`20NULL;`09`09`09`09/*`20these`20fields`20only`20used`20by`20START V`20*/ XP.colors`20=`20NULL; XP.dir`20=`20NULL; XP.autodbl`20=`20NULL;`09`09`09/*`20used`20by`20START`20and`20TIE`20*/ XP.timestamp`20=`20time((long`20*)`200);`09`09/*`20attach`20timestamp`20*/ Xif`20(g->lastacc`20<`20P.timestamp)`09`09/*`20update`20last`20access`20time V`20*/ X`09g->lastacc`20=`20P.timestamp;`09/*`20but`20don't`20let`20time`20go`20backwa Vrds`20*/ Xclearmvs(P.mvs); Xswitch`20(op)`20`7B`09`09`09`09/*`20now`20do`20operation-specific`20stuff`20*/ V Xcase`20START: X`09P.addr`20=`20g->myaddr;`09`09/*`20send`20opponent`20my`20email`20address V`20*/ X`09P.mvs`5B0`5D.roll`20=`20g->mvs`5B0`5D.roll;`09/*`20send`20initial`20die`20r Voll`20*/ X`09sprintf(colors,"%c%c",g->mycolor,g->opcolor); X`09P.colors`20=`20colors; X`09P.dir`20=`20(g->mydir`20>`200)`20?`20"down"`20:`20"up"; X`09sprintf(adbl,"%d",rc.autodouble); X`09P.autodbl`20=`20adbl; X`09if`20(g->flags`20`26`20F_JACOBY)`09/*`20enable`20jacoby`20*/ X`09`09P.jacoby`20=`20"yes"; X`09if`20(g->flags`20`26`20F_CRAWFORD)`09/*`20enable`20crawford`20*/ X`09`09P.crawford`20=`20"yes"; X`09if`20(g->flags`20`26`20F_EUROPE)`09/*`20enable`20european`20rule`20*/ X`09`09P.european`20=`20"yes"; X`09if`20(g->flags`20`26`20F_PERM)`09`09/*`20game`20is`20permanent`20*/ X`09`09P.perm`20=`20"yes"; X`09if`20(g->mtotal`20>`200)`20`7B`09`09/*`20enable`20match`20play`20*/ X`09`09sprintf(mch,"%d",g->mtotal); X`09`09P.match`20=`20mch; X`09`09`7D X`09break; Xcase`20USTART: X`09P.mvs`5B0`5D.roll`20=`20g->mvs`5B0`5D.roll;`09/*`20send`20both`20initial V`20dice`20*/ X`09P.mvs`5B1`5D.roll`20=`20g->mvs`5B1`5D.roll; X`09break; Xcase`20MSTART: Xcase`20RESTART:`09`09`09`09/*`20retry`20initial`20roll`20*/ X`09P.mvs`5B0`5D.roll`20=`20g->mvs`5B0`5D.roll;`09/*`20send`20new`20roll`20*/ X`09break; Xcase`20TIE: X`09if`20(g->adcnt`20>`200)`20`7B`09`09/*`20send`20current`20autodouble`20count V`20*/ X`09`09sprintf(adbl,"%d",g->adcnt); X`09`09P.autodbl`20=`20adbl; X`09`09`7D X`09break; Xcase`20MOVE: X`09for`20(i`20=`200;`20i`20<`204;`20i++) X`09`09P.mvs`5Bi`5D`20=`20g->mvs`5Bi`5D; X`09break; Xcase`20NOTIFY: X`09P.addr`20=`20g->myaddr; X`09P.seq`20=`200;`09`09`09/*`20no`20sequences`20for`20notify`20packets`20*/ X`09P.notify`20=`20NULL; X`09P.name`20=`20rc.myname; X`09i`20=`20gvalue(g,`26status); X`09sprintf(cmt,"%d`20%d`20%d",g->term,status,i); X`09P.comment`20=`20cmt;`09/*`20send`20term`20code,`20game`20val,`20`26`20bg V`20flag`20*/ X`09P.comment2`20=`20g->opaddr;`09/*`20send`20opponent`20address`20*/ X`09if`20(`20(sendaddr`20=`20g->notify)`20==`20NULL) X`09`09return;`09`09/*`20shouldn't`20happen`20*/ X`09`7D Xstatus`20=`20TSendPacket(`26P,sendaddr);`09`09/*`20send`20the`20packet`20*/ Xif`20(FeIsActive)`09`09`09`09/*`20clear`20"Sending..."`20from`20mesg`20line V`20*/ X`09FeMessage(NULL); Xreturn(status); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09resendpkt`20--`20resend`20the`20last`20packet X`20* X`20*`20This`20function`20takes`20a`20game`20structure`20and`20causes`20the`20l Vast`20packet`20sent X`20*`20in`20that`20game`20to`20be`20resent. X`20* X`20*`20The`20F_SENTNAME`20flag`20is`20cleared`20before`20resending,`20causing V`20our`20personal X`20*`20name`20to`20be`20resent.`20`20This`20is`20because`20the`20packet`20bein Vg`20resent`20might`20have X`20*`20been`20the`20one`20that`20sent`20the`20personal`20name`20(and`20set`20t Vhe`20F_SENTNAME`20flag), X`20*`20and`20since`20the`20F_SENTNAME`20flag`20is`20now`20set,`20the`20persona Vl`20name`20would`20not X`20*`20be`20included`20in`20the`20resent`20packet. X`20*---------------------------------------------------------------------- X`20*/ X Xresendpkt(g) Xstruct`20game`20*g; X`7B X Xg->flags`20`26=`20`7EF_SENTNAME; Xsendpkt(g,g->lastop); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09str2mv`20--`20decode`20move`20string`20to`20struct`20mv X`20* X`20*`20This`20function`20takes`20a`20string`20representation`20of`20a`20move, V`20decodes`20it, X`20*`20and`20places`20the`20information`20into`20a`20mv`20structure.`20`20This V`20format`20is: X`20* X`20*`09roll/move X`20* X`20*`20where`20roll`20is`20the`20die`20value`20used`20in`20the`20move,`20and V`20is`20a`20single X`20*`20digit`20in`20`5B1..6`5D,`20and`20move`20is`20one`20of`20the`20following V: X`20* X`20*`09a`201`20or`202`20digit`20number`20in`20`5B1..24`5D X`20*`09`09This`20designates`20the`20point`20the`20move`20originates`20from. X`20*`09`09This`20number`20is`20stored`20in`20the`20"pt"`20field`20of`20the`20m Vove X`20*`09`09structure`20without`20modification. X`20*`09the`20string`20"BAR" X`20*`09`09This`20means`20the`20piece`20is`20coming`20off`20the`20bar. X`20*`09`09Zero`20is`20stored`20in`20the`20"pt"`20field`20of`20the`20move`20str Vucture, X`20*`09`09regardless`20of`20whether`20the`20player's`20bar`20point`20is`200 V`20or`2025. X`20*`09`09Apply()`20and`20FeDrawMove`20understand`20this`20and`20convert`200 V`20to X`20*`09`09the`20appropriate`20bar`20point`20before`20using`20it. X`20*`09the`20string`20"UNUSED" X`20*`09`09This`20means`20the`20roll`20is`20unused.`20`20-1`20is`20stored`20in V`20the X`20*`09`09"pt"`20field`20of`20the`20mv`20structure. X`20*---------------------------------------------------------------------- X`20*/ X Xstr2mv(s,m) Xchar`20*s; Xstruct`20mv`20*m; X`7B Xchar`20*p,`20*strchr(); X Xif`20(`20(p`20=`20strchr(s,'/'))`20==`20NULL)`20`7B X`09message("ERROR:`20malformed`20move:`20%s`5Cn",s); X`09return; X`09`7D Xif`20(`20(`20(m->roll`20=`20atoi(s))`20<`200)`20`7C`7C`20(m->roll`20>`206)`20) V`20`7B X`09message("ERROR:`20invalid`20roll:`20%d`5Cn",m->roll); X`09return; X`09`7D Xp++; Xif`20(`20(m->roll`20==`200)`20`7C`7C`20(*p`20==`20'U')`20`7C`7C`20(*p`20==`20' Vu')`20) X`09m->pt`20=`20-1;`09`09/*`20this`20roll`20is`20unused`20*/ Xelse`20if`20(`20(*p`20==`20'B')`20`7C`7C`20(*p`20==`20'b')`20) X`09m->pt`20=`200;`09`09/*`20move`20from`20bar`20*/ Xelse`20if`20(`20(`20(m->pt`20=`20atoi(p))`20<`200)`20`7C`7C`20(m->pt`20>`2025) V`20)`20`7B X`09message("ERROR:`20invalid`20point:`20%d`5Cn",m->pt); X`09return; X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09mv2str`20--`20encode`20move`20string`20from`20struct`20mv X`20* X`20*`20This`20function`20forms`20a`20string`20representation`20of`20a`20move V`20based`20on X`20*`20the`20information`20in`20a`20mv`20structure.`20`20This`20format`20is: X`20* X`20*`09roll/move X`20* X`20*`20where`20roll`20is`20the`20die`20value`20stored`20in`20mv->roll,`20and V`20move`20is: X`20* X`20*`09mv->pt`20if`20mv->pt`20is`20in`20`5B1..24`5D X`20*`09the`20string`20"BAR",`20if`20mv->pt`20is`200`20or`2025 X`20*`09the`20string`20"UNUSED",`20if`20mv->pt`20is`20<`200 X`20*---------------------------------------------------------------------- X`20*/ X Xmv2str(m,s) Xstruct`20mv`20*m; Xchar`20*s; X`7B X Xif`20(m->roll`20<=`200)`20`7B`09`09/*`20non-existant`20roll`20*/ X`09strcpy(s,"0/0");`09/*`20should`20be`20skipped`20by`20nvwrite`20*/ X`09return;`09`09`09/*`20so`20we`20should`20never`20get`20here`20*/ X`09`7D Xif`20(m->pt`20<`200) X`09sprintf(s,"%d/UNUSED",m->roll); Xelse`20if`20(`20(m->pt`20==`20DOWNBAR)`20`7C`7C`20(m->pt`20==`20UPBAR)`20) X`09sprintf(s,"%d/BAR",m->roll); Xelse X`09sprintf(s,"%d/%d",m->roll,m->pt); X`7D X X X/*---------------------------------------------------------------------- X`20*`09clearmvs`20--`20mark`20all`20entries`20in`20a`20mv`20array`20empty X`20* X`20*`20This`20function`20marks`20all`20elements`20of`20a`20mv`20array`20as`20b Veing`20unused. X`20*---------------------------------------------------------------------- X`20*/ X X Xclearmvs(m) Xstruct`20mv`20*m; X`7B Xint`20i; X Xfor`20(i`20=`200;`20i`20<`204;`20i++)`20`7B X`09m`5Bi`5D.roll`20=`20-1; X`09m`5Bi`5D.pt`20=`20-1; X`09`7D X`7D X X X X/*---------------------------------------------------------------------- X`20*`09canmove`20--`20see`20if`20a`20roll`20is`20usable`20in`20a`20range`20of V`20points X`20* X`20*`20This`20function`20trys`20to`20use`20a`20roll`20over`20a`20range`20of V`20points.`20`20If`20it X`20*`20finds`20a`20point`20where`20a`20roll`20could`20be`20used,`20it`20return Vs`201,`20otherwise X`20*`20it`20returns`200.`20`20The`20board`20is`20not`20changed. X`20*---------------------------------------------------------------------- X`20*/ X Xcanmove(g,r,p1,p2) Xstruct`20game`20*g;`09`09/*`20the`20game`20structure`20*/ Xint`20r;`09`09`09/*`20which`20element`20of`20g->mvs`20*/ Xint`20p1,`20p2;`09`09/*`20the`20range`20of`20points`20to`20try`20*/ X`7B Xint`20i,`20op; X Xif`20(p1`20>`20p2)`20`7B X`09i`20=`20p1; X`09p1`20=`20p2; X`09p2`20=`20i; X`09`7D Xop`20=`20g->mvs`5Br`5D.pt;`09`09/*`20so`20we`20can`20restore`20it`20*/ Xfor`20(i`20=`20p1;`20i`20<=`20p2;`20i++)`20`7B X`09g->mvs`5Br`5D.pt`20=`20i;`09`09/*`20try`20from`20this`20point`20*/ X`09if`20(apply(g,WHO_ME,r,A_CHKONLY,NULL)`20>=`200)`20`7B X`09`09g->mvs`5Br`5D.pt`20=`20op; X`09`09return(1); X`09`09`7D X`09`7D Xg->mvs`5Br`5D.pt`20=`20op; Xreturn(0); X`7D X X X/*---------------------------------------------------------------------- X`20*`09rotate`20--`20rot13`20a`20buffer X`20* X`20*`20This`20function`20performs`20the`20popular`20"rot13"`20conversion`20to V`20a`20buffer. X`20*`20The`20buffer`20is`20modified`20in`20place.`20`20This`20conversion`20mak Ves`20a X`20*`20string`20unreadable`20by`20adding`2013`20to`20letters`20in`20`5BA-Ma-m V`5D`20and`20subtracting X`20*`2013`20from`20letters`20in`20`5BN-Zn-z`5D.`20`20All`20other`20characters V`20are`20unchanged. X`20*`20Applying`20the`20rot13`20transformation`20again`20returns`20the`20buffe Vr`20to`20normal. X`20*---------------------------------------------------------------------- X`20*/ X Xrotate(buf) Xchar`20*buf; X`7B Xregister`20char`20*s; X Xfor`20(s`20=`20buf;`20*s;`20s++)`20`7B X`09if`20(!`20isalpha(*s)) X`09`09continue; X`09if`20(`20((*s`20>=`20'A')`20`26`26`20(*s`20<=`20'M'))`20`7C`7C`20((*s`20>= V`20'a')`20`26`26`20(*s`20<=`20'm'))`20) X`09`09*s`20+=`20(char)`2013; X`09else X`09`09*s`20-=`20(char)`2013; X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09message`20--`20print`20a`20message`20in`20proper`20way X`20* X`20*`20This`20function`20checks`20to`20see`20if`20the`20front`20end`20is`20act Vive.`20`20If X`20*`20so,`20it`20calls`20FeMessage,`20otherwise`20it`20prints`20on`20stderr V`20and X`20*`20sets`20the`20FeWaitInit`20flag`20so`20that`20when`20FeInitialize`20is V`20called, X`20*`20it`20will`20wait`20for`20return`20to`20be`20pressed`20before`20clearing V`20the`20screen. X`20*---------------------------------------------------------------------- X`20*/ X Xmessage(s,a1,a2,a3) Xchar`20*s; Xint`20a1,`20a2,`20a3; X`7B Xchar`20buf`5B80`5D; X Xif`20(FeIsActive)`20`7B X`09sprintf(buf,`20s,`20a1,`20a2,`20a3); X`09FeMessage(buf); X`09`7D Xelse`20`7B X`09fprintf(stderr,s,a1,a2,a3); X`09FeWaitInit++; X`09if`20(FeWaitInit`20>`2022)`20`7B X`09`09fprintf(stderr,"Press`20`20to`20continue..."); X`09`09fgets(buf,sizeof(buf),stdin); X`09`09FeWaitInit`20=`200; X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09fatal`20--`20terminate`20program`20with`20error`20message X`20* X`20*`20This`20function`20prints`20a`20message`20to`20stderr`20and`20exits. X`20*---------------------------------------------------------------------- X`20*/ X Xfatal(msg) Xchar`20*msg; X`7B X XFeFinishSession(); XTFinishSession(); Xfprintf(stderr,"%s`5Cn",msg); Xldbexit(STAT_ABORT); X`7D X X X/*---------------------------------------------------------------------- X`20*`09ldbexit`20--`20terminate`20program`20in`20an`20orderly`20fashion X`20* X`20*`20This`20function`20can`20be`20called`20at`20any`20time,`20and`20ensures V`20that`20the X`20*`20front`20end`20and`20the`20transport`20are`20closed`20down`20cleanly`20b Vefore X`20*`20exiting. X`20*---------------------------------------------------------------------- X`20*/ X Xldbexit(code) Xint`20code; X`7B X XFeFinishSession(); XTFinishSession(); Xrelease_lock(rc.lockfile); Xfflush(stdout); Xfflush(stderr); Xexit(code); X`7D X X X/*---------------------------------------------------------------------- X`20*`09pipcount`20--`20calculate`20a`20pip`20count`20for`20both`20players X`20* X`20*`20This`20function`20takes`20a`20board`20and`20a`20pointer`20to`20a`20game V`20structure X`20*`20and`20calculates`20a`20pip`20count`20for`20both`20players.`20`20These V`20are`20returned X`20*`20in`20*mp`20and`20*op. X`20*---------------------------------------------------------------------- X`20*/ X Xpipcount(b,g,mp,op) Xboard`20b;`09`09`09/*`20the`20board`20*/ Xstruct`20game`20*g;`09`09`09/*`20the`20game`20*/ Xint`20*mp;`09`09`09/*`20where`20to`20store`20my`20pip`20count`20*/ Xint`20*op;`09`09`09/*`20where`20to`20store`20opponent's`20pip`20count`20*/ X`7B Xint`20direction`5B2`5D; Xint`20player;`09`09`09/*`20me`20=`200;`20op`20=`201`20*/ Xint`20PIP`5B2`5D;`09`09`09/*`20mypip`20=`200;`20oppip`20=`201`20*/ Xint`20i;`09`09`09`09/*`20counter`20*/ X XPIP`5BWHO_ME`5D`20=`200;`09`09`09/*`20initialize`20my`20PIP`20count`20*/ XPIP`5BWHO_OPP`5D`20=`200;`09`09`09/*`20initialize`20op`20PIP`20count`20*/ Xdirection`5BWHO_ME`5D`20=`20g->mydir;`09`09/*`20my`20direction`20of`20travel V`20*/ Xdirection`5BWHO_OPP`5D`20=`20g->opdir;`09`09/*`20op`20direction`20of`20travel V`20*/ X Xfor`20(i`20=`200;`20i`20<=`20DOWNBAR;`20i++)`20`7B`09/*`20for`20each`20point V`20on`20the`20board`20*/ X X`09if`20(b`5Bi`5D.qty`20>`200)`20`7B X`09`09player`20=`20(b`5Bi`5D.color`20==`20g->mycolor)`20?`20WHO_ME`20:`20WHO_O VPP; X`09`09if`20((i`20==`20UPBAR)`20`7C`7C`20(i`20==`20DOWNBAR)) X`09`09`09PIP`5Bplayer`5D`20+=`20b`5Bi`5D.qty`20*`2025; X`09`09else`20`7B X`09`09`09if`20(direction`5Bplayer`5D`20==`201) X`09`09`09`09PIP`5Bplayer`5D`20+=`20b`5Bi`5D.qty`20*`20(25`20-`20i); X`09`09`09else X`09`09`09`09PIP`5Bplayer`5D`20+=`20b`5Bi`5D.qty`20*`20i; X`09`09`09`7D X`09`09`7D X`09`7D X*mp`20=`20PIP`5BWHO_ME`5D;`09`09/*`20return`20my`20pip`20count`20*/ X*op`20=`20PIP`5BWHO_OPP`5D;`09`09/*`20return`20opponent's`20pip`20count`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09gvalue`20--`20calculate`20the`20game`20value X`20* X`20*`20This`20function`20takes`20a`20completed`20game`20and`20calculates`20its V`20value, X`20*`20taking`20into`20account`20gammons,`20backgammons,`20and`20the`20Jacoby V`20and X`20*`20European`20rules.`20`20These`20are: X`20*`09-`20Gammon`20(when`20the`20loser`20does`20not`20bear`20off`20any`20piec Ves) X`20*`09`20`20counts`20as`20double`20the`20game`20value`20shown`20on`20the`20cu Vbe. X`20*`09-`20Backgammon`20(when`20the`20loser`20does`20not`20bear`20off`20any V`20pieces X`20*`09`20`20and`20has`20pieces`20in`20the`20winner's`20home`20board)`20counts V`20as X`20*`09`20`20triple`20the`20game`20value`20shown`20on`20the`20cube. X`20*`09-`20Jacoby`20rule`20(if`20enabled)`20states`20that`20Gammons`20and`20Ba Vckgammons X`20*`09`20`20count`20as`20single`20games`20if`20neither`20player`20doubled`20d Vuring`20the`20game. X`20*`09-`20European`20rule`20(if`20enabled)`20states`20the`20Backgammons`20cou Vnt`20double, X`20*`09`20`20not`20triple,`20the`20game`20value`20shown`20on`20the`20cube. X`20*`20The`20game`20value`20is`20returned`20in`20*vp;`20the`20return`20value V`20is`201`20for`20a`20gammon, X`20*`202`20for`20a`20backgammon,`20and`200`20for`20neither. X`20* X`20*`20If`20the`20game`20was`20conceded,`20gvalue()`20scores`20a`20gammon`20if V`20the`20loser`20has X`20*`20not`20borne`20off`20any`20pieces,`20and`20a`20backgammon`20if`20the`20l Voser`20has`20any`20pieces X`20*`20in`20the`20winners`20inner`20table.`20`20This`20prevents`20players`20fr Vom`20conceding`20to X`20*`20avoid`20a`20gammon/backgammon. X`20*---------------------------------------------------------------------- X`20*/ X Xgvalue(g,vp) Xstruct`20game`20*g; Xint`20*vp; X`7B Xint`20bf; Xint`20p1,`20p2; X Xbf`20=`200;`09`09`09`09/*`20init`20to`20no`20gammon/backgammon`20*/ X*vp`20=`20g->gameval;`09`09/*`20init`20to`20game`20value`20on`20cube`20*/ Xif`20(`20(g->term`20==`20T_ILOSE)`20`7C`7C`20(g->term`20==`20T_ICONCEDE)`20) V`20`7B X`09if`20(g->board`5BOFFPT(g->mydir)`5D.qty`20==`200)`20`7B X`09`09p1`20=`20(g->opdir`20>`200)`20?`2019`20:`200;/*`20check`20op's`20inner V`20tbl*/ X`09`09p2`20=`20(g->opdir`20>`200)`20?`2025`20:`206;`09/*`20for`20my`20pieces V`20*/ X`09`09if`20(addpcs(g->board,g->mycolor,p1,p2)`20>`200) X`09`09`09bf`20=`202;`09`09`09/*`20flag`20a`20backgammon`20*/ X`09`09else X`09`09`09bf`20=`201;`09`09`09/*`20flag`20a`20gammon`20*/ X`09`09`7D X`09`7D Xelse`20if`20(`20(g->term`20==`20T_IWIN)`20`7C`7C`20(g->term`20==`20T_OPCONCEDE V)`20)`20`7B X`09if`20(g->board`5BOFFPT(g->opdir)`5D.qty`20==`200)`20`7B X`09`09p1`20=`20(g->mydir`20>`200)`20?`2019`20:`200;`09/*`20check`20my`20inner V`20tbl*/ X`09`09p2`20=`20(g->mydir`20>`200)`20?`2025`20:`206;`09/*`20for`20op's`20pieces V`20*/ X`09`09if`20(addpcs(g->board,g->opcolor,p1,p2)`20>`200) X`09`09`09bf`20=`202;`09`09`09/*`20flag`20a`20backgammon`20*/ X`09`09else X`09`09`09bf`20=`201;`09`09`09/*`20flag`20a`20gammon`20*/ X`09`09`7D X`09`7D Xif`20(`20(g->flags`20`26`20F_JACOBY)`20`26`26`20(g->gameval`20==`20(1`20<<`20g V->adcnt))`20) X`09return(bf);`09/*`20jacoby`20enabled`20`26`20no`20doubles,`20don't`20mult V`20game`20val`20*/ Xif`20(`20(g->flags`20`26`20F_EUROPE)`20`26`26`20(bf`20==`202)`20)`20`7B X`09*vp`20*=`202;`09/*`20european`20rule`20enabled,`20bg`20=`202`20multiplier V`20*/ X`09return(bf); X`09`7D Xif`20(bf`20==`202) X`09*vp`20*=`203;`09/*`20backgammon`20=`203`20multiplier`20*/ Xelse`20if`20(bf`20==`201) X`09*vp`20*=`202;`09/*`20gammon`20=`202`20multipler`20*/ Xreturn(bf);`09`09/*`20return`20gammon/backgammon/neither`20flag`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09iscontact`20--`20determine`20if`20contact`20is`20possible`20for`20a`20g Vame X`20* X`20*`20This`20function`20returns`201`20if`20it`20is`20possible`20for`20any`20p Viece`20to`20hit X`20*`20any`20other`20piece,`200`20if`20both`20players`20have`20moved`20past V`20each`20other X`20*`20and`20the`20game`20is`20a`20race. X`20*---------------------------------------------------------------------- X`20*/ X Xiscontact(g) Xstruct`20game`20*g; X`7B Xint`20dc,`20dn,`20i; X Xif`20(g->mydir`20>`200)`09`09/*`20which`20color`20is`20down-bound?`20*/ X`09dc`20=`20g->opcolor; Xelse X`09dc`20=`20g->mycolor; Xdn`20=`20g->board`5BDOWNOFF`5D.qty;`09`09/*`20start`20with`20#`20pcs`20borne V`20off`20*/ Xfor`20(i`20=`200;`20(i`20<=`2024)`20`26`26`20(dn`20<`2015);`20i++)`20`7B X`09if`20(g->board`5Bi`5D.qty`20==`200) X`09`09continue; X`09if`20(g->board`5Bi`5D.color`20!=`20dc)`09/*`20found`20some`20upbound`20piec Ves`20*/ X`09`09return(1);`09`09/*`20that`20are`20in`20hitting`20range`20*/ X`09dn`20+=`20g->board`5Bi`5D.qty;`09`09/*`20keep`20count`20of`20down`20pcs`20f Vound`20*/ X`09`7D Xif`20(dn`20>=`2015)`09`09`09`09/*`20found`20all`20down`20pcs`20*/ X`09return(0);`09`09`09/*`20no`20more`20contact`20for`20this`20game`20*/ Xreturn(1); X`7D X X X/*---------------------------------------------------------------------- X`20*`09crawford_check`20--`20is`20this`20the`20crawford`20rule`20game`20for V`20a`20match? X`20* X`20*`20This`20function`20sets`20the`20F_CRGAME`20and`20F_CRDONE`20flags`20for V`20a`20match. X`20*`20F_CRGAME`20is`20set`20if`20this`20is`20the`20crawford`20rule`20game`20f Vor`20the`20match. X`20*`20F_CRDONE`20is`20set`20after`20the`20crawford`20rule`20game`20has`20been V`20played. X`20* X`20*`20F_CRGAME`20is`20set`20if: X`20*`09F_CRAWFORD`20is`20set`09AND X`20*`09F_CRDONE`20is`20not`20set`09AND X`20*`09a`20player`20is`20within`20one`20point`20of`20winning`20the`20match. X`20*`20otherwise`20F_CRGAME`20is`20cleared. X`20* X`20*`20F_CRDONE`20is`20set`20if: X`20*`09F_CRAWFORD`20is`20set`09AND X`20*`09F_CRGAME`20was`20set`20(before`20the`20above) X`20*`20otherwise`20F_CRDONE`20is`20not`20changed. X`20*---------------------------------------------------------------------- X`20*/ X Xcrawford_check(g) Xstruct`20game`20*g; X`7B Xint`20old_crgame; X Xold_crgame`20=`20g->flags`20`26`20F_CRGAME;`09`09/*`20save`20F_CRGAME`20*/ Xif`20(`20((g->flags`20`26`20(F_CRAWFORD`7CF_CRDONE))`20==`20F_CRAWFORD)`20`26 V`26 X`20`20`20`20`20(`20(g->mcurrent`5BWHO_ME`5D`20==`20g->mtotal-1)`20`7C`7C X`20`20`20`20`20`20`20(g->mcurrent`5BWHO_OPP`5D`20==`20g->mtotal-1)`20)`20) X`09g->flags`20`7C=`20F_CRGAME;`09`09/*`20this`20is`20the`20crawford`20rule`20g Vame`20*/ Xelse X`09g->flags`20`26=`20`7EF_CRGAME;`09`09/*`20not`20the`20crawford`20game,`20cle Var`20flag`20*/ Xif`20(`20(g->flags`20`26`20F_CRAWFORD)`20`26`26`20old_crgame) X`09g->flags`20`7C=`20F_CRDONE;`09`09/*`20crawford`20rule`20game`20is`20over V`20*/ X`7D $ call unpack MISC.C;1 138558963 "" $! $ create 'f' X/*`09move.c`09`098/5/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*----------------------------------------------------------------------- X`20*`09apply`20--`20apply`20a`20move`20to`20a`20board X`20* X`20*`20Apply`20applies`20a`20move`20to`20a`20board,`20detecting`20the`20follow Ving`20errors: X`20*`09RJ_NOROLL`09The`20mv`20struct`20did`20not`20contain`20a`20valid`20roll. V X`20*`09RJ_ONBAR`09The`20move`20attempted`20to`20move`20from`20a`20point`20othe Vr`20than X`20*`09`09`09the`20bar`20when`20pieces`20are`20on`20the`20bar. X`20*`09RJ_NOOFF`09The`20move`20attempted`20to`20move`20pieces`20off`20before V`20all X`20*`09`09`09pieces`20are`20in`20the`20inner`20table. X`20*`09RJ_NOPIECE`09The`20move`20attempted`20to`20take`20a`20piece`20from`20an V`20empty`20point. X`20*`09RJ_NOTYOURS`09The`20move`20attempted`20to`20move`20the`20opponent's`20p Viece. X`20*`09RJ_OCC`09`09The`20move`20attempted`20to`20move`20to`20an`20occupied`20p Voint. X`20*`09RJ_EXACT`09The`20move`20attempted`20to`20bear`20off`20a`20piece`20with V`20a X`20*`09`09`09larger`20roll`20than`20necessary`20when`20that`20piece`20was X`20*`09`09`09not`20the`20outermost`20piece. X`20*`20If`20the`20move`20was`20legal,`20apply`20returns: X`20*`09MVOK`09`09if`20no`20blot`20was`20hit,`20or X`20*`09point`20number`09where`20the`20blot`20was`20before`20it`20was`20hit. X`20*`20Note`20that`20blot`20numbers`20are`20in`20the`20range`20`5B1-24`5D,`20M VVOK`20is`200,`20and X`20*`20the`20reject`20codes`20are`20negative.`20`20When`20the`20move`20is`20re Vjected, X`20*`20the`20board`20is`20unchanged.`20`20When`20a`20blot`20is`20hit,`20it`20i Vs`20moved`20to`20the X`20*`20appropriate`20bar`20point`20automatically. X`20* X`20*`20If`20A_REDRAW`20is`20set`20in`20flags,`20apply`20redraws`20the`20releva Vnt`20portions`20of X`20*`20the`20screen`20to`20reflect`20the`20move.`20`20If`20A_CHKONLY`20is`20se Vt`20in`20flags,`20the X`20*`20move`20is`20checked`20but`20the`20board`20is`20not`20modified. X`20*----------------------------------------------------------------------- X`20*/ X Xapply(g,who,mn,flags,dest) Xstruct`20game`20*g;`09`09`09/*`20game`20structure`20*/ Xint`20who;`09`09`09/*`20WHO_OPP`20=`20opponent,`20WHO_ME`20=`20me`20*/ Xint`20mn;`09`09`09`09/*`20which`20element`20of`20mv`20array`20*/ Xint`20flags;`09`09`09/*`20A_*`20*/ Xint`20*dest;`09`09`09/*`20where`20to`20store`20destination`20point`20*/ X`7B Xint`20i,`20j,`20blot; Xint`20op,`20np; Xint`20dir; Xchar`20clr; Xstruct`20mv`20*m; Xregister`20struct`20point`20*b`20=`20g->board; X Xdir`20=`20(who`20==`20WHO_ME)`20?`20g->mydir`20:`20g->opdir; Xclr`20=`20(who`20==`20WHO_ME)`20?`20g->mycolor`20:`20g->opcolor; Xblot`20=`20MVOK;`09`09`09/*`20no`20blot`20hit`20yet`20*/ Xm`20=`20(who`20==`20WHO_ME)`20?`20`26g->mvs`5Bmn`5D`20:`20`26g->opmvs`5Bmn`5D; V Xif`20(m->roll`20<=`200)`09`09/*`20sanity`20check`20*/ X`09return(RJ_NOROLL);`09/*`20reject`20move`20*/ Xop`20=`20m->pt;`09`09/*`20starting`20point`20number`20*/ Xif`20(op`20<`200)`09`09/*`20this`20roll`20is`20unused`20*/ X`09return(MVOK);`09/*`20and`20that's`20ok`20*/ Xif`20(`20(op`20==`200)`20`7C`7C`20(op`20==`2025)`20)`09/*`20moving`20off`20bar V`20*/ X`09op`20=`20BARPT(dir);`09/*`20use`20correct`20bar`20point`20*/ Xelse`20`7B`09`09`09/*`20not`20moving`20off`20bar`20*/ X`09j`20=`20BARPT(dir);`09/*`20make`20sure`20no`20pieces`20still`20on`20bar`20* V/ X`09if`20(b`5Bj`5D.qty`20>`200) X`09`09return(RJ_ONBAR);`09/*`20can't`20move,`20pieces`20on`20bar`20*/ X`09`7D Xnp`20=`20op`20+`20m->roll*dir;`09/*`20move`20piece`20correct`20number`20of`20p Vts`20*/ Xif`20(`20(np`20<=`200)`20`7C`7C`20(np`20>=`2025)`20)`20`7B X`09i`20=`20(dir`20>`200)`20?`2019`20:`201; X`09j`20=`20(dir`20>`200)`20?`2024`20:`206; X`09if`20(addpcs(b,clr,i,j)+b`5BOFFPT(dir)`5D.qty`20<`2015)`20/*`20all`20pcs V`20not`20*/ X`09`09return(RJ_NOOFF);`09/*`20in`20inner`20table,`20can't`20move`20off`20*/ X`09if`20(`20(np`20!=`200)`20`26`26`20(np`20!=`2025)`20)`20`7B/*`20using`20bigg Ver`20roll`20than`20needed`20*/ X`09`09i`20=`20(dir`20>`200)`20?`2019`20`20`20:`20op+1;`20/*`20check`20for`20pc Vs`20on`20higher`20pts`20*/ X`09`09j`20=`20(dir`20>`200)`20?`20op-1`20:`206; X`09`09if`20(addpcs(b,clr,i,j)`20>`200)`09/*`20there`20are`20some`20*/ X`09`09`09return(RJ_EXACT);`09/*`20must`20use`20roll`20on`20them`20*/ X`09`09`7D X`09np`20=`20OFFPT(dir);`09/*`20this`20piece`20is`20moving`20off`20*/ X`09`7D Xif`20(b`5Bop`5D.qty`20<=`200)`09`09/*`20no`20piece`20here`20to`20move`20*/ X`09return(RJ_NOPIECE); Xif`20(b`5Bop`5D.color`20!=`20clr)`09/*`20trying`20to`20move`20opponent's`20pie Vces?`20*/ X`09return(RJ_NOTYOURS); Xif`20(b`5Bnp`5D.qty`20==`200)`09`09/*`20moving`20to`20an`20empty`20point`20*/ X`09b`5Bnp`5D.color`20=`20b`5Bop`5D.color;`09/*`20copy`20color`20*/ Xif`20(b`5Bnp`5D.color`20!=`20b`5Bop`5D.color)`20`7B`09/*`20moving`20to`20occup Vied`20pt`20*/ X`09if`20(b`5Bnp`5D.qty`20==`201)`20`7B`09`09/*`20whacked`20a`20blot`20*/ X`09`09blot`20=`20np;`09`09/*`20save`20point`20number`20for`20return`20*/ X`09`09if`20(`20(flags`20`26`20A_CHKONLY)`20==`200)`20`7B +-+-+-+-+-+-+-+- END OF PART 11 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 12 -+-+-+-+-+-+-+-+ X`09`09`09b`5Bnp`5D.qty`20=`200;`09`09/*`20bye`20bye`20*/ X`09`09`09j`20=`20BARPT(REV(dir));`09/*`20send`20it`20to`20opponents`20bar`20*/ V X`09`09`09b`5Bj`5D.color`20=`20b`5Bnp`5D.color;`20/*`20copy`20color`20to`20bar V`20pt`20*/ X`09`09`09b`5Bj`5D.qty++;`09`09/*`20bump`20counter`20*/ X`09`09`09if`20(flags`20`26`20A_REDRAW)`20`7B`09/*`20update`20screen`20*/ X`09`09`09`09FeDrawPoint(b,j,0,g->flags`20`26`20F_INVERT); X`09`09`09`09FeDrawPip(b,g); X`09`09`09`09`7D X`09`09`09b`5Bnp`5D.color`20=`20b`5Bop`5D.color;`09/*`20my`20point`20now`20*/ X`09`09`09`7D X`09`09`7D X`09else X`09`09return(RJ_OCC);`09`09/*`20point`20is`20occupied`20*/ X`09`7D Xif`20(`20(flags`20`26`20A_CHKONLY)`20==`200)`20`7B X`09b`5Bop`5D.qty--;`09`09`09`09/*`20take`20piece`20from`20old`20pt`20*/ X`09b`5Bnp`5D.qty++;`09`09`09`09/*`20and`20put`20in`20on`20new`20pt`20*/ X`09if`20(flags`20`26`20A_REDRAW)`20`7B X`09`09FeDrawPip(b,g); X`09`09FeDrawPoint(b,op,0,g->flags`20`26`20F_INVERT);/*`20update`20the`20screen V`20*/ X`09`09FeDrawPoint(b,np,0,g->flags`20`26`20F_INVERT); X`09`09`7D X`09`7D Xif`20(dest`20!=`20NULL)`09`09`09/*`20return`20new`20position`20*/ X`09*dest`20=`20np; Xreturn(blot);`09`09`09`09/*`20succeeded,`20return`20MVOK`20or`20blot`20*/ X`7D X X X/*---------------------------------------------------------------------- X`20*`09addpcs`20--`20add`20the`20number`20of`20pieces`20in`20a`20range`20of V`20points X`20* X`20*`20This`20function`20returns`20the`20number`20of`20pieces`20of`20a`20certa Vin`20color X`20*`20that`20reside`20within`20a`20range`20of`20points. X`20*---------------------------------------------------------------------- X`20*/ X Xaddpcs(b,clr,f,t) Xboard`20b; Xchar`20clr; Xint`20f,`20t; X`7B Xint`20i,`20q; X Xq`20=`200;`09`09`09`09/*`20quantity`20we`20have`20found`20so`20far`20*/ Xfor`20(i`20=`20f;`20i`20<=`20t;`20i++) X`09if`20(b`5Bi`5D.color`20==`20clr)`09/*`20found`20some`20*/ X`09`09q`20+=`20b`5Bi`5D.qty;`09/*`20count`20them`20*/ Xreturn(q);`09`09`09/*`20return`20quantity`20found`20*/ X`7D $ call unpack MOVE.C;1 268841531 "" $! $ create 'f' X/*`09process.c`09`098/8/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*=========================================================================== X`20*`20This`20file`20contains`20the`20code`20to`20process`20user`20input. X`20*========================================================================== V= X`20*/ X X X X/*---------------------------------------------------------------------- X`20*`09process`20--`20process`20a`20game`20while`20it`20needs`20local`20input X`20* X`20*`20This`20function`20calls`20the`20appropriate`20handler,`20according`20to V`20what X`20*`20state`20the`20game`20is`20in,`20to`20prompt`20the`20user`20for`20input. V`20`20If`20a`20game X`20*`20does`20not`20need`20local`20input,`20it`20is`20skipped.`20`20Process() V`20returns`201 X`20*`20if`20the`20game`20still`20needs`20local`20input,`20in`20which`20case V`20the`20main`20program X`20*`20will`20re-call`20process`20with`20the`20same`20game.`20`20When`20the V`20game`20no`20longer X`20*`20needs`20local`20input,`20process`20will`20return`200,`20telling`20the V`20main`20program X`20*`20to`20proceed`20to`20the`20next`20game. X`20*---------------------------------------------------------------------- X`20*/ X Xprocess(g) Xstruct`20game`20*g; X`7B Xint`20i; X Xif`20(g->state`20<`20OPSTATES)`09/*`20this`20game`20is`20waiting`20for`20the V`20opponent`20*/ X`09return(0);`09`09/*`20skip`20it`20for`20now`20*/ Xif`20(`20(g->state`20==`20ST_GAMEOVER)`20`26`26`20(g->flags`20`26`20F_DISPLAYE VD)`20) X`09return(0);`09/*`20game`20is`20in`20"keepold"`20wait,`20no`20need`20to`20dis Vplay`20*/ XFeDrawGame(g);`09`09`09/*`20draw`20the`20game`20*/ Xswitch`20(g->state)`20`7B Xcase`20ST_MYTURN:`09`09`09/*`20my`20turn,`20I`20haven't`20rolled`20yet`20*/ X`09if`20(`20((g->flags`20`26`20F_IDOUBLED)`20==`200)`20`7C`7C`20(*rc.autoroll V`20==`20'n')`20)`20`7B X`09`09i`20=`20myturn(g);`09/*`20I`20didn't`20double`20last`20*/ X`09`09break; X`09`09`7D X`09rolldice(g);`09`09/*`20if`20I`20doubled`20last,`20go`20ahead`20and`20roll V`20*/ X`09g->state`20=`20ST_MYMOVE;`09/*`20skip`20this`20state`20completely`20*/ X`09if`20(*rc.chkpt`20==`20'y')`20`7B`09/*`20checkpoint`20games`20*/ X`09`09writegames(rc.gfile,rc.gbackup,rc.pfile); X`09`09rc.gbackup`20=`20NULL;`09/*`20only`20backup`20old`20file`20once`20*/ X`09`09`7D X`09for`20(i`20=`200;`20i`20<`204;`20i++)`09`09/*`20draw`20my`20new`20roll`20*/ V X`09`09FeDrawMove(g,WHO_ME,i); X`09/****`20fall`20through`20****/ Xcase`20ST_MYMOVE:`09`09`09/*`20my`20turn,`20I`20have`20rolled`20*/ X`09i`20=`20mymove(g);`09`09/*`20user`20has`20rolled,`20must`20move`20*/ X`09break; Xcase`20ST_MYACCEPT: X`09i`20=`20myacpt(g);`09/*`20user`20must`20accept`20or`20decline`20double`20*/ V X`09break; Xcase`20ST_GAMEOVER: X`09i`20=`20gameover(g);`09`09/*`20tell`20him`20the`20game`20is`20over`20*/ X`09break; X`09`7D Xreturn(i); X`7D X X X/*---------------------------------------------------------------------- X`20*`09myturn`20--`20allow`20user`20to`20roll`20or`20double X`20* X`20*`20This`20function`20is`20called`20to`20allow`20the`20user`20to`20choose V`20between X`20*`20rolling`20the`20dice`20and`20doubling.`20`20It`20also`20allows`20the V`20user`20to`20cycle X`20*`20through`20the`20three`20board`20displays,`20to`20concede,`20and`20to V`20go`20to`20the`20next`20game. X`20*---------------------------------------------------------------------- X`20*/ X Xmyturn(g) Xstruct`20game`20*g; X`7B Xchar`20c; Xchar`20pm`20=`20'`5C0'; Xint`20gv; Xstatic`20char`20*m`5B`5D=`7B"Roll","Double","Board","Next`20Game","Concede","Q Vuit",NULL`7D; X XFeDrawMenu(m);`09`09`09/*`20display`20the`20menu`20*/ XGameState`20=`20STATE_MYTURN; Xwhile`20(1)`20`7B X`09c`20=`20FeMenu(m,0,0,"`5Cn`5Cr`20",pm);`09/*`20get`20a`20menu`20choice`20*/ V X`09pm`20=`20c; X`09switch`20(c)`20`7B X`09case`20'`5Cn': X`09case`20'`5Cr': X`09case`20'`20': X`09`09FeOnMenuItem(m,'R');`09/*`20highlight`20Roll`20item`20*/ X`09`09pm`20=`20'R';`09`09/*`20remember`20to`20unhighlight`20it`20later`20*/ X`09`09/*`20fall`20through`20*/ X`09case`20'R':`09`09`09/*`20roll`20them`20dice`20*/ X`09`09g->curbd`20=`20BD_CUR;`09/*`20bring`20up`20current`20board`20*/ X`09`09rolldice(g); X`09`09g->state`20=`20ST_MYMOVE;`09/*`20I`20just`20entered`20a`20new`20state V`20*/ X`09`09if`20(*rc.chkpt`20==`20'y')`20`7B`09/*`20checkpoint`20games`20*/ X`09`09`09writegames(rc.gfile,rc.gbackup,rc.pfile); X`09`09`09rc.gbackup`20=`20NULL;`09/*`20only`20backup`20old`20file`20once`20*/ X`09`09`09`7D X`09`09return(1);`09`09/*`20make`20sure`20process`20gets`20re-called`20*/ X`09case`20'D':`09`09`09/*`20I`20want`20to`20double`20*/ X`09`09if`20(g->flags`20`26`20F_IDOUBLED)`20`7B`09/*`20I`20doubled`20last`20*/ X`09`09`09FeMessage("You`20doubled`20last."); X`09`09`09break;`09`09/*`20so`20I`20can't`20double`20now`20*/ X`09`09`09`7D X`09`09if`20(g->flags`20`26`20F_CRGAME)`20`7B X`09`09`09FeMessage("Double`20not`20allowed`20(Crawford`20rule)"); X`09`09`09break; X`09`09`09`7D X`09`09if`20(FeGetComment(g)`20<`200)`20`7B`09/*`20get`20message`20*/ X`09`09`09FeMessage("Double`20aborted."); X`09`09`09break;`09`09/*`20changed`20his`20mind`20*/ X`09`09`09`7D X`09`09g->state`20=`20ST_OPACCEPT;`09/*`20we`20are`20waiting`20for`20accept/dec Vline`20*/ X`09`09sendpkt(g,OFRDBL);`09/*`20send`20the`20double`20packet`20*/ X`09`09return(0);`09`09/*`20this`20game`20is`20done`20for`20now`20*/ X`09case`20'C':`09`09`09/*`20I'm`20wimping`20out`20*/ X`09`09if`20(`20(check_concede(g)`20==`200)`20`7C`7C`20(FeGetComment(g)`20<`200 V)`20)`20`7B X`09`09`09FeMessage("Concede`20aborted."); X`09`09`09break; X`09`09`09`7D X`09`09ilose(g,T_ICONCEDE,0);`09/*`20this`20game`20is`20over`20*/ X`09`09sendpkt(g,CONCEDE);`09/*`20send`20the`20packet`20*/ X`09`09return(1);`09`09/*`20display`20the`20gameover`20screen`20*/ X`09case`20'B':`09`09`09/*`20display`20different`20board`20*/ X`09`09if`20(g->curbd++`20>=`20BD_CUR)`09/*`20go`20to`20next`20board`20*/ X`09`09`09g->curbd`20=`20BD_BEFOP;`09/*`20wrap`20around`20*/ X`09`09return(1);`09`09/*`20redraw`20`26`20call`20us`20again`20*/ X`09case`20'N':`09`09`09/*`20I`20don't`20want`20to`20decide`20right`20now`20*/ X`09`09return(0); X`09case`20'Q':`09`09`09/*`20I`20want`20to`20quit`20ldb`20*/ X`09`09return(-1); X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09mymove`20--`20allow`20user`20to`20move X`20* X`20*`20This`20function`20is`20called`20to`20allow`20the`20user`20to`20use`20hi Vs`20roll. X`20*`20It`20also`20allows`20the`20user`20to`20cycle`20through`20the`20three V`20board`20displays, X`20*`20to`20concede,`20and`20to`20go`20to`20the`20next`20game. X`20*`20Since`20the`20user`20has`20already`20rolled,`20doubling`20is`20not`20al Vlowed`20here. X`20*---------------------------------------------------------------------- X`20*/ X Xmymove(g) Xstruct`20game`20*g; X`7B Xchar`20c; Xint`20i,`20n; Xstatic`20char`20used`5B`5D`20=`20"That`20move`20is`20already`20used`20--`20use V`20Reset`20to`20start`20over"; Xstruct`20mv`20tmp; Xstatic`20char`20*m`5B`5D`20=`20`7B"Reset","Send","Board","Next`20Game","Conced Ve", X`09`09`09"Point","Off","Quit",NULL`7D; Xchar`20pm`20=`20'`5C0'; Xint`20lastpt`20=`2099;`09`09/*`20point`20last`20move`20started`20from`20*/ Xint`20lastd`20=`2099;`09`09`09/*`20point`20last`20move`20ended`20at`20*/ X XFeDrawMenu(m); XGameState`20=`20STATE_MYMOVE; Xwhile`20(1)`20`7B X`09c`20=`20FeMenu(m,g->mvs`5B0`5D.roll,g->mvs`5B1`5D.roll,"`5Cn`5Cr`20",pm); X`09pm`20=`20c; X`09switch`20(c)`20`7B X`09case`20'S':`09`09`09/*`20send`20moves`20*/ X`09`09if`20(checkused(g))`09/*`20didn't`20use`20all`20our`20moves`20*/ X`09`09`09break; X`09`09if`20(FeGetComment(g)`20<`200)`20`7B`09/*`20get`20our`20comment`20*/ X`09`09`09FeMessage("Send`20aborted."); X`09`09`09break; X`09`09`09`7D X`09`09if`20(g->board`5BOFFPT(g->mydir)`5D.qty`20==`2015)`09/*`20I`20win`20*/ X`09`09`09iwin(g,T_IWIN,0); X`09`09else X`09`09`09g->state`20=`20ST_OPTURN; X`09`09sendpkt(g,MOVE);`09`09/*`20send`20our`20move`20*/ X`09`09return(g->state`20==`20ST_GAMEOVER);/*`20need`20to`20call`20gameover() V`20*/ X`09case`20'R':`09`09`09/*`20reset`20--`20erase`20moves`20`26`20start`20over V`20*/ X`09`09if`20(g->curbd`20!=`20BD_CUR)`09`09/*`20if`20we`20are`20not`20looking V`20at`20*/ X`09`09`09g->curbd`20=`20BD_CUR;`09/*`20current`20board,`20switch`20*/ X`09`09for`20(i`20=`200;`20i`20<`204;`20i++)`20`7B X`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09FeDrawMove(g,WHO_ME,i); X`09`09`09`7D X`09`09copyboard(g->mybd,g->board); X`09`09FeDrawBoard(g->board,NULL,g->mydir,0,g->flags`20`26`20F_INVERT); X`09`09FeLabelBoard(g); X`09`09FeDrawPip(g->board,g); X`09`09break; X`09case`20'B':`09`09`09`09/*`20display`20different`20board`20*/ X`09`09if`20(g->curbd++`20>=`20BD_CUR)`09/*`20go`20to`20next`20board`20*/ X`09`09`09g->curbd`20=`20BD_BEFOP;`09/*`20wrap`20around`20*/ X`09`09return(1);`09`09/*`20redraw`20`26`20call`20us`20again`20*/ X`09case`20'C':`09`09`09/*`20I'm`20wimping`20out`20*/ X`09`09if`20(`20(check_concede(g)`20==`200)`20`7C`7C`20(FeGetComment(g)`20<`200 V)`20)`20`7B X`09`09`09FeMessage("Concede`20aborted."); X`09`09`09break; X`09`09`09`7D X`09`09ilose(g,T_ICONCEDE,0); X`09`09sendpkt(g,CONCEDE);`09/*`20send`20the`20packet`20*/ X`09`09return(1);`09`09/*`20display`20the`20gameover`20screen`20*/ X`09case`20'N':`09`09`09/*`20I`20don't`20want`20to`20decide`20right`20now`20*/ X`09`09return(0); X`09case`20'Q':`09`09`09/*`20I`20want`20to`20quit`20ldb`20*/ X`09`09return(-1); X`09case`20'`20':`09`09`09/*`20continue`20last`20move`20*/ X`09`09if`20(g->curbd`20!=`20BD_CUR)`20`7B X`09`09`09g->curbd`20=`20BD_CUR; X`09`09`09FeDrawBoard(g->board,NULL,g->mydir,0, X`09`09`09`09g->flags`20`26`20F_INVERT); X`09`09`09FeLabelBoard(g); X`09`09`09`7D X`09`09n`20=`20(g->mvs`5B0`5D.roll`20==`20g->mvs`5B1`5D.roll)`20?`204`20:`202; X`09`09for`20(i`20=`200;`20i`20<`20n;`20i++)`09`09/*`20search`20for`20an`20unus Ved`20move`20*/ X`09`09`09if`20(g->mvs`5Bi`5D.pt`20<`200) X`09`09`09`09break; X`09`09if`20(i`20>=`20n)`20`7B X`09`09`09FeMessage("You`20don't`20have`20any`20moves`20left."); X`09`09`09break; X`09`09`09`7D X`09`09if`20(`20(lastd`20<`201)`20`7C`7C`20(lastd`20>`2024)`20)`20`7B X`09`09`09FeMessage( X`09`09`09`20`20`20"No`20move`20to`20continue`20--`20please`20select`20a`20roll V."); X`09`09`09break; X`09`09`09`7D X`09`09g->mvs`5Bi`5D.pt`20=`20lastd; X`09`09n`20=`20apply(g,WHO_ME,i,A_REDRAW,`26lastd); X`09`09if`20(n`20<`200)`20`7B`09/*`20move`20rejected`20*/ X`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09FeMessage(rejlcl`5B-n`5D); X`09`09`09lastd`20=`2099; X`09`09`09`7D X`09`09else X`09`09`09lastpt`20=`20g->mvs`5Bi`5D.pt; X`09`09FeDrawMove(g,WHO_ME,i); X`09`09FeCheckContact(g); X`09`09break; X`09case`20'`5Cn':`09`09`09/*`20repeat`20last`20move`20*/ X`09case`20'`5Cr': X`09`09if`20(g->curbd`20!=`20BD_CUR)`20`7B X`09`09`09g->curbd`20=`20BD_CUR; X`09`09`09FeDrawBoard(g->board,NULL,g->mydir,0, X`09`09`09`09g->flags`20`26`20F_INVERT); X`09`09`09FeLabelBoard(g); X`09`09`09`7D X`09`09n`20=`20(g->mvs`5B0`5D.roll`20==`20g->mvs`5B1`5D.roll)`20?`204`20:`202; X`09`09for`20(i`20=`200;`20i`20<`20n;`20i++)`09`09/*`20search`20for`20an`20unus Ved`20move`20*/ X`09`09`09if`20(g->mvs`5Bi`5D.pt`20<`200) X`09`09`09`09break; X`09`09if`20(i`20>=`20n)`20`7B X`09`09`09FeMessage("You`20don't`20have`20any`20moves`20left."); X`09`09`09break; X`09`09`09`7D X`09`09if`20(`20(lastpt`20<`200)`20`7C`7C`20(lastpt`20>`2025)`20)`20`7B X`09`09`09FeMessage("No`20move`20to`20repeat`20--`20please`20select`20a`20roll. V"); X`09`09`09break; X`09`09`09`7D X`09`09g->mvs`5Bi`5D.pt`20=`20lastpt; X`09`09n`20=`20apply(g,WHO_ME,i,A_REDRAW,`26lastd); X`09`09if`20(n`20<`200)`20`7B`09/*`20move`20rejected`20*/ X`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09FeMessage(rejlcl`5B-n`5D); X`09`09`09lastpt`20=`2099; X`09`09`09`7D X`09`09FeDrawMove(g,WHO_ME,i); X`09`09FeCheckContact(g); X`09`09break; X`09case`20'P':`09`09`09`09/*`20make`20point`20from`20last`20move`20*/ X`09`09if`20(g->curbd`20!=`20BD_CUR)`20`7B X`09`09`09g->curbd`20=`20BD_CUR; X`09`09`09FeDrawBoard(g->board,NULL,g->mydir,0, X`09`09`09`09g->flags`20`26`20F_INVERT); X`09`09`09FeLabelBoard(g); X`09`09`09`7D X`09`09n`20=`20(g->mvs`5B0`5D.roll`20==`20g->mvs`5B1`5D.roll)`20?`204`20:`202; X`09`09for`20(i`20=`200;`20i`20<`20n;`20i++)`09`09/*`20search`20for`20an`20unus Ved`20move`20*/ X`09`09`09if`20(g->mvs`5Bi`5D.pt`20<`200) X`09`09`09`09break; X`09`09if`20(i`20>=`20n)`20`7B X`09`09`09FeMessage("You`20don't`20have`20any`20moves`20left."); X`09`09`09break; X`09`09`09`7D X`09`09if`20(`20(lastpt`20<`200)`20`7C`7C`20(lastpt`20>`2025)`20)`20`7B X`09`09`09FeMessage("No`20point`20to`20make`20--`20please`20select`20a`20roll." V); X`09`09`09break; X`09`09`09`7D X`09`09g->mvs`5Bi`5D.pt`20=`20lastd`20-`20g->mydir*g->mvs`5Bi`5D.roll; X`09`09n`20=`20apply(g,WHO_ME,i,A_REDRAW,`26lastd); X`09`09if`20(n`20<`200)`20`7B`09/*`20move`20rejected`20*/ X`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09FeMessage(rejlcl`5B-n`5D); X`09`09`09`7D X`09`09FeDrawMove(g,WHO_ME,i); X`09`09FeCheckContact(g); X`09`09break; X`09case`20'O':`09`09`09`09/*`20bear`20off`20with`20next`20roll`20*/ X`09`09if`20(g->curbd`20!=`20BD_CUR)`20`7B X`09`09`09g->curbd`20=`20BD_CUR; X`09`09`09FeDrawBoard(g->board,NULL,g->mydir,0, X`09`09`09`09g->flags`20`26`20F_INVERT); X`09`09`09FeLabelBoard(g); X`09`09`09`7D X`09`09n`20=`20(g->mvs`5B0`5D.roll`20==`20g->mvs`5B1`5D.roll)`20?`204`20:`202; X`09`09for`20(i`20=`200;`20i`20<`20n;`20i++)`09`09/*`20search`20for`20an`20unus Ved`20move`20*/ X`09`09`09if`20(g->mvs`5Bi`5D.pt`20<`200) X`09`09`09`09break; X`09`09if`20(i`20>=`20n)`20`7B X`09`09`09FeMessage("You`20don't`20have`20any`20moves`20left."); X`09`09`09break; X`09`09`09`7D X`09`09n`20=`20(`20(g->mydir`20>`200)`20?`2025`20:`200`20)`20-`20g->mydir*g->mv Vs`5Bi`5D.roll; X`09`09while`20(`20(n`20>`200)`20`26`26`20(n`20<`2025)`20`26`26`20(`20(g->board V`5Bn`5D.qty`20<=`200)`20`7C`7C X`09`09`20`20`20(g->board`5Bn`5D.color`20!=`20g->mycolor)`20)`20`20) X`09`09`09n`20+=`20g->mydir;`09`09/*`20search`20for`20occupied`20point`20*/ X`09`09if`20(`20(n`20<`201)`20`7C`7C`20(n`20>`2024)`20)`20`7B X`09`09`09FeMessage("You`20cannot`20bear`20off`20with`20that`20roll."); X`09`09`09break; X`09`09`09`7D X`09`09g->mvs`5Bi`5D.pt`20=`20n; X`09`09n`20=`20apply(g,WHO_ME,i,A_REDRAW,`26lastd); X`09`09if`20(n`20<`200)`20`7B`09/*`20move`20rejected`20*/ X`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09FeMessage(rejlcl`5B-n`5D); X`09`09`09`7D X`09`09FeDrawMove(g,WHO_ME,i); X`09`09FeCheckContact(g); X`09`09break; X`09case`20'1': X`09case`20'2': X`09case`20'3': X`09case`20'4': X`09case`20'5': X`09case`20'6': X`09`09if`20(g->curbd`20!=`20BD_CUR)`20`7B X`09`09`09g->curbd`20=`20BD_CUR; X`09`09`09FeDrawBoard(g->board,NULL,g->mydir,0, X`09`09`09`09g->flags`20`26`20F_INVERT); X`09`09`09FeLabelBoard(g); X`09`09`09`7D X`09`09c`20-=`20'0'; X`09`09if`20(`20(c`20==`20g->mvs`5B0`5D.roll)`20`26`26`20(c`20==`20g->mvs`5B1 V`5D.roll)`20)`20`7B X`09`09`09for`20(i`20=`200;`20i`20<`204;`20i++)`09`09/*`20doubles`20*/ X`09`09`09`09if`20(g->mvs`5Bi`5D.pt`20<`200) X`09`09`09`09`09break; X`09`09`09if`20(i`20==`204)`20`7B X`09`09`09`09FeMessage(used); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09`7D X`09`09else`20if`20(c`20==`20g->mvs`5B0`5D.roll)`20`7B`09`09/*`20used`201st`20m Vove`20*/ X`09`09`09if`20(g->mvs`5B0`5D.pt`20>=`200)`20`7B X`09`09`09`09FeMessage(used); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09i`20=`200; X`09`09`09`7D X`09`09else`20`7B X`09`09`09if`20(g->mvs`5B0`5D.pt`20<`200)`20`7B`09/*`20used`202nd`20move`201st V`20*/ X`09`09`09`09tmp`20=`20g->mvs`5B0`5D;`09/*`20swap`20moves`20*/ X`09`09`09`09g->mvs`5B0`5D`20=`20g->mvs`5B1`5D; X`09`09`09`09g->mvs`5B1`5D`20=`20tmp; X`09`09`09`09FeDrawMove(g,WHO_ME,0); X`09`09`09`09FeDrawMove(g,WHO_ME,1); X`09`09`09`09i`20=`200; X`09`09`09`09`7D X`09`09`09else`20if`20(g->mvs`5B1`5D.pt`20>=`200)`20`7B`09/*`20this`20move`20us Ved?`20*/ X`09`09`09`09FeMessage(used); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09else X`09`09`09`09i`20=`201; X`09`09`09`7D X`09`09n`20=`20FeGetPoint(g,i,lastpt,lastd); X`09`09if`20(n`20>=`200)`20`7B X`09`09`09if`20(n`20>`2025)`20`7B X`09`09`09`09FeMessage("Invalid`20point`20number"); X`09`09`09`09FeDrawMove(g,WHO_ME,i); X`09`09`09`09break; X`09`09`09`09`7D X`09`09`09g->mvs`5Bi`5D.pt`20=`20n; X`09`09`09n`20=`20apply(g,WHO_ME,i,A_REDRAW,`26lastd); X`09`09`09if`20(n`20<`200)`20`7B`09/*`20move`20rejected`20*/ X`09`09`09`09g->mvs`5Bi`5D.pt`20=`20-1; X`09`09`09`09FeMessage(rejlcl`5B-n`5D); X`09`09`09`09`7D X`09`09`09else X`09`09`09`09lastpt`20=`20g->mvs`5Bi`5D.pt; X`09`09`09`7D X`09`09FeDrawMove(g,WHO_ME,i); X`09`09FeCheckContact(g); X`09`09break; X`09default: X`09`09FeMessage("Invalid`20command."); X`09`09break; X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09myacpt`20--`20allow`20user`20to`20accept`20or`20decline`20double. X`20* X`20*`20This`20function`20allows`20the`20user`20to`20decide`20whether`20he X`20*`20wants`20to`20accept`20or`20decline`20his`20opponent's`20double. X`20*`20It`20also`20allows`20the`20user`20to`20cycle`20through`20the`20three V`20board`20displays, X`20*`20to`20concede,`20and`20to`20go`20to`20the`20next`20game. X`20*`20Rolling`20and`20doubling`20are`20not`20allowed`20here. X`20*---------------------------------------------------------------------- X`20*/ X Xmyacpt(g) Xstruct`20game`20*g; X`7B Xchar`20c; Xchar`20pm`20=`20'`5C0'; Xint`20gv; Xstatic`20char`20*m`5B`5D`20=`20`7B"Accept","Decline","Board","Next`20Game","Qu Vit",NULL`7D; X XFeDrawMenu(m); XGameState`20=`20STATE_MYACPT; Xwhile`20(1)`20`7B X`09c`20=`20FeMenu(m,0,0,"",pm); X`09pm`20=`20c; X`09switch`20(c)`20`7B X`09case`20'A':`09`09`09`09/*`20I`20accepted`20*/ X`09`09if`20(FeGetComment(g)`20<`200)`20`7B`09`09/*`20get`20message`20*/ X`09`09`09FeMessage("Accept`20aborted."); X`09`09`09break; X`09`09`09`7D X`09`09g->gameval`20*=`202;`09`09/*`20the`20game`20value`20is`20doubled`20*/ X`09`09g->state`20=`20ST_OPTURN;`09`09/*`20it's`20opponent's`20turn`20*/ X`09`09sendpkt(g,ACPTDBL);`09`09/*`20send`20accept`20packet`20*/ X`09`09return(0);`09`09`09/*`20done`20w/`20this`20game`20for`20now`20*/ X`09case`20'D':`09`09`09`09/*`20I`20declined`20*/ X`09`09if`20(FeGetComment(g)`20<`200)`20`7B`09`09/*`20get`20message`20*/ X`09`09`09FeMessage("Decline`20aborted."); X`09`09`09break; X`09`09`09`7D X`09`09ilose(g,T_IDECLINE,0); X`09`09sendpkt(g,DECDBL);`09`09/*`20tell`20the`20opponent`20*/ X`09`09return(1);`09`09`09/*`20call`20gameover()`20*/ X`09case`20'B':`09`09`09`09/*`20display`20different`20board`20*/ X`09`09if`20(g->curbd++`20>=`20BD_CUR)`09/*`20go`20to`20next`20board`20*/ X`09`09`09g->curbd`20=`20BD_BEFOP;`09/*`20wrap`20around`20*/ X`09`09return(1);`09`09/*`20redraw`20`26`20call`20us`20again`20*/ X`09case`20'N': X`09`09return(0);`09`09/*`20I'm`20done`20with`20this`20game`20for`20now`20*/ X`09case`20'Q':`09`09`09/*`20I`20want`20to`20quit`20ldb`20*/ X`09`09return(-1); X`09default: X`09`09FeMessage("Invalid`20command."); X`09`09break; X`09`09`7D X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09gameover`20--`20show`20game`20to`20user`20before`20it`20is`20deleted. X`20* X`20*`20This`20function`20displays`20a`20game`20that`20has`20just`20terminated. V X`20*`20It`20displays`20the`20final`20board,`20the`20reason`20the`20game`20ende Vd,`20and`20the X`20*`20number`20of`20points`20won`20or`20lost.`20`20The`20game`20will`20be`20d Veleted`20by X`20*`20writegames()`20when`20ldb`20exits. X`20*---------------------------------------------------------------------- X`20*/ X Xgameover(g) Xstruct`20game`20*g; X`7B Xchar`20c,`20c1,`20c2; Xchar`20pm`20=`20'`5C0'; Xint`20i; Xstatic`20char`20*m`5B`5D`20=`20`7B"Board","Next`20Game","Quit",NULL`7D; X Xif`20(g->flags`20`26`20F_DISPLAYED)`09`09/*`20this`20game`20already`20displaye Vd`20*/ X`09return(0); XFeDrawMenu(m); XGameState`20=`20STATE_GAMEOVER; Xwhile`20(1)`20`7B X`09c`20=`20FeMenu(m,0,0,"`5Cn`5Cr`20",pm); X`09pm`20=`20c; X`09switch`20(c)`20`7B X`09case`20'B':`09`09`09`09/*`20display`20different`20board`20*/ X`09`09if`20(g->curbd++`20>=`20BD_CUR)`09/*`20go`20to`20next`20board`20*/ X`09`09`09g->curbd`20=`20BD_BEFOP;`09/*`20wrap`20around`20*/ X`09`09return(1);`09`09/*`20redraw`20`26`20call`20us`20again`20*/ X`09case`20'`20': X`09case`20'`5Cr': X`09case`20'`5Cn': X`09`09FeOnMenuItem(m,'N');`09/*`20highlight`20Next`20Game`20item`20*/ X`09`09pm`20=`20'N';`09`09/*`20remember`20to`20unhighlight`20*/ X`09`09/*`20fall`20through`20*/ X`09case`20'N':`09`09`09/*`20delete`20game`20`26`20go`20to`20next`20*/ X`09`09if`20(`20(g->mcurrent`5BWHO_ME`5D`20<`20g->mtotal)`20`26`26 X`09`09`20`20`20`20`20(g->mcurrent`5BWHO_OPP`5D`20<`20g->mtotal)`20)`20`7B X`09`09`09g->state`20=`20ST_OPSTART; X`09`09`09if`20(`20(g->term`20==`20T_ILOSE)`20`7C`7C`20(g->term`20==`20T_OPCONC VEDE) X`09`09`09`20`20`20`20`20`7C`7C`20(g->term`20==`20T_OPDECLINE)`20)`20`7B X`09`09`09`09g->gameval`20=`201;`09/*`20reset`20for`20next`20game`20*/ X`09`09`09`09g->adcnt`20=`200; X`09`09`09`09g->flags`20`26=`20`7EF_IDOUBLED; X`09`09`09`09g->term`20=`200; X`09`09`09`09clearmvs(g->mvs); X`09`09`09`09clearmvs(g->opmvs); X`09`09`09`09if`20(g->mydir`20>`200)`20`7B X`09`09`09`09`09c1`20=`20g->mycolor; X`09`09`09`09`09c2`20=`20g->opcolor; X`09`09`09`09`09`7D X`09`09`09`09else`20`7B X`09`09`09`09`09c1`20=`20g->opcolor; X`09`09`09`09`09c2`20=`20g->mycolor; X`09`09`09`09`09`7D X`09`09`09`09newboard(g->opbd,c1,c2); X`09`09`09`09newboard(g->mybd,c1,c2); X`09`09`09`09newboard(g->board,c1,c2); X`09`09`09`09for`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09`09`09`09`09g->rolls`5Bi`5D`20=`200; X`09`09`09`09`09g->doubles`5Bi`5D`20=`200; X`09`09`09`09`09g->oprolls`5Bi`5D`20=`200; X`09`09`09`09`09g->opdoubles`5Bi`5D`20=`200; X`09`09`09`09`09`7D X`09`09`09`09crawford_check(g); X`09`09`09`09g->mvs`5B0`5D.roll`20=`20Rolldie(); X`09`09`09`09sendpkt(g,MSTART); X`09`09`09`09`7D X`09`09`09`7D X`09`09else`20`7B X`09`09`09g->flags`20`7C=`20F_DISPLAYED;/*`20done`20looking`20at`20this`20game V`20*/ X`09`09`09if`20(g->mtotal`20>`200)`20`7B`09/*`20finished`20match`20*/ X`09`09`09`09if`20(g->term`20<=`20T_ILOSE) X`09`09`09`09`09g->ppl->score`5BSC_MLOST`5D++; X`09`09`09`09else X`09`09`09`09`09g->ppl->score`5BSC_MWON`5D++; X`09`09`09`09`7D X`09`09`09`7D X`09`09return(0);`09`09/*`20I'm`20done`20looking`20at`20this`20game`20*/ X`09case`20'Q':`09`09`09/*`20delete`20game`20`26`20quit`20*/ X`09`09return(-1); X`09default: X`09`09FeMessage("Invalid`20command."); X`09`09break; X`09`09`7D X`09`7D X`7D X X Xcheck_concede(g) Xstruct`20game`20*g; X`7B Xint`20gv,`20bg; Xchar`20*msg; X Xg->term`20=`20T_ICONCEDE; Xbg`20=`20gvalue(g,`26gv); Xswitch`20(bg)`20`7B Xcase`201: X`09msg`20=`20"This`20will`20score`20as`20a`20gammon.`20`20Are`20you`20sure? V`20`5Byn`5D"; X`09break; Xcase`202: X`09msg`20=`20"This`20will`20score`20as`20a`20backgammon.`20`20Are`20you`20sure V?`20`5Byn`5D"; X`09break; Xdefault: X`09msg`20=`20"Are`20you`20sure?`20`5Byn`5D"; X`09break; X`09`7D Xreturn(FeYesNo(msg)); X`7D $ call unpack PROCESS.C;1 796178223 "" $! $ create 'f' X/*`09rcvop.c`09`098/6/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*=========================================================================== X`20*`20This`20file`20contains`20the`20functions`20which`20make`20up`20the`20re Vceive`20state X`20*`20machine.`20`20These`20are`20called`20through`20the`20func`5B`5D`5B`5D V`20matrix,`20which`20takes X`20*`20the`20current`20state`20and`20a`20received`20operation`20and`20calls V`20the`20appropriate X`20*`20handler`20function.`20`20These`20functions`20will`20typically`20change V`20the`20game X`20*`20state`20into`20one`20requiring`20user`20input`20at`20this`20host`20(ST_ VMY*),`20and`20return. X`20*========================================================================== V= X`20*/ X X X/*--------------------------------------------------------------------------- X`20*`09start`20--`20initiate`20a`20game X`20* X`20*`20This`20function`20is`20called`20when`20a`20remote`20user`20starts`20a V`20game`20with`20us. X`20*`20We`20store`20his`20personal`20information`20(opaddr`20`26`20opname), V`20roll`201`20die, X`20*`20and`20compare`20it`20to`20the`20one`20he`20sent.`20`20If`20we`20won`20t Vhe`20roll,`20the`20roll X`20*`20is`20stored`20in`20mvs`5B`5D`20and`20state`20is`20set`20to`20MYMOVE. V`20`20If`20we`20lost`20the`20roll, X`20*`20both`20dice`20are`20sent`20back`20in`20a`20USTART`20line.`20`20If`20the V`20roll`20was`20a`20tie, X`20*`20a`20TIE`20packet`20is`20sent`20back`20.`20`20The`20originator`20will V`20re-roll`20and`20send X`20*`20us`20a`20RESTART`20packet,`20which`20will`20repeat`20the`20opening`20ro Vll. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xstart(g) Xstruct`20game`20*g; X`7B Xint`20mydie; Xchar`20c1,`20c2; X Xg->opaddr`20=`20P.addr;`09/*`20save`20mail`20address`20of`20opponent`20*/ Xg->gameid`20=`20P.gameid;`09`09/*`20copy`20game`20id`20*/ Xg->opver`20=`20P.version;`09`09/*`20save`20opponent's`20ldb`20version`20*/ Xg->mycolor`20=`20P.colors`5B1`5D;`09/*`20copy`20out`20colors`20*/ Xg->opcolor`20=`20P.colors`5B0`5D; Xif`20(isupper(*P.dir)) X`09*P.dir`20=`20tolower(*P.dir); Xg->mydir`20=`20(*P.dir`20==`20'u')`20?`201`20:`20-1;`09/*`20copy`20out`20direc Vtions`20*/ Xg->opdir`20=`20REV(g->mydir); Xg->gameval`20=`201;`09`09`09/*`20no`20doubles`20yet`20*/ Xg->flags`20=`200; Xg->seq`20=`202;`09`09`09/*`20we`20rcvd`201`20pkt`20already,`20init`20to`202 V`20*/ Xif`20(`20(g->ppl`20=`20findppl(g->opaddr,P_ADDR))`20==`20NULL)`20`7B`20/*`20kn Vow`20this`20guy?`20*/ X`09g->myaddr`20=`20save(rc.myaddr);`09/*`20nope,`20create`20a`20new`20ppl`20re Vcord`20*/ X`09newppl(g); X`09`7D Xelse X`09g->myaddr`20=`20save(g->ppl->myaddr); Xg->starttime`20=`20P.timestamp;`09/*`20store`20timestamp`20from`20start`20pack Vet`20*/ Xg->lastacc`20=`20P.timestamp;`09/*`20set`20last`20access`20time`20to`20start V`20time`20*/ Xif`20(P.autodbl`20==`20NULL)`09`09/*`20set`20admax`20to`20MIN(my`20count,`20op V's`20count)`20*/ X`09g->admax`20=`200; Xelse X`09g->admax`20=`20atoi(P.autodbl); Xif`20(rc.autodouble`20<`20g->admax) X`09g->admax`20=`20rc.autodouble; Xg->adcnt`20=`200;`09`09`09/*`20no`20autodoubles`20yet`20*/ Xclearmvs(g->mvs); Xclearmvs(g->opmvs); Xif`20(g->mydir`20>`200)`20`7B X`09c1`20=`20g->mycolor;`09/*`20upbound`20color`20is`20mine`20*/ X`09c2`20=`20g->opcolor;`09/*`20downbound`20color`20is`20opponent's`20*/ X`09`7D Xelse`20`7B X`09c1`20=`20g->opcolor;`09/*`20upbound`20color`20is`20opponent's`20*/ X`09c2`20=`20g->mycolor;`09/*`20downbound`20color`20is`20mine`20*/ X`09`7D Xnewboard(g->opbd,c1,c2);`09`09/*`20set`20up`20boards`20for`20new`20game`20*/ Xnewboard(g->mybd,c1,c2); Xnewboard(g->board,c1,c2); Xif`20(P.jacoby`20!=`20NULL) X`09g->flags`20`7C=`20F_JACOBY; Xif`20(P.crawford`20!=`20NULL) X`09g->flags`20`7C=`20F_CRAWFORD; Xif`20(P.european`20!=`20NULL) X`09g->flags`20`7C=`20F_EUROPE; Xif`20(P.perm`20!=`20NULL) X`09g->flags`20`7C=`20F_PERM; Xif`20(P.match`20!=`20NULL) X`09g->mtotal`20=`20atoi(P.match); Xg->curbd`20=`20boardnums`5B*rc.initboard`20-`20'a'`5D;`09/*`20display`20initia Vl`20board`20*/ Xmydie`20=`20Rolldie(); Xif`20(P.mvs`5B0`5D.roll`20==`20mydie)`20`7B`09`09/*`20a`20!#$%`26@`20tie`20*/ X`09if`20(g->adcnt`20<`20g->admax)`09/*`20do`20an`20autodouble`20*/ X`09`09g->gameval`20=`201`20<<`20++(g->adcnt); X`09sendpkt(g,TIE); X`09message("Tie`20on`20initial`20roll`20with`20%s`20(%s).`5Cn",g->opname,g->op Vaddr); X`09return;`09`09`09/*`20opponent`20will`20send`20RESTART`20*/ X`09`7D Xif`20(mydie`20>`20(int)`20P.mvs`5B0`5D.roll)`20`7B`09`09/*`20we`20won`20the V`20initial`20roll`20*/ X`09g->mvs`5B0`5D.roll`20=`20P.mvs`5B0`5D.roll;`09/*`20copy`20initial`20roll V`20*/ X`09g->mvs`5B1`5D.roll`20=`20mydie; X`09g->mvs`5B0`5D.pt`20=`20-1;`09/*`20mark`20both`20rolls`20unused`20*/ X`09g->mvs`5B1`5D.pt`20=`20-1; X`09g->state`20=`20ST_MYMOVE;`09/*`20set`20state`20so`20we`20make`20a`20move V`20*/ X`09legalmoves(g);`09`09/*`20calculate`20legal`20moves`20for`20these`20rolls V`20*/ X`09g->rolls`5Bg->mvs`5B0`5D.roll`20-`201`5D++;`09/*`20count`20the`20rolls`20we V`20got`20*/ X`09g->rolls`5Bg->mvs`5B1`5D.roll`20-`201`5D++; X`09`7D Xelse`20`7B`09`09`09`09/*`20we`20lost,`20tell`20the`20opponent`20to`20start`20* V/ X`09g->mvs`5B0`5D.roll`20=`20P.mvs`5B0`5D.roll;`09/*`20copy`20initial`20roll V`20*/ X`09g->mvs`5B1`5D.roll`20=`20mydie;`09/*`20store`20so`20sendpkt`20can`20find V`20it`20*/ X`09g->state`20=`20ST_OPTURN; X`09sendpkt(g,USTART); X`09message("Started`20game`20with`20%s`20(%s).`5Cn",g->opname,g->opaddr); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09istart`20--`20I`20won`20the`20opening`20toss X`20* X`20*`20This`20function`20is`20called`20when`20a`20USTART`20packet`20is`20recei Vved.`20`20Both`20rolls X`20*`20are`20copied`20into`20the`20game`20structure`20and`20the`20state`20is V`20set`20to`20MYMOVE, X`20*`20allowing`20us`20to`20use`20the`20roll`20but`20not`20to`20double. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xistart(g) Xstruct`20game`20*g; X`7B X Xg->mvs`5B0`5D.roll`20=`20P.mvs`5B0`5D.roll;`09/*`20copy`20rolls`20from`20packe Vt`20*/ Xg->mvs`5B1`5D.roll`20=`20P.mvs`5B1`5D.roll; Xg->mvs`5B0`5D.pt`20=`20-1;`09/*`20mark`20both`20rolls`20unused`20*/ Xg->mvs`5B1`5D.pt`20=`20-1; Xg->state`20=`20ST_MYMOVE;`09/*`20set`20state`20so`20we`20make`20a`20move`20*/ Xlegalmoves(g);`09`09/*`20calculate`20legal`20moves`20*/ Xg->rolls`5Bg->mvs`5B0`5D.roll`20-`201`5D++;`09/*`20count`20the`20rolls`20we V`20got`20*/ Xg->rolls`5Bg->mvs`5B1`5D.roll`20-`201`5D++; X`7D X X X/*--------------------------------------------------------------------------- X`20*`09tie`20--`20The`20opening`20toss`20was`20a`20tie,`20try`20again X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20a`20TIE`20packet. V`20`20We`20reroll X`20*`20one`20die`20and`20send`20a`20RESTART`20packet.`20`20If`20the`20autodbl V`20field`20in X`20*`20the`20received`20packet`20is`20>`200,`20the`20game`20value`20is`20set V`20to`202`20**`20autodbl. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xtie(g) Xstruct`20game`20*g; X`7B X Xclearmvs(g->mvs); Xg->mvs`5B0`5D.roll`20=`20Rolldie(); Xif`20(P.autodbl`20!=`20NULL) X`09g->gameval`20=`201`20<<`20(g->adcnt`20=`20atoi(P.autodbl)); Xsendpkt(g,RESTART); Xmessage("Tie`20on`20initial`20roll`20with`20%s`20(%s).`5Cn",g->opname,g->opadd Vr); X`7D X X X/*--------------------------------------------------------------------------- X`20*`09restart`20--`20restart`20after`20opening`20tie X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20a`20RESTART`20pac Vket.`20`20It`20is X`20*`20mostly`20the`20same`20as`20start(). X`20*-------------------------------------------------------------------------- V- X`20*/ X Xrestart(g) Xstruct`20game`20*g; X`7B Xint`20mydie; X Xclearmvs(g->mvs); Xclearmvs(g->opmvs); Xmydie`20=`20Rolldie(); Xif`20(P.mvs`5B0`5D.roll`20==`20mydie)`20`7B`09`09/*`20a`20!#$%`26@`20tie`20*/ X`09if`20(g->adcnt`20<`20g->admax)`09/*`20do`20an`20autodouble`20*/ X`09`09g->gameval`20=`201`20<<`20++(g->adcnt); X`09sendpkt(g,TIE); X`09message("Tie`20on`20initial`20roll`20with`20%s`20(%s).`5Cn",g->opname,g->op Vaddr); X`09return;`09`09`09/*`20opponent`20will`20send`20RESTART`20*/ X`09`7D Xg->mvs`5B0`5D.roll`20=`20P.mvs`5B0`5D.roll;`09/*`20copy`20initial`20roll`20*/ Xg->mvs`5B1`5D.roll`20=`20mydie;`09/*`20store`20so`20sendpkt`20can`20find`20it V`20*/ Xif`20(mydie`20>`20(int)`20P.mvs`5B0`5D.roll)`20`7B`09`09/*`20we`20won`20the V`20initial`20roll`20*/ X`09g->state`20=`20ST_MYMOVE;`09/*`20set`20state`20so`20we`20make`20a`20move V`20*/ X`09legalmoves(g);`09`09/*`20calculate`20legal`20moves`20for`20these`20rolls V`20*/ X`09g->rolls`5Bg->mvs`5B0`5D.roll`20-`201`5D++;`09/*`20count`20the`20rolls`20we V`20got`20*/ X`09g->rolls`5Bg->mvs`5B1`5D.roll`20-`201`5D++; X`09`7D Xelse`20`7B`09`09`09`09/*`20we`20lost,`20tell`20the`20opponent`20to`20start`20* V/ X`09g->state`20=`20ST_OPTURN; X`09sendpkt(g,USTART); X`09message("Started`20game`20with`20%s`20(%s).`5Cn",g->opname,g->opaddr); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09mstart`20--`20start`20next`20game`20of`20match X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20an`20MSTART`20pac Vket.`20`20It`20is X`20*`20similar`20to`20restart,`20except`20that`20it`20also`20reinitializes`20t Vhe`20game X`20*`20structure`20for`20the`20next`20game`20of`20the`20match.`20`20All`20game Vs`20of`20a`20match X`20*`20use`20the`20same`20gameid`20and`20game`20structure.`20`20Mstart`20also V`20checks`20to X`20*`20see`20if`20this`20is`20a`20Crawford`20rule`20game,`20and`20if`20so,`20s Vets`20F_CRGAME`20in`20g->flags. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xmstart(g) Xstruct`20game`20*g; X`7B Xint`20mydie; Xint`20i; Xchar`20c1,`20c2; X Xg->state`20=`20ST_OPSTART; Xg->gameval`20=`201;`09`09/*`20reset`20for`20next`20game`20*/ Xg->adcnt`20=`200; Xg->flags`20`26=`20`7EF_IDOUBLED; Xg->term`20=`200; Xif`20(g->mydir`20>`200)`20`7B X`09c1`20=`20g->mycolor;`09/*`20upbound`20color`20is`20mine`20*/ X`09c2`20=`20g->opcolor;`09/*`20downbound`20color`20is`20opponent's`20*/ X`09`7D Xelse`20`7B X`09c1`20=`20g->opcolor;`09/*`20upbound`20color`20is`20opponent's`20*/ X`09c2`20=`20g->mycolor;`09/*`20downbound`20color`20is`20mine`20*/ X`09`7D Xnewboard(g->opbd,c1,c2); Xnewboard(g->mybd,c1,c2); Xnewboard(g->board,c1,c2); Xfor`20(i`20=`200;`20i`20<`206;`20i++)`20`7B X`09g->rolls`5Bi`5D`20=`200; X`09g->doubles`5Bi`5D`20=`200; X`09g->oprolls`5Bi`5D`20=`200; X`09g->opdoubles`5Bi`5D`20=`200; X`09`7D Xclearmvs(g->mvs); Xclearmvs(g->opmvs); Xcrawford_check(g);`09`09`09/*`20is`20this`20the`20Crawford`20rule`20game?`20*/ V Xmydie`20=`20Rolldie(); Xif`20(P.mvs`5B0`5D.roll`20==`20mydie)`20`7B`09`09/*`20a`20!#$%`26@`20tie`20*/ X`09if`20(g->adcnt`20<`20g->admax)`09/*`20do`20an`20autodouble`20*/ X`09`09g->gameval`20=`201`20<<`20++(g->adcnt); X`09sendpkt(g,TIE); X`09message("Tie`20on`20initial`20roll`20with`20%s`20(%s).`5Cn",g->opname,g->op Vaddr); X`09return;`09`09`09/*`20opponent`20will`20send`20RESTART`20*/ X`09`7D Xg->mvs`5B0`5D.roll`20=`20P.mvs`5B0`5D.roll;`09/*`20copy`20initial`20roll`20*/ Xg->mvs`5B1`5D.roll`20=`20mydie;`09/*`20store`20so`20sendpkt`20can`20find`20it V`20*/ Xif`20(mydie`20>`20(int)`20P.mvs`5B0`5D.roll)`20`7B`09`09/*`20we`20won`20the V`20initial`20roll`20*/ X`09g->state`20=`20ST_MYMOVE;`09/*`20set`20state`20so`20we`20make`20a`20move V`20*/ X`09legalmoves(g);`09`09/*`20calculate`20legal`20moves`20for`20these`20rolls V`20*/ X`09g->rolls`5Bg->mvs`5B0`5D.roll`20-`201`5D++;`09/*`20count`20the`20rolls`20we V`20got`20*/ X`09g->rolls`5Bg->mvs`5B1`5D.roll`20-`201`5D++; X`09`7D Xelse`20`7B`09`09`09`09/*`20we`20lost,`20tell`20the`20opponent`20to`20start`20* V/ X`09g->state`20=`20ST_OPTURN; X`09sendpkt(g,USTART); X`09message("Started`20game`20with`20%s`20(%s).`5Cn",g->opname,g->opaddr); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09opmove`20--`20opponent`20moved X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20a`20MOVE`20packet V.`20`20The`20move`20is X`20*`20copied`20into`20the`20opmvs`20field`20of`20the`20game`20structure`20and V`20applied`20to`20the X`20*`20board.`20`20A`20copy`20of`20the`20board`20before`20the`20moves`20are V`20applied`20is`20stored X`20*`20in`20the`20opbd`20field,`20and`20a`20copy`20of`20the`20board`20after V`20the`20moves`20are`20applied X`20*`20is`20stored`20in`20the`20mybd`20field.`20`20These`20two`20boards,`20alo Vng`20with`20the X`20*`20current`20board`20in`20the`20board`20field,`20make`20up`20the`20three V`20boards`20that`20can X`20*`20be`20displayed`20with`20the`20"Board"`20command`20in`20the`20user`20men Vus`20in`20process.c X`20*-------------------------------------------------------------------------- V- X`20*/ X Xopmove(g) Xstruct`20game`20*g; X`7B Xint`20i,`20n,`20r; Xstatic`20char`20buf`5B`5D`20=`20"Opponent`20move`20dated`20DDD`20MMM`20NN`20HH V:MM:SS`20YYYY"; Xstruct`20game`20*pg; X Xcopyboard(g->board,g->opbd);`09/*`20save`20board`20before`20opponent`20moved V`20*/ Xg->curbd`20=`20boardnums`5B*rc.initboard`20-`20'a'`5D;`09/*`20display`20initia Vl`20board`20*/ Xclearmvs(g->opmvs);`09`09/*`20clear`20old`20moves`20*/ Xg->opmvs`5B0`5D`20=`20P.mvs`5B0`5D;`09/*`20extract`20opponent's`20moves`20*/ Xg->opmvs`5B1`5D`20=`20P.mvs`5B1`5D; Xg->oprolls`5Bg->opmvs`5B0`5D.roll`20-`201`5D++;`09`09/*`20count`20rolls`20oppo Vnent`20got`20*/ Xg->oprolls`5Bg->opmvs`5B1`5D.roll`20-`201`5D++; Xif`20(g->opmvs`5B0`5D.roll`20==`20g->opmvs`5B1`5D.roll)`20`7B X`09g->opmvs`5B2`5D`20=`20P.mvs`5B2`5D;`09/*`20he`20got`20doubles`20*/ X`09g->opmvs`5B3`5D`20=`20P.mvs`5B3`5D;`09/*`20extract`202`20more`20moves`20*/ X`09g->opdoubles`5Bg->opmvs`5B0`5D.roll`20-`201`5D++; X`09n`20=`204; X`09`7D Xelse X`09n`20=`202; Xfor`20(i`20=`200;`20i`20<`204;`20i++) X`09g->blot`5Bi`5D`20=`200;`09`09/*`20clear`20all`20blot`20locations`20*/ Xfor`20(i`20=`200;`20i`20<`20n;`20i++)`20`7B X`09if`20(`20(r`20=`20apply(g,WHO_OPP,i,0,NULL))`20<`200)`20`7B`09/*`20err`20w/ V`20op`20move`20*/ X`09`09copyboard(g->opbd,g->board);`09/*`20restore`20board`20*/ X`09`09message("ERROR:`20Opponent`20move`20rejected,`20id=%s`5Cn", X`09`09`09P.gameid); X`09`09message("`20`20`20`20`20`20`20%s`5Cn",rejmsg`5B-r`5D); X`09`09return; X`09`09`7D X`09else`09`09/*`20if`20opponent`20hit`20our`20blot`20*/ X`09`09g->blot`5Bi`5D`20=`20r;`09`09/*`20save`20location`20*/ X`09`7D Xcopyboard(g->board,g->mybd);`09`09/*`20save`20board`20after`20op`20move`20*/ Xif`20(g->board`5BOFFPT(g->opdir)`5D.qty`20==`2015)`09/*`20opponent`20won`20*/ X`09ilose(g,T_ILOSE,1); Xelse X`09g->state`20=`20ST_MYTURN;`09`09/*`20opponent`20has`20moved,`20it's`20our V`20turn`20*/ Xclearmvs(g->mvs);`09`09/*`20erase`20our`20previous`20move`20*/ Xif`20(P.timestamp`20>`200)`20`7B`09`09/*`20if`20we`20got`20a`20timestamp`20*/ X`09strncpy(`26buf`5B20`5D,ctime(`26P.timestamp),24);`09/*`20gen`20message`20*/ V X`09g->dispmsg`20=`20save(buf);`09`09/*`20save`20copy`20in`20game`20*/ X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09opofr`20--`20opponent`20offered`20to`20double X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20an`20OFRDBL`20pac Vket,`20indicating X`20*`20the`20opponent`20wishes`20to`20double.`20`20The`20game`20moves`20to`20s Vtate`20MYACCEPT, X`20*`20where`20the`20user`20will`20decide`20to`20accept`20or`20decline`20the V`20double. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xopofr(g) Xstruct`20game`20*g; X`7B X Xif`20(g->flags`20`26`20F_CRGAME)`20`7B X`09message("ERROR:`20Opponent`20move`20rejected,`20id=%s`5Cn",P.gameid); X`09message("`20`20`20`20`20`20`20Invalid`20double`20(Crawford`20rule)`5Cn"); X`09return; X`09`7D Xg->state`20=`20ST_MYACCEPT;`09`09`09/*`20send`20us`20to`20an`20accept`20screen V`20*/ Xg->flags`20`26=`20`7EF_IDOUBLED;`09`09/*`20I`20didn't`20double`20last`20*/ Xcopyboard(g->board,g->opbd); Xcopyboard(g->board,g->mybd); Xg->curbd`20=`20BD_CUR;`09`09/*`20display`20current`20board`20*/ Xclearmvs(g->opmvs);`09`09/*`20clear`20old`20moves`20*/ Xclearmvs(g->mvs);`09`09/*`20erase`20our`20previous`20move`20*/ X`7D X X X/*--------------------------------------------------------------------------- X`20*`09opconc`20--`20opponent`20conceded X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20a`20CONCEDE`20pac Vket,`20indicating X`20*`20the`20opponent`20has`20given`20up. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xopconc(g) Xstruct`20game`20*g; X`7B Xint`20gv; X Xiwin(g,T_OPCONCEDE,1);`09`09`09/*`20wimp`20*/ X`7D X X X/*--------------------------------------------------------------------------- X`20*`09opacpt`20--`20opponent`20accepted`20double X`20* X`20*`20This`20function`20is`20called`20when`20we`20receive`20an`20ACPTDBL`20pa Vcket,`20indicating X`20*`20the`20opponent`20has`20accepted`20our`20double.`20`20The`20IDOUBLED`20f Vlag`20is`20set`20to X`20*`20prevent`20us`20from`20doubling`20again`20until`20the`20opponent`20doubl Ves.`20`20Since`20it X`20*`20is`20now`20our`20turn,`20we`20go`20ahead`20and`20roll`20the`20dice`20an Vd`20proceed`20to`20the X`20*`20MYMOVE`20state. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xopacpt(g) Xstruct`20game`20*g; X`7B X Xg->gameval`20*=`202;`09`09/*`20double`20game`20value`20*/ Xg->flags`20`7C=`20F_IDOUBLED;`09`09/*`20I`20doubled`20last`20*/ Xg->state`20=`20ST_MYMOVE;`09`09/*`20It`20is`20my`20move`20*/ Xcopyboard(g->board,g->opbd); Xcopyboard(g->board,g->mybd); Xg->curbd`20=`20BD_CUR;`09`09/*`20display`20current`20board`20*/ Xclearmvs(g->opmvs);`09`09/*`20clear`20old`20moves`20*/ Xclearmvs(g->mvs);`09`09/*`20erase`20our`20previous`20move`20*/ Xrolldice(g);`09`09`09/*`20go`20ahead`20and`20roll,`20I`20can't`20double`20*/ Xg->dispmsg`20=`20save("Opponent`20has`20accepted`20your`20double.");/*`20notif Vy`20user`20*/ X`7D X X X/*--------------------------------------------------------------------------- X`20*`09opdec`20--`20opponent`20declined`20double X`20* X`20*`20This`20function`20is`20called`20when`20a`20DECDBL`20packet`20is`20recei Vved.`20`20This X`20*`20indicates`20that`20the`20opponent`20has`20declined`20our`20double,`20an Vd`20the`20game`20is`20over. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xopdec(g) Xstruct`20game`20*g; X`7B Xint`20gv; X Xiwin(g,T_OPDECLINE,1); Xcopyboard(g->board,g->opbd); Xcopyboard(g->board,g->mybd); Xg->curbd`20=`20BD_CUR;`09`09/*`20display`20current`20board`20*/ Xclearmvs(g->opmvs);`09`09/*`20clear`20old`20moves`20*/ Xclearmvs(g->mvs);`09`09/*`20erase`20our`20previous`20move`20*/ X`7D X X X/*--------------------------------------------------------------------------- X`20*`09smerr`20--`20an`20illegal`20operation`20was`20received`20for`20this`20s Vtate X`20* X`20*`20This`20function`20is`20called`20when`20a`20packet`20is`20received`20tha Vt`20is`20invalid X`20*`20for`20the`20game`20state.`20`20An`20example`20of`20this`20would`20be V`20receiving`20an X`20*`20ACPTDBL`20packet`20when`20we`20did`20not`20send`20an`20OFRDBL. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xsmerr(g) Xstruct`20game`20*g; X`7B X Xmessage("ERROR:`20invalid`20operation`20(%d)`20for`20state`20(%d),`20id=%s`5Cn V", X`09P.opcode,`20g->state,`20g->gameid); X`7D $ call unpack RCVOP.C;1 861626388 "" $! $ create 'f' X/*`09readmail.c`09`098/7/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*---------------------------------------------------------------------- X`20*`09readmail`20--`20read`20the`20incoming`20mail`20and`20process`20it X`20* X`20*`20This`20function`20extracts`20each`20packet`20from`20the`20mail`20file V`20and`20applies`20it X`20*`20to`20the`20appropriate`20game`20structure.`20`20Most`20packets`20are V`20processed`20by X`20*`20calling`20the`20handler`20found`20in`20the`20func`20array,`20which`20is V`20a`202-dimensional X`20*`20array`20indexed`20by`20the`20current`20game`20state`20and`20the`20recei Vved`20opcode. X`20*`20The`20handlers`20are`20responsible`20for`20transforming`20the`20game V`20state`20as X`20*`20necessary.`20`20The`20START`20and`20RSTART`20opcodes`20receive`20specia Vl`20processing, X`20*`20since`20they`20apply`20to`20games`20that`20do`20not`20exist`20and`20thu Vs`20have`20no`20state. X`20*`20START`20packets`20result`20in`20the`20creation`20of`20a`20game,`20whose V`20state`20is`20set X`20*`20such`20that`20the`20correct`20handler`20will`20be`20called.`20`20The V`20RSTART`20opcode X`20*`20is`20processed`20in`20the`20same`20way`20as`20the`20-start`20command V`20line`20argument; X`20*`20the`20packet`20is`20then`20discarded. X`20* +-+-+-+-+-+-+-+- END OF PART 12 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 13 -+-+-+-+-+-+-+-+ X`20*`20Note`20that`20the`20file`20argument`20can`20be`20actually`20be`20a`20pa Vttern,`20causing X`20*`20all`20matching`20files`20to`20be`20scanned.`20`20On`20UNIX`20systems, V`20patterns`20are X`20*`20interpreted`20in`20the`20same`20manner`20as`20the`20shell.`20`20On`20VM VS,`20they X`20*`20are`20interpreted`20in`20the`20same`20manner`20as`20DCL. X`20*---------------------------------------------------------------------- X`20*/ X Xreadmail(file) Xchar`20*file; X`7B Xstruct`20flist`20*fl,`20*t; X Xfl`20=`20filelist(file);`09`09/*`20generate`20a`20list`20of`20all`20matching V`20files`20*/ Xwhile`20(fl`20!=`20NULL)`20`7B`09`09/*`20for`20each`20matching`20file`20found V`20*/ X`09readfile(fl->name);`09/*`20scan`20it`20*/ X`09free(fl->name);`09`09/*`20free`20the`20string`20*/ X`09t`20=`20fl;`09`09`09/*`20keep`20a`20pointer`20to`20the`20struct`20*/ X`09fl`20=`20fl->next;`09`09/*`20advance`20fl`20pointer`20*/ X`09free(t);`09`09/*`20free`20the`20previous`20struct`20*/ X`09`7D X`7D X X X/*---------------------------------------------------------------------- X`20*`09readfile`20--`20scan`20a`20file`20looking`20for`20incoming`20messages X`20* X`20*`20This`20function`20is`20called`20by`20readmail`20to`20scan`20a`20file V`20that`20matches X`20*`20the`20pattern. X`20*---------------------------------------------------------------------- X`20*/ X Xreadfile(name) Xchar`20*name; X`7B XFILE`20*fp; Xint`20d,`20c1,`20c2; Xint`20flags`20=`200,`20match`20=`200; Xstruct`20people`20*p; Xstruct`20game`20*g; X Xif`20(`20(fp`20=`20fopen(name,"r"))`20==`20NULL) X`09return; Xif`20(rc.debug`20`26`20DB_READFILE) X`09message("DB-readfile:`20scanning`20%s`5Cn",name); Xwhile`20(getpkt(fp)`20>`200)`20`7B`09/*`20as`20long`20as`20we`20found`20a`20va Vlid`20packet`20*/ X`09if`20(P.gameptr`20==`20NULL)`20`7B X`09`09if`20(rc.debug`20`26`20DB_READFILE) X`09`09`09message("DB-readfile:`20found`20packet`20for`20`5Cn"); X`09`09if`20(P.opcode`20==`20START)`20`7B X`09`09`09if`20(`20((p`20=`20findppl(P.addr,P_ADDR))`20!=`20NULL)`20`26`26 X`09`09`09`20`20`20`20`20(p->fence`20>=`20P.timestamp)`20) X`09`09`09`09continue;`09/*`20ignore`20old`20start`20packets`20*/ X`09`09`09P.gameptr`20=`20addgame();`20/*`20init`20later`20in`20start()`20*/ X`09`09`09P.gameptr->ppl`20=`20p; X`09`09`09P.gameptr->gameid`20=`20P.gameid; X`09`09`09P.gameptr->state`20=`20ST_OPSTART; X`09`09`09`7D X`09`09else`20if`20(P.opcode`20==`20RSTART)`20`7B`09/*`20remote`20start`20packe Vt`20*/ X`09`09`09if`20(rc.debug`20`26`20DB_RSTART) X`09`09`09`09message("DB-readfile:`20remstart`20to`20%s`5Cn",P.addr); X`09`09`09if`20(`20(p`20=`20findppl(P.addr,P_ADDR))`20!=`20NULL) X`09`09`09`09P.addr`20=`20p->addr;`09/*`20use`20real`20addr`20*/ X`09`09`09for`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next) X`09`09`09`09if`20(`20(P.timestamp`20==`20g->starttime)`20`26`26 X`09`09`09`09`20`20`20`20`20(strcmp(P.addr,g->opaddr)`20==`200)`20) X`09`09`09`09`09break;`09/*`20already`20seen`20this`20packet`20*/ X`09`09`09if`20(g`20!=`20NULL) X`09`09`09`09continue; X`09`09`09if`20(`20(p`20!=`20NULL)`20`26`26`20(p->fence`20>=`20P.timestamp)`20) V X`09`09`09`09continue;`09/*`20this`20game`20already`20played`20*/ X`09`09`09if`20(rc.debug`20`26`20DB_RSTART) X`09`09`09`09message("DB-readfile:`20address`20is`20%s`5Cn",P.addr); X`09`09`09if`20(P.dir`20==`20NULL)`09/*`20if`20no`20direction`20was`20given`20* V/ X`09`09`09`09d`20=`20cr_mydir;`09/*`20use`20my`20default`20*/ X`09`09`09else`09`09`09/*`20dir`20was`20given,`20grab`20it`20*/ X`09`09`09`09d`20=`20(*P.dir`20==`20'u')`20?`201`20:`20-1; X`09`09`09if`20(P.colors`20==`20NULL)`20`7B`09/*`20if`20no`20colors`20were`20gi Vven`20*/ X`09`09`09`09c1`20=`20cr_mycolor;`09/*`20use`20my`20defaults`20*/ X`09`09`09`09c2`20=`20cr_opcolor; X`09`09`09`09`7D X`09`09`09else`20`7B`09`09`09`09/*`20colors`20were`20given`20*/ X`09`09`09`09c1`20=`20*P.colors;`09`09/*`20use`20them`20*/ X`09`09`09`09c2`20=`20P.colors`5B1`5D; X`09`09`09`09`7D X`09`09`09if`20(P.jacoby`20!=`20NULL) X`09`09`09`09flags`20`7C=`20F_JACOBY; X`09`09`09if`20(P.crawford`20!=`20NULL) X`09`09`09`09flags`20`7C=`20F_CRAWFORD; X`09`09`09if`20(P.european`20!=`20NULL) X`09`09`09`09flags`20`7C=`20F_EUROPE; X`09`09`09if`20(P.perm`20!=`20NULL) X`09`09`09`09flags`20`7C=`20F_PERM; X`09`09`09if`20(P.match`20!=`20NULL) X`09`09`09`09match`20=`20atoi(P.match); X`09`09`09notify`20=`20P.notify;`09/*`20store`20notify`20address`20*/ X`09`09`09startgame(P.addr,d,c1,c2,flags,match,P.timestamp); X`09`09`09continue;`09/*`20game`20started,`20discard`20this`20packet`20*/ X`09`09`09`7D X`09`09else`20`7B X`09`09`09message("ERROR:`20no`20such`20gameid:`20%s`20(ignored)`5Cn", X`09`09`09`09P.gameid); X`09`09`09continue; X`09`09`09`7D X`09`09`7D X`09if`20(rc.debug`20`26`20DB_READFILE) X`09`09message("DB-readfile:`20found`20packet`20for`20%s`5Cn", X`09`09`09P.gameptr->gameid); X`09if`20(P.gameptr->state`20>=`20OPSTATES)`20`7B`09/*`20hey,`20it's`20still V`20my`20turn`20*/ X`09`09message("ERROR:`20move`20out`20of`20turn:`20%s`20(ignored)`5Cn",P.gameid V); X`09`09continue; X`09`09`7D X`09if`20(P.name`20!=`20NULL)`20`7B`09`09/*`20snarf`20opponent's`20name`20*/ X`09`09P.gameptr->opname`20=`20P.name; X`09`09if`20(P.gameptr->ppl`20!=`20NULL) X`09`09`09P.gameptr->ppl->name`20=`20save(P.name); X`09`09`7D X`09if`20(P.notify`20!=`20NULL) X`09`09P.gameptr->notify`20=`20P.notify; X`09(*func`5BP.gameptr->state`5D`5BP.opcode`5D)(P.gameptr);`09/*`20call`20handl Ver`20*/ X`09`7D Xfclose(fp); Xif`20(`20((*rc.delmail`20==`20'y')`20`7C`7C`20(*rc.delmail`20==`20'Y')) X#ifndef`20VMS X`09`09`26`26`20(*name`20!=`20'/')`09/*`20absolute`20paths`20not`20deleted`20*/ V X#endif X`09)`20`7B X`09if`20(rc.debug`20`26`20DB_READFILE) X`09`09message("DB-readfile:`20deleting`20mail`20file`20%s`5Cn",name); X`09unlink(name); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09getpkt`20--`20read`20one`20packet`20from`20a`20file X`20* X`20*`20This`20function`20reads`20the`20next`20packet`20from`20the`20specified V`20file. X`20*`20Getpkt()`20is`20passed`20a`20open`20file`20pointer`20to`20the`20file V`20it`20is`20to`20scan. X`20*`20Lines`20are`20read`20and`20discarded`20until`20a`20line`20is`20found V`20that`20contains`20only: X`20*`09`09<<<===LDB===>>> X`20*`20Subsequent`20lines`20should`20contain`20name/value`20pairs`20as`20speci Vfied X`20*`20in`20nv_packet.`20`20The`20packet`20ends`20with`20end`20of`20file`20or V`20a`20line`20beginning X`20*`20with`20"end=".`20`20Getpkt`20reads`20from`20the`20input`20file`20until V`20one X`20*`20packet`20has`20been`20found`20and`20processed,`20then`20returns.`20`20S Vubsequent`20calls X`20*`20to`20getpkt`20with`20the`20same`20file`20pointer`20will`20process`20add Vitional`20packets. X`20*`20Getpkt`20returns`201`20if`20a`20valid`20packet`20was`20read,`200`20if V`20EOF`20was`20encountered. X`20*`20Getpkt`20ignores`20incoming`20packets`20with`20the`20incorrect`20sequen Vce`20number. X`20* X`20*`20As`20a`20compatibility`20hook`20with`20old`20versions,`20getpkt`20check Vs`20that`20the X`20*`20version`20field`20on`20the`20incoming`20packet`20is`20high`20enough`20t Vo`20support X`20*`20the`20following`20features`20if`20they`20are`20enabled`20in`20the`20gam Ve: X`20*`09feature`09`09need`20at`20least`20version X`20*`09------------------------------------- X`20*`09match`20play`09`091.1 X`20*`09jacoby`20rule`09`091.1 X`20*`09crawford`20rule`09`091.1 X`20*`09european`20rule`09`091.1 X`20*`09permanent`20games`09`091.1 X`20*`20If`20the`20incoming`20packet`20indicates`20a`20feature`20is`20not`20sup Vported`20by`20the X`20*`20remote`20ldb,`20it`20is`20disabled`20and`20the`20game`20continues`20as V`20if`20it`20had X`20*`20never`20been`20set.`20`20The`20Crawford`20rule`20contained`20a`20bug V`20in`20pre-1.3`20games, X`20*`20so`201.3`20will`20print`20a`20warning`20if`20an`20older`20version`20tri Ves`20to`20start X`20*`20a`20game`20with`20the`20crawford`20rule`20enabled. X`20* X`20*`20Getpkt`20handles`20RESEND`20packets`20itself,`20performing`20a`20resend V`20and X`20*`20discarding`20the`20packet. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xgetpkt(fp) XFILE`20*fp; X`7B Xstatic`20char`20buf`5B128`5D; Xint`20i; X Xwhile`20(fgets(buf,sizeof(buf),fp)`20!=`20NULL)`20`7B X`09if`20(strcmp(buf,"<<<===LDB===>>>`5Cn"))/*`20skip`20all`20other`20lines`20* V/ X`09`09continue; X`09P.gameid`20=`20NULL;`09/*`20init`20P`20structure`20*/ X`09P.version`20=`20100;`09/*`20default`20to`20oldest`20version`20*/ X`09P.timestamp`20=`200L; X`09P.opcode`20=`20-1; X`09P.name`20=`20NULL; X`09P.addr`20=`20NULL; X`09P.comment`20=`20NULL; X`09P.comment2`20=`20NULL; X`09P.seq`20=`20-1; X`09P.autodbl`20=`20NULL; X`09P.jacoby`20=`20NULL;`09/*`20jacoby`20is`20off`20by`20default`20*/ X`09P.crawford`20=`20NULL;`09/*`20so`20is`20crawford`20*/ X`09P.perm`20=`20NULL;`09`09/*`20so`20is`20permanent`20option`20*/ X`09P.european`20=`20NULL;`09/*`20so`20is`20european`20rule`20*/ X`09P.match`20=`20NULL;`09`09/*`20so`20is`20match`20play`20*/ X`09clearmvs(P.mvs); X`09P.gameptr`20=`20NULL; X`09P.notify`20=`20NULL; X`09nvscan(fp,nv_packet,`26P);`09/*`20scan`20the`20packet`20into`20P`20*/ X`09if`20(P.gameid`20==`20NULL)`20`7B`09`09/*`20didn't`20get`20a`20gameid`20*/ X`09`09message("ERROR:`20missing`20gameid`20in`20packet`20--`20ignored`5Cn"); X`09`09continue; X`09`09`7D X`09if`20(P.version`20>`20100)`20`7B`09`09/*`20versions`20after`201.0`20rot13 V`20comments`20*/ X`09`09if`20(P.comment`20!=`20NULL) X`09`09`09rotate(P.comment); X`09`09if`20(P.comment2`20!=`20NULL) X`09`09`09rotate(P.comment2); X`09`09`7D X`09if`20(`20(P.gameptr`20=`20findgame(P.gameid))`20==`20NULL)`20`7B/*`20doesn' Vt`20exist`20*/ X`09`09if`20(`20(P.opcode`20!=`20START)`20`26`26`20(P.opcode`20!=`20RSTART)`20) V X`09`09`09continue;`09/*`20ignore`20pkts`20for`20dead`20games`20*/ X`09`09i`20=`201;`09`09`09/*`20initial`20seq`20==`201`20*/ X`09`09`7D X`09else`20`7B X`09`09if`20(P.opcode`20==`20RESEND)`20`7B`09/*`20resend`20request`20*/ X`09`09`09if`20((P.seq`20+`201)`20!=`20P.gameptr->seq) X`09`09`09`09continue;`09/*`20old`20resend`20request,`20ignore`20*/ X`09`09`09if`20(P.timestamp`20<`20P.gameptr->lastacc) X`09`09`09`09continue;`09/*`20old`20resend`20request,`20ignore`20*/ X`09`09`09message( X`09`09`09`09"Resend`20requested`20for`20game`20%s`20--`20sending...`5Cn", X`09`09`09`09P.gameid); X`09`09`09resendpkt(P.gameptr);`09/*`20resend`20*/ X`09`09`09P.gameptr->lastacc`20=`20time(`20(long`20*)`200);`09/*set`20lastacc*/ V X`09`09`09if`20(P.timestamp`20>`20P.gameptr->lastacc) X`09`09`09`09P.gameptr->lastacc`20=`20P.timestamp; X`09`09`09continue;`09`09/*`20and`20ignore`20packet`20*/ X`09`09`09`7D X`09`09i`20=`20P.gameptr->seq+1;`09/*`20get`20current`20seq`20*/ X`09`09`7D X`09if`20(P.seq`20!=`20i)`20`7B`09`09/*`20sequence`20number`20is`20wrong`20*/ X`09`09if`20(P.seq`20>`20i)`09`09/*`20rec'd`20seq`20#`20is`20too`20big`20*/ X`09`09`09message(`09`09/*`20shouldn't`20happen`20*/ X`09`09`09"WARNING:`20game`20%s,`20seq`20no.`20is`20%d,`20s/b`20%d`20--`20ignor Ved.`5Cn" X`09`09`09,P.gameid,P.seq,i); X`09`09continue;`09`09/*`20ignore`20pkts`20with`20bad`20sequence`20#s`20*/ X`09`09`7D X`09if`20(`20(P.opcode`20<`200)`20`7C`7C`20(P.opcode`20>=`20NOP)`20)`20`7B`09/* V`20bad`20opcode`20*/ X`09`09message("ERROR:`20bad`20opcode`20for`20game`20%s:`20%d`20--`20ignored. V`5Cn", X`09`09`09P.gameid,P.opcode); X`09`09continue; X`09`09`7D X`09if`20(P.gameptr`20!=`20NULL)`20`7B X`09`09P.gameptr->seq`20+=`202;`09/*`20bump`20sequence`20number`20*/ X`09`09P.gameptr->lastacc`20=`20time(`20(long`20*)`200);`09/*set`20lastacc*/ X`09`09if`20(P.timestamp`20>`20P.gameptr->lastacc) X`09`09`09P.gameptr->lastacc`20=`20P.timestamp; X`09`09if`20(P.gameptr->opcmt`20!=`20NULL) X`09`09`09free(P.gameptr->opcmt);`09/*`20discard`20old`20comment`20*/ X`09`09P.gameptr->opcmt`20=`20P.comment;`09/*`20copy`20new`20comment`20*/ X`09`09if`20(P.gameptr->opcmt2`20!=`20NULL) X`09`09`09free(P.gameptr->opcmt2);/*`20discard`20old`20comment`20*/ X`09`09P.gameptr->opcmt2`20=`20P.comment2;`09/*`20copy`20new`20comment`20*/ X`09`09P.gameptr->opver`20=`20P.version;`09/*in`20case`20he`20changed`20version Vs*/ X`09`09`7D X`09if`20(P.gameptr`20==`20NULL)`09`09/*`20everything`20after`20here`20needs V`20ptr`20*/ X`09`09return(1);`09`09/*`20to`20game`20structure`20*/ X X`09`09`09/*`20any`201.1`20features`20used`20with`201.0?`20*/ X`09if`20(`20(P.version`20<`20110)`20`26`26`20(`20(P.gameptr->mtotal`20>`200) V`20`7C`7C X`09`20`20`20`20`20(P.gameptr->flags`20`26`20(F_JACOBY`7CF_CRAWFORD`7CF_PERM V`7CF_EUROPE)))`20)`20`7B X`09`09message("Warning:`20in`20game`20%s:`5Cn",P.gameid); X`09`09message( X"The`20following`20features`20are`20not`20supported`20by`20your`20opponent's V`20version`20of`20ldb:`5Cn" X`09`09); X`09`09if`20(P.gameptr->flags`20`26`20F_JACOBY) X`09`09`09message("`5CtJacoby`20rule.`5Cn"); X`09`09if`20(P.gameptr->flags`20`26`20F_CRAWFORD) X`09`09`09message("`5CtCrawford`20rule.`5Cn"); X`09`09if`20(P.gameptr->flags`20`26`20F_EUROPE) X`09`09`09message("`5CtEuropean`20rule.`5Cn"); X`09`09if`20(P.gameptr->flags`20`26`20F_PERM) X`09`09`09message("`5CtPermanent`20games.`5Cn"); X`09`09if`20(P.gameptr->mtotal`20>`200) X`09`09`09message("`5CtMatch`20play.`5Cn"); X`09`09P.gameptr->flags`20`26= X`09`09`09`7E(F_CRAWFORD`7CF_JACOBY`7CF_PERM`7CF_EUROPE); X`09`09P.gameptr->mtotal`20=`200; X`09`09message( X"This`20game`20will`20continue`20as`20if`20those`20features`20had`20not`20been V`20used.`5Cn"); X`09`09`7D X`09if`20(`20(P.version`20<`20130)`20`26`26`20(P.gameptr->flags`20`26`20F_CRAWF VORD)`20) X`09`09message( X"Warning:`20opponent`20using`20pre-1.3`20ldb`20--`20using`20Crawford`20rule V`20not`20recommended!`5Cn" X`09`09); X`09return(1);`09`09`09/*`20return`20success`20*/ X`09`7D Xreturn(0);`09`09/*`20return`20this`20to`20mean`20end`20of`20file`20*/ X`7D $ call unpack READMAIL.C;1 2020022216 "" $! $ create 'f' X/*`09rename.c`09`094/10/92 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X X/*---------------------------------------------------------------------- X`20*`09rename`20--`20rename`20a`20file X`20* X`20*`20This`20function`20may`20be`20used`20to`20rename`20a`20file`20if`20the V`20local`20C`20library X`20*`20does`20not`20have`20such`20a`20function.`20`20It`20uses`20the`20link V`20and`20unlink`20calls, X`20*`20which`20should`20be`20on`20all`20systems,`20but`20is`20not`20atomic`20l Vike`20real`20rename's. X`20*`20This`20rename`20is`20not`20meant`20for`20general`20use,`20as`20it`20doe Vs`20no`20error`20checking. X`20*`20Since`20it`20is`20only`20used`20to`20save`20the`20old`20copy`20of`20a V`20file`20as`20a`20backup, X`20*`20it`20is`20better`20to`20fail`20silently`20than`20complain`20about`20som Vething`20the`20user X`20*`20can't`20do`20anything`20about`20anyway.`20`20The`20old`20file`20is`20al Vways`20unlinked, X`20*`20even`20if`20the`20link`20to`20the`20new`20name`20succeeded,`20since`20t Vhe`20next`20thing X`20*`20we`20are`20going`20to`20do`20is`20write`20over`20the`20old`20file`20any Vway. X`20*---------------------------------------------------------------------- X`20*/ X Xrename(old,new) Xchar`20*old; Xchar`20*new; X`7B X Xunlink(new);`09`09/*`20get`20rid`20of`20existing`20file`20named`20NEW`20*/ Xlink(old,new);`09`09/*`20make`20link`20from`20OLD`20to`20NEW`20*/ Xunlink(old);`09`09/*`20get`20rid`20of`20link`20to`20OLD`20*/ X`7D $ call unpack RENAME.C;1 1866027360 "" $! $ create 'f' X/*`09r_xrand.c X`20*/ X X#include`20"ldb.h" X#include`20 X Xlong`20rnd_ri(); X X/*====================================================================== X`20*`20This`20file`20contains`20the`20random`20number`20generator.`20`20It`20i Vs`20accessed`20by X`20*`20calling`20RandomInit`20with`20a`2032-bit`20seed,`20then`20calling`20Rol Vldie()`20to X`20*`20generate`20integers`20in`20the`20range`20`5B1-6`5D.`20`20This`20particu Vlar`20implementation X`20*`20was`20taken`20from`20xrand`20in`20volume`202`20of`20comp.sources.misc. V`20`20It`20was X`20*`20written`20by`20Andreas`20Nowatzyk,`20then`20of`20Carnegie-Mellon`20Univ Versity,`20and X`20*`20is`20reproduced`20here`20essentially`20unchanged`20(although`20I`20omit Vted X`20*`20all`20routines`20but`20the`20ones`20needed`20for`20integers`20in`20`5B1 V-6`5D). X`20*`20It`20is`20used`20by`20permission`20of`20the`20author,`20whose`20origina Vl`20copyright X`20*`20and`20permission-to-use`20appears`20below. X`20*====================================================================== X`20*/ X X X X/*---------------------------------------------------------------------- X`20*`09Rolldie`20--`20return`20a`20random`20number`20between`201`20and`206 X`20*---------------------------------------------------------------------- X`20*/ X XRolldie() X`7B X Xreturn(`20(`20(int)`20rnd_ri(6L)`20)`20+`201); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09RandomInit`20--`20initialize`20the`20random`20number`20generator X`20* X`20*`20This`20function`20should`20be`20called`20once,`20before`20Rolldie`20is V`20called. X`20*`20The`20seed`20may`20be`20any`20more`20or`20less`20random`20number;`20the V`20time`20seems X`20*`20to`20be`20conventional. X`20*---------------------------------------------------------------------- X`20*/ X XRandomInit(seed) Xlong`20seed; X`7B X Xrnd_init(seed); X`7D X X X X/*---------------------------------------------------------------------- X`20*From:`09EMF780::WINS%"Andreas.Nowatzyk@eng.sun.com"`2020-NOV-1991`2017:50: V38.73 X`20*To:`09ROSS X`20*CC:`09 X`20*Subj:`09Re:`20`20xrand X`20* X`20*Return-Path:`20 X`20*Received:`20from`20everest.den.mmc.com`20by`20emf780.den.mmc.com`20with V`20SMTP`20;`20 X`20*`20`20`20`20`20`20`20`20`20`20Wed,`2020`20Nov`2091`2016:50:29`20MDT X`20*Received:`20from`20Sun.COM`20by`20everest.den.mmc.com`20(4.1/1.34.a) X`20*`09id`20AA27426;`20Wed,`2020`20Nov`2091`2017:52:10`20MST X`20*Received:`20from`20Eng.Sun.COM`20(zigzag-bb.Corp.Sun.COM)`20by`20Sun.COM V`20(4.1/SMI-4.1) X`20*`09id`20AA07190;`20Wed,`2020`20Nov`2091`2016:50:53`20PST X`20*Received:`20from`20bovic.Eng.Sun.COM`20by`20Eng.Sun.COM`20(4.1/SMI-4.1) X`20*`09id`20AA21474;`20Wed,`2020`20Nov`2091`2016:49:44`20PST X`20*Received:`20by`20bovic.Eng.Sun.COM`20(4.1/SMI-4.1) X`20*`09id`20AA02462;`20Wed,`2020`20Nov`2091`2016:49:16`20PST X`20*Date:`20Wed,`2020`20Nov`2091`2016:49:16`20PST X`20*From:`20Andreas.Nowatzyk@eng.sun.com`20(Andreas`20G.`20Nowatzyk) X`20*Message-Id:`20<9111210049.AA02462@bovic.Eng.Sun.COM> X`20*To:`20ross@emf780.den.mmc.com X`20*Subject:`20Re:`20`20xrand X`20* X`20*I`20have`20no`20objection`20to`20distributing`20xrand,`20provided`20that V`20this`20is`20not`20done X`20*for`20profit`20and`20that`20the`20source`20is`20credited. X`20* X`20*`20`20--`20`20Andreas X`20* X`20*PS:`20There`20was`20a`20bug`20is`20some`20version`20of`20xrand.c:`20The V`20constant`20for`20the`20most X`20*`20`20`20`20positive`20integer`20(0x7fffffff)`20had`20an`20'f'`20missing V`20in`20two`20places.`20It`20should X`20*`20`20`20`20have`20used`20a`20#define`20MAX_INT`20with`20apropriate`20valu Ve`20instead`20of`20hardwiring X`20*`20`20`20`20an`20hex-constant. X`20*---------------------------------------------------------------------- X`20*/ X X#define`20MAX_INT`200x7fffffff X X/*`20Random`20number`20generators: X`20* X`20*`20`20rnd_init`20(unsigned`20seed)`20 X`20*`09`09`09:`20initializes`20the`20generator X`20* X`20*`20`20rnd_i`20()`09`09:`20returns`20positive`20integers`20`5B0,0x7fffffff V`5D X`20*`20`20rnd_ri`20(long`20n)`09:`20returns`20positive`20integers`20`5B0,n-1 V`5D X`20* X`20*`20`20Algorithm`20M`20as`20describes`20in`20Knuth's`20"Art`20of`20Computer V`20Programming",`20Vol`202.`201969 X`20*`20`20is`20used`20with`20a`20linear`20congruential`20generator`20(to`20get V`20a`20good`20uniform X`20*`20`20distribution)`20that`20is`20permuted`20with`20a`20Fibonacci`20additi Vve`20congruential X`20*`20`20generator`20to`20get`20good`20independence. X`20* X`20*`20`20Bit,`20byte,`20and`20word`20distributions`20were`20extensively`20tes Vted`20and`20pass X`20*`20`20Chi-squared`20test`20near`20perfect`20scores`20(>7E8`20numbers`20tes Vted,`20Uniformity X`20*`20`20assumption`20holds`20with`20probability`20>`200.999) X`20* X`20*`20`20Run-up`20tests`20for`20on`207E8`20numbers`20confirm`20independence V`20with X`20*`20`20probability`20>`200.97. X`20* X`20*`20`20Plotting`20random`20points`20in`202d`20reveals`20no`20apparent`20str Vucture. X`20* X`20*`20`20Autocorrelation`20on`20sequences`20of`205E5`20numbers`20(A(i)`20= V`20SUM`20X(n)*X(n-i),`20i=1..512) X`20*`20`20results`20in`20no`20obvious`20structure`20(A(i)`20`7E`20const). X`20* X`20*`20`20On`20a`20SUN`203/60,`20rnd_u()`20takes`20about`2019.4`20usec`20per V`20call,`20which`20is`20about`2044% X`20*`20`20slower`20than`20Berkeley's`20random()`20(13.5`20usec/call). X`20* X`20*`20`20Except`20for`20speed`20and`20memory`20requirements,`20this`20generat Vor`20outperforms X`20*`20`20random()`20for`20all`20tests.`20(random()`20scored`20rather`20low V`20on`20uniformity`20tests, X`20*`20`20while`20independence`20test`20differences`20were`20less`20dramatic). V X`20* X`20*`20`20Thanks`20to`20M.Mauldin,`20H.Walker,`20J.Saxe`20and`20M.Molloy`20for V`20inspiration`20`26`20help. X`20* X`20*`20`20(c)`20Copyright`201988`20by`20A.`20Nowatzyk X`20* X`20*/ X X/*`20LC-parameter`20selection`20follows`20recommendations`20in`20 X`20*`20"Handbook`20of`20Mathematical`20Functions"`20by`20Abramowitz`20`26`20St Vegun`2010th,`20edi. X`20*/ X#define`20LC_A`2066049L`09`09`20`20`20`20/*`20=`20251`5E2,`20`7E=`20sqrt(2`5E3 V2)`09`09`09*/ X#define`20LC_C`20390786457L`09/*`20result`20of`20a`20long`20trial`20`26`20erro Vr`20series`20`20`20`20*/ X X/* X#define`20Xrnd(x)`20(long)((long)x`20*`20LC_A`20+`20LC_C)`20*/`20`20`20/*`20th Ve`20LC`20polynomial`09`09`09*/ X`09`09`09 Xstatic`20unsigned`20long`20Fib`5B55`5D;`09`20`20`20`20/*`20will`20use`20X(n) V`20=`20X(n-55)`20-`20X(n-24)`09*/ Xstatic`20int`20Fib_ind;`09`09`20`20`20`20/*`20current`20index`20in`20circular V`20buffer`09`09*/ Xstatic`20unsigned`20long`20Xrnd_var;`09`20`20`20`20/*`20LCA`20-`20recurrence V`20variable`09`09*/ Xstatic`20unsigned`20long`20auxtab`5B256`5D;`20`20`20/*`20temporal`20permutatio Vn`20table`09`09*/ Xstatic`20unsigned`20long`20prmtab`5B64`5D`20=`20`7B`20/*`20spatial`20permutati Von`20table`09`09*/ X`20`20`20`200xffffffff,`200x00000000,`20`200x00000000,`20`200x00000000,`20`20/ V*`203210`20*/ X`20`20`20`200x0000ffff,`200x00ff0000,`20`200x00000000,`20`200xff000000,`20`20/ V*`202310`20*/ X`20`20`20`200xff0000ff,`200x0000ff00,`20`200x00000000,`20`200x00ff0000,`20`20/ V*`203120`20*/ X`20`20`20`200x00ff00ff,`200x00000000,`20`200xff00ff00,`20`200x00000000,`20`20/ V*`201230`20*/ X X`20`20`20`200xffff0000,`200x000000ff,`20`200x00000000,`20`200x0000ff00,`20`20/ V*`203201`20*/ X`20`20`20`200x00000000,`200x00ff00ff,`20`200x00000000,`20`200xff00ff00,`20`20/ V*`202301`20*/ X`20`20`20`200xff000000,`200x00000000,`20`200x000000ff,`20`200x00ffff00,`20`20/ V*`203102`20*/ X`20`20`20`200x00000000,`200x00000000,`20`200x00000000,`20`200xffffffff,`20`20/ V*`202103`20*/ X X`20`20`20`200xff00ff00,`200x00000000,`20`200x00ff00ff,`20`200x00000000,`20`20/ V*`203012`20*/ X`20`20`20`200x0000ff00,`200x00000000,`20`200x00ff0000,`20`200xff0000ff,`20`20/ V*`202013`20*/ X`20`20`20`200x00000000,`200x00000000,`20`200xffffffff,`20`200x00000000,`20`20/ V*`201032`20*/ X`20`20`20`200x00000000,`200x0000ff00,`20`200xffff0000,`20`200x000000ff,`20`20/ V*`201023`20*/ X X`20`20`20`200x00000000,`200xffffffff,`20`200x00000000,`20`200x00000000,`20`20/ V*`200321`20*/ X`20`20`20`200x00ffff00,`200xff000000,`20`200x00000000,`20`200x000000ff,`20`20/ V*`200213`20*/ X`20`20`20`200x00000000,`200xff000000,`20`200x0000ffff,`20`200x00ff0000,`20`20/ V*`200132`20*/ X`20`20`20`200x00000000,`200xff00ff00,`20`200x00000000,`20`200x00ff00ff`20`20 V`20/*`200123`20*/ X`7D; X Xunion`20hack`20`7B`09`09`09`20`20`20`20/*`20used`20to`20access`20doubles`20as V`20unsigneds`09*/ X`20`20`20`20double`20d; X`20`20`20`20unsigned`20long`20u`5B2`5D; X`7D; X Xstatic`20union`20hack`20man;`09`09`20`20`20`20/*`20mantissa`20bit`20vector`09 V`09`09*/ X Xlong`20Xrnd(x)`20 Xlong`20x; X`7B X`09long`20tmp; X X`09tmp`20=`20x*`20LC_A; X`09tmp`20+=`20LC_C; X`09return`20tmp; X`7D X Xrnd_init`20(seed)`09`09`09`20`20`20`20/*`20modified:`20seed`200-31`20use`20pre Vcomputed`20stuff`20*/ X`20`20`20`20unsigned`20seed; X`7B X`20`20`20`20register`20unsigned`20long`20u; X`20`20`20`20register`20int`20i; X`20`20`20`20double`20x,`20y; X`20`20`20`20union`20hack`20t; X X`20`20`20`20static`20unsigned`20seed_tab`5B32`5D`20=`20`7B X`09`090xbdcc47e5,`200x54aea45d,`200xec0df859,`200xda84637b, X`09`090xc8c6cb4f,`200x35574b01,`200x28260b7d,`200x0d07fdbf, X`09`090x9faaeeb0,`200x613dd169,`200x5ce2d818,`200x85b9e706, X`09`090xab2469db,`200xda02b0dc,`200x45c60d6e,`200xffe49d10, X`09`090x7224fea3,`200xf9684fc9,`200xfc7ee074,`200x326ce92a, X`09`090x366d13b5,`200x17aaa731,`200xeb83a675,`200x7781cb32, X`09`090x4ec7c92d,`200x7f187521,`200x2cf346b4,`200xad13310f, X`09`090xb89cff2b,`200x12164de1,`200xa865168d,`200x32b56cdf`20`20`7D; X X`20`20`20`20if`20(seed`20<`2032) X`09u`20=`20seed_tab`5Bseed`5D; X`20`20`20`20else X`09u`20=`20seed`20`5E`20seed_tab`5Bseed`20`26`2031`5D; X X`20`20`20`20for`20(i`20=`2055;`20i--;)`09`09`20`20`20`20/*`20set`20up`20Fibona Vcci`20additive`20congruential`09*/ X`09Fib`5Bi`5D`20=`20u`20=`20Xrnd(u); X X`20`20`20`20for`20(i`20=`20256;`20i--;) X`09auxtab`5Bi`5D`20=`20u`20=`20Xrnd(u); X X`20`20`20`20Fib_ind`20=`20u`20%`2055;`09`09`20`20`20`20/*`20select`20a`20start Ving`20point`09`09`09*/ X X`20`20`20`20Xrnd_var`20=`20u; X X`09/*`09The`20following`20tests`20to`20see`20if`20a`20double`20fits`20into X`09`092`20unsigned`20longs.`20`20If`20not,`20rnd_01d`20will`20not`20work X`09`09on`20this`20machine.`09`09`09`09`09*/ X X`20`20`20`20if`20(sizeof(x)`20!=`202`20*`20sizeof(unsigned`20long)) X`09fatal("ERROR:`20xrand`20roller`20does`20not`20work`20on`20this`20machine!") V; X X`20`20`20`20x`20=`201.0; X`20`20`20`20y`20=`200.5; X`20`20`20`20do`20`7B`09`09`09`20`20`20`20/*`20find`20largest`20fp-number`20< V`202.0`09*/ X`09t.d`20=`20x; X`09x`20+=`20y; X`09y`20*=`200.5; X`20`20`20`20`7D`20while`20(x`20!=`20t.d`20`26`26`20x`20<`202.0); X X`20`20`20`20man.d`20=`201.0; X`20`20`20`20man.u`5B0`5D`20`5E=`20t.u`5B0`5D; X`20`20`20`20man.u`5B1`5D`20`5E=`20t.u`5B1`5D;`09`09`20`20`20`20/*`20man`20is V`20now`201`20for`20each`20mantissa`20bit`09*/ X`7D X Xlong`20rnd_i`20() X/* X`20*`20returns`20a`20positive,`20uniformly`20distributed`20random`20number`20i Vn`20`5B0,0x7fffffff`5D X`20*/ X`7B`20 X`20`20`20`20register`20unsigned`20long`20i,`20j,`20*t`20=`20Fib; X X`20`20`20`20i`20=`20Fib_ind; X`20`20`20`20j`20=`20t`5Bi`5D;`09`09`09`09`20`20`20`20/*`20=`20X(n-55)`20*/ X`20`20`20`20j`20-=`20(i`20>=`2024)`20?`20t`5Bi`20-`2024`5D`20:`20t`5Bi`20+`202 V1`5D;`20/*`20=`20X(n-24)`20*/ X`20`20`20`20t`5Bi`5D`20=`20j; X`20`20`20`20if`20(++i`20>=`2055)`20i`20=`200; X`20`20`20`20Fib_ind`20=`20i; X X`20`20`20`20t`20=`20`26auxtab`5B(j`20>>`2024)`20`26`200xff`5D; X`20`20`20`20i`20=`20*t; X`20`20`20`20Xrnd_var`20=`20*t`20=`20Xrnd(Xrnd_var); X`20`20`20`20t`20=`20`26prmtab`5Bj`20`26`200x3c`5D; X X`20`20`20`20j`20=`20`20*t++`20`26`20i; X`20`20`20`20j`20`7C=`20*t++`20`26`20((i`20<<`2024)`20`7C`20((i`20>>`20`208) V`20`26`200x00ffffff)); X`20`20`20`20j`20`7C=`20*t++`20`26`20((i`20<<`2016)`20`7C`20((i`20>>`2016)`20 V`26`200x0000ffff)); X`20`20`20`20j`20`7C=`20*t`20`20`20`26`20((i`20<<`20`208)`20`7C`20((i`20>>`2024 V)`20`26`200x000000ff)); X`20`20`20`20 X`20`20`20`20return`20j`20`26`20MAX_INT; X`7D X X Xlong`20rnd_ri`20(rng) X`20`20`20`20long`20rng; X/* X`20*`20randint:`20Return`20a`20random`20integer`20in`20a`20given`20Range`20 V`5B0..rng-1`5D X`20*`20`20`20`20`20`20`20`20`20`20Note:`20`200`20<`20rng X`20*/ X`7B X`20`20`20`20register`20unsigned`20long`20`20r,`20a; X X`20`20`20`20do`20`7B X`09r`20=`20rnd_i(); X`09a`20=`20(r`20/`20rng)`20+`201; X`09a`20*=`20rng; X`20`20`20`20`7D`20while`20(a`20>=`20MAX_INT); X`20`20`20`20 X`20`20`20`20a--; X`20`20`20`20return`20a`20-`20r; X`7D $ call unpack R_XRAND.C;1 172441753 "" $! $ create 'f' X/*`09save.c`09`098/4/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*=========================================================================== X`20*`20This`20file`20contains`20miscellaneous`20functions`20that`20save`20and V`20load`20things. X`20*========================================================================== V= X`20*/ X X/*--------------------------------------------------------------------------- X`20*`09save`20--`20make`20a`20copy`20of`20a`20string X`20* X`20*`20This`20function`20makes`20a`20copy`20of`20a`20string`20in`20malloc`20me Vmory,`20and`20returns X`20*`20a`20pointer`20to`20the`20copy. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xchar`20*save(s) Xchar`20*s; X`7B Xchar`20*n; X Xif`20(s`20==`20NULL)`20`7B X`09return(NULL); X`09`7D Xelse`20`7B X`09if`20(`20(n`20=`20calloc(strlen(s)+1,1))`20==`20NULL) X`09`09fatal("Out`20of`20memory!"); X`09strcpy(n,s); X`09return(n); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09readldbrc`20--`20read`20in`20the`20.ldbrc`20file X`20* X`20*`20This`20function`20reads`20the`20.ldbrc`20file,`20which`20contains`20the V`20setup`20info X`20*`20for`20this`20user.`20`20If`20the`20HOME`20environment`20variable`20is V`20set,`20we`20chdir`20to`20it. X`20*`20If`20the`20LDBRC`20environment`20variable`20is`20set,`20it`20is`20used V`20as`20the`20file`20to X`20*`20read`20instead`20of`20.ldbrc. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xreadldbrc() X`7B XFILE`20*fp; Xchar`20*s,`20*n,`20*getenv(); Xchar`20buf`5B80`5D; X Xif`20(`20(s`20=`20getenv("HOME"))`20!=`20NULL)`09/*`20if`20we`20have`20a`20hom Ve`20*/ X`09chdir(s);`09`09`09/*`20go`20there`20*/ Xif`20(`20(s`20=`20getenv("LDBRC"))`20==`20NULL)`09/*`20LDBRC`20not`20set`20*/ X#ifdef`20VMS X`09s`20=`20"ldb.rc";`09`09`09/*`20use`20default`20file`20name`20*/ X#else X`09s`20=`20".ldbrc";`09`09`09/*`20use`20default`20file`20name`20*/ X#endif Xif`20(`20(fp`20=`20fopen(s,"r"))`20==`20NULL)`20`7B X`09printf("'%s'`20does`20not`20exist.`20`20Do`20you`20want`20to`20create`20it? V",s); X`09if`20(`20(fgets(buf,sizeof(buf),stdin)`20==`20NULL) X`09`20`20`20`20`20`7C`7C`20(`20(*buf`20!=`20'y')`20`26`26`20(*buf`20!=`20'Y') V`20)`20) X`09`09fatal("ldb`20aborted."); X`09if`20(`20(fp`20=`20fopen(s,"w"))`20==`20NULL)`20`7B X`09`09printf("Sorry,`20could`20not`20create`20%s.`5Cn",s); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09printf("Please`20enter`20your`20personal`20name:`20"); X`09if`20(fgets(buf,sizeof(buf),stdin)`20==`20NULL)`20`7B X`09`09fclose(fp); X`09`09unlink(s); X`09`09printf("ldb`20aborted.`5Cn"); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09/*`20clobber`20the`20newline`20char V`20*/ X`09fprintf(fp,"myname=%s`5Cn",buf); X`09printf("Please`20enter`20your`20e-mail`20address:`20"); X`09if`20(fgets(buf,sizeof(buf),stdin)`20==`20NULL)`20`7B X`09`09fclose(fp); X`09`09unlink(s); X`09`09printf("ldb`20aborted.`5Cn"); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09/*`20clobber`20the`20newline`20char V`20*/ X`09fprintf(fp,"myaddr=%s`5Cn",buf); X`09fprintf(fp,"mailfile=ldb.rcv`5Cn"); X#ifdef`20VMS X`09fprintf(fp,"sendcmd=mail/subject=`5C"$s`5C"`20$f`20IN%%`5C"`5C"`5C"$a`5C" V`5C"`5C"`5Cn"); X`09fprintf(fp,"gamefile=ldb.data`5Cn"); X`09fprintf(fp,"backupfile=ldb.olddata`5Cn"); X`09fprintf(fp,"peoplefile=ldb.people`5Cn"); X`09fprintf(fp,"lockfile=ldb.lock`5Cn"); X`09fprintf(fp,"supercmd=`5Cn"); X#else X`09fprintf(fp,"sendcmd=mail`20-s`20'$s'`20$a`20<`20$f`5Cn"); X`09fprintf(fp,"gamefile=.ldbdata`5Cn"); X`09fprintf(fp,"backupfile=.oldldbdata`5Cn"); X`09fprintf(fp,"peoplefile=.ldbpeople`5Cn"); X`09fprintf(fp,"lockfile=.ldb_lock`5Cn"); X`09fprintf(fp,"supercmd=sh`5Cn"); X#endif X`09fprintf(fp,"delmail=no`5Cn"); X`09fprintf(fp,"tempfile=ldb.tmp`5Cn"); X`09fprintf(fp,"colors=rw`5Cn"); X`09fprintf(fp,"direction=up`5Cn"); X`09fprintf(fp,"initialboard=current`5Cn"); X`09fprintf(fp,"autoroll=yes`5Cn"); X`09fprintf(fp,"automove=no`5Cn"); X`09fprintf(fp,"autodouble=0`5Cn"); X`09fprintf(fp,"superkey=0`5Cn"); X`09fprintf(fp,"checkpoint=yes`5Cn"); X`09fprintf(fp,"timeout=7`5Cn"); X`09fprintf(fp,"keepold=7`5Cn"); X`09fprintf(fp,"debug=0`5Cn"); X`09fclose(fp); X`09printf("`5CnYour`20%s`20file`20was`20created.`20`20You`20may`20want`20to V`20read`20the`5Cn",s); X`09printf("manual`20for`20additional`20options`20available`20in`20this`20file. V`5Cn`5Cn"); X#ifdef`20VMS X`09printf("VMS`20users`20should`20edit`20the`20sendcmd`20command`20in`20%s`20t Vo`20use`5Cn",s); X`09printf("the`20appropriate`20mailer.`20`20The`20IN%%`20mailer`20is`20assumed V.`5Cn`5Cn"); X#endif X`09if`20(`20(fp`20=`20fopen(s,"r"))`20==`20NULL)`20`7B X`09`09printf("I`20can't`20re-open`20your`20%s`20file!`5Cn",s); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09`7D Xrc.myname`20=`20NULL;`09`09/*`20these`20fields`20are`20required`20*/ Xrc.myaddr`20=`20NULL; X#ifdef`20VMS Xrc.gfile`20=`20"ldb.data";`09/*`20default`20game`20storage`20file`20*/ Xrc.pfile`20=`20"ldb.people";`09/*`20default`20opponent`20file`20*/ Xrc.gbackup`20=`20"ldb.olddata";`09/*`20game`20backup`20file`20*/ Xrc.sendcmd`20=`20"mail/subject=`5C"$s`5C"`20$f`20IN%%`5C"`5C"`5C"$a`5C"`5C" V`5C"";`20/*`20dflt`20mail`20cmd`20*/ Xrc.lockfile`20=`20"ldb.lock";`09/*`20default`20lock`20file`20*/ Xrc.supercmd`20=`20"";`09`09/*`20command`20to`20run`20when`20we`20have`20compan Vy`20*/ X#else Xrc.gfile`20=`20".ldbdata";`09/*`20default`20game`20storage`20file`20*/ Xrc.pfile`20=`20".ldbpeople";`09/*`20default`20opponent`20file`20*/ Xrc.gbackup`20=`20".oldldbdata";`09/*`20game`20backup`20file`20*/ Xrc.sendcmd`20=`20"mail`20-s`20'$s'`20$a`20<`20$f";`09/*`20default`20mail`20com Vmand`20*/ Xrc.lockfile`20=`20".ldb_lock";`09/*`20default`20lock`20file`20*/ Xrc.supercmd`20=`20"sh";`09`09/*`20command`20to`20run`20when`20we`20have`20comp Vany`20*/ X#endif Xrc.mfile`20=`20"ldb.rcv";`09/*`20default`20file`20for`20received`20mail`20*/ Xrc.delmail`20=`20"no";`09`09`09/*`20don't`20delete`20mail`20by`20default`20*/ Xrc.tempfile`20=`20"ldb.tmp";`09`09/*`20default`20temp`20file`20*/ Xrc.defclrs`20=`20"rw";`09`09`09/*`20"default"`20default`20colors`20*/ Xrc.defdir`20=`20"u";`09`09`09/*`20and`20direction`20*/ Xrc.initboard`20=`20"c";`09`09`09/*`20show`20current`20board`20by`20default`20* V/ Xrc.autoroll`20=`20"y";`09`09`09/*`20enable`20autoroll`20by`20default`20*/ Xrc.automove`20=`20"n";`09`09/*`20disabled`20by`20default`20(it's`20really`20an Vnoying`20*/ Xrc.autodouble`20=`200;`09`09/*`20disable`20autodouble`20by`20default`20*/ Xrc.superkey`20=`200;`09`09/*`20key`20to`20activate`20supercmd`20(dflt=disabled V)`20*/ Xrc.chkpt`20=`20"y";`09`09`09/*`20checkpoint`20is`20enabled`20by`20default`20*/ V Xrc.acctime`20=`207;`09`09`09/*`20access`20timeout`20in`207`20days`20by`20defau Vlt`20*/ Xrc.keepold`20=`207;`09`09`09/*`20keep`20dead`20games`207`20days`20by`20default V`20*/ Xrc.debug`20=`200;`09`09`09/*`20default`20to`20no`20debug`20*/ Xif`20(`20(n`20=`20nvscan(fp,nv_rcfile,`26rc))`20!=`20NULL)`20`7B X`09fprintf(stderr,"Invalid`20line`20in`20.ldbrc:`20%s`5Cn",n); X`09ldbexit(STAT_ABORT); X`09`7D Xfclose(fp); Xif`20(rc.myname`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20missing`20'myname'`20line`20in`20%s`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(rc.myaddr`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20missing`20'myaddr'`20line`20in`20%s`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(`20(strlen(rc.defclrs)`20!=`202)`20`7C`7C`20(!`20isalpha(rc.defclrs`5B0 V`5D))`20`7C`7C X`20`20`20`20`20(!`20isalpha(rc.defclrs`5B1`5D))`20`7C`7C`20(rc.defclrs`5B0`5D V`20==`20rc.defclrs`5B1`5D)`20)`20`7B X`09fprintf(stderr,"ERROR:`20invalid`20color`20string`20in`20%s:`20%s",s,rc.def Vclrs); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(strchr("ud",*rc.defdir)`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20direction`20must`20be`20'up'`20or`20'down'`20in V`20%s`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(strchr("bac",*rc.initboard)`20==`20NULL)`20`7B X`09fprintf(stderr, X`09`20"ERROR:`20initialboard`20must`20be`20'before',`20'after',`20or`20'curren Vt'`20in`20%s`5Cn" X`09`20,s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(strchr("yn",*rc.autoroll)`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20autoroll`20must`20be`20'yes'`20or`20'no'`20in`20%s V`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(strchr("yn",*rc.automove)`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20automove`20must`20be`20'yes'`20or`20'no'`20in`20%s V`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D Xif`20(strchr("yn",*rc.chkpt)`20==`20NULL)`20`7B X`09fprintf(stderr,"ERROR:`20checkpoint`20must`20be`20'yes'`20or`20'no'`20in V`20%s`5Cn",s); X`09ldbexit(STAT_ABORT); X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09readgames`20--`20read`20in`20games`20in`20progress X`20* X`20*`20This`20function`20reads`20the`20games`20file`20specified`20in`20.ldbrc V`20and`20loads X`20*`20the`20games`20into`20the`20games`20list`20(ghead/gtail). X`20*-------------------------------------------------------------------------- V- X`20*/ X Xreadgames() X`7B XFILE`20*fp; Xchar`20c,`20*s; Xstruct`20game`20*g; Xlong`20old; X Xreadpeople(); Xif`20(`20(fp`20=`20fopen(rc.gfile,"r"))`20==`20NULL) X`09return;`09`09`09`09/*`20no`20games`20*/ Xold`20=`20time(`20(long`20*)`200); Xif`20(rc.keepold`20>`200)`09`09/*`20if`20keeping`20old`20games`20is`20enabled V`20*/ X`09old`20-=`20(rc.keepold`20*`2086400);`09/*`20how`20old`20is`20too`20old?`20* V/ Xwhile`20(`20(c`20=`20getc(fp))`20!=`20EOF)`20`7B X`09ungetc(c,fp);`09/*`20put`20char`20back`20*/ X`09g`20=`20addgame();`09`09/*`20insert`20a`20new`20game`20*/ X`09g->opaddr`20=`20NULL; X`09g->opname`20=`20NULL; X`09g->myaddr`20=`20NULL; X`09g->mycmt`20=`20NULL; X`09g->mycmt2`20=`20NULL; X`09g->opcmt`20=`20NULL; X`09g->opcmt2`20=`20NULL; X`09g->dispmsg`20=`20NULL; X`09g->hiused`20=`200; X`09g->maxused`20=`200; X`09g->opver`20=`20100;`09`09/*`20default`20to`20version`201.0`20*/ X`09g->starttime`20=`200L; X`09clearmvs(g->opmvs); X`09clearmvs(g->mvs); X`09if`20(`20(s`20=`20nvscan(fp,nv_gfile,g))`20!=`20NULL)`20`7B`09/*`20read`20g Vame`20*/ X`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/ X`09`09TFinishSession();`09/*`20close`20down`20transport`20*/ X`09`09fprintf(stderr,"ERROR:`20invalid`20line`20in`20%s:`20%s`5Cn",`20rc.gfile V,`20s); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09if`20(g->gameid`20==`20NULL)`20`7B`09`09/*`20empty`20game`20(prob.`20EOF) V`20*/ X`09`09deletegame(g); X`09`09continue; X`09`09`7D X`09if`20(g->myaddr`20==`20NULL)`09`09/*`20no`20myaddr`20line`20*/ X`09`09g->myaddr`20=`20save(rc.myaddr);`09/*`20dflt`20to`20ldbrc`20setting`20*/ V X`09if`20(`20(g->ppl`20=`20findppl(g->opaddr,P_ADDR))`20==`20NULL) X`09`09newppl(g); X`09if`20( X`09`20`20`20(g->state`20==`20ST_GAMEOVER)`09`26`26 X`09`20`20`20(g->flags`20`26`20F_DISPLAYED)`09`26`26 X`09`20`20`20(g->lastacc`20<`20old)`20) X`09`09g->flags`20`7C=`20F_DELETE;`09/*`20game`20is`20old,`20mark`20it`20for V`20deletion`20*/ X`09if`20(rc.debug`20`26`20DB_RWGAMES) X`09`09message("DB-readgames:`20read`20game`20%s`5Cn",g->gameid); X`09`7D Xfclose(fp); X`7D X X X/*---------------------------------------------------------------------- X`20*`09writegames`20--`20save`20the`20game`20list`20to`20a`20file X`20* X`20*`20This`20function`20writes`20each`20game`20in`20the`20game`20list`20to V`20the`20specified X`20*`20file.`20`20Games`20with`20F_DELETE`20set`20in`20their`20flags`20are`20s Vkipped,`20and X`20*`20are`20thus`20effectively`20deleted.`20`20If`20the`20bkup`20arg`20is`20n Vot`20NULL`20and X`20*`20is`20not`20an`20empty`20string,`20the`20old`20file`20is`20renamed`20to V`20the`20string X`20*`20specified`20in`20bkup`20before`20the`20new`20file`20is`20created. X`20*---------------------------------------------------------------------- X`20*/ X Xwritegames(file,bkup,pfile) Xchar`20*file,`20*bkup,`20*pfile; X`7B XFILE`20*fp; Xstruct`20game`20*g; X Xwritepeople(pfile);`09`09`09/*`20save`20the`20people`20file`20*/ Xif`20(`20(bkup`20!=`20NULL)`20`26`26`20(*bkup`20!=`20'`5C0')`20)`20`7B X`09unlink(bkup);`09`09/*`20prevent`20multiple`20versions`20on`20VMS`20*/ X`09rename(file,bkup);`09/*`20save`20old`20game`20file`20*/ X`09`7D Xelse X`09unlink(file);`09`09/*`20prevent`20multiple`20versions`20on`20VMS`20*/ Xif`20(`20(fp`20=`20fopen(file,"w"))`20==`20NULL)`20`7B X`09message("ERROR:`20can't`20save`20games`20in`20%s!`5Cn",file); X`09return;`09`09`09/*`20should`20do`20something`20to`20save`20games...`20*/ X`09`7D Xfor`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next)`20`7B X`09if`20(g->flags`20`26`20F_DELETE) X`09`09continue;`09`09`09/*`20game`20is`20over,`20delete`20it`20*/ X`09if`20(g->state`20==`20ST_GAMEOVER) X`09`09continue;`09`09`09/*`20skip`20complete`20games`204`20now`20*/ X`09nvwrite(fp,nv_gfile,g);`09/*`20write`20the`20struct`20*/ X`09if`20(rc.debug`20`26`20DB_RWGAMES) X`09`09message("DB-writegames:`20write`20game`20%s`5Cn",g->gameid); X`09`7D Xfor`20(g`20=`20ghead;`20g`20!=`20NULL;`20g`20=`20g->next)`20`7B X`09if`20(g->flags`20`26`20F_DELETE) X`09`09continue;`09`09/*`20game`20is`20over,`20delete`20it`20*/ X`09if`20(g->state`20!=`20ST_GAMEOVER) X`09`09continue;`09`09/*`20put`20complete`20games`20@`20end`20*/ X`09nvwrite(fp,nv_gfile,g);`09/*`20write`20the`20struct`20*/ X`09if`20(rc.debug`20`26`20DB_RWGAMES) X`09`09message("DB-writegames:`20write`20game`20%s`5Cn",g->gameid); X`09`7D Xfclose(fp); X`7D X X X/*--------------------------------------------------------------------------- X`20*`09readpeople`20--`20read`20in`20the`20people`20file X`20* X`20*`20This`20function`20reads`20the`20"people"`20file,`20which`20is`20the`20l Vist`20of`20all`20of`20the X`20*`20opponents`20we`20have`20ever`20played.`20`20The`20people`20file`20serve Vs`20three`20purposes: X`20*`091.`20It`20keeps`20a`20record`20of`20games/gammons/backgammons/matches V`20won/lost X`20*`09`20`20`20to`20each`20person. X`20*`092.`20It`20stores`20the`20mail`20address`20so`20you`20don't`20have`20to V`20remember, X`20*`09`20`20`20and`20allows`20you`20to`20assign`20an`20alias`20to`20each`20pe Vrson.`20`20This X`20*`09`20`20`20alias`20can`20be`20used`20in`20the`20-start`20argument`20inste Vad`20of`20the X`20*`09`20`20`20mail`20address. X`20*`093.`20It`20stores`20the`20"fence"`20time,`20which`20is`20the`20time`20th Vat`20the X`20*`09`20`20`20(newest`20game`20played`20with`20that`20person`20that`20has V`20finished) X`20*`09`20`20`20was`20started.`20`20(Read`20it`20again,`20it`20makes`20sense). V X`20*`09`20`20`20This`20information`20allows`20us`20to`20discard`20START`20pack Vets`20that X`20*`09`20`20`20have`20remained`20in`20our`20mail`20(that`20we`20should`20have V`20deleted, X`20*`09`20`20`20but`20didn't)`20by`20discarding`20START`20packets`20that`20are V`20not`20newer X`20*`09`20`20`20than`20the`20fence`20time. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xreadpeople() X`7B XFILE`20*fp; Xchar`20c,`20*s; Xstruct`20people`20*p; X Xif`20(`20(fp`20=`20fopen(rc.pfile,"r"))`20==`20NULL) X`09return;`09`09`09`09/*`20no`20people`20file`20*/ Xwhile`20(`20(c`20=`20getc(fp))`20!=`20EOF)`20`7B X`09ungetc(c,fp);`09/*`20put`20char`20back`20*/ X`09p`20=`20addppl();`09`09/*`20insert`20a`20new`20record`20*/ X`09p->name`20=`20NULL;`09`09 X`09p->addr`20=`20NULL; X`09p->alias`20=`20NULL; X`09p->myaddr`20=`20NULL; X`09p->equiv`20=`20NULL; X`09p->fence`20=`200L; X`09if`20(`20(s`20=`20nvscan(fp,nv_pfile,p))`20!=`20NULL)`20`7B`09/*`20read`20r Vecord`20*/ X`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/ X`09`09TFinishSession();`09/*`20close`20down`20transport`20*/ X`09`09fprintf(stderr,"ERROR:`20invalid`20line`20in`20%s:`20%s`5Cn",`20rc.pfile V,`20s); X`09`09ldbexit(STAT_ABORT); X`09`09`7D X`09if`20(p->equiv`20!=`20NULL)`09`09/*`20an`20equiv`20record`20*/ X`09`09continue;`09`09/*`20no`20other`20fields`20*/ X`09if`20(p->myaddr`20==`20NULL)`09`09`09/*`20if`20no`20myaddr`20line`20*/ X`09`09p->myaddr`20=`20save(rc.myaddr);`09/*`20dflt`20to`20ldbrc`20setting`20*/ V X`09if`20(rc.debug`20`26`20DB_RWGAMES) X`09`09message("DB-readpeople:`20read`20'%s'`5Cn",p->name); X`09`7D Xfclose(fp); X`7D X X X/*---------------------------------------------------------------------- X`20*`09writepeople`20--`20save`20the`20people`20list`20to`20a`20file X`20* X`20*`20This`20function`20writes`20the`20people`20list`20to`20rc.pfile. X`20*---------------------------------------------------------------------- X`20*/ X Xwritepeople(file) Xchar`20*file; X`7B XFILE`20*fp; Xstruct`20people`20*p; X Xunlink(file);`09`09/*`20prevent`20multiple`20versions`20on`20VMS`20*/ Xif`20(`20(fp`20=`20fopen(file,"w"))`20==`20NULL)`20`7B X`09message("ERROR:`20can't`20save`20people`20in`20%s!`5Cn",file); X`09return;`09`09`09/*`20should`20do`20something`20to`20save`20people`20list V`20*/ X`09`7D Xfor`20(p`20=`20phead;`20p`20!=`20NULL;`20p`20=`20p->next)`20`7B X`09if`20(p->equiv`20==`20NULL)`20`7B X`09`09nvwrite(fp,nv_pfile,p);`09/*`20write`20the`20struct`20*/ X`09`09if`20(rc.debug`20`26`20DB_RWGAMES) X`09`09`09message("DB-writepeople:`20write`20'%s'`5Cn",p->name); X`09`09`7D X`09else X`09`09nvwrite(fp,nv_pequiv,p);`09/*`20write`20an`20equiv`20record`20*/ X`09`7D Xfclose(fp); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09boardstr`20--`20generate`20an`20ascii`20representation`20of`20a`20board V X`20* X`20*`20This`20function`20produces`20a`20visible`20representation`20of`20a`20bo Vard.`20`20Each`20point X`20*`20on`20the`20board`20takes`20two`20characters;`20the`20quantity`20is`20of Vfset`20by`2065, X`20*`20putting`20it`20in`20the`20range`20`5BA-P`5D,`20and`20the`20color`20is V`20unchanged`20since`20it X`20*`20is`20already`20a`20printable`20character.`20`20This`20results`20in`20a V`20string`20of X`20*`2028`20character`20pairs,`20one`20for`20each`20point`20on`20the`20board. V`20`20These`20are X`20*`20in`20the`20order: X`20*`090:`09BAR`20point`20for`20upbound`20player X`20*`091-24:`09board`20points X`20*`0925:`09BAR`20point`20for`20downbound`20player X`20*`0926:`09OFF`20point`20for`20upbound`20player X`20*`0927:`09OFF`20point`20for`20downbound`20player X`20*---------------------------------------------------------------------- X`20*/ X Xchar`20*boardstr(b) Xboard`20b; X`7B Xstatic`20char`20buf`5BBOARDSIZE*2+1`5D; Xchar`20*s,`20c; Xint`20i; X Xs`20=`20buf; Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++)`20`7B X`09*s++`20=`20b`5Bi`5D.qty`20+`20'A';`09`09/*`20offset`20qty`20into`20u.c.`20l Vetters`20*/ X`09c`20=`20b`5Bi`5D.color; X`09if`20(!`20isalpha(c)) X`09`09c`20=`20'-';`09`09/*`20use`20printing`20chars`20*/ X`09*s++`20=`20c; X`09`7D X*s`20=`20'`5C0'; Xreturn(buf); X`7D X X +-+-+-+-+-+-+-+- END OF PART 13 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 14 -+-+-+-+-+-+-+-+ X X/*---------------------------------------------------------------------- X`20*`09nvscan`20--`20read`20name/value`20pairs`20from`20a`20file X`20* X`20*`20This`20function`20provides`20a`20generalized`20method`20for`20reading V`20name/value X`20*`20pairs.`20`20The`20names`20and`20value`20types`20are`20specified`20in V`20an`20array`20of X`20*`20struct`20namevalue's,`20along`20with`20an`20offset`20which`20is`20used V`20to`20store X`20*`20the`20value.`20`20The`20offset`20is`20added`20to`20a`20base`20pointer, V`20passed`20as`20the X`20*`20"st"`20argument,`20to`20form`20a`20pointer,`20which`20is`20then`20conve Vrted`20to`20the X`20*`20type`20indicated`20by`20the`20"type"`20field`20of`20the`20namevalue`20t Vable`20using X`20*`20the`20"nvtypes"`20union,`20and`20used`20to`20store`20the`20value.`20 V`20The`20legal X`20*`20value`20types`20are`20defined`20in`20ldb.h`20as`20FT_*.`20`20Name/value V`20pairs`20are X`20*`20expected`20to`20be`20in`20the`20form`20"name=value`5Cn",`20with`20no V`20spaces`20before X`20*`20or`20after`20name,`20and`20with`20any`20spaces`20after`20the`20=`20or V`20before`20the X`20*`20newline`20being`20part`20of`20the`20value`20string.`20`20Comments`20are V`20indicated`20by X`20*`20a`20#`20in`20column`201,`20which`20comments`20to`20the`20end`20of`20the V`20line. X`20*---------------------------------------------------------------------- X`20*/ X Xchar`20*nvscan(fp,t,st) XFILE`20*fp;`09`09/*`20file`20to`20scan`20*/ Xstruct`20namevalue`20*t;`09/*`20table`20of`20name/value`20pairs`20*/ Xchar`20*st;`09`09/*`20really`20a`20pointer`20to`20a`20structure`20*/ X`7B Xstatic`20char`20buf`5B128`5D; Xchar`20*s,`20**p; Xint`20i,`20j; Xunion`20nvtypes`20u; Xlong`20atol(); X Xwhile`20(fgets(buf,sizeof(buf),fp)`20!=`20NULL)`20`7B X`09if`20(*buf`20==`20'#')`09`09`09/*`20comment`20character`20*/ X`09`09continue; X`09buf`5Bstrlen(buf)-1`5D`20=`20'`5C0';`09`09/*`20clobber`20the`20newline`20*/ V X`09if`20(`20(s`20=`20strchr(buf,'='))`20==`20NULL) X`09`09return(buf);`09`09`09/*`20bad`20line,`20return`20it`20*/ X`09*s++`20=`20'`5C0'; X`09for`20(i`20=`200;`20t`5Bi`5D.name`20!=`20NULL;`20i++) X`09`09if`20(strcmp(t`5Bi`5D.name,buf)`20==`200) X`09`09`09break; X`09if`20(t`5Bi`5D.name`20==`20NULL)`09`09/*`20got`20a`20name`20we`20don't`20re Vcognize`20*/ X`09`09continue;`09`09/*`20ignore`20it`20*/ X`09u.nvchar`20=`20st`20+`20t`5Bi`5D.offset;`09/*`20put`20pointer`20into`20unio Vn`20*/ X`09switch`20(t`5Bi`5D.type)`20`7B X`09case`20FT_CHAR:`09`09`09/*`20just`20store`20a`20single`20char`20*/ X`09`09*u.nvchar`20=`20atoi(s);`09/*`20chars`20stored`20as`20ints`20in`20the V`20file`20*/ X`09`09break; X`09case`20FT_INT:`09`09`09/*`20store`20an`20int`20*/ X`09`09*u.nvint`20=`20atoi(s); X`09`09break; X`09case`20FT_STRING:`09`09`09/*`20store`20a`20copy`20of`20a`20string`20*/ X`09`09*u.nvstring`20=`20save(s); X`09`09break; X`09case`20FT_MOVE:`09`09`09/*`20store`20a`20struct`20mv`20*/ X`09`09str2mv(s,u.nvmove); X`09`09break; X`09case`20FT_BOARD:`09`09`09/*`20store`20an`20entire`20board`20*/ X`09`09for`20(j`20=`200;`20j`20<`20BOARDSIZE;`20j++)`20`7B X`09`09`09u.nvboard`5Bj`5D.qty`20=`20*s++`20-`20'A'; X`09`09`09u.nvboard`5Bj`5D.color`20=`20*s++; X`09`09`09`7D X`09`09break; X`09case`20FT_STRLKUP:`09`09/*`20look`20up`20string`20`26`20store`20index`20*/ X`09`09p`20=`20(char`20**)`20t`5Bi`5D.dflt;`09/*`20unions`20are`20such`20a`20pa Vin`20*/ X`09`09if`20(p`20==`20NULL)`09`09/*`20choke...`20*/ X`09`09`09fatal("ERROR:`20NULL`20string`20table`20in`20nvscan."); X`09`09for`20(j`20=`200;`20*p;`20j++,`20p++) X`09`09`09if`20(strcmp(s,*p)`20==`200) X`09`09`09`09break; X`09`09if`20(*p`20==`20NULL)`20`7B X`09`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/ X`09`09`09TFinishSession();`09/*`20close`20down`20transport`20*/ X`09`09`09fprintf(stderr,"ERROR:`20unknown`20string:`20%s`5Cn",s); X`09`09`09ldbexit(STAT_ABORT);`09/*`20shouldn't`20do`20this...`20*/ X`09`09`09`7D X`09`09*u.nvint`20=`20j;`09/*`20store`20integer`20opcode`20*/ X`09`09break; X`09case`20FT_TIME:`09`09`09/*`20read`20in`20a`20timestamp`20*/ X`09`09*u.nvtime`20=`20atol(s); X`09`09break; X`09case`20FT_INTARRAY:`09`09/*`20array`20of`20integers`20*/ X`09`09for`20(j`20=`200;`20j`20<`20t`5Bi`5D.dflt;`20j++)`20`7B X`09`09`09while`20(isspace(*s)) X`09`09`09`09s++; X`09`09`09(u.nvint)`5Bj`5D`20=`20atoi(s);`09`09/*`20store`20an`20int`20*/ X`09`09`09while`20(isdigit(*s))`09/*`20skip`20to`20end`20of`20int`20*/ X`09`09`09`09s++; X`09`09`09`7D X`09`09break; X`09case`20FT_END:`09`09`09/*`20we`20hit`20the`20end`20marker`20*/ X`09`09return(NULL);`09`09/*`20return`20success`20*/ X`09default:`09`09`09/*`20we`20have`20a`20bad`20nv`20table`20*/ X`09`09*--s`20=`20'=';`09`09/*`20restore`20the`20buffer`20*/ X`09`09return(buf);`09`09/*`20return`20bad`20line`20*/ X`09`09`7D X`09`7D Xreturn(NULL); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09nvwrite`20--`20write`20name/value`20pairs`20into`20a`20file X`20* X`20*`20This`20function`20writes`20name/value`20pairs`20to`20a`20file`20in`20th Ve`20same`20format X`20*`20used`20by`20nvscan.`20`20Nvwrite`20is`20merely`20the`20inverse`20of`20n Vvscan,`20taking`20values X`20*`20out`20of`20the`20structure`20in`20the`20same`20manner`20nvscan`20used V`20to`20store`20them X`20*`20there,`20and`20generating`20"name=value"`20lines.`20`20One`20line`20is V`20generated`20for X`20*`20each`20element`20in`20the`20namevalue`20table,`20except`20that`20elemen Vts`20of`20type X`20*`20FT_MOVE`20whose`20"roll"`20field`20is`20<=`200`20are`20skipped,`20as V`20are`20elements`20of X`20*`20type`20FT_STRING`20that`20are`20equal`20to`20NULL. X`20*---------------------------------------------------------------------- X`20*/ X Xnvwrite(fp,t,st) XFILE`20*fp;`09`09`09/*`20file`20to`20write`20to`20*/ Xstruct`20namevalue`20*t;`09`09/*`20table`20of`20name/value`20pairs`20*/ Xchar`20*st;`09`09`09/*`20really`20a`20pointer`20to`20a`20structure`20*/ X`7B Xstruct`20namevalue`20*n; Xstatic`20char`20buf`5B128`5D; Xint`20nstr; Xunion`20nvtypes`20u; Xchar`20c,`20**stbl; Xint`20j; X Xfor`20(n`20=`20t;`20n->name`20!=`20NULL;`20n++)`20`7B X`09u.nvchar`20=`20st`20+`20n->offset; X`09switch`20(n->type)`20`7B X`09case`20FT_CHAR:`09`09`09/*`20just`20store`20a`20single`20char`20*/ X`09`09fprintf(fp,"%s=%d`5Cn",n->name,*u.nvchar); X`09`09break; X`09case`20FT_INT:`09`09`09/*`20store`20an`20int`20*/ X`09`09fprintf(fp,"%s=%d`5Cn",n->name,*u.nvint); X`09`09break; X`09case`20FT_STRING:`09`09`09/*`20store`20a`20copy`20of`20a`20string`20*/ X`09`09if`20(*u.nvstring`20!=`20NULL)/*`20skip`20NULL`20strings`20*/ X`09`09`09fprintf(fp,"%s=%s`5Cn",n->name,*u.nvstring); X`09`09break; X`09case`20FT_MOVE:`09`09`09/*`20store`20a`20struct`20mv`20*/ X`09`09if`20(u.nvmove->roll`20>`200)`20`7B X`09`09`09mv2str(u.nvmove,buf); X`09`09`09fprintf(fp,"%s=%s`5Cn",n->name,buf); X`09`09`09`7D X`09`09break; X`09case`20FT_BOARD:`09`09`09/*`20store`20an`20entire`20board`20*/ X`09`09fprintf(fp,"%s=%s`5Cn",n->name,boardstr(u.nvboard)); X`09`09break; X`09case`20FT_STRLKUP:`09`09/*`20look`20up`20string`20`26`20store`20index`20*/ X`09`09stbl`20=`20(char`20**)`20n->dflt;`09/*`20hope`20char**`20fits`20in`20int V`20*/ X`09`09if`20(stbl`20==`20NULL) X`09`09`09fatal("ERROR:`20NULL`20string`20table`20in`20nvwrite."); X`09`09for`20(nstr`20=`200;`20stbl`5Bnstr`5D;`20nstr++);`20/*`20#`20strings`20* V/ X`09`09if`20(`20(*u.nvint`20<`200)`20`7C`7C`20(*u.nvint`20>=`20nstr)`20)`20`7B X`09`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/ X`09`09`09TFinishSession();`09/*`20close`20down`20transport`20*/ X`09`09`09fprintf(stderr,"ERROR:`20invalid`20index:`20%s=%d`5Cn", X`09`09`09`09n->name,*u.nvint); X`09`09`09ldbexit(STAT_ABORT);`09/*`20shouldn't`20do`20this...`20*/ X`09`09`09`7D X`09`09fprintf(fp,"%s=%s`5Cn",n->name,stbl`5B*u.nvint`5D); X`09`09break; X`09case`20FT_TIME:`09`09`09/*`20generate`20a`20timestamp`20*/ X`09`09fprintf(fp,"%s=%lu`5Cn",n->name,*u.nvtime); X`09`09break; X`09case`20FT_INTARRAY:`09`09/*`20generate`20an`20integer`20array`20*/ X`09`09fprintf(fp,"%s",n->name); X`09`09c`20=`20'='; X`09`09for`20(j`20=`200;`20j`20<`20n->dflt;`20j++)`20`7B X`09`09`09fprintf(fp,"%c%d",c,(u.nvint)`5Bj`5D); X`09`09`09c`20=`20'`20'; X`09`09`09`7D X`09`09fprintf(fp,"`5Cn"); X`09`09break; X`09case`20FT_END:`09`09`09/*`20we`20hit`20the`20end`20marker`20*/ X`09`09fprintf(fp,"%s=end`5Cn",n->name); X`09`09break; X`09default:`09`09`09/*`20we`20have`20a`20bad`20nv`20table`20*/ X`09`09FeFinishSession();`09/*`20close`20down`20front-end`20*/ X`09`09TFinishSession();`09/*`20close`20down`20transport`20*/ X`09`09fprintf(stderr,"ERROR:`20bad`20namevalue`20type:`20%s`20(%d)`5Cn", X`09`09`09n->name,n->type); X`09`09ldbexit(STAT_ABORT);`09`09/*`20should`20have`20saved`20games?`20*/ X`09`09`7D X`09`7D X`7D X X X/*--------------------------------------------------------------------------- X`20*`09check_timeout`20--`20see`20if`20a`20game`20has`20been`20accessed`20rece Vntly X`20* X`20*`20This`20function`20checks`20the`20access`20time`20of`20a`20game.`20`20If V`20it`20is`20less`20than X`20*`20rc.acctime`20(default`207`20days),`20and`20the`20game`20is`20waiting V`20for`20the`20opponent, X`20*`20an`20automatic`20timeout`20is`20performed.`20`20If`20rc.acctime`20is V`20<=`200, X`20*`20automatic`20timeouts`20are`20disabled. X`20*-------------------------------------------------------------------------- V- X`20*/ X Xcheck_timeout(g) Xstruct`20game`20*g; X`7B Xlong`20old; X Xif`20(rc.acctime`20<=`200) X`09return; Xold`20=`20time((long`20*)`200)`20-`20((long)`20(rc.acctime*86400));`20/*`20loo Vk`20for`20idle`20games`20*/ Xif`20(`20(g->lastacc`20<`20old)`20`26`26`20(g->state`20<`20OPSTATES)`20)`20 V`7B X`09message("Access`20timeout`20(%d`20days)`20with`20%s`20--`20resending...`5Cn V", X`09`09rc.acctime,g->opaddr); X`09g->lastacc`20=`20time(`20(long`20*)`200); X`09resendpkt(g);`09/*`20auto`20resend`20*/ X`09`7D X`7D $ call unpack SAVE.C;1 1246453896 "" $! $ create 'f' X/*`09t_email.c`09`099/5/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*====================================================================== X`20*`20This`20file`20is`20the`20e-mail`20transport`20for`20the`20ldb`20program V.`20`20It`20is X`20*`20modularized`20to`20allow`20other`20transports`20to`20be`20substituted, V`20most X`20*`20notably`20a`20socket`20transport`20to`20allow`20interactive`20network V`20backgammon. X`20*`20For`20now,`20though,`20this`20is`20the`20only`20transport`20available. X`20* X`20*`20Packets`20are`20sent`20via`20TSendPacket,`20which`20takes`20an`20instan Vce`20of X`20*`20struct`20packet`20and`20an`20address,`20and`20sends`20the`20packet`20to V`20that`20address. X`20*`20TInitialize`20must`20be`20called`20before`20any`20calls`20to`20TSendPac Vket,`20and X`20*`20TFinishSession`20must`20be`20called`20before`20exiting. X`20* X`20*`20Individual`20files`20may`20be`20sent`20by`20calling`20TSendFile.`20`20T Vhese`20files X`20*`20need`20not`20be`20related`20to`20a`20game. X`20*====================================================================== X`20*/ X XPRIVATE`20PStringSub(); X X X/*---------------------------------------------------------------------- X`20*`09TInitialize`20--`20initialize`20the`20transport X`20* X`20*`20This`20function`20is`20called`20before`20the`20transport`20is`20used. V`20`20As`20you`20can X`20*`20see,`20email`20doesn't`20require`20a`20great`20deal`20of`20initializati Von. X`20*---------------------------------------------------------------------- X`20*/ X XTInitialize() X`7B X`7D X X X/*---------------------------------------------------------------------- X`20*`09FeDrawMenu`20--`20draw`20menu`20choices`20in`20menu`20box X`20* X`20*`20This`20function`20closes`20down`20the`20transport. X`20*---------------------------------------------------------------------- X`20*/ X XTFinishSession() X`7B X`7D X X X X/*---------------------------------------------------------------------- X`20*`09TSendPacket`20--`20send`20a`20packet`20to`20an`20email`20address X`20* X`20*`20This`20function`20sends`20a`20packet`20to`20an`20email`20address.`20 V`20It`20returns`201`20if X`20*`20the`20packet`20was`20sent,`200`20if`20an`20error`20occurred. X`20*---------------------------------------------------------------------- X`20*/ X XTSendPacket(p,addr) Xstruct`20packet`20*p; Xchar`20*addr; X`7B Xchar`20subject`5B80`5D; XFILE`20*fp; Xint`20status; X X Xif`20((fp`20=`20fopen(rc.tempfile,"w"))`20==`20NULL)`20`7B`09/*`20open`20temp V`20file`20*/ X`09message("ERROR:`20can't`20create`20%s!`5Cn",rc.tempfile); X`09return; X`09`7D Xfprintf(fp,"<<<===LDB===>>>`5Cn");`09/*`20send`20magic`20header`20text`20*/ Xnvwrite(fp,nv_packet,p);`09/*`20write`20the`20contents`20of`20the`20packet`20* V/ Xfclose(fp);`09`09`09`09/*`20close`20temp`20file`20*/ Xsprintf(subject,"<=LDB=>`20from`20%s`20(Long`20Distance`20Backgammon)",`20rc.m Vyname); Xstatus`20=`20TSendFile(addr,rc.tempfile,subject);`09/*`20send`20the`20file`20* V/ Xunlink(rc.tempfile);`09`09/*`20delete`20the`20temp`20file`20*/ Xreturn(status); X`7D X X X/*---------------------------------------------------------------------- X`20*`09TSendFile`20--`20send`20a`20file`20to`20an`20address X`20* X`20*`20This`20function`20takes`20an`20e-mail`20address,`20a`20file,`20and`20a V`20subject`20line, X`20*`20and`20sends`20the`20contents`20of`20the`20file`20to`20the`20specified V`20address.`20`20The X`20*`20subject`20is`20set`20to`20the`20contents`20of`20the`20subject`20argumen Vt,`20which`20should X`20*`20be`20one`20line.`20`20TSendFile`20returns`20a`201`20if`20the`20message V`20was`20sent, X`20*`20and`20a`200`20if`20an`20error`20occurred. X`20*---------------------------------------------------------------------- X`20*/ X XTSendFile(addr,file,subj) Xchar`20*addr,`20*file,`20*subj; X`7B Xchar`20cmd`5B256`5D; Xchar`20*subs`5B3`5D; Xint`20s; X Xsubs`5B0`5D`20=`20addr;`09`09`09/*`20substitute`20$a`20with`20opponent`20addre Vss`20*/ Xsubs`5B1`5D`20=`20file;`09`09`09/*`20substitue`20$f`20with`20file`20*/ Xsubs`5B2`5D`20=`20subj;`09`09`09/*`20substitute`20$s`20with`20subject`20*/ XPStringSub(rc.sendcmd,"afs",subs,cmd); Xs`20=`20system(cmd);`09`09`09/*`20execute`20email`20command`20*/ Xreturn(s`20==`20SYS_GOOD); X`7D X X X X/*---------------------------------------------------------------------- X`20*`09PStringSub`20--`20substitute`20variables`20in`20a`20string X`20* X`20*`20This`20function`20copies`20str`20to`20obuf,`20replacing`20occurrences V`20of`20$x`20to X`20*`20a`20corresponding`20string.`20`20The`20characters`20which`20can`20appea Vr`20after X`20*`20the`20$`20are`20passed`20in`20a`20single`20string`20in`20the`20"chars" V`20argument,`20and X`20*`20the`20strings`20to`20replace`20them`20with`20are`20passed,`20in`20the V`20same`20order`20as X`20*`20the`20characters`20appear`20in`20"chars",`20in`20the`20"strings"`20argu Vment. X`20*---------------------------------------------------------------------- X`20*/ X XPRIVATE`20PStringSub(str,chars,strings,obuf) Xchar`20*str,`20*chars,`20*strings`5B`5D,`20obuf`5B`5D; X`7B Xchar`20*s,`20*o,`20*t; X Xfor`20(s`20=`20str,`20o`20=`20obuf;`20*s;`20s++)`20`7B X`09if`20(*s`20!=`20'$')`20`7B`09/*`20as`20long`20as`20we`20don't`20see`20a`20$ V`20*/ X`09`09*o++`20=`20*s;`09/*`20just`20keep`20copying`20*/ X`09`09continue; X`09`09`7D X`09s++; X`09if`20(*s`20==`20'$')`20`7B`09/*`20$$`20is`20a`20single`20$`20*/ X`09`09*o++`20=`20'$'; X`09`09continue; X`09`09`7D X`09if`20(`20(t`20=`20strchr(chars,*s))`20==`20NULL)`09/*`20skip`20invalid`20$ V`20subs`20*/ X`09`09continue; X`09t`20=`20strings`5Bt`20-`20chars`5D;`09`09/*`20get`20ptr`20to`20replacement V`20string`20*/ X`09while`20(*t)`09`09`09/*`20copy`20it`20to`20obuf`20*/ X`09`09*o++`20=`20*t++; X`09`7D X*o`20=`20'`5C0';`09`09`09`09/*`20null`20terminate`20obuf`20*/ X`7D $ call unpack T_EMAIL.C;1 2014881667 "" $! $ create 'f' X/*`09vars.c`09`098/4/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"ldb.h" X X/*====================================================================== X`20*`20This`20file`20contains`20the`20definition`20for`20all`20global`20variab Vles,`20as`20well X`20*`20as`20the`20static`20initialization`20values`20for`20those`20that`20need V`20it. X`20*====================================================================== X`20*/ X Xint`20Pflag;`09`09`09/*`20should`20I`20process`20local`20input?`20*/ Xint`20Rflag;`09`09`09/*`20should`20I`20look`20for`20mail?`20*/ Xstruct`20game`20*ghead;`09`09/*`20head`20of`20linked`20list`20of`20games`20*/ Xstruct`20game`20*gtail;`09`09/*`20tail`20of`20linked`20list`20of`20games`20*/ Xstruct`20legal`20*lhead;`09`09/*`20head`20of`20list`20of`20legal`20moves`20*/ Xstruct`20legal`20*ltail;`09`09/*`20tail`20of`20list`20of`20legal`20moves`20*/ Xstruct`20people`20*phead;`09`09/*`20head`20of`20people`20list`20*/ Xstruct`20packet`20P;`09`09/*`20last`20packet`20read`20*/ Xchar`20cr_mycolor;`09`09/*`20my`20color`20when`20game`20is`20created`20*/ Xchar`20cr_opcolor;`09`09/*`20opponent's`20color`20for`20new`20games`20*/ Xchar`20cr_mydir;`09`09`09/*`20my`20direction`20for`20new`20games`20*/ Xchar`20*notify;`09`09`09/*`20address`20to`20notify`20when`20game`20ends`20*/ Xchar`20blk76`5B`5D`20=`09`09`09/*`2076`20blanks`20*/ X"`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20"; X Xchar`20FeIsActive`20=`200;`09`09/*`20has`20the`20front-end`20been`20initialize Vd?`20*/ Xchar`20FeWaitInit`20=`200;`09`09/*`20non-0`20if`20message()`20has`20been`20cal Vled`20*/ X X#ifdef`20NEED_READDIR Xstruct`20direct`20dirbuf;`09`09/*`20mem`20used`20by`20readdir`20emulation`20#d Vefine`20*/ X#endif X Xint`20GameState`20=`200;`09`09/*`20Current`20game`20state`20for`20help`20*/ Xint`20boardnums`5B3`5D`20=`20`7BBD_AFTOP,`20BD_BEFOP,`20BD_CUR`7D; Xchar`20*states`5B`5D`20=`20`7B`09`09/*`20description`20of`20the`20states`20*/ X`09"Waiting`20for`20opponent`20to`20start`20game", X`09"Waiting`20for`20opponent`20to`20move", X`09"Waiting`20for`20opponent`20to`20accept`20double", X`09"Your`20turn`20(you`20haven't`20rolled`20yet)", X`09"Your`20move`20(you`20have`20rolled)", X`09"Waiting`20for`20you`20to`20accept`20double", X`09"Game`20over" X`09`7D; X Xstruct`20opt`20options`5B`5D`20=`20`7B X`09"broadcast",`09OPT_BCAST,`09"`20`5Bfile`5D", X`09"`5CtSend`20a`20mail`20message`20to`20all`20opponents", X`09"colors",`09OPT_COLOR,`09"`20xx", X`09"`5Ct`5CtSet`20colors`20for`20new`20game", X`09"control",`09OPT_CONTROL,`09"", X`09"`5Ct`5CtPerform`20control`20functions`20on`20games", X`09"crawford",`09OPT_CRAWFORD,`09"", X`09"`5Ct`5CtEnable`20crawford`20rule`20for`20new`20games", X`09"direction",`09OPT_DIRECTION,`09"`20dir", X`09"`5Ct`5CtSet`20direction`20for`20new`20game`20`5Bup`20or`20down`5D", X`09"european",`09OPT_EUROPE,`09"", X`09"`5Ct`5CtEnable`20european`20rule`20for`20new`20games", X`09"help",`09`09OPT_HELP,`09"", X`09"`5Ct`5Ct`5CtPrint`20this`20message", X`09"jacoby",`09OPT_JACOBY,`09"", X`09"`5Ct`5Ct`5CtEnable`20jacoby`20rule`20for`20new`20games", X`09"match",`09OPT_MATCH,`09"`20number", X`09"`5Ct`5CtSet`20number`20of`20points`20in`20match", X`09"myaddr",`09OPT_MYADDR,`09"`20addr", X`09"`5Ct`5CtSet`20local`20e-mail`20address", X`09"notify",`09OPT_NOTIFY,`09"`20addr", X`09"`5Ct`5CtSend`20mail`20to`20addr`20when`20game`20ends", X`09"permanent",`09OPT_PERM,`09"", X`09"`5Ct`5CtMake`20new`20games`20permanent", X`09"play",`09`09OPT_PLAY,`09"", X`09"`5Ct`5Ct`5CtPlay`20any`20waiting`20games`20but`20do`20not`20read`20mail", X`09"read",`09`09OPT_READ,`09"", X`09"`5Ct`5Ct`5CtRead`20incoming`20mail`20but`20do`20not`20play", X`09"reconstruct",`09OPT_RECONS,`09"`20file", X`09"`5CtReconstruct`20a`20game`20from`20opponent's`20data`20file", X`09"remotestart",`09OPT_RSTART,`09"`20u1`20u2", X`09"`5CtStart`20a`20game`20between`20u1`20and`20u2", X`09"score",`09OPT_SCORE,`09"", X`09"`5Ct`5Ct`5CtPrint`20cumulative`20score`20by`20opponent", X`09"start",`09OPT_START,`09"`20user", X`09"`5Ct`5CtStart`20a`20game`20with`20another`20user", X`09NULL,`09`09-1,`09`09NULL,`09`09NULL X`09`7D; X Xchar`20*opcodes`5B`5D`20=`20`7B X`20`20`20`20`20`20`20`20"START",`20"USTART",`20"TIE",`20`20"MOVE",`20"OFFERDOU VBLE",`20"ACCEPTDOUBLE", X`09"DECLINEDOUBLE",`20"CONCEDE",`20"REMOTESTART",`20"RESTART",`20"MSTART", X`09"RESEND",`20"NOTIFY", X`09NULL X`20`20`20`20`20`20`20`20`7D; X Xstruct`20namevalue`20nv_rcfile`5B`5D`20=`20`7B X`09"myname",`09FT_STRING,`09Offset(struct`20ldbrc`20*,myname),`09NULL, X`09"myaddr",`09FT_STRING,`09Offset(struct`20ldbrc`20*,myaddr),`09NULL, X`09"peoplefile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,pfile),`09NULL, X`09"gamefile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,gfile),`09NULL, X`09"backupfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,gbackup),`09NULL, X`09"mailfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,mfile),`09NULL, X`09"delmail",`09FT_STRING,`09Offset(struct`20ldbrc`20*,delmail),`09NULL, X`09"lockfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,lockfile),NULL, X`09"sendcmd",`09FT_STRING,`09Offset(struct`20ldbrc`20*,sendcmd),`09NULL, X`09"tempfile",`09FT_STRING,`09Offset(struct`20ldbrc`20*,tempfile),NULL, X`09"colors",`09FT_STRING,`09Offset(struct`20ldbrc`20*,defclrs),`09NULL, X`09"direction",`09FT_STRING,`09Offset(struct`20ldbrc`20*,defdir),`09NULL, X`09"initialboard",`09FT_STRING,`09Offset(struct`20ldbrc`20*,initboard),NULL, X`09"autoroll",`09FT_STRING,`09Offset(struct`20ldbrc`20*,autoroll),NULL, X`09"automove",`09FT_STRING,`09Offset(struct`20ldbrc`20*,automove),NULL, X`09"autodouble",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,autodouble),0, X`09"supercmd",`09FT_STRING,`09Offset(struct`20ldbrc`20*,supercmd),NULL, X`09"superkey",`09FT_CHAR,`09Offset(struct`20ldbrc`20*,superkey),0, X`09"checkpoint",`09FT_STRING,`09Offset(struct`20ldbrc`20*,chkpt),`09NULL, X`09"timeout",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,acctime),`090, X`09"keepold",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,keepold),`090, X`09"debug",`09FT_INT,`09`09Offset(struct`20ldbrc`20*,debug),`090, X`09NULL,`09`090,`09`09-1,`090 X`09`7D; X Xstruct`20namevalue`20nv_gfile`5B`5D`20=`20`7B`09`09/*`20extracts`20into`20glob Val`20var`20G`20*/ X`09"gameid",`09FT_STRING,`09Offset(struct`20game`20*,gameid),`09NULL, X`09"opaddr",`09FT_STRING,`09Offset(struct`20game`20*,opaddr),`09NULL, X`09"opname",`09FT_STRING,`09Offset(struct`20game`20*,opname),`09NULL, X`09"myaddr",`09FT_STRING,`09Offset(struct`20game`20*,myaddr),`09NULL, X`09"mycolor",`09FT_CHAR,`09Offset(struct`20game`20*,mycolor),`090, X`09"opcolor",`09FT_CHAR,`09Offset(struct`20game`20*,opcolor),`090, X`09"mydir",`09FT_CHAR,`09Offset(struct`20game`20*,mydir),`090, X`09"opdir",`09FT_CHAR,`09Offset(struct`20game`20*,opdir),`090, X`09"gameval",`09FT_INT,`09`09Offset(struct`20game`20*,gameval),`090, X`09"flags",`09FT_INT,`09`09Offset(struct`20game`20*,flags),`090, X`09"opversion",`09FT_INT,`09`09Offset(struct`20game`20*,opver),`090, X`09"state",`09FT_CHAR,`09Offset(struct`20game`20*,state),`090, X`09"term",`09`09FT_CHAR,`09Offset(struct`20game`20*,term),`090, X`09"seq",`09`09FT_INT,`09`09Offset(struct`20game`20*,seq),`090, X`09"lastop",`09FT_STRLKUP,`09Offset(struct`20game`20*,lastop), X`09`09(int)`20opcodes, X`09"mycmt",`09FT_STRING,`09Offset(struct`20game`20*,mycmt),`09NULL, X`09"mycmt2",`09FT_STRING,`09Offset(struct`20game`20*,mycmt2),`09NULL, X`09"opcmt",`09FT_STRING,`09Offset(struct`20game`20*,opcmt),`09NULL, X`09"opcmt2",`09FT_STRING,`09Offset(struct`20game`20*,opcmt2),`09NULL, X`09"dispmsg",`09FT_STRING,`09Offset(struct`20game`20*,dispmsg),`09NULL, X`09"opmvs0",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B0`5D),`090, X`09"opmvs1",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B1`5D),`090, X`09"opmvs2",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B2`5D),`090, X`09"opmvs3",`09FT_MOVE,`09Offset(struct`20game`20*,opmvs`5B3`5D),`090, X`09"blot0",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B0`5D),`090, X`09"blot1",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B1`5D),`090, X`09"blot2",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B2`5D),`090, X`09"blot3",`09FT_CHAR,`09Offset(struct`20game`20*,blot`5B3`5D),`090, X`09"mvs0",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B0`5D),`090, X`09"mvs1",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B1`5D),`090, X`09"mvs2",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B2`5D),`090, X`09"mvs3",`09`09FT_MOVE,`09Offset(struct`20game`20*,mvs`5B3`5D),`090, X`09"maxused",`09FT_INT,`09`09Offset(struct`20game`20*,maxused),`090, X`09"hiused",`09FT_INT,`09`09Offset(struct`20game`20*,hiused),`090, X`09"adcnt",`09FT_INT,`09`09Offset(struct`20game`20*,adcnt),`090, X`09"admax",`09FT_INT,`09`09Offset(struct`20game`20*,admax),`090, X`09"opbd",`09`09FT_BOARD,`09Offset(struct`20game`20*,opbd`5B0`5D),`090, X`09"mybd",`09`09FT_BOARD,`09Offset(struct`20game`20*,mybd`5B0`5D),`090, X`09"board",`09FT_BOARD,`09Offset(struct`20game`20*,board`5B0`5D),`090, X`09"curbd",`09FT_CHAR,`09Offset(struct`20game`20*,curbd),`09-1, X`09"rolls",`09FT_INTARRAY,`09Offset(struct`20game`20*,rolls`5B0`5D),`096, X`09"doubles",`09FT_INTARRAY,`09Offset(struct`20game`20*,doubles`5B0`5D),6, X`09"oprolls",`09FT_INTARRAY,`20Offset(struct`20game`20*,oprolls`5B0`5D),`096, X`09"opdoubles",`09FT_INTARRAY,`20Offset(struct`20game`20*,opdoubles`5B0`5D),6, V X`09"starttime",`09FT_TIME,`09Offset(struct`20game`20*,starttime),0, X`09"lastacc",`09FT_TIME,`09Offset(struct`20game`20*,lastacc),`090, X`09"mcurrent",`09FT_INTARRAY,`09Offset(struct`20game`20*,mcurrent`5B0`5D),2, X`09"mtotal",`09FT_INT,`09`09Offset(struct`20game`20*,mtotal),`090, X`09"notify",`09FT_STRING,`09Offset(struct`20game`20*,notify),`09NULL, X`09"end",`09`09FT_END,`09`09-1,`090, X`09NULL,`09`090,`09`09-1,`090 X`09`7D; X Xstruct`20namevalue`20nv_packet`5B`5D`20=`20`7B X`09"version",`09FT_INT,`09`09Offset(struct`20packet`20*,version),0, X`09"timestamp",`09FT_TIME,`09Offset(struct`20packet`20*,timestamp),0, X`09"gameid",`09FT_STRING,`09Offset(struct`20packet`20*,gameid),`09NULL, X`09"opcode",`09FT_STRLKUP,`09Offset(struct`20packet`20*,opcode), X`09`09(int)`20opcodes, X`09"move0",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B0`5D),`090, X`09"move1",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B1`5D),`090, X`09"move2",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B2`5D),`090, X`09"move3",`09FT_MOVE,`09Offset(struct`20packet`20*,mvs`5B3`5D),`090, X`09"name",`09`09FT_STRING,`09Offset(struct`20packet`20*,name),`09NULL, X`09"addr",`09`09FT_STRING,`09Offset(struct`20packet`20*,addr),`09NULL, X`09"comment",`09FT_STRING,`09Offset(struct`20packet`20*,comment),NULL, X`09"comment2",`09FT_STRING,`09Offset(struct`20packet`20*,comment2),NULL, X`09"seq",`09`09FT_INT,`09`09Offset(struct`20packet`20*,seq),`090, X`09"colors",`09FT_STRING,`09Offset(struct`20packet`20*,colors),`09NULL, X`09"direction",`09FT_STRING,`09Offset(struct`20packet`20*,dir),`09NULL, X`09"autodouble",`09FT_STRING,`09Offset(struct`20packet`20*,autodbl),NULL, X`09"jacoby",`09FT_STRING,`09Offset(struct`20packet`20*,jacoby),`20NULL, X`09"crawford",`09FT_STRING,`09Offset(struct`20packet`20*,crawford),NULL, X`09"european",`09FT_STRING,`09Offset(struct`20packet`20*,european),NULL, X`09"permanent",`09FT_STRING,`09Offset(struct`20packet`20*,perm),`09NULL, X`09"match",`09FT_STRING,`09Offset(struct`20packet`20*,match),`20`20NULL, X`09"notify",`09FT_STRING,`09Offset(struct`20packet`20*,notify),`09NULL, X`09"end",`09`09FT_END,`09`09-1,`090, X`09NULL,`09`090,`09`09-1,`090 X`09`7D; X Xstruct`20namevalue`20nv_pfile`5B`5D`20=`20`7B X`09"addr",`09`09FT_STRING,`09Offset(struct`20people`20*,addr),`09NULL, X`09"name",`09`09FT_STRING,`09Offset(struct`20people`20*,name),`09NULL, X`09"alias",`09FT_STRING,`09Offset(struct`20people`20*,alias),`09NULL, X`09"myaddr",`09FT_STRING,`09Offset(struct`20people`20*,myaddr),`09NULL, X`09"equiv",`09FT_STRING,`09Offset(struct`20people`20*,equiv),`09NULL, X`09"fence",`09FT_TIME,`09Offset(struct`20people`20*,fence),`090, X`09"score",`09FT_INTARRAY,`09Offset(struct`20people`20*,score`5B0`5D),`2010, X`09"end",`09`09FT_END,`09`09-1,`090, X`09NULL,`09`090,`09`09-1,`090 X`09`7D; X Xstruct`20namevalue`20nv_pequiv`5B`5D`20=`20`7B X`09"addr",`09`09FT_STRING,`09Offset(struct`20people`20*,addr),`09NULL, X`09"equiv",`09FT_STRING,`09Offset(struct`20people`20*,equiv),`09NULL, X`09"end",`09`09FT_END,`09`09-1,`090, X`09NULL,`09`090,`09`09-1,`090 X`09`7D; X Xint`20(*func`5BOPSTATES`5D`5BNOP`5D)()`20=`20`7B X/*`09START`09USTART`09TIE`09MOVE`09OFRDBL`09ACPTDBL X`09`09DECDBL`09CONCEDE`09RSTART`09RESTART`09MSTART`09RESEND`09NOTIFY`09*/ X`09start,`09istart,`09tie,`09opmove,`09smerr,`09smerr, X`09`09smerr,`09opconc,`09smerr,`09restart,mstart,`09smerr,`09smerr, X`09smerr,`09smerr,`09smerr,`09opmove,`09opofr,`09smerr, X`09`09smerr,`09opconc,`09smerr,`09smerr,`09smerr,`09smerr,`09smerr, X`09smerr,`09smerr,`09smerr,`09smerr,`09smerr,`09opacpt, X`09`09opdec,`09opconc,`09smerr,`09smerr,`09smerr,`09smerr,`09smerr X`09`7D; X Xchar`20*rejlcl`5B`5D`20=`20`7B`09`09`09/*`20reject`20messages`20for`20local V`20player`20*/ X`09"",`09`09`09`09`09/*`20no`20error`20*/ X`09"Move`20does`20not`20contain`20a`20legal`20roll.",`09/*`20shouldn't`20happe Vn`20*/ X`09"You`20must`20fill`20your`20inner`20table`20before`20bearing`20off.", X`09"There`20is`20no`20piece`20on`20that`20point.", X`09"The`20destination`20of`20that`20move`20is`20occupied.", X`09"You`20cannot`20move`20while`20you`20are`20on`20the`20bar.", X`09"You`20can't`20move`20your`20opponent's`20pieces.", X`09"You`20must`20bear`20that`20piece`20off`20with`20an`20exact`20roll." X`09`7D; X Xchar`20*rejmsg`5B`5D`20=`20`7B`09`09/*`20reject`20messages`20for`20received V`20moves`20*/ X`09"Move`20Accepted.",`09`09`09`09/*`20no`20error`20*/ X`09"Move`20does`20not`20contain`20a`20legal`20roll.",`09`09/*`20bad`20roll`20* V/ X`09"Cannot`20remove`20pieces`20before`20filling`20inner`20table.", X`09"There`20is`20no`20piece`20at`20the`20specified`20location.", X`09"The`20destination`20of`20this`20move`20is`20occupied.", X`09"Attempt`20to`20move`20while`20pieces`20are`20on`20the`20bar.", X`09"Attempt`20to`20move`20wrong`20color.", X`09"That`20piece`20must`20be`20borne`20off`20by`20an`20exact`20roll." X`09`7D; $ call unpack VARS.C;1 374419947 "" $! $ create 'f' X/*`09ldb.h`09`098/3/91 X`20* X`20*`20Copyright`201991`20`20Perry`20R.`20Ross X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so Vftware`20and`20its X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to V`20the`20restrictions X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b Vy`20reference. X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth Vor.`20`20This`20software X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including V`20any`20implied X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result Ving`20from`20the X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the V`20user`20agrees X`20*`20to`20these`20terms. X`20*/ X X#include`20"patchlevel.h" X X`09/*`20LDB_VER`20breaks`20if`20REVISION`20or`20PATCHLEVEL`20>`209,`20see`20pa Vtchlevel.h`20*/ X#define`20LDB_VER`09((VERSION*100)+(REVISION*10)+PATCHLEVEL)`20`20/*`20used V`20in`20sendpkt`20*/ X X#include`20 X#include`20 X#include`20 X#include`20 X X#ifdef`20VMS X X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#define`20STAT_NORM`20SS$_NORMAL X#define`20STAT_ABORT`20SS$_ABORT X#define`20SYS_GOOD`201`09`09/*`20success`20return`20from`20system()`20*/ X X#else X X#include`20 X#include`20 X#include`20 X#include`20 X#include`20 X#define`20STAT_NORM`200 X#define`20STAT_ABORT`201 X#define`20SYS_GOOD`200`09`09/*`20success`20return`20from`20system()`20*/ X X#endif X X#ifdef`20NEED_READDIR`09`09/*`20defined`20by`20Makefile`20*/ Xextern`20struct`20direct`20dirbuf;`09/*`20simulate`20Berkeley`20directory`20ro Vutines`20*/ X#define`20DIR`20FILE X#define`20opendir(X)`20fopen((X),"r") X#define`20readdir(X)`20(fread(`26dirbuf,sizeof(dirbuf),1,(X))?`26dirbuf:NULL) X#define`20closedir(X)`20fclose(X) X#endif X X#ifdef`20vaxc X#define`20OLD_CURSES`201 X#define`20unlink(X)`20delete(X) X#endif X X#ifdef`20sequent X#define`20OLD_CURSES`201 X#endif X X#ifdef`20OLD_CURSES`09`09/*`20defined`20above`20or`20in`20Makefile`20*/ X#define`20cbreak()`20crmode()`09/*`20from`20ancient`20curses`20*/ X#define`20nocbreak()`20nocrmode() X#endif X X#ifdef`20USE_INDEX`09`09/*`20defined`20in`20Makefile`20*/ X#define`20strchr`20index`09`09/*`20$%!@`5E`26#$`20pick`20a`20name`20and`20stic Vk`20with`20it`20*/ X#define`20strrchr`20rindex X#endif X X#define`20release_lock(X)`20unlink(X)`09/*`20delete`20lock`20file`20*/ X X`09/*`20swiped`20from`20X`20toolkit`20*/ X#define`20Offset(T,F)`20((int)(((char`20*)(`26(((T)NULL)->F)))-((char`20*)NULL V))) X X#define`20PRIVATE`20static`09`09/*`20for`20private`20functions`20*/ X X#define`20INTGFILE`20"interrupt.ldbdata"`09/*`20file`20to`20save`20games`20to V`20on`20`5EC`20*/ X#define`20INTPFILE`20"interrupt.ldbpeople"`09/*`20file`20to`20save`20people V`20to`20on`20`5EC`20*/ X X#define`20BLANKS(X)`20(`26blk76`5B76-(X)`5D)`09/*`20blank`20string`20of`20spec Vified`20length`20*/ X X`09`09/*`20locations`20in`20board`20typedef`20*/ X#define`20UPBAR`09`090`09`09/*`20BAR`20point`20for`20up-bound`20player`20*/ X#define`20DOWNBAR`09`0925`09`09/*`20BAR`20point`20for`20down-bound`20player V`20*/ X#define`20UPOFF`09`0926`09`09/*`20off`20point`20for`20up-bound`20player`20*/ X#define`20DOWNOFF`09`0927`09`09/*`20off`20point`20for`20down-bound`20player V`20*/ X#define`20BOARDSIZE`0928`09`09/*`20number`20of`20points`20in`20board`20*/ X X`09/*`20BARPT`20takes`20a`20direction`20(-1`20or`201)`20and`20returns`20the V`09*/ X`09/*`20point`20in`20the`20board`20typedef`20that`20represents`20that`09*/ X`09/*`20players`20bar.`20`20OFFPT`20does`20the`20same`20thing`20for`20the`09*/ V X`09/*`20point`20that`20pieces`20go`20to`20when`20they`20are`20thrown`20off. V`09*/ X`09/*`20REV(direction)`20returns`20the`20opposite`20direction.`09*/ X#define`20BARPT(D)`09(((D)>0)?UPBAR:DOWNBAR) X#define`20OFFPT(D)`09(((D)>0)?UPOFF:DOWNOFF) X#define`20REV(D)`09`09(-(D)) X X`09`09/*`20states`20we`20can`20be`20in`20*/ X#define`20ST_OPSTART`090`09`09/*`20we`20have`20sent`20a`20START`20(or`20rcvd V`20one)*/ X#define`20ST_OPTURN`091`09`09/*`20Its`20the`20opponent's`20turn`20*/ X#define`20ST_OPACCEPT`092`09`09/*`20I`20have`20offered`20to`20double`20*/ X X#define`20OPSTATES`093`09`09/*`20<`20OPSTATES`20needs`20remote`20input`20*/ X X#define`20ST_MYTURN`093`09`09/*`20My`20turn,`20I`20haven't`20rolled`20yet`20*/ V X#define`20ST_MYMOVE`094`09`09/*`20I've`20rolled,`20but`20I`20haven't`20moved V`20*/ X#define`20ST_MYACCEPT`095`09`09/*`20Opponent`20has`20offered`20to`20double`20* V/ X#define`20ST_GAMEOVER`096`09`09/*`20game`20is`20dead,`20see`20T_*`20for`20reas Von`20*/ X#define`20NSTATE`09`097`09`09/*`20number`20of`20possible`20states`20*/ X X`09`09/*`20operations`20to`20send`20or`20receive`20*/ X#define`20START`09`090`09`09/*`20start`20a`20game`20*/ X#define`20USTART`09`091`09`09/*`20if`20rcvd,`20we`20won`20the`20initial`20roll V`20*/ X#define`20TIE`09`092`09`09/*`20tie`20on`20initial`20roll,`20restart`20*/ X#define`20MOVE`09`093`09`09/*`20send`20a`20move`20*/ X#define`20OFRDBL`09`094`09`09/*`20offer`20to`20double`20*/ X#define`20ACPTDBL`09`095`09`09/*`20double`20accepted`20*/ X#define`20DECDBL`09`096`09`09/*`20double`20declined,`20game`20over`20*/ X#define`20CONCEDE`09`097`09`09/*`20we`20give`20up`20*/ X#define`20RSTART`09`098`09`09/*`20remote`20start`20packet`20*/ X#define`20RESTART`09`099`09`09/*`20repeat`20initial`20roll`20*/ X#define`20MSTART`09`0910`09`09/*`20start`20next`20game`20of`20match`20*/ X#define`20RESEND`09`0911`09`09/*`20resend`20request`20from`20opponent`20*/ X#define`20NOTIFY`09`0912`09`09/*`20tell`20game`20starter`20when`20game`20ends V`20*/ X#define`20NOP`09`0913`09`09/*`20number`20of`20possible`20operations`20*/ X X`09`09/*`20termination`20codes`20for`20state`20ST_GAMEOVER`20*/ X#define`20T_ICONCEDE`091`09`09/*`20I`20gave`20up`20*/ X#define`20T_IDECLINE`092`09`09/*`20I`20declined`20double`20*/ X#define`20T_ILOSE`09`093`09`09/*`20opponent`20moved`20all`20pieces`20off`20*/ X#define`20T_OPCONCEDE`094`09`09/*`20opponent`20gave`20up`20*/ X#define`20T_OPDECLINE`095`09`09/*`20opponent`20declined`20double`20*/ X#define`20T_IWIN`09`096`09`09/*`20I`20moved`20all`20pieces`20off`20*/ X X`09`09/*`20flags`20passed`20to`20apply`20*/ X#define`20A_REDRAW`091`09/*`20redraw`20the`20pieces`20moved`20*/ X#define`20A_CHKONLY`092`09/*`20check`20move`20but`20don't`20move`20pieces`20*/ V X X`09`09/*`20codes`20returned`20by`20apply`20*/ X#define`20MVOK`09`090`09/*`20move`20was`20accepted`20by`20apply()`20*/ X#define`20RJ_NOROLL`09-1`09/*`20move`20does`20not`20contain`20valid`20roll`20* V/ X#define`20RJ_NOOFF`09-2`09/*`20all`20pcs`20not`20in`20inner`20tbl,`20can't`20t Vhrow`20off`20*/ X#define`20RJ_NOPIECE`09-3`09/*`20no`20piece`20at`20specified`20point`20*/ X#define`20RJ_OCC`09`09-4`09/*`20destination`20occupied`20*/ X#define`20RJ_ONBAR`09-5`09/*`20can't`20move,`20pieces`20are`20on`20bar`20*/ X#define`20RJ_NOTYOURS`09-6`09/*`20wrong`20color,`20dummy`20*/ X#define`20RJ_EXACT`09-7`09/*`20must`20use`20exact`20roll`20except`20for`20oute Vr`20pc`20*/ X X`09`09/*`20bits`20for`20flags`20field`20of`20game`20struct`20*/ X#define`20F_IDOUBLED`091`09/*`20I`20doubled`20last`20*/ X#define`20F_SENTNAME`092`09/*`20I've`20sent`20my`20name`20*/ X#define`20F_INVERT`094`09/*`20I`20want`20my`20board`20upside`20down`20*/ X#define`20F_DELETE`098`09/*`20this`20game`20is`20deleted`20*/ X#define`20F_JACOBY`0916`09/*`20jacoby`20rule`20in`20effect`20for`20this`20game V`20*/ X#define`20F_CRAWFORD`0932`09/*`20crawford`20rule`20in`20effect`20for`20this V`20game`20*/ X#define`20F_PERM`09`0964`09/*`20permanent`20game`20*/ X#define`20F_EUROPE`09128`09/*`20european`20rule`20(backgammons`20count`20doubl Ve)`20*/ X#define`20F_DISPLAYED`09256`09/*`20Game`20over,`20keeping`20in`20case`20need V`20resend`20*/ X#define`20F_CRGAME`09512`09/*`20This`20game`20is`20the`20crawford`20rule`20gam Ve`20*/ X#define`20F_CRDONE`091024`09/*`20The`20crawford`20rule`20game`20has`20been`20p Vlayed`20*/ X X`09`09/*`20field`20types`20for`20reading`20name/value`20files`20*/ X#define`20FT_CHAR`09`091`09/*`20store`20a`20single`20character`20*/ X#define`20FT_INT`09`092`09/*`20store`20a`20single`20integer`20*/ X#define`20FT_STRING`093`09/*`20store`20a`20char`20*`20(use`20save())`20*/ X#define`20FT_MOVE`09`094`09/*`20a`20struct`20mv`20*/ X#define`20FT_BOARD`095`09/*`20a`20board`20image`20*/ X#define`20FT_STRLKUP`096`09/*`20lookup`20string`20in`20table`20`26`20store`20i Vndex`20*/ X#define`20FT_TIME`09`097`09/*`20a`20timestamp`20*/ X#define`20FT_INTARRAY`098`09/*`20array`20of`20integers`20*/ X#define`20FT_END`09`0999`09/*`20end`20of`20structure`20*/ X X`09`09/*`20which`20board`20is`20currently`20displayed`20(g->curbd)`20*/ X#define`20BD_BEFOP`090`09/*`20before`20op's`20move`20(after`20my`20previous) V`20*/ X#define`20BD_AFTOP`091`09/*`20after`20op's`20move`20(before`20my`20next)`20*/ X#define`20BD_CUR`09`092`09/*`20current`20(with`20any`20moves`20I've`20made`20s Vo`20far)`20*/ X X`09`09/*`20these`20are`20the`20command`20line`20options`20*/ X#define`20OPT_START`091`09/*`20start`20a`20game`20*/ X#define`20OPT_READ`092`09/*`20read`20incoming`20mail`20*/ X#define`20OPT_PLAY`093`09/*`20play`20any`20games`20that`20are`20waiting`20for V`20me`20*/ X#define`20OPT_COLOR`094`09/*`20set`20the`20color`20for`20created`20games`20*/ X#define`20OPT_DIRECTION`095`09/*`20set`20the`20direction`20for`20created`20gam Ves`20*/ X#define`20OPT_RSTART`096`09/*`20remote`20start`20a`20game`20*/ X#define`20OPT_HELP`097`09/*`20print`20long`20help`20*/ X#define`20OPT_CONTROL`098`09/*`20go`20into`20control`20mode`20*/ X#define`20OPT_MYADDR`099`09/*`20set`20my`20e-mail`20address`20(override`20.ldb Vrc)`20*/ X#define`20OPT_BCAST`0910`09/*`20send`20a`20mail`20message`20to`20all`20opponen Vts`20*/ X#define`20OPT_JACOBY`0911`09/*`20enable`20the`20jacoby`20rule`20*/ X#define`20OPT_CRAWFORD`0912`09/*`20enable`20the`20crawford`20rule`20*/ X#define`20OPT_PERM`0913`09/*`20make`20game`20permanent`20*/ X#define`20OPT_MATCH`0914`09/*`20set`20number`20of`20points`20in`20match`20*/ X#define`20OPT_EUROPE`0915`09/*`20enable`20european`20rule`20*/ X#define`20OPT_RECONS`0916`09/*`20reconstruct`20a`20game`20from`20opponent's V`20data`20*/ X#define`20OPT_SCORE`0917`09/*`20print`20cumulative`20scores`20*/ X#define`20OPT_NOTIFY`0918`09/*`20set`20notify`20address`20*/ X X`09`09/*`20these`20are`20the`20different`20game`20states`20for`20the`20help V`20call`20*/ X#define`20STATE_CONTROL`091`09/*`20Invoked`20with`20the`20control`20option`20* V/ X#define`20STATE_MYTURN`092`09/*`20Waiting`20for`20user`20to`20move`20*/ X#define`20STATE_MYMOVE`093`09/*`20User`20has`20rolled`20but`20needs`20to`20mov Ve`20*/ X#define`20STATE_MYACPT`094`09/*`20Accept`20or`20decline`20the`20double`20*/ X#define`20STATE_GAMEOVER`095`09/*`20The`20game`20is`20over`20*/ X X#define`20WHO_ME`09`090`09/*`20used`20to`20mean`20local`20player`20*/ X#define`20WHO_OPP`09`091`09/*`20used`20to`20mean`20opponent`20*/ X X`09/*`20these`20bits`20are`20passed`20to`20findppl`20to`20specify`20whether V`09*/ X`09/*`20we`20want`20to`20look`20up`20an`20address,`20an`20alias,`20or`20both V`09*/ X#define`20P_ADDR`09`091`09/*`20look`20for`20a`20address`20*/ X#define`20P_ALIAS`09`092`09/*`20look`20for`20an`20alias`20*/ X X`09/*`20these`20are`20the`20bits`20to`20set`20in`20rc.debug`20to`20enable`09*/ V X`09/*`20debug`20messages`20for`20various`20functions.`09`09*/ X#define`20DB_READFILE`091`09/*`20print`20mail`20files`20scanned`20*/ X#define`20DB_RWGAMES`092`09/*`20print`20games`20read/written`20*/ X#define`20DB_GSTART`094`09/*`20print`20games`20started`20*/ X#define`20DB_RSTART`098`09/*`20trace`20remote`20start`20packets`20*/ X X`09/*`20these`20refer`20to`20the`20elements`20of`20struct`20people->score`20*/ V X#define`20SC_GAMESWON`090`09/*`20number`20of`20games`20won`20against`20this V`20guy`20*/ X#define`20SC_GAMESLOST`091`09/*`20number`20of`20games`20lost`20to`20this`20guy V`20*/ X#define`20SC_PTSWON`092`09/*`20number`20of`20points`20won`20against`20this`20g Vuy`20*/ X#define`20SC_PTSLOST`093`09/*`20number`20of`20points`20lost`20to`20this`20guy V`20*/ X#define`20SC_GMNWON`094`09/*`20number`20of`20gammons`20won`20*/ X#define`20SC_GMNLOST`095`09/*`20number`20of`20gammons`20lost`20*/ X#define`20SC_BGWON`096`09/*`20number`20of`20backgammons`20won`20*/ X#define`20SC_BGLOST`097`09/*`20number`20of`20backgammons`20lost`20*/ X#define`20SC_MWON`09`098`09/*`20number`20of`20matches`20won`20*/ X#define`20SC_MLOST`099`09/*`20number`20of`20matches`20lost`20*/ X Xstruct`20opt`20`7B`09`09`09/*`20used`20to`20make`20list`20of`20command`20line V`20options`20*/ X`09char`09*name;`09`09/*`20name`20of`20option`20(as`20used`20on`20command`20li Vne)`20*/ X`09int`09index;`09`09/*`20OPT_*`20*/ X`09char`09*args;`09`09/*`20arguments`20the`20option`20takes,`20if`20any`20*/ X`09char`09*help;`09`09/*`201-line`20help`20string`20for`20option`20*/ X`09`7D; X Xstruct`20ldbrc`20`7B`09`09/*`20struct`20where`20all`20fields`20from`20.ldbrc V`20are`20stored`20*/ X`09char`09*myaddr;`09/*`20my`20e-mail`20address`20*/ X`09char`09*myname;`09/*`20my`20name`20*/ X`09char`09*pfile;`09`09/*`20people`20file`20*/ X`09char`09*gfile;`09`09/*`20games`20file`20*/ X`09char`09*gbackup;`09/*`20where`20to`20save`20old`20game`20file`20*/ X`09char`09*mfile;`09`09/*`20mail`20file`20*/ X`09char`09*delmail;`09/*`20should`20we`20delete`20mail`20files`20after`20readi Vng?*/ X`09char`09*lockfile;`09/*`20ldb`20mutex`20lock`20file`20*/ X`09char`09*sendcmd;`09/*`20mail`20send`20command`20*/ X`09char`09*tempfile;`09/*`20temp`20file`20for`20sendpkt`20*/ X`09char`09*defclrs;`09/*`20default`20colors`20(2`20from`20`5Brwb`5D)`20*/ X`09char`09*defdir;`09/*`20default`20direction`20(up/down)`20*/ X`09char`09*initboard;`09/*`20init.`20brd`20display`20(before/after/current) V`20*/ X`09char`09*autoroll;`09/*`20enable`20autoroll?`20(yes/no)`20*/ X`09char`09*automove;`09/*`20enable`20automove?`20(yes/no)`20*/ X`09int`09autodouble;`09/*`20autodouble`20count,`200`20to`20disable`20*/ X`09char`09*supercmd;`09/*`20command`20to`20run`20to`20fool`20supervisor`20*/ X`09char`09superkey;`09/*`20key`20to`20activate`20supercmd`20*/ X`09char`09*chkpt;`09`09/*`20keep`20games`20up`20to`20date?`20*/ X`09int`09acctime;`09/*`20number`20of`20days`20until`20auto`20resend`20*/ X`09int`09keepold;`09/*`20number`20of`20days`20to`20keep`20finished`20games`20* V/ X`09int`09debug;`09`09/*`20debug`20level,`200`20=`20none`20*/ X`09`7D; X X`09`09/*`20the`20following`20structure`20is`20used`20to`20save/load`20*/ X`09`09/*`20the`20games`20file,`20the`20.ldbrc,`20and`20to`20send`09*/ X`09`09/*`20packets`20between`20the`20players.`20`20It`20stores`20a`09*/ X`09`09/*`20name,`20the`20type`20(see`20FT_*`20above),`20and`20the`09*/ X`09`09/*`20offset`20into`20a`20structure.`20`20A`20pointer`20to`20the`09*/ X`09`09/*`20structure`20is`20provided`20at`20runtime.`09`09*/ Xstruct`20namevalue`20`7B X`20`20`20`20`20`20`20char`20*name;`09`09/*`20name`20of`20the`20field`20*/ X`20`20`20`20`20`20`20char`20type;`09`09/*`20type`20of`20the`20field`20(T_*) V`20*/ X`20`20`20`20`20`20`20int`20offset;`09`09/*`20where`20to`20store`20value`20*/ X`20`20`20`20`20`20`20int`20dflt;`09`09/*`20default`20value`20*/ X`20`20`20`20`20`20`20`7D; X Xunion`20nvtypes`20`7B`09`09`09/*`20convert`20char*`20to/from`20FT_*`20*/ X`09char`09*nvchar;`09/*`20FT_CHAR`20*/ X`09int`09*nvint;`09`09/*`20FT_INT`20*/ X`09long`09*nvtime;`09/*`20FT_TIME`20*/ X`09char`09**nvstring;`09/*`20FT_STRING`20*/ X`09struct`20mv`20*nvmove;`09/*`20FT_MOVE`20*/ X`09struct`20point`20*nvboard;`09/*`20FT_BOARD`20*/ X`09`7D; X Xstruct`20flist`20`7B`09`09`09/*`20list`20returned`20by`20filelist()`20*/ X`09char`09*name;`09`09/*`20file`20name`20*/ X`09struct`20flist`20*next;`09/*`20forward`20link`20*/ X`09`7D; X Xstruct`20mv`20`7B X`09char`09roll;`09`09`09/*`20#`20on`201`20die,`200`20=`20DOUBLE,`20-1=empty V`20*/ X`09char`09pt;`09`09`09/*`20point`20move`20is`20from,`20-1=UNUSED`20*/ X`09`7D; X Xstruct`20point`20`7B X`09char`09qty;`09`09`09/*`20number`20of`20pieces`20on`20this`20point`20*/ X`09char`09color;`09`09`09/*`20color`20of`20pieces`20on`20this`20point`20*/ X`09`7D; X Xtypedef`20struct`20point`20board`5BBOARDSIZE`5D;`09/*`20board`20is`20array`20o Vf`20points`20*/ X Xstruct`20game`20`7B`09`09`09`09/*`20all`20info`20about`20a`20game`20in`20progr Vess`20*/ X`09char`09*gameid;`09`09/*`20unique`20game`20id`20*/ X`09char`09*opaddr;`09`09/*`20email`20path`20to`20opponent`20*/ X`09char`09*opname;`09`09/*`20full`20name`20of`20opponent`20*/ X`09char`09*myaddr;`09`09/*`20my`20address`20for`20this`20user`20*/ X`09char`09mycolor;`09`09/*`20char`20to`20represent`20my`20pieces`20*/ X`09char`09opcolor;`09`09/*`20opponent's`20pieces`20*/ X`09char`09mydir;`09`09`09/*`201/-1`20direction`20I`20am`20moving`20*/ +-+-+-+-+-+-+-+- END OF PART 14 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 15 -+-+-+-+-+-+-+-+ X`09char`09opdir;`09`09`09/*`201/-1`20direction`20opponent`20is`20moving`20*/ X`09int`09gameval;`09`09/*`20current`20value`20of`20game`20*/ X`09int`09adcnt;`09`09`09/*`20current`20number`20of`20autodoubles`20*/ X`09int`09admax;`09`09`09/*`20max`20autodoubles`20allowed`20*/ X`09int`09flags;`09`09`09/*`20various`20flags`20(F_*)`20*/ X`09int`09opver;`09`09`09/*`20opponent's`20ldb`20version`20*/ X`09char`09state;`09`09`09/*`20my`20current`20state`20(ST_*)`20*/ X`09char`09term;`09`09`09/*`20if`20game`20over,`20why`20(T_*)`20*/ X`09int`09seq;`09`09`09/*`20sequence`20number`20of`20next`20pkt`20*/ X`09int`09lastop;`09`09`09/*`20last`20opcode`20sent`20(for`20resends)`20*/ X`09char`09*mycmt;`09`09`09/*`20comment`20I`20sent`20with`20last`20move`20*/ X`09char`09*mycmt2;`09`09/*`20second`20line`20of`20mycmt`20*/ X`09char`09*opcmt;`09`09`09/*`20comment`20I`20received`20with`20last`20move`20* V/ X`09char`09*opcmt2;`09`09/*`20second`20line`20of`20opcmt`20*/ X`09char`09*dispmsg;`09`09/*`20msg`20to`20display`20when`20game`20drawn`20*/ X`09struct`20mv`20opmvs`5B4`5D;`09`09/*`20opponent's`20last`20move`20*/ X`09char`09blot`5B4`5D;`09`09/*`20my`20blots`20that`20were`20hit`20*/ X`09struct`20mv`20mvs`5B4`5D;`09`09/*`20my`20move,`20holds`20roll`20until`20I V`20move`20*/ X`09int`09maxused;`09`09/*`20#`20of`20rolls`20in`20mvs`20that`20can`20be`20used V*/ X`09int`09hiused;`09`09`09/*`20highest`20roll`20that`20can`20be`20used`20*/ X`09board`09opbd;`09`09`09/*`20board`20image`20before`20opmvs`20applied`20*/ X`09board`09mybd;`09`09`09/*`20board`20before`20mvs`20(for`20Reset)`20*/ X`09board`09board;`09`09`09/*`20current`20board`20image`20*/ X`09char`09curbd;`09`09`09/*`20which`20brd`20is`20currently`20displayed`20*/ X`09int`09rolls`5B6`5D;`09`09/*`20how`20many`20of`20each`20roll`20we`20get`20*/ V X`09int`09doubles`5B6`5D;`09`09/*`20how`20many`20of`20each`20double`20we`20get V`20*/ X`09int`09oprolls`5B6`5D;`09`09/*`20how`20many`20of`20each`20roll`20op`20gets V`20*/ X`09int`09opdoubles`5B6`5D;`09`09/*`20how`20many`20of`20each`20double`20op`20ge Vts`20*/ X`09long`09starttime;`09`09/*`20time`20START`20packet`20was`20sent`20*/ X`09long`09lastacc;`09`09/*`20last`20time`20game`20was`20accessed`20*/ X`09int`09mcurrent`5B2`5D;`09`09/*`20current`20match`20scores`20for`20me`20`26 V`20op`20*/ X`09int`09mtotal;`09`09`09/*`20match`20score`20we`20are`20playing`20to`20*/ X`09char`09*notify;`09`09/*`20address`20to`20mail`20to`20when`20game`20over`20* V/ X`09struct`20people`20*ppl;`09`09/*`20side`20pointer`20to`20people`20record`20* V/ X`09struct`20game`20*prev;`09`09/*`20back`20link`20in`20game`20list`20*/ X`09struct`20game`20*next;`09`09/*`20forward`20link`20in`20game`20list`20*/ X`09`7D; X Xstruct`20packet`20`7B X`09int`09version;`09`09/*`20ldb`20version`20*/ X`09long`09timestamp;`09`09/*`20time`20packet`20was`20sent`20*/ X`09char`09*gameid;`09`09/*`20the`20gameid`20string`20*/ X`09int`09opcode;`09`09`09/*`20operation`20being`20performed`20*/ X`09char`09*name;`09`09`09/*`20name`20*/ X`09char`09*addr;`09`09`09/*`20mail`20address`20*/ X`09char`09*comment;`09`09/*`20comment`20received`20*/ X`09char`09*comment2;`09`09/*`20second`20line`20of`20comment`20*/ X`09int`09seq;`09`09`09/*`20sequence`20number`20*/ X`09char`09*colors;`09`09/*`20colors`20of`20new`20game`20*/ X`09char`09*dir;`09`09`09/*`20direction`20of`20game`20starter`20*/ X`09char`09*autodbl;`09`09/*`20autodouble`20count`20(sprintf'ed)`20*/ X`09struct`20mv`20mvs`5B4`5D;`09`09/*`20moves`20(if`20opcode`20==`20MOVE)`20*/ X`09char`09*jacoby;`09`09/*`20yes=jacoby`20rule`20in`20effect`20*/ X`09char`09*crawford;`09`09/*`20yes=crawford`20rule`20in`20effect`20*/ X`09char`09*european;`09`09/*`20yes=european`20rule`20in`20effect`20*/ X`09char`09*perm;`09`09`09/*`20yes=permanent`20game`20*/ X`09char`09*match;`09`09`09/*`20number`20of`20points`20in`20match`20*/ X`09char`09*notify;`09`09/*`20address`20to`20notify`20when`20game`20ends`20*/ X`09struct`20game`20*gameptr;`09`09/*`20not`20a`20pkt`20field,`20set`20by`20get Vpkt()`20*/ X`09`7D; X Xstruct`20people`20`7B`09`09`09`09/*`20people`20we`20play`20with`20*/ X`09char`09*name;`09`09`09/*`20person's`20name`20*/ X`09char`09*addr;`09`09`09/*`20person's`20mail`20address`20*/ X`09char`09*alias;`09`09`09/*`20person's`20nickname`20*/ X`09char`09*myaddr;`09`09/*`20my`20addr`20for`20this`20person`20*/ X`09char`09*equiv;`09`09`09/*`20equiv`20name`20for`20ppl`20w/`20mult`20addr`20* V/ X`09long`09fence;`09`09`09/*`20start`20time`20of`20newest`20finished`20game*/ X`09int`09score`5B10`5D;`09`09/*`20won/lost`20record,`20see`20SC_*`20*/ X`09struct`20people`20*next;`09`09/*`20forward`20link`20*/ X`09`7D; X Xstruct`20legal`20`7B`09`09`09`09/*`20list`20of`20legal`20moves`20*/ X`09int`20nmove;`09`09`09/*`20number`20of`20moves`20in`20this`20entry`20*/ X`09int`20himove;`09`09`09/*`20highest`20roll`20used`20in`20this`20entry`20*/ X`09struct`20mv`20mvs`5B4`5D;`09`09/*`20the`20rolls`20and`20moves`20*/ X`09struct`20legal`20*prev;`09`09/*`20pointer`20to`20the`20previous`20entry`20* V/ X`09struct`20legal`20*next;`09`09/*`20pointer`20to`20the`20previous`20entry`20* V/ X`09`7D; X Xextern`20int`20Pflag;`09`09`09/*`20should`20I`20process`20local`20input?`20*/ Xextern`20int`20Rflag;`09`09`09/*`20should`20I`20look`20for`20mail?`20*/ Xextern`20struct`20game`20*ghead;`09`09/*`20head`20of`20linked`20list`20of`20ga Vmes`20*/ Xextern`20struct`20game`20*gtail;`09`09/*`20tail`20of`20linked`20list`20of`20ga Vmes`20*/ Xextern`20struct`20legal`20*lhead;`09`09/*`20head`20of`20list`20of`20legal`20mo Vves`20*/ Xextern`20struct`20legal`20*ltail;`09`09/*`20tail`20of`20list`20of`20legal`20mo Vves`20*/ Xextern`20int`20(*func`5BOPSTATES`5D`5BNOP`5D)();`09/*`20receive`20state`20mach Vine`20*/ Xstruct`20ldbrc`20rc;`09`09`09/*`20stuff`20from`20.ldbrc`20*/ Xextern`20struct`20opt`20options`5B`5D;`09`09/*`20command`20line`20options`20*/ V Xextern`20char`20*rejlcl`5B`5D;`09`09`09/*`20error`20messages`20for`20local`20p Vlayer`20*/ Xextern`20char`20*rejmsg`5B`5D;`09`09`09/*`20error`20messages`20for`20received V`20moves`20*/ Xextern`20char`20*opcodes`5B`5D; Xextern`20char`20blk76`5B`5D;`09`09`09/*`2076`20blanks`20*/ Xextern`20struct`20packet`20P;`09`09`09/*`20last`20packet`20read`20*/ Xextern`20char`20cr_mycolor;`09`09`09/*`20my`20color`20when`20game`20is`20creat Ved`20*/ Xextern`20char`20cr_opcolor;`09`09`09/*`20opponent's`20color`20for`20new`20game Vs`20*/ Xextern`20char`20cr_mydir;`09`09`09/*`20my`20direction`20for`20new`20games`20*/ V Xextern`20char`20*notify;`09`09`09/*`20address`20to`20notify`20when`20game`20en Vds`20*/ Xextern`20char`20*states`5B`5D;`09`09`09/*`20description`20of`20the`20states V`20*/ X Xextern`20char`20FeIsActive;`09`09`09/*`20front-end`20been`20initialized?`20*/ Xextern`20char`20FeWaitInit;`09`09`09/*`20non-0`20if`20message()`20called`20*/ Xextern`20int`20GameState;`09`09`09/*`20Current`20game`20state`20for`20help`20* V/ Xextern`20int`20boardnums`5B3`5D;`09`09/*`20board`20name`20->`20board`20number V`20*/ X Xextern`20struct`20people`20*phead;`09`09/*`20head`20pointer`20of`20people`20li Vst`20*/ X Xextern`20struct`20namevalue`20nv_rcfile`5B`5D,`20nv_gfile`5B`5D,`20nv_packet V`5B`5D,`20nv_pfile`5B`5D; Xextern`20struct`20namevalue`20nv_pequiv`5B`5D; X Xchar`20*tgetstr(); Xchar`20*save(),`20*makeid(),`20*calloc(); Xchar`20*nvscan(),`20*strchr(),`20*boardstr(); Xchar`20*strchr(),`20*strrchr(); Xstruct`20game`20*startgame(),`20*addgame(),`20*findgame(); X Xstruct`20people`20*addppl(),`20*findppl(),`20*newppl(); X Xint`20start(),`20istart(),`20tie(),`20restart(),`20mstart(); Xint`20opmove(),`20opofr(),`20opconc(),`20opacpt(),`20opdec(); Xint`20smerr(); X Xlong`20rnd_ri(); X Xchar`20FeMenu(); X Xstruct`20flist`20*filelist(); $ call unpack LDB.H;1 1090934642 "" $! $ create 'f' X/*`09patchlevel.h`099/9/91 X`20* X`20*`20adapted`20from`20the`20file`20"patchlevel",`20which`20is`20part`20of V`20the X`20*`20"xloadimage"`20package`20by`20Jim`20Frost,`20and`20used`20within`20the V`20terms X`20*`20of`20the`20original`20copyright`20notice,`20which`20appears`20below. X`20*`20Please`20note`20that`20the`20copyright`20notice`20below`20applies`20onl Vy`20to X`20*`20this`20file. X`20*/ X X/* X`20*`20Copyright`201989,`201990,`201991`20Jim`20Frost X`20* X`20*`20Permission`20to`20use,`20copy,`20modify,`20distribute,`20and`20sell`20t Vhis`20software X`20*`20and`20its`20documentation`20for`20any`20purpose`20is`20hereby`20granted V`20without`20fee, X`20*`20provided`20that`20the`20above`20copyright`20notice`20appear`20in`20all V`20copies`20and X`20*`20that`20both`20that`20copyright`20notice`20and`20this`20permission`20not Vice`20appear X`20*`20in`20supporting`20documentation.`20`20The`20author`20makes`20no`20repre Vsentations X`20*`20about`20the`20suitability`20of`20this`20software`20for`20any`20purpose. V`20`20It`20is X`20*`20provided`20"as`20is"`20without`20express`20or`20implied`20warranty. X`20* X`20*`20THE`20AUTHOR`20DISCLAIMS`20ALL`20WARRANTIES`20WITH`20REGARD`20TO`20THIS V`20SOFTWARE, X`20*`20INCLUDING`20ALL`20IMPLIED`20WARRANTIES`20OF`20MERCHANTABILITY`20AND`20F VITNESS,`20IN X`20*`20NO`20EVENT`20SHALL`20THE`20AUTHOR`20BE`20LIABLE`20FOR`20ANY`20SPECIAL, V`20INDIRECT`20OR X`20*`20CONSEQUENTIAL`20DAMAGES`20OR`20ANY`20DAMAGES`20WHATSOEVER`20RESULTING V`20FROM`20LOSS X`20*`20OF`20USE,`20DATA`20OR`20PROFITS,`20WHETHER`20IN`20AN`20ACTION`20OF`20CO VNTRACT,`20NEGLIGENCE X`20*`20OR`20OTHER`20TORTIOUS`20ACTION,`20ARISING`20OUT`20OF`20OR`20IN`20CONNEC VTION`20WITH`20THE X`20*`20USE`20OR`20PERFORMANCE`20OF`20THIS`20SOFTWARE. X`20*/ X X`09/*`20REVISION`20and`20PATCHLEVEL`20can't`20be`20more`20than`209`09`09`09*/ X`09/*`20due`20to`20the`20way`20the`20version`20field`20is`20coded`20in`20outgo Ving`09*/ X`09/*`20messages`20(i.e.`20only`201`20digit`20each).`20`20I`20would`20suggest V`09`09*/ X`09/*`20rolling`20REVISION`20if`20PATCHLEVEL`20gets`20to`209,`20and`20similarl Vy`09*/ X`09/*`20rolling`20VERSION`20if`20REVISION`20gets`20to`209.`20`20VERSION`20is V`09`09*/ X`09/*`20essentially`20unlimited.`09`09`09`09`09*/ X X#define`20VERSION`09`091 X#define`20REVISION`093`09`09/*`20no`20more`20than`209`20*/ X#define`20PATCHLEVEL`090`09`09/*`20no`20more`20than`209`20*/ X#define`20AUTHOR_EMAIL`09"ross@emf780.den.mmc.com" $ call unpack PATCHLEVEL.H;1 1611664587 "" $! $ create 'f' X#!`20/bin/csh`20-x Xset`20host=cs.umb.edu`20home=/u/ra/ugrad/mrubin/ldb`20user=mrubin Xsource`20/usr/local/lib/.cshrc Xset`20nonomatch`20fld='`5EFrom`20`7C`5EReturn-Path:'`20edscr=(-e`20's///g') Xcd`20$home Xsetenv`20LDBRC`20$home/starter.ldbrc Xsetenv`20HOME`20$home X#`20first`20handle`20bad`20addresses. Xcd`20badaddr Xset`20f=(*) Xif`20("$f"`20==`20"*")`20set`20f="" Xforeach`20x`20($f) X`09set`20rptmp=(`60egrep`20"($fld)"`20$x`20`7C`20awk`20'`7Bprint`20$2;`7D'`20 V`7C`20tail`20-1`20`7C`20sed`20$edscr`60) X`09set`20rp=$rptmp`5B$#rptmp`5D X`09set`20to=(`60fgrep`20To:`20$x`20`7C`20tail`20-1`20`7C`20sed`20's/To://g' V`60) X`09echo`20"`60date`60`20`20badaddr`09`09$rp`09$to"`20>>`20../ldbstarter.log X`09mail`20-s`20"Mail`20to`20invalid`20ldb`20address"`20$rp:q`20<>`20../ldbstarter.log X`09mail`20-s`20"Information`20on`20automatic`20ldb`20game`20starter"`20$rp:q V`20<`201) X`09`09set`20u1tmp=(`60egrep`20"($fld)"`20$y`5B1`5D`20`7C`20awk`20'`7Bprint`20$ V2;`7D'`20`7C`20tail`20-1`20`7C`20sed`20$edscr`60) X`09`09set`20u1=$u1tmp`5B$#u1tmp`5D X`09`09set`20u2tmp=(`60egrep`20"($fld)"`20$y`5B2`5D`20`7C`20awk`20'`7Bprint`20$ V2;`7D'`20`7C`20tail`20-1`20`7C`20sed`20$edscr`60) X`09`09set`20u2=$u2tmp`5B$#u2tmp`5D X`09`09if`20("$u1"`20==`20"$u2")`20then`09#`20duplicate X`09`09`09rm`20$y`5B1`5D`09`09#`20eliminate`20one`20of`20them X`09`09`09set`20y=(`60ls`20`7C`20head`20-2`60)`09#`20and`20try`20again X`09`09`09continue X`09`09endif X`09`09/u/ra/ugrad/mrubin/bin/sun4/ldb`20-remotestart`20$u1:q`20$u2:q X`09`09rm`20$y X`09`09echo`20"`60date`60`20`20$z`09$u1:q`20$u2:q"`20>>`20../ldbstarter.log X`09`09set`20y=(`60ls`20`7C`20head`20-2`60) X`09end Xend Xexit $ call unpack LDBSTARTER.CSH;1 1042688351 "" $! $ create 'f' X%`20-*-LaTeX-*- X%`20Converted`20automatically`20from`20troff`20to`20LaTeX X%`20by`20tr2latex`20($Revision:`202.2`20$$Date:`201992/04/27`2015:13:26`20$ V`20by`20C.`20Engel) X%`20on`20Thu`20Jun`2011`2012:30:31`201992 X%`20tr2latex`20was`20written`20by`20Kamal`20Al-Yahya`20at`20Stanford`20Univers Vity X%`20(Kamal%Hanauma@SU-SCORE.ARPA) X%`20and`20substantially`20enhanced`20by`20Christian`20Engel`20at`20RWTH`20Aach Ven X%`20(krischan@informatik.rwth-aachen.de). X% X%`20troff`20input`20file:`20ldb.man X X`5Cdocumentstyle`5Btroffman,twoside`5D`7Barticle`7D X`5Cbegin`7Bdocument`7D X%-------------------------------------------------- X%`20start`20of`20input`20file:`20ldb.man X% X%`20ldb.man`09`098/4/91 X% X%`20Copyright`201991`20`20Perry`20R.`20Ross X% X%`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20softw Vare`20and`20its X%`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to`20th Ve`20restrictions X%`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20by V`20reference. X%`20Any`20other`20use`20requires`20written`20permission`20from`20the`20author. V`20`20This`20software X%`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including`20any V`20implied X%`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular V`20purpose. X%`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20resulting V`20from`20the X%`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the`20use Vr`20agrees X%`20to`20these`20terms. X% X%`20VMS`20bug`20fixes`20and`20additions`20by`20Earle`20F.`20Ake`20 X% X`5Cphead`7BLDB`7D`7B1`7D`7BMay`204,`201992`7D`7B`7D`7B`7D%.nh X%.nr`20si`205n X%.ie`20`5CnT`20.pl`20`5CnTv X`5Cshead`7BNAME`7D Xldb`20--`20Play`20backgammon`20by`20e--mail X`5Cshead`7BSYNOPSIS`7D Xldb`20`5Boptions`5D`20`5Binput`20files...`5D X`5Cnwl X`5Cshead`7BDESCRIPTION`7D X`7B`5Cit`20Ldb`7D Xallows`20two`20people`20to`20play`20backgammon`20over`20a Xnetwork`20using`20electronic`20mail.`20`20It`20runs`20on`20character--oriented V Xterminals,`20or`20emulators`20thereof,`20using`20the X`7B`5Cit`20curses`7D Xscreen`20package.`20`20It`20will`20run`20on`20most`20UNIX`20dialects,`20as Xwell`20as`20VAX--C`20under`20VMS`205.0`20and`20above. X`7B`5Cit`20Ldb`7D Xwill`20display`20a`20picture`20of`20the`20board,`20prompt`20the`20user`20to Xenter`20a`20move,`20check`20the`20move`20for`20legality, Xand`20send`20the`20move`20to`20the`20opponent. XWhen`20it`20arrives,`20it`20will`20be`20displayed`20on`20the`20opponent's`20sc Vreen, Xafter`20which`20the`20opponent`20will`20be`20prompted`20for`20a`20move`20to Xbe`20sent`20back. X`5Cshead`7BFEATURES`7D X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7BMultiple`5C`20Games`7D`7D X`7B`5Cit`20Ldb`7D Xcan`20keep`20track`20of`20an`20arbitrary`20number`20of`20games`20simultaneousl Vy, Xand`20will`20display`20them`20one`20at`20a`20time`20for`20you`20to`20play. XYou`20can`20exit`20from X`7B`5Cit`20ldb`7D Xat`20any`20time;`20when`20you`20run`20ldb`20again,`20it`20will`20pick`20up Xyour`20games`20where`20you`20left`20off. X`5CIPitem`7B`7BMove`5C`20Checking`7D`7D XBoth`20your`20moves`20and`20your`20opponent's`20moves`20are`20checked`20for V`20legality. XThis`20includes: X`5CIPitem`7B`7B--`7D`7D XLanding`20on`20an`20occupied`20point. X`5CIPitem`7B`7B--`7D`7D XBearing`20off`20before`20your`20inner`20table`20is`20full. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20move`20pieces`20that`20are`20on`20the`20board`20when`20you Xhave`20a`20piece`20on`20the`20bar. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20bear`20off`20a`20piece Xwhen`20there`20is`20a`20piece`20on`20a`20higher`20point,`20and Xthe`20roll`20is`20not`20being`20used`20exactly. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20leave`20a`20usable`20move`20unused. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20leave`20a`20move`20unused`20when`20it`20is`20usable`20and`20has Xa`20higher`20roll`20than`20the`20move`20that`20is`20used. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20double`20when`20you`20doubled`20last. X`5CIPitem`7B`7B--`7D`7D XTrying`20to`20double`20when`20either`20player`20is`20within`201`20point`20of Xwinning`20the`20match,`20and`20the`20Crawford`20rule`20is`20in`20effect. X`5CIPitem`7B`7BMessage`5C`20Reliability`7D`7D X`7B`5Cit`20Ldb`7D Xdetects`20(and`20rejects)`20duplicate`20messages,`20and`20can Xregenerate`20lost`20messages. X`5CIPitem`7B`7BRemote`5C`20Start`7D`7D X`7B`5Cit`20Ldb`7D Xcan`20start`20a`20game`20between`20two`20players`20on`20remote`20hosts. XThis`20is`20used`20to`20set`20up`20"game`20starter"`20hosts, Xwhere`20people`20interested`20in`20finding`20new`20opponents`20are Xmatched`20by`20some`20criteria`20(such`20as`20ability,`20or`20by`20a Xtournament`20schedule),`20and`20have`20their`20games`20started Xautomatically.`20`20For`20a`20current`20listing`20of`20game Xstarter`20hosts,`20see`20the`20README`20file. X`5CIPitem`7B`7BGame`5C`20Value`7D`7D X`7B`5Cit`20Ldb`7D Xdetects`20the`20end`20of`20the`20game,`20gammons,`20and`20backgammons, Xand`20notifies`20both`20players`20of`20the`20game`20value`20when`20the Xgame`20is`20over.`20`20The`20Jacoby`20rule`20may`20be`20enabled, Xas`20may`20European`20scoring,`20to`20calculate`20the`20game`20value Xas`20desired. X`5CIPitem`7B`7BOnline`5C`20Help`5C`20Screen`7D`7D X`7B`5Cit`20Ldb`7D Xhas`20an`20online,`20context`20sensitive`20help`20facility Xthat`20lists`20the`20available`20commands`20for`20the`20current`20screen. X`5CIPitem`7B`7BMatch`5C`20Play`7D`7D X`7B`5Cit`20Ldb`7D Xcan`20support`20matches`20that`20play`20to`20any Xdesired`20point`20total,`20and`20will`20continue`20to Xstart`20games`20until`20one`20player`20reaches`20that`20total. X`5Cend`7BIPlist`7D`5Cpar X`5Cshead`7BOPTIONS`7D X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B% X`5Cbf`20-read`5C`20`5Crm% X`7D`7D XMail`20is`20read,`20and`20the`20games`20are`20updated`20and`20saved. XThe`20user`20is`20not`20prompted`20for`20his`20moves. X`5CIPitem`7B`7B% X`5Cbf`20-play`5C`20`5Crm% X`7D`7D XAny`20games`20that`20are`20waiting`20for`20local`20input`20are Xdisplayed`20for`20the`20user`20to`20process.`20`20No`20mail`20is`20read. X`5CIPitem`7B`7B% X`5Cbf`20-color`5C`20xy`5Crm% X`7D`7D XThe`20colors`20for`20any`20games`20started`20are`20set`20to`20x`20and`20y. XThe`20first`20color`20is`20played`20by`20the`20local`20user,`20and`20the Xother`20is`20played`20by`20the`20opponent.`20`20Legal`20color Xcharacters`20are`20any`20upper`20or`20lower`20case`20letters. XThe`20default`20is`20"--color`20rw".`20`20This`20argument`20is`20positional, Xand`20only`20affects`20games`20started`20after`20it`20has`20been`20scanned. X`5CIPitem`7B`7B% X`5Cbf`20-direction`5C`20up/down`5Crm% X`7D`7D XThe`20direction`20of`20play`20for`20any`20games`20started`20by`20the`20local V`20user Xis`20set`20to`20the`20specified`20value. XThe`20default`20is`20"--direction`20up".`20`20This`20argument`20is`20positiona Vl, Xand`20only`20affects`20games`20started`20after`20it`20has`20been`20scanned. X`5CIPitem`7B`7B% X`5Cbf`20-myaddr`5C`20addr`5Crm% X`7D`7D XYour`20mail`20address`20is`20set`20to X`7B`5Cit`20addr`7D Xfor`20games`20started`20after`20the X`7B`5Cit`20--myaddr`7D Xoption`20is`20scanned.`20`20This`20overrides`20the`20address Xspecified`20in X`7B`5Cit`20.ldbrc.`7D X`5CIPitem`7B`7B% X`5Cbf`20-start`5C`20user`5Crm% X`7D`7D XA`20game`20is`20started`20with`20the`20specified`20user. XThe X`7B`5Cit`20user`7D Xargument`20may`20be`20any`20e--mail`20address`20that`20is`20valid`20for Xyour`20host.`20`20Some`20e--mail`20addresses`20will`20need`20to`20be`20quoted Xif`20they`20contain`20shell`20metacharacters. XThe X`7B`5Cit`20user`7D Xargument`20may`20also`20be`20an X`7B`5Cit`20alias`7D Xfor`20an`20opponent`20you`20have`20played`20before. XAliases`20are Xdefined`20in`20the`20people`20file, Xand`20are`20initialized`20to`20the`20first`20name`20of Xthe`20opponent,`20with`20all`20upper-case`20letters`20changed`20to`20lower. X`5CIPitem`7B`7B% X`5Cbf`20-remotestart`5C`20user1`5C`20user2`5Crm% X`7D`7D XA`20game`20is`20started`20between`20user1`20and`20user2.`20`20The`20local Xhost`20sends`20a`20remote`20start`20message`20to`20user1`20instructing Xit`20to`20start`20a`20game`20with`20user2.`20`20The`20local`20host Xdoes`20not`20participate`20thereafter`20in`20the`20game. XFor`20the`20purposes`20of`20the`20--color`20and`20--direction`20options, Xuser1`20is`20considered`20the`20local`20user. X`5CIPitem`7B`7B% X`5Cbf`20-jacoby`5Crm% X`7D`7D XThe`20Jacoby`20rule`20is`20enabled`20for`20all`20games`20started`20after`20the V X`7B`5Cit`20--jacoby`7D Xargument`20is`20scanned.`20`20This`20rule`20specifies`20that`20gammons Xand`20backgammons`20count`20as`20single`20games`20if`20neither`20player Xdoubled`20during`20the`20game.`20`20This`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20Jacoby`20rule,`20it`20is`20disabled`20and`20the`20game Xproceeds`20as`20if`20it`20were`20never`20enabled. X`5CIPitem`7B`7B% X`5Cbf`20-crawford`5Crm% X`7D`7D XThe`20Crawford`20rule`20is`20enabled`20for`20all`20games`20started`20after`20t Vhe X`7B`5Cit`20--crawford`7D Xargument`20is`20scanned.`20`20This`20rule`20specifies`20that`20neither Xplayer`20may`20double`20if`20either`20player`20is`20within`201`20point`20of Xwinning`20the`20match.`20`20If`20match`20play`20is`20not`20enabled,`20this Xargument`20has`20no`20meaning. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20Crawford`20rule,`20it`20is`20disabled`20and`20the`20game V Xproceeds`20as`20if`20it`20were`20never`20enabled. X`5CIPitem`7B`7B% X`5Cbf`20-european`5Crm% X`7D`7D XThe`20European`20rule`20is`20enabled`20for`20all`20games`20started`20after`20t Vhe X`7B`5Cit`20--european`7D Xargument`20is`20scanned.`20`20This`20rule`20specifies`20that`20backgammons Xcount`20as`20double,`20rather`20than`20triple,`20the`20score`20shown`20on`20th Ve`20cube. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20the`20European`20rule,`20it`20is`20disabled`20and`20the`20game V Xproceeds`20as`20if`20it`20were`20never`20enabled. X`5CIPitem`7B`7B% X`5Cbf`20-permanent`5Crm% X`7D`7D XAny`20games`20started`20after`20the X`7B`5Cit`20--european`7D Xargument`20is`20scanned`20are`20marked`20permanent.`20`20Permanent`20games Xare`20automatically`20restarted`20when`20they`20end.`20`20This`20is`20for Xpeople`20you`20play`20with`20constantly,`20and`20it`20saves`20you`20the`20trou Vble Xof`20restarting`20the`20game`20when`20it`20is`20over. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20permanent`20games,`20the`20permanent`20flag`20is`20disabled V`20and`20the`20game Xproceeds`20as`20if`20it`20were`20never`20enabled. X`5CIPitem`7B`7B% X`5Cbf`20-match`5C`20points`5Crm% X`7D`7D XThis`20option`20enables`20match`20play`20and`20specifies`20the`20number`20of V`20points Xthe`20match`20is`20to`20play`20to.`20`20Games`20that`20are`20part`20of`20a`20m Vatch`20have`20additional Xinformation`20displayed`20above`20the`20board`20to`20show`20the`20current`20ma Vtch`20score Xand`20the`20number`20of`20points`20being`20played`20to.`20`20When`20a`20game V`20that`20is`20part Xof`20a`20match`20ends,`20and`20the`20specified`20number`20of`20points`20has V`20not`20been`20reached, Xthe`20game`20is`20restarted. XThis`20option`20may`20only`20be`20enabled Xby`20the`20user`20starting`20the`20game,`20and`20may`20not`20be`20disabled`20b Vy Xthe`20other`20player.`20`20If`20the`20opponent's`20version`20of`20ldb`20does Xnot`20support`20match`20play,`20the`20game Xproceeds`20as`20if`20it`20were`20a`20normal`20game. X`5CIPitem`7B`7B% X`5Cbf`20-broadcast`5C`20file`5Crm% X`7D`7D XThe`20specified`20file`20is`20mailed`20to`20all`20current`20opponents. XThis`20is`20useful`20for`20announcing`20vacation`20absences,`20etc. X`5Cend`7BIPlist`7D`5Cpar XThe`20default`20mode`20for`20the`20--read`20and`20--play`20options Xis`20to`20do`20both.`20`20This`20is`20also`20what`20happens`20if`20both X--read`20and`20--play`20are`20given.`20`20Any`20arguments`20not`20beginning Xwith`20--`20are`20treated`20as`20input`20files`20and`20are`20searched`20for Xincoming`20moves`20from`20opponents.`20`20It`20is`20not`20an`20error`20for Xany`20of`20these`20files`20to`20not`20exist. X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B% X`5Cbf`20-control`5Crm% X`7D`7D XThis`20option`20puts`20ldb`20into`20a`20special`20mode`20that`20does`20not`20a Vllow Xgames`20to`20be`20played,`20but`20instead`20displays`20them`20one`20at`20a`20t Vime Xand`20allows`20certain`20"overhead"`20functions`20to`20be`20performed. XThese`20are`20described`20fully`20in`20the`20section`20titled`20"CONTROLLING V`20A`20GAME". X`5CIPitem`7B`7B% X`5Cbf`20-reconstruct`5C`20file`5Crm% X`7D`7D XThis`20option`20allows`20your`20game`20file`20to`20be`20reconstructed`20if`20y Vou`20accidentally Xclobber`20it.`20`20It`20does`20this`20by`20extracting`20the`20information`20fr Vom`20your Xopponent's`20data`20file`20and`20"reversing"`20it`20so`20you`20can`20use`20it. V XTo`20use`20the`20reconstruct`20option,`20ask`20all`20of`20your`20opponents`20t Vo`20send Xyou`20their`20.ldbdata`20files.`20`20Extract`20these`20from`20your`20mail`20in Vto`20files Xon`20your`20system,`20strip`20the`20mail`20headers,`20and`20feed`20them`20one V`20at`20a`20time Xinto`20ldb.`20`20For`20each`20game`20found`20listing`20you`20as`20the`20oppone Vnt,`20you`20will Xbe`20prompted`20to`20enter`20the`20opponent's`20e-mail`20address`20or`20alias X(and`20his`20name`20if`20he Xis`20not`20in`20your`20people`20file),`20and`20the`20game`20will`20be`20added V`20to`20your Xgame`20file. X`5CIPitem`7B`7B`7D`7D XThe`20reconstruct`20function`20cannot`20recover`20games`20that`20were`20in`20t Vhe Xprocess`20of`20starting`20(i.e.`20in`20their`20initial`20roll`20stage),`20or V`20that Xhave`20already`20completed`20(why`20bother?).`20`20Your`20opponent`20should Xread`20any`20mail`20files`20you`20sent`20before`20your`20data`20file`20got`20c Vlobbered, Xand`20should`20make`20his`20move`20and`20send`20it`20before`20sending`20you V`20his`20data`20file. XYou`20will`20not`20need`20to`20process`20the`20move`20he`20sent,`20though,`20s Vince`20all Xthat`20data`20is`20in`20his`20file`20anyway.`20`20It`20won't`20hurt`20if`20you V`20do, Xldb`20will`20just`20ignore`20it. X`5CIPitem`7B`7B% X`5Cbf`20-help`5Crm% X`7D`7D XThis`20prints`20a`20one-line`20description`20of`20each`20option,`20in`20case V`20you Xforget`20later`20on. X`5Cend`7BIPlist`7D`5Cpar X`5Cshead`7BSCREEN`7D XThe`20screen`20displays`20the`20following`20items`20of`20interest: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B% X`5Cbf`20Opponent`5Crm% X`7D`7D XThe`20e--mail`20address`20and`20personal`20name`20of`20the`20opponent`20are V`20displayed Xon`20the`20top`20line`20of`20the`20screen.`20`20This`20can`20help`20identify V`20the Xgame`20if`20you`20have`20many`20games`20in`20progress`20at`20once. X`5CIPitem`7B`7B% X`5Cbf`20Board`5C`20Label`5Crm% X`7D`7D X`7B`5Cit`20Ldb`7D Xdisplays`20one`20of`20three`20possible`20board`20images`20at`20a`20time; Xthe`20name`20of`20the`20board`20currently`20displayed`20is`20shown`20on Xthe`20second`20line`20of`20the`20screen,`20near`20the`20left. XThe`20significance`20of`20these`20three`20boards`20is`20explained`20below. X`5CIPitem`7B`7B% X`5Cbf`20Flags`5Crm% X`7D`7D XThis`20area`20displays`20any`20special`20rules`20in`20effect`20for Xthe`20game.`20`20Each`20special`20rule`20causes`20one`20character`20to Xbe`20displayed.`20`20These`20are: X`5Cnofill X`20`20`20`20`20J`20`20`20`20`20Jacoby`20rule X`20`20`20`20`20C`20`20`20`20`20Crawford`20rule X`20`20`20`20`20E`20`20`20`20`20European`20rule X`20`20`20`20`20P`20`20`20`20`20Permanent`20game X`5Cfill X`5CIPitem`7B`7B% X`5Cbf`20Match`5C`20Score`5Crm% X`7D`7D XThe`20current`20match`20score`20is`20displayed`20next`20to`20the`20board`20lab Vel, Xas`20is`20the`20number`20of`20points`20the`20match`20plays`20to. XIf`20the`20game`20being`20displayed`20is`20not`20part`20of`20a`20match, Xthis`20area`20is`20blanked`20out. X`5CIPitem`7B`7B% X`5Cbf`20Pip`5C`20Count`5Crm% X`7D`7D XNear`20the`20right`20of`20the`20screen`20on`20the`20second`20line`20is`20the Xpip`20count`20for`20the`20board`20being`20displayed. X`5CIPitem`7B`7B% X`5Cbf`20Board`5Crm% X`7D`7D XThe`20board`20is`20displayed`20near`20the`20left`20side`20of`20the`20screen, V`20and`20takes Xup`20most`20of`20the`20screen`20area.`20`20It`20consists`20of`20an`20outline, V`20drawn Xwith`20ASCII`20characters,`20and`2028`20"points"`20where`20pieces`20can`20resi Vde. XOf`20these,`2024`20are`20the`20normal`20points`20making`20up`20the`20main`20bo Vdy`20of`20the Xboard`20(numbered`201--24), X2`20are`20the`20"BAR"`20points,`20located`20between`20the`20left Xand`20right`20halves`20of`20the`20main`20board,`20and`202`20are`20the`20"OFF" Xpoints`20(where`20pieces`20go`20when`20they`20are`20borne`20off),`20located V`20to`20the Xleft`20of`20the`20board.`20`20Pieces`20are`20represented`20by`20upper`20or`20l Vower`20case`20letters. XTo`20help`20you`20remember`20which`20direction`20you Xare`20playing,`20there`20are`20arrows`20drawn`20at`20the`20four`20corners`20of V`20the Xboard`20indicating`20your`20direction`20of`20play. X`5CIPitem`7B`7B% X`5Cbf`20Doubling`5C`20Cube`5Crm% X`7D`7D XThe`20current`20value`20of`20the`20doubling`20cube`20is`20displayed`20in`20rev Verse Xvideo`20on`20the`20left`20side`20of`20the`20screen.`20`20The`20cube`20will`20a Vppear Xnext`20to`20the`20home`20board`20of`20the`20owner`20of`20the`20cube, Xor`20in`20the`20middle`20if`20neither`20player Xhas`20doubled.`20`20For`20example,`20if`20the`20player`20whose`20home`20board V`20is Xat`20the`20bottom`20of`20the`20screen`20doubled`20last,`20the`20cube`20will V`20appear Xbeside`20the`20top`20of`20the`20board. X`5CIPitem`7B`7B% X`5Cbf`20Move`5C`20Blocks`5Crm% X`7D`7D XThe`20move`20blocks`20are`20located`20on`20the`20right`20of`20the`20screen. V`20`20There Xare`20two`20move`20blocks;`20one`20for`20you,`20and`20one`20for`20your`20oppon Vent. XYou`20will`20use`20your`20move`20block`20to`20enter`20your`20moves,`20and`20yo Vu`20will Xsee`20your`20opponent's`20moves`20displayed`20in`20his`20move`20block.`20`20A V`20move Xblock`20consists`20of`20a`20header,`20which`20identifies`20the`20owner`20of V`20the Xmove`20block,`20and`20two`20columns`20of`20either`20two`20or`20four`20lines. XEach`20line`20in`20a`20move`20block`20is`20one`20roll,`20and`20shows`20the`20v Value Xof`20the`20roll`20(in`20the`20range`201--6)`20and`20how`20that`20roll`20has V`20been`20used. XIf`20doubles`20were`20rolled, Xthe`20third`20and`20fourth`20lines`20will`20also Xbe`20used`20to`20display`20the`20two`20additional`20rolls`20that`20may`20be V`20used. X`5CIPitem`7B`7B% X`5Cbf`20Command`5C`20Box`5Crm% X`7D`7D XThe`20bottom`20right`20corner`20of`20the`20screen`20contains`20a`20small`20box V Xthat`20displays`20the`20commands`20that`20are`20legal`20at`20any`20given`20tim Ve. XYou`20can`20execute`20a`20command`20by`20typing`20the`20first`20letter;`20you Xshould`20not`20hit`20return`20afterwards.`20`20There`20may`20be`20legal`20comm Vands Xother`20than`20those`20shown`20in`20the`20command`20box,`20depending`20on Xthe`20state`20the`20game`20is`20in.`20`20Press`20"h"`20or`20"?"`20for`20a`20co Vmplete`20listing Xof`20legal`20commands. X`5CIPitem`7B`7B% X`5Cbf`20Message`5C`20Area`5Crm% X`7D`7D XThe`20bottom`206`20lines`20of`20the`20screen`20are`20reserved`20for`20messages V`20of Xvarious`20types.`20`20The`20bottom`20line`20is`20used`20for`20error`20and`20in Vformative Xmessages`20that`20occur`20as`20a`20game`20is`20played.`20`20The`20top`20line V`20in`20this Xarea`20displays`20messages`20pertaining`20to`20the`20status`20of`20a`20game, V`20such`20as Xblots`20hit`20by`20an`20opponent's`20move.`20`20The`20remaining`204`20lines V`20are`20used`20to Xenclose`20a`20message`20to`20your`20opponent`20with`20your`20move,`20and`20to V`20display Xthe`20one`20your`20opponent`20sent`20to`20you.`20`20These`20messages`20may`20b Ve`20up`20to X2`20lines`20of`2056`20characters. X`5Cend`7BIPlist`7D`5Cpar X`5Cshead`7BSTARTUP`20FILE`7D XThe`20first`20time`20you`20run X`7B`5Cit`20ldb,`7D Xit`20will`20ask`20you`20if`20you`20want`20to Xcreate`20a X`7B`5Cit`20.ldbrc`7D Xfile.`20`20You`20should`20answer`20"yes",`20unless`20you`20have`20a`20reason Xnot`20to.`20`20If`20you`20want`20the`20ldb`20startup`20file`20to`20be`20named V`20something Xother`20than X`7B`5Cit`20.ldbrc,`7D Xyou`20should`20set`20the`20environment`20variable`20LDBRC`20to`20the Xname`20you`20want`20before Xrunning`20ldb`20for`20the`20first`20time. XIf`20you`20do`20this,`20the`20LDBRC`20variable`20must`20be`20set Xevery`20time`20you`20run`20ldb. X`7B`5Cit`20Ldb`7D Xmoves`20to`20the`20directory`20in`20the`20HOME`20environment`20variable, Xif`20it`20is`20set,`20before`20accessing`20any`20files. XThis`20makes`20all`20files`20(including`20.ldbrc)`20relative Xto`20`5C$HOME. X`5Cpar XThe X`7B`5Cit`20.ldbrc`7D Xis`20organized`20as`20a`20sequence`20of`20name/value`20pairs,`20one`20per`20li Vne, Xin`20the`20format X`7B`5Cit`20name=value`20.`7D XThere`20should`20be`20no`20spaces`20before X`7B`5Cit`20name`7D Xor`20before`20or`20after`20the`20equals`20sign.`20`20Comments`20are`20indicate Vd Xby`20a`20pound`20sign`20(`5C#)`20in`20column`201,`20and`20extend`20to`20the V`20end`20of`20the`20line. XThe`20following`20names`20are`20defined: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7Bmyname`7D`7D XThis`20line`20is`20where`20you`20enter`20your`20(human)`20name. XIt`20is`20sent`20to`20your`20opponent`20when`20a`20game`20is`20started,`20to Xmake`20things`20a`20little`20more`20personal.`20`20You`20can`20put`20anything Xyou`20like`20here,`20of`20course,`20but`20I`20highly`20recommend`20you`20just Xstick`20to`20your`20name. XThe X`7B`5Cit`20myname`7D Xline`20is`20mandatory;`20if`20you`20don't`20want`20your`20name Xsent`20to`20people,`20you`20can`20just`20put`20your`20email`20address`20instea Vd, Xbut`20you`20must`20have`20something. X`5CIPitem`7B`7Bmyaddr`7D`7D XThis`20line`20defines`20your`20e--mail`20address.`20`20This`20is`20sent`20to V`20your Xopponent`20when`20you`20start`20a`20game`20so`20they`20know`20how`20to`20send Xmail`20back`20to`20you.`20`20For`20people`20with`20multiple`20mail`20paths, V`20put Xthe`20one`20here`20you`20use`20the`20most`20(e.g.`20the`20Internet`20domain--s Vtyle Xpath),`20and`20for`20games`20that`20need`20to`20use`20a`20different`20address, V Xuse`20the X`7B`5Cit`20--myaddr`7D Xcommand`20line`20argument`20to`20override`20the`20path`20in X`7B`5Cit`20.ldbrc.`20Note`20that`20the`20first`20time`20you`20start`20a`20game V`7D Xwith`20someone,`20the`20address`20you`20use`20is`20saved`20in`20your Xpeople`20file.`20`20Subsequent`20games`20you`20start`20with`20this`20person Xautomatically`20use`20this`20same`20address,`20so`20the X`7B`5Cit`20--myaddr`7D Xoption`20will`20be`20unnecessary. XThe X`7B`5Cit`20myaddr`7D Xline`20is`20mandatory. X`5CIPitem`7B`7Bpeoplefile`7D`7D XThis`20line`20sets`20the`20file`20name`20that`20is`20used`20to`20store`20infor Vmation Xabout`20your`20opponents.`20`20In`20addition`20to`20storing`20your`20opponents V' Xnames,`20addresses,`20and`20aliases,`20it`20records`20the`20number`20of Xgames,`20points,`20gammons,`20backgammons,`20and`20matches`20you`20have Xwon`20or`20lost`20to`20that`20opponent.`20`20It`20also`20stores`20something Xcalled`20the X`7B`5Cit`20fence,`7D Xwhich`20is`20the`20start`20time`20of`20the`20most`20recently`20finished`20game V. XThis`20allows`20start`20messages`20from`20old`20games`20to`20be`20discarded. XThe`20peoplefile`20line`20is`20optional,`20and`20if`20it`20is`20not`20given, Xthe`20people`20file`20defaults`20to X`7B`5Cit`20.ldbpeople.`7D X`5CIPitem`7B`7Bgamefile`7D`7D XThis`20line`20sets`20the`20file`20name`20that`20is`20used`20to`20store`20games V Xin`20progress.`20`20It`20is`20optional,`20and`20if`20it`20is`20not`20given, V`20the Xgame`20file`20defaults`20to X`7B`5Cit`20.ldbdata.`7D XMy`20advice,`20if`20you`20care,`20is`20that`20you`20should`20avoid Xusing`20a`20file`20name`20containing`20the`20string X`7B`5Cit`20games`7D Xor`20any`20other`20giveaway`20string`20that`20would`20let`20your`20boss,`20sys Vadmin, Xor`20other`20local`20Nazi--type`20know`20that`20you're`20using Xa`20very`20expensive`20piece`20of`20high--tech`20equipment`20to`20goof`20off, Xwhen`20you`20could`20do`20that`20with`20nothing`20more`20exotic`20than Xa`20rubber`20band`20and`20some`20spitballs. X`5CIPitem`7B`7Bbackupfile`7D`7D XThis`20is`20the`20file`20your`20old X`7B`5Cit`20gamefile`7D Xwill`20be`20moved`20to`20just`20before`20a`20new Xone`20is`20created.`20`20It`20defaults`20to X`7B`5Cit`20.oldldbdata.`7D X`5CIPitem`7B`7Bmailfile`7D`7D XThis`20line`20is`20where`20you`20tell`20ldb`20how`20to`20find`20the`20mail`20m Vessages Xyour`20opponents`20have`20sent.`20`20There`20are`20several`20ways`20to`20do V`20this. XThe`20simplest`20one`20is`20to`20just`20put Xsome`20file`20name`20here`20(the`20default`20is`20ldb.rcv)`20and,`20when`20you V`20receive Xmail`20containing`20an Xldb Xmove,`20just`20save`20it`20to`20this`20file.`20`20When`20you`20are`20done`20re Vading`20your`20mail, Xrun`20ldb,`20and`20it`20will`20scan`20this`20file`20and`20extract`20all`20your V`20incoming Xmoves.`20`20If`20your`20mail`20program`20is`20like`20most,`20it`20will Xappend`20messages`20if`20the`20file`20you`20are`20saving`20to`20already`20exis Vts, Xwhich`20is`20just`20what`20you`20want. X`7B`5Cit`20Ldb`7D Xwill`20silently`20ignore`20moves`20that`20it`20has`20already`20seen`20for`20ga Vmes`20in Xprogress,`20so`20you`20don't`20have`20to`20clean`20them`20out`20of`20your`20ma Vilfile Xif`20you`20don't`20want`20to. XNote`20however`20that`20if`20anything`20happens`20to`20your`20people`20file, Xand`20you`20have`20old`20start`20messages`20in`20your`20input`20file, Xldb`20could`20start`20a`20spurious`20game`20(i.e.`20one`20your`20opponent's V`20ldb Xknows`20nothing`20about).`20`20Also,`20if`20your`20input`20file`20gets`20reall Vy`20long, Xldb`20will`20take`20a`20while`20to`20start`20up. XSo`20the`20best`20course`20is`20to`20delete`20all`20messages Xafter`20ldb`20has`20read`20them. X`5CIPitem`7B`7B`7D`7D XFor`20UNIX`20users,`20a`20much`20easier`20way Xis`20to`20set`20the`20mailfile`20to`20point`20to`20your Xactual`20mail`20file`20(e.g.`20/usr/spool/mail/`5C$USER),`20and`20let`20ldb Xscan`20your`20mail`20directly.`20`20This`20will`20only`20work`20if`20your`20sy Vstem Xkeeps`20mail`20in`20ASCII`20format,`20but`20many`20do.`20`20Ldb`20will`20not Xdelete`20these`20messages`20from`20your`20mail Xso`20you`20will`20have`20to. X`5CIPitem`7B`7B`7D`7D XThe`20third`20option`20is`20to`20set`20the`20mailfile`20to`20a`20pattern`20ins Vtead Xof`20a`20filename.`20`20Ldb`20will`20scan`20all`20matching`20files`20for`20mov Ves. XThis`20is`20good`20for`20mailers`20that`20don't`20append`20on`20save,`20and Xdon't`20store`20in`20ascii`20format,`20such`20as`20on`20VMS.`20`20Note`20that Xon`20VMS,`20if`20no`20version`20number`20is`20defined,`20mailfile`20defaults Xto`20scanning`20all`20versions. XVMS`20users`20should`20read`20the`20section`20entitled`20"VMS`20NOTES" Xfor`20more`20information`20on`20extracting`20mail. X`5CIPitem`7B`7Bdelmail`7D`7D XThis`20option`20causes`20any`20mail`20files`20scanned`20by`20ldb`20to`20be`20r Vemoved`20after Xthey`20have`20been`20scanned.`20`20This`20is`20a`20hideously`20dangerous`20opt Vion, Xso`20I`20recommend`20you`20try`20it`20in`20a`20friend's`20account`20first. XIt`20will`20delete`20ANY`20file`20that`20matches`20the`20pattern`20specified V`20in Xthe`20mailfile`20line,`20with`20the`20exception`20that,`20under`20UNIX, Xit`20will`20refuse`20to`20delete`20any`20file`20starting`20with`20"/". XUse`20it`20with`20great`20care.`20`20This`20option`20defaults`20to`20no; Xto`20enable`20it,`20set`20it`20to`20"yes". X`5CIPitem`7B`7Blockfile`7D`7D XThis`20line`20sets`20the`20name`20of`20the`20ldb`20lock`20file. XIt`20defaults`20to X".ldb`5C_lock", Xand`20there's`20no Xreal`20reason`20to`20change`20it`20unless`20by`20some`20chance`20it`20conflict Vs Xwith`20a`20file`20name`20you`20might`20use. XWhen`20ldb`20starts,`20it`20checks`20to`20see`20if`20this`20file`20exists; Xif`20it`20does,`20ldb`20exits.`20`20Otherwise,`20it`20creates`20it`20and`20goe Vs`20on. XThis`20prevents`20more`20than`20one`20ldb`20from`20running`20in`20the`20same Xaccount`20at`20the`20same`20time,`20and`20thereby`20garbling`20the`20data`20fi Vles. X`5CIPitem`7B`7Bsendcmd`7D`7D XThis`20tells`20ldb`20how`20to`20send`20a`20file`20with`20your`20particular Xmail`20command.`20`20This`20string`20is`20passed`20to`20the`20system,`20after V`20making`20the Xfollowing`20substitutions: X`5CIPitem`7B`7B`5C`20`5C`20`5C`20`5C`20`5C`20`5C$a`7D`7D Xis`20substituted`20with`20the`20address`20to`20mail`20to. X`5CIPitem`7B`7B`5C`20`5C`20`5C`20`5C`20`5C`20`5C$f`7D`7D Xis`20substituted`20with`20the`20file`20containing`20the`20message. X`5CIPitem`7B`7B`5C`20`5C`20`5C`20`5C`20`5C`20`5C$s`7D`7D Xis`20substituted`20with`20the`20subject`20of`20the`20message. X`5CIPitem`7B`7B`7D`7D XMost`20mail`20systems`20will`20work`20fine`20with`20the`20default,`20which`20i Vs X`5Cnofill X`20`20`20`20`20mail`20--s`20'`5C$s'`20`5C$a`20$<$`20`5C$f X`5Cfill X`5CIPitem`7B`7B`7D`7D Xor,`20on`20VMS, X`5Cnofill X`20`20`20`20`20MAIL/SUBJECT="`5C$s"`20`5C$f`20IN`5C%"""$<$`5C$a$>$""" X`5Cfill X`5CIPitem`7B`7B`7D`7D XNote`20that`20the`20`5C$`20substitutions`20are Xmade`20by`20ldb,`20not`20by`20a`20shell,`20and`20thus`20are`20not`20subject V`20to Xany`20quoting.`20`20If`20you`20need`20a`20`5C$`20in`20the`20string,`20use`20 V`5C$`5C$. XVMS`20users`20may`20need`20to`20change`20the`20name`20of`20the`20SMTP`20mailer V; Xfor`20example,`20to`20send`20mail`20using`20Wollongong`20TCP/IP,`20you`20would V Xuse`20the`20string X`5CIPitem`7B`7B`7D`7D X`5Cnofill X`20`20`20`20`20MAIL/SUBJECT="`5C$s"`20`5C$f`20WINS`5C%"""$<$`5C$a$>$""" X`5Cfill X`5CIPitem`7B`7Btempfile`7D`7D XThis`20line`20specifies`20a`20temporary`20file`20that`20ldb`20can`20use`20to V`20compose Xmail`20messages.`20`20The`20file`20will`20be`20created`20in`20your`20home`20di Vrectory, Xthus`20avoiding`20file`20name`20conflicts`20in`20/tmp.`20`20It`20defaults`20to V`20ldb.tmp. X`5CIPitem`7B`7Bcolors`7D`7D XThis`20is`20a`20string`20of`20two`20upper`20or`20lower`20case Xletters, Xand`20defines Xyour`20preferred`20colors`20for`20any`20games`20you`20start.`20`20The`20first V`20character Xin`20the`20string`20is`20the`20color`20you`20will`20play,`20and`20the`20second V`20is`20the Xone`20your`20opponent`20will`20play.`20`20It`20defaults`20to`20"rw",`20and`20i Vs Xoverridden`20by`20the X`7B`5Cit`20--color`7D Xcommand`20line`20argument. X`5CIPitem`7B`7Bdirection`7D`7D XThis`20is`20either`20"up"`20or`20"down",`20and`20defines`20your`20preferred V`20direction Xof`20play`20for`20games`20you`20start.`20`20The`20direction`20of`20play`20only V`20refers`20to Xwhether`20you`20play`20toward`20increasing`20or`20decreasing`20numbered`20poin Vts. +-+-+-+-+-+-+-+- END OF PART 15 +-+-+-+-+-+-+-+- -+-+-+-+-+-+-+-+ START OF PART 16 -+-+-+-+-+-+-+-+ XAlthough`20by`20default`20upward`20play`20goes`20toward`20the`20top`20of`20the V`20screen, Xthis`20can`20be`20reversed`20(for`20your`20screen`20only)`20by`20the`20"Invert V" Xcommand`20in`20the`20Control`20menu, Xaccessible`20via`20the X`7B`5Cit`20--control`7D Xcommand`20line`20argument.`20`20The`20default`20for`20this`20line`20is`20"up", V Xand`20is`20overridden`20by`20the X`7B`5Cit`20--direction`7D Xcommand`20line`20argument. X`5CIPitem`7B`7Binitialboard`7D`7D XAs`20was`20alluded`20to`20earlier,`20your`20screen`20shows`20one`20of Xthree`20possible`20board`20images`20at`20any`20time.`20`20Although Xthe`20purpose`20for`20this Xwill`20be`20explained`20later,`20this`20line`20allows`20you`20to`20select Xwhich`20of`20these`20three`20boards`20should`20be`20displayed`20initially. XThe`20legal`20values`20are`20"before",`20"after",`20and`20"current". XThe`20default`20is`20"current". X`5CIPitem`7B`7Bautoroll`7D`7D XIf`20you`20were`20the`20last`20to`20double,`20you`20have`20no`20option Xbut`20to`20roll`20the`20dice`20when`20it`20is`20your`20turn.`20`20If Xautoroll`20is`20enabled,`20ldb`20will`20roll`20the`20dice`20for`20you`20automa Vtically Xin`20this`20case.`20`20For`20those`20that`20prefer`20consistency,`20autoroll Xmay`20be`20disabled,`20although`20attempting`20to`20double`20when`20you Xdoubled`20last`20will`20cause`20an Xerror`20message.`20`20Possible`20values`20for`20autoroll`20are`20"yes"`20and V`20"no", Xwith`20"yes"`20being`20the`20default. X`5CIPitem`7B`7Bautomove`7D`7D XEach`20time`20you`20roll`20the`20dice,`20ldb`20determines`20how`20many Xlegal`20ways`20there`20are`20for`20you`20to`20use`20your`20rolls.`20`20In`20th Ve Xrelatively`20unusual`20case`20where`20there`20is`20only`20one`20way Xfor`20you`20to`20use`20your`20rolls,`20ldb`20can`20automatically`20apply Xthis`20move`20to`20your`20board`20before`20displaying`20it.`20`20Automove Xis`20disabled`20by`20default`20because`20quite`20frankly`20it's Xpretty`20annoying.`20`20Possible`20values`20for`20automove`20are`20"yes" Xand`20"no",`20with`20"no"`20being`20the`20default. X`5CIPitem`7B`7Bautodouble`7D`7D XOne`20of`20the`20official`20rules`20of`20backgammon`20allows`20for Xautomatically`20doubling`20the`20game`20value`20when`20the`20opening Xroll`20is`20a`20tie.`20`20The`20rules`20go`20on`20to`20state`20that`20automati Vc Xdoubling`20is`20only`20to`20be`20used`20when`20the`20players`20agree`20beforeh Vand Xon`20its`20use`20and`20limitations.`20`20The`20method`20ldb`20uses`20to`20impl Vement Xthis`20somewhat`20vague`20rule`20is`20to`20allow`20each`20player`20to`20specif Vy Xa`20maximum`20number`20of`20autodoubles`20they`20are`20willing`20to`20accept V`20in X`7B`5Cit`20.ldbrc,`7D Xand`20for`20the`20maximum`20number`20of`20autodoubles`20applied`20to`20any`20g Vame Xto`20be`20the`20lesser`20of`20the`20two`20players'`20specified`20limits. XFor`20example,`20if`20you`20set X`7B`5Cit`20autodouble=4`7D Xin`20your`20.ldbrc,`20no`20game`20you`20play`20will`20ever`20be`20autodoubled Xmore`20than`204`20times,`20although`20the`20number`20of`20tied`20opening`20rol Vls Xis`20obviously`20not`20limited.`20`20However,`20if`20you`20were`20to`20start V`20a`20game Xwith`20someone`20who`20had`20set X`7B`5Cit`20autodouble=2`20,`7D Xthat`20game`20would`20be`20limited`20to`20at`20most`202`20autodoubles.`20`20If V`20you`20don't Xwant`20to`20play`20automatic`20doubles,`20set Xautodouble=0,`20which`20is`20also`20the`20default. X`5CIPitem`7B`7Bsuperkey`7D`7D XIf`20you`20live`20in`20fear`20of`20roving`20supervisors`20(or`20other Xfun-impaired`20individuals)`20running`20across`20you`20playing`20an Xinnocent`20game`20of`20backgammon, Xyou`20may`20want`20to`20enable`20the`20superkey`20function. XJust`20pick`20a`20key`20on`20the`20keyboard`20you`20never`20use`20in`20ldb, V`20such`20as`20the Xbackquote,`20and`20put`20a`20line`20in X`7B`5Cit`20.ldbrc`7D Xsetting`20superkey`20to`20the X`7B`5Cit`20decimal`5C`20ASCII`5C`20code`7D Xof`20the`20key`20you`20want;`20for`20example,`20to`20use`20the`20backquote`20k Vey, Xuse`20"superkey=96". XOnly`20single--character`20keys`20are`20allowed,`20and Xthe`20key`20you`20select`20will`20not`20be`20usable`20for`20normal`20purposes Xwithin`20ldb.`20`20Make`20it`20one`20you`20can`20hit`20in`20a`20hurry. X`5CIPitem`7B`7Bsupercmd`7D`7D XIf`20you'd`20rather`20have`20a`20program`20of`20your`20choice`20come`20up Xinstead`20of`20the`20shell`20when`20the`20superkey`20is`20pressed, Xput`20it`20on`20this`20line.`20`20It`20will`20be`20passed Xunchanged`20to`20a`20shell`20via`20the`20system()`20function. XVMS`20users`20should`20read`20the`20note`20in`20the`20section`20titled X"VMS`20NOTES"`20on`20supercmd`20functionality. X`5CIPitem`7B`7Bcheckpoint`7D`7D XThis`20option`20keeps`20the`20gamefile`20up`20to`20date`20by`20writing`20it V`20out Xwhenever`20the`20dice`20are`20rolled`20or`20a`20message`20is`20sent.`20`20This V Xprevents`20game`20information`20from`20being`20lost`20if`20ldb`20crashes, Xyour`20machine`20goes`20down,`20or`20what`20have`20you.`20`20This`20option`20i Vs Xenabled`20by`20default,`20and`20I`20highly`20recommend`20you`20leave`20it Xthat`20way.`20`20If`20you`20just`20can't`20stand`20the`20thought`20of`20a`20fe Vw`20extra Xwrites`20to`20disk,`20you`20can`20disable`20it`20with`20"checkpoint=no". XOn`20your`20own`20head`20be`20it. X`5CIPitem`7B`7Bdebug`7D`7D XThis`20option`20enables`20various`20debug`20messages.`20`20It`20is`20a`20bitma Vp, Xwith`20each`20set`20bit`20enabling`20debug`20messages`20from`20a`20different V`20part Xof`20ldb.`20`20Most`20people`20will`20want`20to`20leave`20it`20at`200,`20which V`20is Xthe`20default.`20`20If`20you`20want`20debug`20messages,`20look`20for`20the Xdefinitions`20of`20DB`5C_*`20in`20ldb.h. X`5Cend`7BIPlist`7D`5Cpar X`5Cshead`7BPEOPLE`20FILE`7D XLdb`20maintains`20a`20list`20of`20all`20of`20the`20people`20you Xhave`20ever`20played.`20`20This`20file`20is`20used`20for`20several`20purposes: V X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B1`7D`7D XIt`20stores`20the`20number`20of`20games,`20points,`20gammons,`20backgammons, Xand`20matches`20you`20have`20won`20and`20lost`20to`20that`20person. X`5CIPitem`7B`7B2`7D`7D XIt`20stores`20the`20address`20for`20that`20person,`20and`20the Xaddress`20that`20person`20should`20use`20to`20get`20to`20you. XIt`20also`20allows`20you`20to`20assign`20an`20alias`20to`20that`20person, Xand`20to`20use`20that`20alias`20when`20starting`20a`20game`20instead Xof`20the`20full`20e--mail`20address. X`5CIPitem`7B`7B3`7D`7D XIt`20stores`20information`20that`20allows`20ldb`20to`20reject Xstart`20messages`20from`20defunct`20games. X`5Cend`7BIPlist`7D`5Cpar XNormally,`20you`20should`20never`20have`20to`20edit`20the Xpeople`20file,`20but`20it`20is`20described`20here`20in`20case Xyou`20need`20to`20for`20some`20reason.`20`20It`20is`20in`20the`20same Xoverall`20format`20as`20.ldbrc`20(name/value`20pairs). X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7Baddr`7D`7D XThis`20is`20the`20address`20of`20the`20opponent.`20`20This`20is`20what Xuniquely`20defines`20the`20record,`20in`20case`20you`20are`20playing Xtwo`20people`20with`20the`20same`20name. X`5CIPitem`7B`7Bname`7D`7D XThis`20is`20the`20name`20of`20the`20opponent. X`5CIPitem`7B`7Balias`7D`7D XThis`20is`20a`20"nickname"`20you`20can`20assign`20to Xan`20opponent.`20`20When`20a`20new`20opponent`20is`20found, Xthe`20alias`20is`20initialized`20to`20the`20first`20word`20of Xthe`20opponent's`20name,`20with`20all`20upper`20case`20letters Xchanged`20to`20lower.`20`20You`20can`20change`20the`20alias`20to Xany`20desired`20string`20with`20a`20text`20editor`20(just`20make`20sure Xldb`20isn't`20running`20at`20the`20time,`20or`20your`20changes`20will Xbe`20lost). X`5CIPitem`7B`7Bmyaddr`7D`7D XThis`20is`20the`20address`20that`20this`20opponent`20should`20use`20to Xmail`20to`20you.`20`20This`20saves`20you`20from`20having`20to`20specify Xthe`20-myaddr`20argument`20when`20starting`20a`20game,`20and`20is Xespecially`20important`20with`20permanent`20games,`20since Xthese`20games`20are`20started`20automatically`20without`20giving Xyou`20a`20chance`20to`20change`20your`20address.`20`20If`20you`20only Xhave`20one`20e--mail`20path,`20you`20can`20ignore`20this. XThis`20field`20is`20initialized`20to`20the`20value`20of`20the X`7B`5Cit`20--myaddr`7D Xoption`20at`20the`20time`20the`20first`20game`20with Xthis`20opponent`20is`20started,`20or`20to Xthe`20value`20of`20myaddr`20from`20.ldbrc`20if`20no X`7B`5Cit`20--myaddr`7D Xoption`20was`20used. X`5CIPitem`7B`7Bequiv`7D`7D XThe`20presence`20of`20this`20field`20flags`20this`20as`20an`20"equiv" Xrecord.`20`20Equiv`20records`20allow`20one`20opponent`20to`20have`20multiple Xe--mail`20addresses,`20but`20to`20cause`20all`20of`20them`20to`20refer`20to Xone`20people`20record.`20`20Equiv`20records`20have`20no`20valid`20fields Xexcept X`7B`5Cit`20addr`7D Xand X`7B`5Cit`20equiv,`7D Xand`20must`20be`20preceded`20by`20the`20record`20they`20refer`20to`20in`20the V`20people`20file. X`5CIPitem`7B`7Bfence`7D`7D XThe`20fence`20is`20defined`20as`20the`20start`20time`20of`20the`20most Xrecently`20started`20game`20that`20has`20finished.`20`20If`20that`20makes Xno`20sense,`20don't`20worry,`20you`20should`20never`20have`20to`20mess Xwith`20it.`20`20It`20is`20used`20to`20discard`20old`20start`20messages`20that Xyou`20forgot`20to`20clean`20out`20of`20your`20mail. X`5CIPitem`7B`7Bscore`7D`7D XThis`20is`20an`20array`20of`2010`20numbers`20that`20represent,`20in`20order: X`5CIPitem`7B`7B`7D`7D X`5Cnofill X`20`20`20`20`20-`20Games`20won X`20`20`20`20`20-`20Games`20lost X`20`20`20`20`20-`20Points`20won X`20`20`20`20`20-`20Points`20lost X`20`20`20`20`20-`20Gammons`20won X`20`20`20`20`20-`20Gammons`20lost X`20`20`20`20`20-`20Backgammons`20won X`20`20`20`20`20-`20Backgammons`20lost X`20`20`20`20`20-`20Matches`20won X`20`20`20`20`20-`20Matches`20lost X`5Cfill X`5CIPitem`7B`7B`7D`7D XThis`20information`20is`20stored`20purely`20for`20whatever`20purposes`20you Xcan`20think`20of. X`5CIPitem`7B`7Bend`7D`7D XThis`20line`20is`20required`20to`20separate`20people`20records.`20`20If`20you Xhand`20enter`20a`20record,`20you`20must`20be`20sure`20to`20put`20an`20end`20ma Vrker Xor`20your`20record`20will`20merge`20with`20the`20next`20one,`20which`20is Xnot`20what`20you`20want. X`5Cend`7BIPlist`7D`5Cpar X`5Cshead`7BSTARTING`20A`20GAME`7D XTo`20start`20a`20game,`20you`20must`20use`20the X`7B`5Cit`20--start`7D Xcommand`20line`20argument,`20along`20with`20the`20e--mail`20address`20of Xthe`20person`20you`20wish`20to`20play`20with. XFor`20example, X`5Cnofill X`20`20`20`20`20ldb`20--start`20mybuddy@back.gammon.com X`5Cfill XIf`20you`20want`20to`20play`20'w',`20and`20make`20your`20opponent`20play X'b',`20use`20the`20command X`5Cnofill X`20`20`20`20`20ldb`20--color`20wb`20--start`20black@blah.blah.blah X`5Cfill XSee`20the XOPTIONS`20section`20for`20more`20details`20on`20the`20available Xcommand`20line`20arguments. X`7B`5Cit`20Ldb`7D Xwill`20not`20allow`20you`20to`20play`20with`20yourself,`20but Xthat's`20ok`20because`20you'd`20probably`20lose. X`5Cpar XWhen`20you`20start`20a`20game,`20ldb`20sends`20your`20e--mail`20address Xto`20your`20opponent,`20along`20with Xyour`20opening`20roll.`20`20When`20your`20opponent`20receives Xyour`20message,`20his`20ldb`20will`20roll`20his`20opening`20roll,`20and Xdecide`20who`20won.`20`20If`20you`20won,`20his`20ldb`20will`20send`20your`20ld Vb Xa`20message`20to`20that`20effect,`20and`20the`20board`20will`20come`20up Xon`20your`20screen`20with`20that`20roll`20in`20your`20move`20block.`20`20If V`20he Xwon,`20he`20will`20use`20the`20opening`20roll`20and`20his`20ldb`20will`20send Xyour`20ldb Xa`20message`20telling`20you`20how`20he`20moved.`20`20Either`20way,`20the`20gam Ve`20is`20off Xand`20running. X`5Cpar XIf,`20by`20unfortunate`20chance,`20the`20opening`20roll`20is`20a`20tie, Xyour`20opponent's`20ldb`20will`20send Xyour`20ldb`20a`20message`20to`20that`20effect. XThis`20will`20cause`20a`20new`20opening`20roll`20sequence`20as Xdescribed`20above. XA`20message`20will`20be`20printed`20telling`20you Xwhat's`20going`20on; Xjust`20keep`20feeding`20the`20incoming`20messages`20to`20ldb,`20and Xit`20will`20take`20care`20of`20everything. X`5Cpar X`5Cshead`7BPLAYING`20A`20GAME`7D XWhen`20it`20is`20your`20turn,`20the`20game`20will`20be`20displayed`20on`20your V`20screen, Xand`20you`20will`20be Xfaced`20with`20three`20options:`20Roll,`20Double,`20or`20Concede. XUnless`20you`20are`20very`20cocky,`20I`20would`20not`20suggest`20doubling Xat`20this`20point.`20`20You`20could`20always`20concede,`20but`20I`20really Xthink`20that`20would`20be`20selling`20yourself`20short. XSo`20you`20should`20choose`20"Roll". XJust`20press`20"r",`20and`20watch`20your`20roll`20appear`20on Xyour`20move`20block`20(along`20the`20right`20side`20of`20the`20screen,`20under V`20the Xword`20"You").`20`20You`20should`20see`20two`20numbers`20appear`20(four`20if V`20you Xrolled`20doubles),`20and`20the`20word`20UNUSED`20beside`20them. XDecide`20which`20of`20the`20rolls`20you`20want`20to`20use`20first,`20and`20pre Vss Xthe`20number`20of`20that`20roll.`20`20For`20example,`20say`20you`20rolled X1`206,`20and`20you`20want`20to`20move`20the`20obvious`208--7,`2013--7`20to Xmake`20your`20bar`20point. XJust`20hit`20"6".`20`20Notice`20the`20cursor`20jump`20up`20to`20your`20move V`20block,`20beside Xthe`20"6"`20roll?`20`20It`20is`20waiting`20for`20you`20to`20enter`20the`20poin Vt`20you`20want Xto`20move`20from.`20`20Press`20"1"`20"3"`20(don't`20hit`20return).`20`20You V`20should`20see Xa`20piece`20move`20from`2013`20to`207,`20and`20this`20fact`20will`20be`20refle Vcted`20in Xyour`20move`20block`20as`20well.`20`20Now,`20press`20"1".`20`20Again`20the`20c Vursor Xjumps`20to`20the`20move`20block,`20and`20you`20type`20"8". XThe`20second`20entry`20in`20the`20move`20block Xreflects`20this`20move,`20as`20does`20the`20board.`20`20Happy?`20`20If`20not, V`20press X"r";`20this`20will`20reset`20your`20rolls`20to`20UNUSED`20and`20put Xthe`20board`20back`20to`20how`20it`20was`20before`20you`20moved, Xand`20then`20you`20can`20enter`20some`20different`20moves.`20`20Otherwise,`20h Vit`20"s" X(not`20"q"!) Xto`20send`20the`20move.`20`20The`20cursor`20will`20jump`20down`20to`20the`20me Vssage`20area, Xwhere`20you`20get`20a`20chance`20to`20enclose`20a`20message`20to`20your`20oppo Vnent, Xperhaps`20to`20gloat`20over`20the`20great`20move`20you`20just`20made. XYou`20only`20get`202`20lines`20of`2056`20characters,`20so`20keep`20it`20short. V`20`20When Xyou`20are`20done,`20press`20$<$return$>$.`20`20Your`20move`20is`20on`20its`20w Vay! X`5Cpar XThere`20are`20three`20shortcuts`20you`20can`20use Xafter`20you`20have`20entered`20your`20first`20move: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B1.`7D`7D XYou`20can`20press`20$<$return$>$,`20which`20will`20"repeat"`20your`20last`20mo Vve. XThat`20is,`20your`20next`20remaining`20roll`20will`20move`20from`20the`20same Xpoint`20as`20your`20last`20one`20moved`20from.`20`20This`20is`20handy`20when Xusing`20doubles`20to`20move`20more`20than`20one`20piece`20from`20the`20same V`20point. X`5CIPitem`7B`7B2.`7D`7D XYou`20can`20press`20$<$space$>$,`20which`20will`20"continue"`20your`20last`20m Vove. XThat`20is,`20your`20next`20remaining`20roll`20will`20move`20from`20the Xpoint`20your`20last`20move`20ended`20on. X`5CIPitem`7B`7B3.`7D`7D XYou`20can`20press`20"p",`20which`20will`20attempt`20to`20make`20the`20point V`20your Xlast`20move`20ended`20on.`20`20In`20our`201`206`20example`20above,`20you`20cou Vld`20have Xjust`20hit`20"p"`20after`20you`20moved`2013--7,`20and`20ldb`20would`20have`20f Vigured Xout`20that`20to`20make`20the`207`20point`20with`20the`20remaining`20roll`20of V`201, Xit`20would`20have`20to`20move`20a`20piece`20from`20the`208`20point. X`5Cend`7BIPlist`7D`5Cpar XIn`20addition,`20there`20is`20one`20more`20shortcut`20that`20may`20be`20used Xwith`20any`20roll.`20`20If`20you`20want`20to`20use`20a`20roll`20to`20bear`20of Vf Xa`20piece,`20you`20can`20just`20hit`20"o".`20`20Ldb`20will`20locate`20the Xpoint`20(if`20any)`20from`20which`20pieces`20may`20be`20legally`20borne`20off Xby`20the`20next`20unused`20roll,`20and`20make`20that`20move`20automatically. XYou`20can`20also`20select`20a`20roll,`20then`20hit`20"o". X`5Cpar XIf`20you`20use`20your`20moves,`20hit`20"Send",`20and`20start`20to`20enter`20yo Vur Xmessage,`20then`20realize`20you`20made`20a`20mistake,`20you`20can`20press XESC`20to`20get`20out`20of`20send`20and`20back`20into`20the`20game,`20where Xyou`20can`20use`20"Reset"`20and`20re--enter`20your`20moves. X`5Cpar X`5Cshead`7BDOUBLING`7D XIf`20you`20decide`20to`20double,`20just`20choose`20"Double"`20instead`20of X"Roll".`20`20You`20will`20get`20to`20enclose`20a`20message,`20just`20like`20wh Ven Xyou`20send`20a`20move,`20then`20your`20message`20gets`20sent.`20`20Once`20you V`20have Xdoubled,`20you`20cannot`20double`20again`20until`20your`20opponent`20does`20so V, Xso`20ldb`20automatically`20selects`20"Roll"`20and`20sends`20you`20to`20the Xnext`20menu.`20`20If`20you`20don't`20like`20this,`20you`20can`20disable`20it V`20by Xsetting X`7B`5Cit`20autoroll=no`7D Xin`20.ldbrc. X`5Cpar XIf`20your`20opponent`20doubles,`20you`20will`20see`20a`20message`20just`20unde Vr Xthe`20board`20to`20that`20effect,`20and`20a`20menu`20will`20come`20up Xallowing`20you`20to`20Accept`20or`20Decline`20the`20double. XDeclining`20the`20double`20means`20you`20lose`20the`20game`20for`20the Xcurrent`20game`20value.`20`20Accepting`20means`20that`20the`20game Xcontinues,`20but`20its`20value`20is`20doubled.`20`20The`20current Xgame`20value`20is`20shown`20to`20the`20left`20of`20the`20board.`20`20After Xyou`20accept,`20you`20should`20see`20this`20display`20move`20next`20to`20your Xhome`20board,`20indicating`20that`20you`20own`20the`20doubling`20cube. X`5Cpar XIf`20the`20Crawford`20rule`20is`20in`20effect,`20and`20the`20either Xplayer`20is`20within`201`20point`20of`20winning`20the`20match, Xdoubling`20is`20illegal,`20and`20will`20result`20in`20an`20error`20message. X`5Cpar X`5Cshead`7BBOARDS`7D X`7B`5Cit`20Ldb`7D Xmaintains`20three`20board`20images`20at`20all`20times.`20`20These`20are: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7B1`7D`7D XThe`20board`20before`20your`20opponent's`20last`20move. XIt`20is`20for`20display`20purposes`20only,`20so`20you`20can`20see`20your Xopponent's`20move`20"before`20and`20after".`20`20The`20pieces`20your`20opponen Vt Xis`20going`20to`20move`20are`20highlighted. X`5CIPitem`7B`7B2`7D`7D XThe`20board`20after`20your`20opponent's`20last`20move. XIt`20shows`20the`20condition`20of`20the Xboard`20after`20your`20opponent's`20last`20move,`20with`20the`20pieces`20he Xmoved`20highlighted. X`5CIPitem`7B`7B3`7D`7D XThe`20current`20board.`20`20This`20is`20the`20"real"`20board`20that`20shows V`20the Xcurrent`20state`20of`20the`20game. XNothing`20is`20highlighted. X`5Cend`7BIPlist`7D`5Cpar XBy`20default,`20ldb`20displays`20the`20Current`20board`20at`20all`20times.`20 V`20If Xyou`20want`20to`20see`20the`20other`20boards,`20use`20the`20Board`20command X(provided`20it`20is`20in`20the`20current`20menu).`20`20This`20will`20cycle`20t Vhrough Xthe`20three`20boards`20in`20the`20order`20they`20are`20listed`20above.`20`20Th Ve`20second Xline`20of`20the`20screen`20tells`20you`20which`20board`20is`20displayed`20(nea Vr`20the`20left).`20`20When Xyou`20roll,`20ldb`20automatically`20switches`20to`20the`20current`20board`20if V Xit`20is`20not`20already`20up.`20`20You`20can`20set`20which`20of`20these`20thre Ve`20boards Xis`20initially`20displayed`20via`20the X`7B`5Cit`20initialboard`7D Xsetting`20in`20.ldbrc. X`5Cpar X`5Cshead`7BENTERING`20COMMENTS`7D XWhenever`20you`20send`20a`20move`20to`20your`20opponent,`20you`20are Xgiven`20the`20opportunity`20to`20enclose`20a`20two`20line`20comment. XWhile`20entering`20your`20comment,`20certain`20keys`20have`20special`20meaning V. XThese`20are: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7BBS/DEL`7D`7D XThe`20backspace`20and`20delete`20(or`20rubout)`20keys`20both`20erase`20the Xlast`20character`20typed.`20`20You`20can`20backspace`20from`20one`20line`20to Xthe`20previous`20one. X`5CIPitem`7B`7B`5C`5E`7B`7DW/`5C`5E`7B`7DB`7D`7D XThe`20`5C`5E`7B`7DW`20and`20`5C`5E`7B`7DB`20(control-W`20and`20control-B)`20ke Vys`20both`20erase`20the Xlast`20word`20typed.`20`20Words`20are`20delimited`20by`20spaces. X`5CIPitem`7B`7B`5C`5E`7B`7DX/`5C`5E`7B`7DU`7D`7D XThe`20`5C`5E`7B`7DX`20and`20`5C`5E`7B`7DU`20(control-X`20and`20control-U)`20ke Vys`20erase`20the Xcurrent`20line`20and`20move`20to`20the`20end`20of`20the`20previous`20line, Xor`20to`20the`20beginning`20of`20the`20first`20line`20if`20used`20on`20the Xfirst`20line. X`5CIPitem`7B`7BRETURN`7D`7D XIf`20you`20press`20return`20on`20an`20empty`20line,`20or`20on`20the`20last`20l Vine, Xthe`20comment`20is`20finished.`20`20Otherwise,`20the`20cursor`20moves`20to`20t Vhe Xnext`20line. X`5CIPitem`7B`7BESC`7D`7D XThe`20escape`20key`20aborts`20the`20operation`20(e.g.`20Send),`20restores Xthe`20previous`20comment,`20and`20returns`20to`20the`20previous`20menu. XThis`20allows`20you`20to`20change`20your`20mind`20and`20back`20out`20of Xan`20operation. X`5Cend`7BIPlist`7D`5Cpar XAll`20other`20keys`20are`20entered`20into`20the`20comment.`20`20When`20you`20r Veach Xthe`20end`20of`20a`20line,`20ldb`20word-wraps`20to`20the`20next`20line,`20or V`20beeps Xif`20you`20are`20at`20the`20end`20of`20the`20last`20line.`20`20Note`20that`20t Vhe Xsuperkey`20is`20still`20active`20while`20entering`20comments,`20and Xcannot`20be`20entered`20into`20a`20comment. X`5Cpar X`5Cshead`7BCONTROLLING`20A`20GAME`7D XThe X`7B`5Cit`20--control`7D Xoption`20permits`20you`20to`20control`20your`20games`20in Xcertain`20ways.`20`20Each`20of`20your`20current`20games`20are Xdisplayed,`20one`20at`20a`20time,`20just`20as`20they`20are`20when`20you Xare`20playing,`20allowing`20you`20to`20perform`20any`20of`20the Xfunctions`20on`20the`20control`20menu. XThe`20control`20menu`20has`20the`20following`20commands: X`5Cbegin`7BIPlist`7D X`5CIPitem`7B`7BInvert`7D`7D XThis`20allows`20you`20to`20invert`20the`20board`20for`20this`20game.`20`20The Xboard`20will`20invert`20immediately`20on`20your`20screen,`20so`20you`20can Xsee`20if`20you`20like`20it.`20`20Pressing X`7B`5Cit`20Invert`7D Xagain`20will`20put`20it`20back`20to`20normal.`20`20Inverting`20the`20board`20d Voes Xnot`20affect`20the`20point`20numbering`20or`20the`20color`20you`20play, Xit`20merely`20draws`20the`20board`20with`20the`20low-numbered`20points`20at Xthe`20top`20of`20the`20screen`20rather`20than`20the`20bottom.`20`20You`20may V`20find Xit`20easier`20to`20make`20all`20of`20your`20games`20play`20a`20certain`20direc Vtion. X`5CIPitem`7B`7BResend`7D`7D XFrom`20time`20to`20time,`20messages`20may`20be`20lost`20due`20to`20faulty`20ma Vilers Xor`20human`20error.`20`20If`20your`20last`20message`20gets`20lost,`20you`20can V Xregenerate`20it`20with`20the X`7B`5Cit`20Resend`7D Xcommand.`20`20There`20is`20no`20harm`20in`20regenerating`20messages,`20as Xldb`20will`20ignore`20duplicate`20messages.`20`20If`20you`20and`20your`20oppon Vent Xhave`20forgotten`20whose`20move`20it`20is,`20the`20easiest`20way`20to`20get V`20going Xagain`20is`20for`20both`20of`20you`20to`20resend`20your`20last`20message.`20 V`20The`20one Xthat`20got`20lost`20will`20be`20accepted,`20and`20the`20game`20will`20be`20off V Xand`20running`20again.`20`20So`20that`20you`20can`20resend`20the`20last`20move V Xof`20a`20game,`20completed`20games`20are`20kept`20in`20your`20.ldbdata`20for X1`20week,`20after`20which`20they`20are`20deleted.`20`20They`20may`20be`20delet Ved Xsooner`20with`20the`20Delete`20Game`20command.`20`20Note`20also`20that Xgames`20that`20have`20been`20waiting`20for`20your`20opponent`20for`20more`20th Van X1`20week`20have`20an`20automatic`20resend`20performed`20whenever`20you`20run V`20ldb. X`5CIPitem`7B`7BGet`5C`20Resend`7D`7D XThis`20allows`20you`20to`20send`20a`20message`20to`20your`20opponent's Xldb`20requesting`20a`20resend.`20`20This`20saves`20your`20opponent`20the Xtrouble`20of`20getting`20into X`7B`5Cit`20--control,`7D Xfinding`20which`20game`20you're`20talking`20about,`20and`20resending. XInstead,`20he`20can`20just`20feed`20your`20resend`20request`20message`20into Xldb`20like`20it`20was`20a`20regular`20move.`20`20Version`201.0`20of`20ldb Xnot`20only`20does`20not`20support`20this`20feature,`20but`20will`20crash Xif`20a`20resend`20request`20packet`20is`20sent`20to`20it,`20so X`7B`5Cit`20--control`7D Xwill`20check`20to`20make`20sure`20your`20opponent`20is`20running Xthe`20proper`20version Xbefore`20sending`20the`20message. X`5CIPitem`7B`7BScreen`5C`20Dump`7D`7D XThis`20command`20makes`20an`20exact`20copy`20of`20the`20screen`20in`20the Xfile`20"ldb`5C_screen.dmp".`20`20This`20could`20be`20useful`20if`20you Xwant`20to`20mail`20the`20board`20to`20someone`20or`20print`20it`20out. X`5CIPitem`7B`7BDelete`5C`20Game`7D`7D XThis`20command`20marks`20a`20game`20for`20deletion.`20`20The`20game`20is`20not V`20deleted Xuntil`20you`20quit,`20and`20you`20can`20undelete`20it`20by`20pressing`20D`20ag Vain. XNormally,`20you`20should`20not`20delete`20a`20game`20in`20this`20manner, Xyou`20should`20play`20until`20someone`20wins`20or`20concedes.`20`20The X`7B`5Cit`20Delete`5C`20Game`7D Xcommand`20can`20be`20used`20to`20get`20rid`20of`20games`20where`20your`20oppon Vent Xdoesn't`20answer`20his`20mail,`20or`20doesn't`20want`20to`20play,`20etc. X`5CIPitem`7B`7BNext`5C`20Game`7D`7D XThe`20next`20game`20is`20displayed.`20`20If`20there`20is`20no`20next`20game, Xthis`20choice`20is`20equivalent`20to X`7B`5Cit`20Quit.`7D X`5CIPitem`7B`7BQuit`7D`7D XThis`20allows`20you`20to`20exit`20from X`7B`5Cit`20--control`20.`7D XIf`20you`20made`20any`20changes`20to`20your`20games,`20you`20will`20be`20given V`20the`20opportunity Xto`20save`20these`20changes,`20then`20ldb`20will`20exit. X`5Cend`7BIPlist`7D`5Cshead`7BVMS`20NOTES`7D X`5Cpar XVMS`20users`20have`20a`20few`20unique`20considerations: X`5Cpar XOn`20VMS,`20the`20default`20file`20names`20are`20changed`20from`20.ldb*`20to V`20ldb.*.`20`20This Xgroups`20all`20ldb`20files`20together. X`5Cpar XVMS`20mail`20doesn't`20append Xmessages`20to`20an`20existing`20file,`20it`20creates`20new`20versions. XTo`20accommodate`20this,`20vms-compiled`20executables`20will`20search`20all V`20versions Xof`20a`20file`20by`20default.`20`20This`20applies`20to`20files`20specified`20o Vn`20the`20command Xline`20as`20well`20as`20the`20file`20specified`20in`20your`20ldb.rc.`20`20You V`20can`20disable Xthis`20in`20either`20case`20by`20specifying`20a`20version`20number,`20or`20by V`20specifying Xversion`20number`200`20to`20get`20the`20most`20current`20version.`20`20The`20d Vefault`20setting Xin`20ldb.rc`20is`20to`20scan`20sys`5C$login:ldb.rcv;*.`20`20You`20might`20want V`20to`20change Xthis`20to`20ldb.txt;*,`20since`20that`20is`20the`20default`20extension`20added V`20by Xmail`20when`20you`20extract`20a`20file.`20`20If`20you`20use`20multiple`20versi Vons,`20you Xshould`20be`20careful`20not`20to`20PURGE`20until`20after`20you`20have`20run V`20ldb. X`5Cpar XIf`20you`20have`20the`20Eunice`20package,`20ldb`20will`20compile`20and`20run V`20under`20it`20fine, Xbut`20any`20files`20created`20by`20the`20Eunice--compiled`20version X(most`20notably`20the`20games`20file) Xwill`20be`20incompatible`20with`20the`20VAX`20C--compiled`20version.`20`20Use V`20the Xunixtovms`20command`20to`20convert. X`5Cpar XLdb`20is`20available`20in`20vms`5C_share`20format`20with`20the`20manual`20pref Vormatted. XIf`20you`20have`20MMS,`20you`20can`20use`20the`20makefile.vms`20provided`20by V`20entering: X`5Cnofill X`20`20`20`20`20`5C$`20rename`20makefile.vms`20makefile. X`20`20`20`20`20`5C$`20make X`5Cfill XIf`20you`20don't`20have`20a`20make`20available,`20you`20can`20compile`20with: X`5Cnofill X`20`20`20`20`20`5C$`20@makeldb X`5Cfill XAfter`20ldb`20is`20compiled,`20you'll`20probably`20want Xto`20define`20a`20symbol`20such`20as: X`5Cnofill X`20`20`20`20`20`5C$`20ldb`20:==`20`5C$dua0:`5Bme.ldb`5Dldb X`5Cfill Xso`20you`20can`20run`20it. X`5Cpar XThe`20VMS`20implementation`20spawns`20a`20subprocess`20with`20no`20command`20w Vhen`20the Xsuperkey`20is`20pressed.`20`20You`20can`20enter`20LOGOUT`20or`20EOJ`20to`20ret Vurn`20to`20the Xgame.`20`20If`20you`20define`20a`20command`20to`20run`20when`20the`20superkey V`20is`20pressed, Xthe`20command`20will`20be`20run,`20but`20you`20will`20still`20need`20to`20logo Vut`20of Xthe`20subprocess`20to`20return`20to`20ldb. X`5Cpar X`5Cshead`7BBUGS`7D X`5Cpar XA`20game`20file`20created`20by`20ldb`20under`20Eunice`20must`20be`20run`20thro Vugh X"unixtovms"`20before`20the`20VAX--C`20ldb`20can`20read`20it. X`5Cpar XThe`20"Concede"`20command`20violates`20the`20rules,`20in`20that`20it`20allows V`20one Xplayer`20to`20unilaterally`20settle`20the`20game`20for`20the`20current`20game V`20value. XThis`20could`20be`20used`20to`20avoid`20an`20impending`20gammon. X`5Cpar XThe`20superkey`20function`20only`20works`20when`20ldb`20is`20waiting`20for`20a V`20key. XIf`20ldb`20is`20doing`20something`20time-consuming,`20such`20as`20calculating Xlegal`20moves,`20the`20superkey`20will`20not`20work`20until`20the`20calculatio Vn Xis`20complete. X`5Cpar XThere`20should`20be`20a`20way`20to`20play`20interactively`20(using`20socket V`20connections, Xfor`20example),`20rather`20than`20via`20e--mail. X`5Cpar XUnder`20Eunice,`20there`20is`20a`20bug`20when`20delmail`20is`20enabled, Xreceived`20mail`20is`20in`20a`20file`20with`20multiple`20versions, Xand`20these`20versions`20are`20entered`20on`20the`20command`20line X(as`20opposed`20to`20being`20specified`20by`20a`20pattern`20in`20.ldbrc). XEunice`20handles`20multiple`20versions`20by`20appending`20a`20dot`20and`20the V`20version Xnumber`20to`20all`20versions`20of`20the`20file`20but`20the`20newest`20version, V Xto`20which`20it`20appends`20nothing.`20`20When`20the`20most`20recent`20version V`20is`20deleted, Xthe`20next`20older Xversion`20becomes`20the`20most`20recent,`20and`20has`20no`20version`20suffix Xattached.`20`20This`20file`20will`20be`20skipped,`20since`20its`20name`20chang Ved Xbetween`20the`20time`20the`20file`20list`20was`20created`20and`20the`20file V`20is`20opened. XAll`20other`20files`20will`20be`20scanned`20properly.`20`20The`20work-around V`20for`20this Xis`20to`20not`20use`20a`20pattern`20like`20'ldb`20ldb.txt*'`20on`20the`20comma Vnd`20line Xto`20specify`20all`20versions`20of`20the`20file,`20but`20rather`20use`20'ldb V`20ldb.txt.*`20ldb.txt' Xso`20that`20the`20most`20recent`20version`20is`20scanned`20(and`20thus`20delet Ved)`20last. XAlternatively,`20the`20pattern`20can`20be`20quoted`20so`20that`20ldb`20interpr Vets Xit`20instead`20of`20the`20shell. X`5Cpar XThe X`7B`5Cit`20--myaddr`7D Xcommand`20line`20option`20should`20override`20the Xmyaddr`20line`20in`20the`20people`20file. X`5Cpar XVersion`201.0`20of`20ldb`20only`20allowed`20the`20colors`20red, Xwhite,`20and`20black,`20represented`20by`20r,`20w,`20and`20b, Xrespectively.`20`20Although`20ldb`201.0`20will`20allow`20games Xto`20be`20started`20and`20played`20correctly`20with`20different Xcolors,`20the`20move`20blocks`20will`20have`20the`20string`20"*BAD`20COLOR*" Xdisplayed`20where`20the`20color`20should`20be,`20making`20it`20difficult Xto`20figure`20out`20which`20color`20you`20are`20playing.`20`20Upgrading Xto`20a`20newer`20ldb`20will`20fix`20this.`20`20Nevertheless,`20if`20you Xare`20playing`20someone`20who`20is`20using`20ldb`201.0,`20you`20may`20want Xto`20restrict`20your`20color`20choices`20to`20r,`20w,`20and`20b. X`5Cpar XThe`20Crawford`20rule`20option`20may`20be`20incorrect.`20`20As`20implemented, Xit`20prevents`20doubling`20for`20any`20game`20where`20either`20player Xis`20within`20one`20point`20of`20winning`20the`20match.`20`20Some`20people Xplay`20the`20Crawford`20rule`20such`20that`20doubling`20is`20only Xillegal`20for`20the`20first`20game`20that`20a`20player Xis`20withing`20one`20point`20of`20winning;`20if`20that`20player Xdoes`20not`20win`20the`20Crawford`20rule`20game, Xdoubling`20for`20subsequent`20games`20is`20allowed. XAn`20authoritative`20description`20of`20this`20rule`20is`20needed. X% X%`20end`20of`20input`20file:`20ldb.man X%-------------------------------------------------- X`5Cend`7Bdocument`7D $ call unpack LDB.TEX;1 1031385950 "" $ v=f$verify(v) $ exit