1:
2: /*
3: * Copyright (c) 1980 Regents of the University of California.
4: * All rights reserved. The Berkeley software License Agreement
5: * specifies the terms and conditions for redistribution.
6: *
7: * @(#)back.h 5.1 (Berkeley) 5/29/85
8: */
9:
10: #include <sgtty.h>
11:
12: #define rnum(r) (random()%r)
13: #define D0 dice[0]
14: #define D1 dice[1]
15: #define swap {D0 ^= D1; D1 ^= D0; D0 ^= D1; d0 = 1-d0;}
16:
17: /*
18: *
19: * Some numerical conventions:
20: *
21: * Arrays have white's value in [0], red in [1].
22: * Numeric values which are one color or the other use
23: * -1 for white, 1 for red.
24: * Hence, white will be negative values, red positive one.
25: * This makes a lot of sense since white is going in decending
26: * order around the board, and red is ascending.
27: *
28: */
29:
30: char EXEC[]; /* object for main program */
31: char TEACH[]; /* object for tutorial program */
32:
33: int pnum; /* color of player:
34: -1 = white
35: 1 = red
36: 0 = both
37: 2 = not yet init'ed */
38: char args[100]; /* args passed to teachgammon and back */
39: int acnt; /* length of args */
40: int aflag; /* flag to ask for rules or instructions */
41: int bflag; /* flag for automatic board printing */
42: int cflag; /* case conversion flag */
43: int hflag; /* flag for cleaning screen */
44: int mflag; /* backgammon flag */
45: int raflag; /* 'roll again' flag for recovered game */
46: int rflag; /* recovered game flag */
47: int tflag; /* cursor addressing flag */
48: int rfl; /* saved value of rflag */
49: int iroll; /* special flag for inputting rolls */
50: int board[26]; /* board: negative values are white,
51: positive are red */
52: int dice[2]; /* value of dice */
53: int mvlim; /* 'move limit': max. number of moves */
54: int mvl; /* working copy of mvlim */
55: int p[5]; /* starting position of moves */
56: int g[5]; /* ending position of moves (goals) */
57: int h[4]; /* flag for each move if a man was hit */
58: int cturn; /* whose turn it currently is:
59: -1 = white
60: 1 = red
61: 0 = just quitted
62: -2 = white just lost
63: 2 = red just lost */
64: int d0; /* flag if dice have been reversed from
65: original position */
66: int table[6][6]; /* odds table for possible rolls */
67: int rscore; /* red's score */
68: int wscore; /* white's score */
69: int gvalue; /* value of game (64 max.) */
70: int dlast; /* who doubled last (0 = neither) */
71: int bar; /* position of bar for current player */
72: int home; /* position of home for current player */
73: int off[2]; /* number of men off board */
74: int *offptr; /* pointer to off for current player */
75: int *offopp; /* pointer to off for opponent */
76: int in[2]; /* number of men in inner table */
77: int *inptr; /* pointer to in for current player */
78: int *inopp; /* pointer to in for opponent */
79:
80: int ncin; /* number of characters in cin */
81: char cin[100]; /* input line of current move
82: (used for reconstructing input after
83: a backspace) */
84:
85: char *color[];
86: /* colors as strings */
87: char **colorptr; /* color of current player */
88: char **Colorptr; /* color of current player, capitalized */
89: int colen; /* length of color of current player */
90:
91: struct sgttyb tty; /* tty information buffer */
92: int old; /* original tty status */
93: int noech; /* original tty status without echo */
94: int raw; /* raw tty status, no echo */
95:
96: int curr; /* row position of cursor */
97: int curc; /* column position of cursor */
98: int begscr; /* 'beginning' of screen
99: (not including board) */
100:
101: int getout(); /* function to exit backgammon cleanly */
Defined variables
EXEC
defined in line
30; used 1 times
TEACH
defined in line
31; used 1 times
acnt
defined in line
39; used 7 times
aflag
defined in line
40; used 6 times
args
defined in line
38; used 9 times
bar
defined in line
71; used 32 times
bflag
defined in line
41; used 7 times
board
defined in line
50; used 99 times
- in /usr/src/games/backgammon/allow.c line
28,
77
- in /usr/src/games/backgammon/board.c line
50-54(3),
86-90(3),
136-140(3)
- in /usr/src/games/backgammon/check.c line
101
- in /usr/src/games/backgammon/extra.c line
104,
170-177(4),
194-196(2),
203,
214(3)
- in /usr/src/games/backgammon/fancy.c line
113-121(6),
132-140(6),
147,
229-242(9),
252-265(9)
- in /usr/src/games/backgammon/main.c line
489
- in /usr/src/games/backgammon/move.c line
79-83(2),
177-180(2),
213,
360,
384-389(2),
395,
401,
429,
476
- in /usr/src/games/backgammon/odds.c line
59,
67-77(5)
- in /usr/src/games/backgammon/one.c line
23-25(2),
42-46(4),
54,
103,
121-123(2),
134-135(2)
- in /usr/src/games/backgammon/save.c line
93(2),
126(2)
- in /usr/src/games/backgammon/subs.c line
357-363(9)
- in /usr/src/games/backgammon/tutor.c line
39
cflag
defined in line
42; used 7 times
cin
defined in line
81; used 4 times
colen
defined in line
89; used 3 times
color
defined in line
85; used 12 times
cturn
defined in line
58; used 94 times
- in /usr/src/games/backgammon/allow.c line
30-32(2),
47,
68-71(3),
77
- in /usr/src/games/backgammon/check.c line
32,
69,
94
- in /usr/src/games/backgammon/extra.c line
29-38(3),
47,
65,
72,
100,
148-149(2)
- in /usr/src/games/backgammon/main.c line
138,
263-266(2),
274,
299,
305,
324(2),
331-340(4),
346,
365-367(2),
440,
452,
475-479(2),
487-489(3),
506,
542,
551,
557
- in /usr/src/games/backgammon/move.c line
67-71(3),
91,
172,
180-185(3),
278,
293,
384-395(8)
- in /usr/src/games/backgammon/one.c line
23-25(2),
42-45(3),
54,
102-103(3),
121-123(2),
134-135(2)
- in /usr/src/games/backgammon/save.c line
97(2),
130(2)
- in /usr/src/games/backgammon/subs.c line
129,
212,
260-261(4)
- in /usr/src/games/backgammon/table.c line
78,
162,
191,
211,
243
- in /usr/src/games/backgammon/tutor.c line
26,
56,
98
curc
defined in line
97; used 51 times
- in /usr/src/games/backgammon/fancy.c line
70,
82,
91,
100,
108,
217,
226,
359,
368-375(3),
395-400(3),
425-430(4),
444-449(4),
456(3),
492,
500,
517,
525,
535,
541,
556,
584-589(4),
610-621(6),
653-663(4)
- in /usr/src/games/backgammon/save.c line
53
- in /usr/src/games/backgammon/subs.c line
160,
412
- in /usr/src/games/backgammon/table.c line
90
- in /usr/src/games/backgammon/tutor.c line
109
curr
defined in line
96; used 68 times
- in /usr/src/games/backgammon/fancy.c line
70,
82,
91,
100,
108,
217,
225,
359,
368-374(3),
394-400(3),
418-430(4),
437-449(4),
456,
467,
482,
490,
498,
507,
515,
523,
540,
556,
586-591(2),
610-621(6),
631-641(6),
653-666(5),
672-675(2)
- in /usr/src/games/backgammon/main.c line
190,
213
- in /usr/src/games/backgammon/save.c line
53
- in /usr/src/games/backgammon/subs.c line
159,
411
- in /usr/src/games/backgammon/table.c line
62,
90,
112
- in /usr/src/games/backgammon/ttext2.c line
160
- in /usr/src/games/backgammon/tutor.c line
40,
49-54(4),
108
d0
defined in line
64; used 15 times
dice
defined in line
52; used 7 times
dlast
defined in line
70; used 10 times
g
defined in line
56; used 49 times
- in /usr/src/games/backgammon/allow.c line
30-32(2),
68-73(4)
- in /usr/src/games/backgammon/check.c line
29,
87,
94
- in /usr/src/games/backgammon/move.c line
127,
139,
184-188(3),
220,
367,
410,
422
- in /usr/src/games/backgammon/one.c line
21-25(3),
39-48(5),
54-55(2),
81,
122-124(3),
135-136(2)
- in /usr/src/games/backgammon/table.c line
69,
206-222(10),
228,
256,
277
- in /usr/src/games/backgammon/tutor.c line
75
gvalue
defined in line
69; used 17 times
h
defined in line
57; used 6 times
hflag
defined in line
43; used 4 times
home
defined in line
72; used 33 times
- in /usr/src/games/backgammon/allow.c line
47,
71-73(2)
- in /usr/src/games/backgammon/extra.c line
147-148(2)
- in /usr/src/games/backgammon/main.c line
275,
285
- in /usr/src/games/backgammon/move.c line
172,
185-188(2),
388-397(5),
429,
476
- in /usr/src/games/backgammon/one.c line
25,
39-45(3),
55(2),
102-104(3),
122-124(3),
134
- in /usr/src/games/backgammon/subs.c line
262
- in /usr/src/games/backgammon/table.c line
256
- in /usr/src/games/backgammon/tutor.c line
27
in
defined in line
76; used 15 times
inopp
defined in line
78; used 7 times
inptr
defined in line
77; used 16 times
iroll
defined in line
49; used 3 times
mflag
defined in line
44; used 3 times
mvl
defined in line
54; used 35 times
mvlim
defined in line
53; used 31 times
- in /usr/src/games/backgammon/check.c line
22-27(2),
53-55(2)
- in /usr/src/games/backgammon/main.c line
302,
406,
456
- in /usr/src/games/backgammon/move.c line
104-105(2),
122,
137,
159,
218,
292,
299-301(2),
365,
409,
420
- in /usr/src/games/backgammon/table.c line
142-144(2),
207,
226,
232
- in /usr/src/games/backgammon/tutor.c line
44,
70,
76-79(3),
89-90(2)
ncin
defined in line
80; used 10 times
noech
defined in line
93; used 12 times
off
defined in line
73; used 57 times
offopp
defined in line
75; used 12 times
offptr
defined in line
74; used 24 times
- in /usr/src/games/backgammon/allow.c line
25,
72
- in /usr/src/games/backgammon/extra.c line
90
- in /usr/src/games/backgammon/main.c line
279,
289,
499
- in /usr/src/games/backgammon/move.c line
186,
434,
447,
455-456(2),
485-486(2)
- in /usr/src/games/backgammon/one.c line
22,
39,
57-61(3),
126-130(4)
- in /usr/src/games/backgammon/subs.c line
264
- in /usr/src/games/backgammon/tutor.c line
31
old
defined in line
92; used 18 times
p
defined in line
55; used 52 times
- in /usr/src/games/backgammon/allow.c line
22,
41,
47-53(3),
63-70(3),
77
- in /usr/src/games/backgammon/check.c line
87,
94,
101
- in /usr/src/games/backgammon/move.c line
125,
183,
219,
228-264(15),
366,
410,
421
- in /usr/src/games/backgammon/one.c line
21-23(2),
42,
55,
79,
121-124(2)
- in /usr/src/games/backgammon/table.c line
69,
199-202(4),
209-211(3),
228,
252,
277
- in /usr/src/games/backgammon/tutor.c line
74
pnum
defined in line
33; used 19 times
raw
defined in line
94; used 14 times
rfl
defined in line
48; used 4 times
rflag
defined in line
46; used 11 times
table
defined in line
66; used 6 times
tflag
defined in line
47; used 77 times
- in /usr/src/games/backgammon/board.c line
26,
123
- in /usr/src/games/backgammon/check.c line
23,
33,
40-44(2),
66
- in /usr/src/games/backgammon/extra.c line
39,
66
- in /usr/src/games/backgammon/main.c line
106-109(2),
121,
152,
189,
212,
230,
237,
249,
304,
310,
327,
357,
366,
412,
434-439(2),
451,
482,
492
- in /usr/src/games/backgammon/move.c line
90,
99,
133
- in /usr/src/games/backgammon/one.c line
73
- in /usr/src/games/backgammon/save.c line
35,
52,
68,
105,
112,
147
- in /usr/src/games/backgammon/subs.c line
73,
96,
136,
158,
191,
200,
243,
337-339(2),
384,
394,
410,
430,
438
- in /usr/src/games/backgammon/table.c line
61,
77,
89,
101,
110,
133,
148,
190,
237-242(2)
- in /usr/src/games/backgammon/teach.c line
59,
66,
126
- in /usr/src/games/backgammon/ttext2.c line
123,
148,
159
- in /usr/src/games/backgammon/tutor.c line
40-49(3),
60-63(2),
82,
91-96(2)
tty
defined in line
91; used 11 times
Defined macros
D0
defined in line
13; used 23 times
D1
defined in line
14; used 23 times
rnum
defined in line
12; used 11 times
swap
defined in line
15; used 9 times
Usage of this include