static char sccsid
[] = " subs.c 4.2 82/11/27 ";
static char plred
[] = "Player is red, computer is white.";
static char plwhite
[] = "Player is white, computer is red.";
static char nocomp
[] = "(No computer play.)";
"Usage: backgammon [-] [n r w b pr pw pb t3a]\n",
"\t-\tgets this list\n\tn\tdon't ask for rules or instructions",
"\tr\tplayer is red (implies n)\n\tw\tplayer is white (implies n)",
"\tb\ttwo players, red and white (implies n)",
"\tpr\tprint the board before red's turn",
"\tpw\tprint the board before white's turn",
"\tpb\tprint the board before both player's turn",
"\tterm\tterminal is a term",
"\tsfile\trecover saved game from file",
while ( (*s1
++ = *s2
++) != '\0');
if (write(1,outbuff
,BUFSIZ
) != BUFSIZ
)
errexit ("addbuf (write):");
if (write (1,outbuff
,buffnum
) != buffnum
)
errexit ("buflush (write):");
if (c
== '\033' || c
== '\015')
if (c
>= 'a' && c
<= 'z')
trace
= fopen ("bgtrace","w");
fprintf (trace
,"writel: \"");
if (*s
< ' ' || *s
== '\177')
fprintf (trace
,"^%c",(*s
)^0100);
writel ("White's roll: ");
for (i
= 4; i
> 0; i
--) {
writel (" doubled last.");
case -1: /* player is red */
case 0: /* player is both colors */
case 1: /* player is white */
writel ("Are you sure you want to quit?");
writel ("Would you like to save this game?");
register char special
; /* special response */
while ( (c
= readc()) != 'Y' && c
!= 'N') {
if (special
&& c
== special
)
/* process arguments here. dashes are ignored, nbrw are ignored
if the game is being recovered */
/* don't ask if rules or instructions needed */
/* player is both read and white */
/* print board after move according to following character */
if (s
[0][2] != 'r' && s
[0][2] != 'w' && s
[0][2] != 'b')
if (s
[0][2] == '\0') { /* get terminal caps */
tflag
= getcaps (&s
[0][2]);
board
[6] = board
[13] = -5;
board
[12] = board
[19] = 5;
/* go to bottom of screen */
/* fix terminal status */
while (c
< '1' || c
> '6')
while (c
< '1' || c
> '6')