home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 16c / xmille.zip / XMILLE2.3 < prev    next >
Text File  |  1987-07-05  |  46KB  |  1,924 lines

  1. Article 43 of comp.sources.games:
  2. Path: ncrcce!rd1632!ncrlnk!ncrcae!hubcap!gatech!mcnc!seismo!rutgers!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games-request
  3. From: games-request@tekred.TEK.COM
  4. Newsgroups: comp.sources.games
  5. Subject: v01i069:  xmille - mille bournes game for X-windows, Part02/03
  6. Message-ID: <1359@tekred.TEK.COM>
  7. Date: 30 Jun 87 17:29:15 GMT
  8. Expires: 30 Jul 87 17:28:03 GMT
  9. Sender: billr@tekred.TEK.COM
  10. Lines: 1909
  11. Approved: billr@tekred.TEK.COM
  12.  
  13. Submitted by: keithp@copper.TEK.COM (Keith Packard)
  14. Comp.sources.games: Volume 1, Issue 69
  15. Archive-name: xmille/Part02
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 2 (of 3)."
  25. # Contents:  Makefile animate.c background.h card.h color.h extern.c
  26. #   init.c mille.c mille.h misc.c move.c print.c roll.c save.c table.c
  27. #   types.c ui.h varpush.c
  28. # Wrapped by billr@tekred on Mon Jun 29 17:24:36 1987
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f Makefile -a "${1}" != "-c" ; then 
  31.   echo shar: Will not over-write existing file \"Makefile\"
  32. else
  33. echo shar: Extracting \"Makefile\" \(1945 characters\)
  34. sed "s/^X//" >Makefile <<'END_OF_Makefile'
  35. X# @(#)Makefile    1.2    ULTRIX    6/29/84
  36. X#
  37. X# mille bourne game makefile
  38. X#
  39. X# @(#)Makefile    1.7 (Berkeley) 8/14/83
  40. X#
  41. XDESTROOT=
  42. XHEADERS=mille.h
  43. XCFILES=    comp.c end.c extern.c init.c mille.c misc.c move.c print.c \
  44. X    roll.c save.c types.c varpush.c ui.c drawcard.c animate.c
  45. XOBJS=    comp.o end.o extern.o init.o mille.o misc.o move.o print.o \
  46. X    roll.o save.o types.o varpush.o ui.o drawcard.o animate.o
  47. XPOBJS=    comp.po end.po extern.po init.po mille.po misc.po move.po \
  48. X    roll.po print.po save.po types.po varpush.po ui.po drawcard.po animate.po
  49. XCRL=    
  50. XL=    control/control.a cards/cardlib.a -lX -lm
  51. XLIBS=    ${CRL} ${L}
  52. XDEFS=    
  53. XCFLAGS=    -O ${DEFS}
  54. XBINDIR=    ${DESTROOT}/usr/games
  55. X.SUFFIXES: .po .i
  56. X
  57. X.c.po:
  58. X    rm -f x.c ; ln $*.c x.c
  59. X    ${CC} ${CFLAGS} -p -c x.c
  60. X    mv x.o $*.po
  61. X
  62. X.c.i:
  63. X    ${CC} ${CFLAGS} -P $*.c
  64. X
  65. Xa.out: ${OBJS} ${CRL} control/control.a cards/cardlib.a
  66. X    ${CC} ${CFLAGS} ${OBJS} ${LIBS}
  67. X
  68. Xmille: ${OBJS} ${CRL}
  69. X    ${CC} ${CFLAGS} -o mille ${OBJS} ${LIBS}
  70. X
  71. Xcontrol/control.a: always
  72. X    cd control; make control.a
  73. X
  74. Xcards/cardlib.a: always
  75. X    cd cards; make cardlib.a
  76. X
  77. Xalways:
  78. X
  79. Xinstall: mille
  80. X    install -c -s mille ${BINDIR}
  81. X
  82. Xpmb: ${POBJS} ../pcrlib
  83. X    ${CC} ${CFLAGS} -p -o pmb ${POBJS} ../pcrlib -ltermlib
  84. X
  85. Xmille.po: mille.c
  86. X    rm -f x.c ; ln mille.c x.c
  87. X    ${CC} ${CFLAGS} -DPROF -p -c x.c
  88. X    mv x.o mille.po
  89. X
  90. Xtable: table.o extern.o
  91. X    ${CC} ${CFLAGS} -i -o table table.o extern.o
  92. X
  93. Xanimate.o ui.o: ui.h
  94. X
  95. Xreaddump: readdump.o extern.o varpush.o
  96. X    ${CC} ${CFLAGS} -i -o readdump readdump.o extern.o varpush.o
  97. X
  98. Xctags:
  99. X    ctags ${HEADERS} ${CFILES}
  100. X    ed - tags < :ctfix
  101. X    sort tags -o tags
  102. X
  103. Xlint:
  104. X    lint -hxb ${DEFS} ${CFILES} ${L} > lint.out
  105. X
  106. Xmille.ar:
  107. X    ar ruv mille.ar Makefile tags ${HEADERS} ${CFILES}
  108. X
  109. Xtar:
  110. X    tar rvf /dev/rmt0 Makefile tags :ctfix ${HEADERS} ${CFILES}
  111. X
  112. Xlpr:
  113. X    pr Makefile ${HEADERS} ${CFILES} tags | lpr ; lpq
  114. X
  115. Xclean:
  116. X    rm -f ${OBJS} ${POBJS} core ? a.out mille
  117. X
  118. Xclobber: clean
  119. X    rm -f *.[ch] Makefile
  120. X
  121. Xsccsinfo:
  122. X    sccs info
  123. X
  124. Xsccsget:
  125. X    sccs get SCCS
  126. X
  127. X.DEFAULT:
  128. X    sccs get $<
  129. END_OF_Makefile
  130. if test 1945 -ne `wc -c <Makefile`; then
  131.     echo shar: \"Makefile\" unpacked with wrong size!
  132. fi
  133. # end of overwriting check
  134. fi
  135. if test -f animate.c -a "${1}" != "-c" ; then 
  136.   echo shar: Will not over-write existing file \"animate.c\"
  137. else
  138. echo shar: Extracting \"animate.c\" \(4533 characters\)
  139. sed "s/^X//" >animate.c <<'END_OF_animate.c'
  140. X/*
  141. X * animation
  142. X */
  143. X
  144. X# include    "mille.h"
  145. X# include    "ui.h"
  146. X# include    "card.h"
  147. X# include    <math.h>
  148. X
  149. Xanimate_move (player, orig_type, orig_arg, dest_type, dest_arg)
  150. X{
  151. X    int    ox, oy, dx, dy;
  152. X
  153. X    compute_position (player, orig_type, orig_arg, &ox, &oy);
  154. X    compute_position (player, dest_type, dest_arg, &dx, &dy);
  155. X    do_animate (ox, oy, dx, dy);
  156. X}
  157. X
  158. X# define abs(x)    ((x) < 0 ? -(x) : (x))
  159. X
  160. X# define SPEED_FACTOR    (2.5)
  161. X# define accerate(v,r)    ((v) + (0.1 * (r)))
  162. X
  163. Xstatic
  164. Xdo_animate (ox, oy, dx, dy)
  165. X{
  166. X    double    x, y;
  167. X    double    xc, yc;
  168. X    int    xd, yd;
  169. X    int    xp, yp;
  170. X    int    x1, y1, x2, y2, x3, y3, x4, y4;
  171. X    int    ix, iy;
  172. X    double    dist;
  173. X    double    rx, ry;
  174. X
  175. X    x = ox;
  176. X    y = oy;
  177. X    xd = dx - ox;
  178. X    yd = dy - oy;
  179. X    dist = sqrt ((double) xd * xd + yd * yd);
  180. X    rx = (double) xd / dist;
  181. X    ry = (double) yd / dist;
  182. X    xc = SPEED_FACTOR * rx;
  183. X    yc = SPEED_FACTOR * ry;
  184. X    xp = yp = -32767;
  185. X    XFlush ();
  186. X    while (abs(dx - x) > abs (xc) || abs(dy - y) > abs (yc)) {
  187. X        ix = x;
  188. X        iy = y;
  189. X        if (xp == -32767)
  190. X            draw_square (ix, iy, ix + WIDTH, iy + HEIGHT);
  191. X        else {
  192. X            if (xp < ix) {
  193. X                x1 = xp + WIDTH;
  194. X                x2 = ix + WIDTH;
  195. X                x3 = ix;
  196. X                x4 = ix + WIDTH;
  197. X            } else if (xp > ix) {
  198. X                x1 = ix;
  199. X                x2 = xp;
  200. X                x3 = ix;
  201. X                x4 = ix + WIDTH;
  202. X            } else {
  203. X                x1 = -32767;
  204. X                x2 = -32767;
  205. X                x3 = ix;
  206. X                x4 = ix + WIDTH;
  207. X            }
  208. X            if (yp < iy) {
  209. X                y1 = iy;
  210. X                y2 = yp + HEIGHT;
  211. X                y3 = yp + HEIGHT;
  212. X                y4 = iy + HEIGHT;
  213. X            } else if (yp > iy) {
  214. X                y1 = yp;
  215. X                y2 = iy + HEIGHT;
  216. X                y3 = iy;
  217. X                y4 = yp;
  218. X            } else {
  219. X                y1 = iy;
  220. X                y2 = iy + HEIGHT;
  221. X                y3 = -32767;
  222. X                y4 = -32767;
  223. X            }
  224. X            if (x1 != -32767 && y1 != -32767)
  225. X                draw_square (x1, y1, x2, y2);
  226. X            if (x3 != -32767 && y3 != -32767)
  227. X                draw_square (x3, y3, x4, y4);
  228. X            if (ix < xp) {
  229. X                x1 = ix + WIDTH;
  230. X                x2 = xp + WIDTH;
  231. X                x3 = xp;
  232. X                x4 = xp + WIDTH;
  233. X            } else if (ix > xp) {
  234. X                x1 = xp;
  235. X                x2 = ix;
  236. X                x3 = xp;
  237. X                x4 = xp + WIDTH;
  238. X            } else {
  239. X                x1 = -32767;
  240. X                x2 = -32767;
  241. X                x3 = xp;
  242. X                x4 = xp + WIDTH;
  243. X            }
  244. X            if (iy < yp) {
  245. X                y1 = yp;
  246. X                y2 = iy + HEIGHT;
  247. X                y3 = iy + HEIGHT;
  248. X                y4 = yp + HEIGHT;
  249. X            } else if (iy > yp) {
  250. X                y1 = iy;
  251. X                y2 = yp + HEIGHT;
  252. X                y3 = yp;
  253. X                y4 = iy;
  254. X            } else {
  255. X                y1 = yp;
  256. X                y2 = yp + HEIGHT;
  257. X                y3 = -32767;
  258. X                y4 = -32767;
  259. X            }
  260. X            if (x1 != -32767 && y1 != -32767)
  261. X                draw_square (x1, y1, x2, y2);
  262. X            if (x3 != -32767 && y3 != -32767)
  263. X                draw_square (x3, y3, x4, y4);
  264. X        }
  265. X        xp = ix;
  266. X        yp = iy;
  267. X        if (abs (dx - x) > xc)
  268. X            x += xc;
  269. X        if (abs (dy - y) > yc)
  270. X            y += yc;
  271. X        xc = accerate(xc, rx);
  272. X        yc = accerate(yc, ry);
  273. X    }
  274. X    draw_square (xp, yp, xp+WIDTH, yp+HEIGHT);
  275. X    XFlush ();
  276. X}
  277. X
  278. Xstatic
  279. Xdraw_square (x1, y1, x2, y2)
  280. X{
  281. X    XPixFill (xwindow, x1, y1, x2-x1, y2-y1, colorMap[BLACK_COLOR].pixel, 0,
  282. X        GXxor, AllPlanes);
  283. X}
  284. X
  285. Xstatic
  286. Xcompute_position (player, type, arg, xp, yp)
  287. Xint    *xp, *yp;
  288. X{
  289. X    switch (type) {
  290. X    case ANIMATE_HAND:
  291. X        switch (player) {
  292. X        case 0:
  293. X            *xp = HUM_HAND_X + (WIDTH + PAD_CARD) * arg;
  294. X            *yp = HUM_HAND_Y;
  295. X            break;
  296. X        case 1:
  297. X            *xp = COMP_HAND_X + (WIDTH + PAD_CARD) * arg;
  298. X            *yp = COMP_HAND_Y;
  299. X            break;
  300. X        }
  301. X        break;
  302. X    case ANIMATE_DECK:
  303. X        *xp = DECK_X;
  304. X        *yp = DECK_Y;
  305. X        break;
  306. X    case ANIMATE_DISC:
  307. X        *xp = DISCARD_X;
  308. X        *yp = DISCARD_Y;
  309. X        break;
  310. X    case ANIMATE_MILES:
  311. X        switch (player) {
  312. X        case 0:
  313. X            *xp = HUM_PLAY_X + (WIDTH + PAD_CARD) * (2 + C_200 - arg);
  314. X            *yp = HUM_PLAY_Y;
  315. X            break;
  316. X        case 1:
  317. X            *xp = COMP_PLAY_X + (WIDTH + PAD_CARD) * (2 + C_200 - arg);
  318. X            *yp = COMP_PLAY_Y;
  319. X            break;
  320. X        }
  321. X        break;
  322. X    case ANIMATE_BATTLE:
  323. X        switch (player) {
  324. X        case 0:
  325. X            *xp = HUM_PLAY_X + WIDTH + PAD_CARD;
  326. X            *yp = HUM_PLAY_Y;
  327. X            break;
  328. X        case 1:
  329. X            *xp = COMP_PLAY_X + WIDTH + PAD_CARD;
  330. X            *yp = COMP_PLAY_Y;
  331. X            break;
  332. X        }
  333. X        break;
  334. X    case ANIMATE_SPEED:
  335. X        switch (player) {
  336. X        case 0:
  337. X            *xp = HUM_PLAY_X;
  338. X            *yp = HUM_PLAY_Y;
  339. X            break;
  340. X        case 1:
  341. X            *xp = COMP_PLAY_X;
  342. X            *yp = COMP_PLAY_Y;
  343. X            break;
  344. X        }
  345. X        break;
  346. X    case ANIMATE_OBATTLE:
  347. X        switch (1-player) {
  348. X        case 0:
  349. X            *xp = HUM_PLAY_X + WIDTH + PAD_CARD;
  350. X            *yp = HUM_PLAY_Y;
  351. X            break;
  352. X        case 1:
  353. X            *xp = COMP_PLAY_X + WIDTH + PAD_CARD;
  354. X            *yp = COMP_PLAY_Y;
  355. X            break;
  356. X        }
  357. X        break;
  358. X    case ANIMATE_OSPEED:
  359. X        switch (1-player) {
  360. X        case 0:
  361. X            *xp = HUM_PLAY_X;
  362. X            *yp = HUM_PLAY_Y;
  363. X            break;
  364. X        case 1:
  365. X            *xp = COMP_PLAY_X;
  366. X            *yp = COMP_PLAY_Y;
  367. X            break;
  368. X        }
  369. X        break;
  370. X    case ANIMATE_SAFETY:
  371. X        switch (player) {
  372. X        case 0:
  373. X            *xp = HUM_SAFE_X + safety_offsets[arg - S_CONV].x;
  374. X            *yp = HUM_SAFE_Y + safety_offsets[arg - S_CONV].y;
  375. X            break;
  376. X        case 1:
  377. X            *xp = COMP_SAFE_X + safety_offsets[arg - S_CONV].x;
  378. X            *yp = COMP_SAFE_Y + safety_offsets[arg - S_CONV].y;
  379. X            break;
  380. X        }
  381. X        break;
  382. X    }
  383. X}
  384. END_OF_animate.c
  385. if test 4533 -ne `wc -c <animate.c`; then
  386.     echo shar: \"animate.c\" unpacked with wrong size!
  387. fi
  388. # end of overwriting check
  389. fi
  390. if test -f background.h -a "${1}" != "-c" ; then 
  391.   echo shar: Will not over-write existing file \"background.h\"
  392. else
  393. echo shar: Extracting \"background.h\" \(17 characters\)
  394. sed "s/^X//" >background.h <<'END_OF_background.h'
  395. X# include    "fill"
  396. END_OF_background.h
  397. if test 17 -ne `wc -c <background.h`; then
  398.     echo shar: \"background.h\" unpacked with wrong size!
  399. fi
  400. # end of overwriting check
  401. fi
  402. if test -f card.h -a "${1}" != "-c" ; then 
  403.   echo shar: Will not over-write existing file \"card.h\"
  404. else
  405. echo shar: Extracting \"card.h\" \(39 characters\)
  406. sed "s/^X//" >card.h <<'END_OF_card.h'
  407. X# define HEIGHT    150
  408. X# define WIDTH    100
  409. END_OF_card.h
  410. if test 39 -ne `wc -c <card.h`; then
  411.     echo shar: \"card.h\" unpacked with wrong size!
  412. fi
  413. # end of overwriting check
  414. fi
  415. if test -f color.h -a "${1}" != "-c" ; then 
  416.   echo shar: Will not over-write existing file \"color.h\"
  417. else
  418. echo shar: Extracting \"color.h\" \(299 characters\)
  419. sed "s/^X//" >color.h <<'END_OF_color.h'
  420. X/*
  421. X * color.h
  422. X *
  423. X * definitions for standard colors
  424. X */
  425. X
  426. X# define BLACK_COLOR    0
  427. X# define WHITE_COLOR    1
  428. X# define RED_COLOR    2
  429. X# define GREEN_COLOR    3
  430. X# define GREY_COLOR    4
  431. X# define BLUE_COLOR    5
  432. X# define NUM_COLOR    6
  433. X
  434. X
  435. Xstruct color {
  436. X    char    *name;
  437. X    int    pixel;
  438. X};
  439. X
  440. Xextern struct color    colorMap[NUM_COLOR];
  441. END_OF_color.h
  442. if test 299 -ne `wc -c <color.h`; then
  443.     echo shar: \"color.h\" unpacked with wrong size!
  444. fi
  445. # end of overwriting check
  446. fi
  447. if test -f extern.c -a "${1}" != "-c" ; then 
  448.   echo shar: Will not over-write existing file \"extern.c\"
  449. else
  450. echo shar: Extracting \"extern.c\" \(2988 characters\)
  451. sed "s/^X//" >extern.c <<'END_OF_extern.c'
  452. X# include    "mille.h"
  453. X
  454. X/*
  455. X * @(#)extern.c    1.1 (Berkeley) 4/1/82
  456. X */
  457. X
  458. Xbool    Debug,            /* set if debugging code on        */
  459. X    Finished,        /* set if current hand is finished    */
  460. X    Next,            /* set if changing players        */
  461. X    On_exit,        /* set if game saved on exiting        */
  462. X    Order,            /* set if hand should be sorted        */
  463. X    Saved;            /* set if game just saved        */
  464. X
  465. Xchar    *Fromfile = NULL;    /* startup file for game        */
  466. X
  467. Xint    Card_no,        /* Card number for current move        */
  468. X    End,            /* End value for current hand        */
  469. X    Handstart = COMP,    /* Player who starts hand        */
  470. X    Movetype,        /* Current move type            */
  471. X    Play,            /* Current player            */
  472. X    Numgos,            /* Number of Go cards used by computer    */
  473. X    WIndow = W_SMALL,    /* Current window wanted        */
  474. X    Numseen[NUM_CARDS],    /* Number of cards seen in current hand    */
  475. X    Value[NUM_MILES] = {    /* Value of mileage cards        */
  476. X        25, 50, 75, 100, 200
  477. X    },
  478. X    Numcards[NUM_CARDS] = {    /* Number of cards in deck        */
  479. X        10,    /* C_25 */
  480. X        10,    /* C_50 */
  481. X        10,    /* C_75 */
  482. X        12,    /* C_100 */
  483. X        4,    /* C_200 */
  484. X        2,    /* C_EMPTY */
  485. X        2,    /* C_FLAT */
  486. X        2,    /* C_CRASH */
  487. X        4,    /* C_STOP */
  488. X        3,    /* C_LIMIT */
  489. X        6,    /* C_GAS */
  490. X        6,    /* C_SPARE */
  491. X        6,    /* C_REPAIRS */
  492. X        14,    /* C_GO */
  493. X        6,    /* C_END_LIMIT */
  494. X        1,    /* C_GAS_SAFE */
  495. X        1,    /* C_SPARE_SAFE */
  496. X        1,    /* C_DRIVE_SAFE */
  497. X        1,    /* C_RIGHT_WAY */
  498. X        0    /* C_INIT */
  499. X    };
  500. X    Numneed[NUM_CARDS] = {    /* number of cards needed per hand    */
  501. X        0,    /* C_25 */
  502. X        0,    /* C_50 */
  503. X        0,    /* C_75 */
  504. X        0,    /* C_100 */
  505. X        0,    /* C_200 */
  506. X        2,    /* C_EMPTY */
  507. X        2,    /* C_FLAT */
  508. X        2,    /* C_CRASH */
  509. X        4,    /* C_STOP */
  510. X        3,    /* C_LIMIT */
  511. X        2,    /* C_GAS */
  512. X        2,    /* C_SPARE */
  513. X        2,    /* C_REPAIRS */
  514. X        10,    /* C_GO */
  515. X        3,    /* C_END_LIMIT */
  516. X        1,    /* C_GAS_SAFE */
  517. X        1,    /* C_SPARE_SAFE */
  518. X        1,    /* C_DRIVE_SAFE */
  519. X        1,    /* C_RIGHT_WAY */
  520. X        0    /* C_INIT */
  521. X    };
  522. X
  523. XCARD    Discard,        /* Top of discard pile            */
  524. X    *Topcard,        /* Pointer to next card to be picked    */
  525. X    Opposite[NUM_CARDS] = {    /* Opposites of each card        */
  526. X        C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
  527. X        C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
  528. X        C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
  529. X    },
  530. X    Deck[DECK_SZ] = {    /* Current deck                */
  531. X        C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
  532. X        C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
  533. X        C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
  534. X        C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100,
  535. X        C_100, C_100, C_100,
  536. X        C_200, C_200, C_200, C_200,
  537. X        C_EMPTY, C_EMPTY,
  538. X        C_FLAT, C_FLAT,
  539. X        C_CRASH, C_CRASH,
  540. X        C_STOP, C_STOP, C_STOP, C_STOP,
  541. X        C_LIMIT, C_LIMIT, C_LIMIT,
  542. X        C_GAS, C_GAS, C_GAS, C_GAS, C_GAS, C_GAS,
  543. X        C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE,
  544. X        C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS,
  545. X            C_REPAIRS,
  546. X        C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT,
  547. X            C_END_LIMIT,
  548. X        C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO,
  549. X            C_GO, C_GO, C_GO, C_GO,
  550. X        C_GAS_SAFE, C_SPARE_SAFE, C_DRIVE_SAFE, C_RIGHT_WAY
  551. X    };
  552. X
  553. XFILE    *outf;
  554. X
  555. XPLAY    Player[2];        /* Player descriptions            */
  556. END_OF_extern.c
  557. if test 2988 -ne `wc -c <extern.c`; then
  558.     echo shar: \"extern.c\" unpacked with wrong size!
  559. fi
  560. # end of overwriting check
  561. fi
  562. if test -f init.c -a "${1}" != "-c" ; then 
  563.   echo shar: Will not over-write existing file \"init.c\"
  564. else
  565. echo shar: Extracting \"init.c\" \(1198 characters\)
  566. sed "s/^X//" >init.c <<'END_OF_init.c'
  567. X# include    "mille.h"
  568. X
  569. X/*
  570. X * @(#)init.c    1.1 (Berkeley) 4/1/82
  571. X */
  572. X
  573. Xinit() {
  574. X
  575. X    reg PLAY    *pp;
  576. X    reg int        i, j;
  577. X    reg CARD    card;
  578. X
  579. X    for (j = 0; j < C_RIGHT_WAY; j++)
  580. X        Numseen[j] = 0;
  581. X    Numgos = 0;
  582. X
  583. X    for (i = 0; i < 2; i++) {
  584. X        pp = &Player[i];
  585. X        pp->hand[0] = C_INIT;
  586. X        for (j = 0; j < NUM_SAFE; j++) {
  587. X            pp->safety[j] = S_UNKNOWN;
  588. X            pp->coups[j] = FALSE;
  589. X        }
  590. X        for (j = 1; j < HAND_SZ; j++) {
  591. X            pp->hand[j] = *--Topcard;
  592. X            if (i == COMP) {
  593. X                account(card = *Topcard);
  594. X                if (issafety(card))
  595. X                    pp->safety[card - S_CONV] = S_IN_HAND;
  596. X            }
  597. X        }
  598. X        pp->mileage = 0;
  599. X        pp->hand_tot = 0;
  600. X        pp->safescore = 0;
  601. X        pp->coupscore = 0;
  602. X        pp->can_go = FALSE;
  603. X        pp->speed = C_INIT;
  604. X        pp->battle = C_INIT;
  605. X        pp->new_speed = FALSE;
  606. X        pp->new_battle = FALSE;
  607. X        for (j = 0; j < NUM_MILES; j++)
  608. X            pp->nummiles[j] = 0;
  609. X    }
  610. X    if (Order)
  611. X        sort(Player[PLAYER].hand);
  612. X    Discard = C_INIT;
  613. X    Finished = FALSE;
  614. X    End = 700;
  615. X}
  616. X
  617. Xshuffle() {
  618. X
  619. X    reg int        i, r;
  620. X    reg CARD    temp;
  621. X
  622. X    for (i = 0; i < DECK_SZ; i++) {
  623. X        r = roll(1, DECK_SZ) - 1;
  624. X        if (r < 0 || r > DECK_SZ - 1) {
  625. X            fprintf(stderr, "shuffle: card no. error: %d\n", r);
  626. X            die();
  627. X        }
  628. X        temp = Deck[r];
  629. X        Deck[r] = Deck[i];
  630. X        Deck[i] = temp;
  631. X    }
  632. X    Topcard = &Deck[DECK_SZ];
  633. X}
  634. END_OF_init.c
  635. if test 1198 -ne `wc -c <init.c`; then
  636.     echo shar: \"init.c\" unpacked with wrong size!
  637. fi
  638. # end of overwriting check
  639. fi
  640. if test -f mille.c -a "${1}" != "-c" ; then 
  641.   echo shar: Will not over-write existing file \"mille.c\"
  642. else
  643. echo shar: Extracting \"mille.c\" \(1892 characters\)
  644. sed "s/^X//" >mille.c <<'END_OF_mille.c'
  645. X# include    "mille.h"
  646. X# include    <signal.h>
  647. X# ifdef attron
  648. X#    include    <term.h>
  649. X# endif    attron
  650. X
  651. X/*
  652. X * @(#)mille.c    1.3 (Berkeley) 5/10/83
  653. X */
  654. X
  655. Xint    rub();
  656. X
  657. Xchar    _sobuf[BUFSIZ];
  658. X
  659. Xmain(ac, av)
  660. Xreg int        ac;
  661. Xreg char    *av[]; {
  662. X
  663. X    reg bool    restore;
  664. X    double        avs[3];
  665. X
  666. X    if (strcmp(av[0], "a.out") == 0) {
  667. X        outf = fopen("q", "w");
  668. X        setbuf(outf, 0);
  669. X        Debug = TRUE;
  670. X    }
  671. X    restore = FALSE;
  672. X# ifdef pdp11
  673. X    if (geteuid() != ARNOLD) {
  674. X        loadav(avs);
  675. X        if (avs[2] > 9.0) {
  676. X            printf("Sorry.  The load average is too high.\n");
  677. X            printf("Please try again later\n");
  678. X            exit(1);
  679. X        }
  680. X    }
  681. X# endif
  682. X    switch (ac) {
  683. X      case 2:
  684. X        rest_f(av[1]);
  685. X        restore = TRUE;
  686. X      case 1:
  687. X        break;
  688. X      default:
  689. X        printf("usage: milles [ restore_file ]\n");
  690. X        exit(-1);
  691. X        /* NOTREACHED */
  692. X    }
  693. X    setbuf(stdout, _sobuf);
  694. X    Play = PLAYER;
  695. X    init_ui ();
  696. X# ifndef PROF
  697. X    srand(getpid());
  698. X# else
  699. X    srand(0);
  700. X# endif
  701. X    signal(SIGINT, rub);
  702. X    for (;;) {
  703. X        if (!restore || (Player[PLAYER].total >= 5000
  704. X            || Player[COMP].total >= 5000)) {
  705. X            if (Player[COMP].total < Player[PLAYER].total)
  706. X                Player[PLAYER].games++;
  707. X            else if (Player[COMP].total > Player[PLAYER].total)
  708. X                Player[COMP].games++;
  709. X            Player[COMP].total = 0;
  710. X            Player[PLAYER].total = 0;
  711. X        }
  712. X        do {
  713. X            if (!restore)
  714. X                Handstart = Play = other(Handstart);
  715. X            if (!restore || On_exit) {
  716. X                shuffle();
  717. X                init();
  718. X            }
  719. X            newboard();
  720. X            if (restore)
  721. X                Error (Initstr);
  722. X            prboard();
  723. X            do {
  724. X                domove();
  725. X                if (Finished)
  726. X                    newscore();
  727. X                prboard();
  728. X            } while (!Finished);
  729. X            check_more();
  730. X            restore = On_exit = FALSE;
  731. X        } while (Player[COMP].total < 5000
  732. X            && Player[PLAYER].total < 5000);
  733. X    }
  734. X}
  735. X
  736. X/*
  737. X *    Routine to trap rubouts, and make sure they really want to
  738. X * quit.
  739. X */
  740. Xrub() {
  741. X
  742. X    signal(SIGINT, 1);
  743. X    if (getyn("Really? "))
  744. X        die();
  745. X    signal(SIGINT, rub);
  746. X}
  747. X
  748. X/*
  749. X *    Time to go beddy-by
  750. X */
  751. Xdie() {
  752. X
  753. X    signal(SIGINT, 1);
  754. X    if (outf)
  755. X        fflush(outf);
  756. X    finish_ui ();
  757. X    exit(1);
  758. X}
  759. END_OF_mille.c
  760. if test 1892 -ne `wc -c <mille.c`; then
  761.     echo shar: \"mille.c\" unpacked with wrong size!
  762. fi
  763. # end of overwriting check
  764. fi
  765. if test -f mille.h -a "${1}" != "-c" ; then 
  766.   echo shar: Will not over-write existing file \"mille.h\"
  767. else
  768. echo shar: Extracting \"mille.h\" \(3206 characters\)
  769. sed "s/^X//" >mille.h <<'END_OF_mille.h'
  770. X# include    <ctype.h>
  771. X# include    <stdio.h>
  772. X
  773. Xtypedef char    bool;
  774. X# define reg register
  775. X# define TRUE    1
  776. X# define FALSE    0
  777. X
  778. X/*
  779. X * @(#)mille.h    1.1 (Berkeley) 4/1/82
  780. X */
  781. X
  782. X/*
  783. X * Miscellaneous constants
  784. X */
  785. X
  786. X# define    unsgn        unsigned
  787. X# define    CARD        short
  788. X
  789. X# ifdef  vax
  790. X#    define    ARNOLD        78    /* my uid            */
  791. X# else
  792. X#    define    ARNOLD        24601    /* my uid            */
  793. X# endif
  794. X
  795. X# define    GURP        28672    /* bad uid            */
  796. X# define    MAXUSERS    35    /* max # of users for startup    */
  797. X# define    HAND_SZ        7    /* number of cards in a hand    */
  798. X# define    DECK_SZ        101    /* number of cards in decks    */
  799. X# define    NUM_SAFE    4    /* number of saftey cards    */
  800. X# define    NUM_MILES    5    /* number of milestones types    */
  801. X# define    NUM_CARDS    20    /* number of types of cards    */
  802. X
  803. X# define    PLAYER        0
  804. X# define    COMP        1
  805. X
  806. X# define    W_SMALL        0    /* Small (initial) window    */
  807. X# define    W_FULL        1    /* Full (final) window        */
  808. X
  809. X/*
  810. X * Move types
  811. X */
  812. X
  813. X# define    M_DISCARD    0
  814. X# define    M_DRAW        1
  815. X# define    M_PLAY        2
  816. X# define    M_ORDER        3
  817. X# define    M_REASONABLE    4
  818. X
  819. X/*
  820. X * Scores
  821. X */
  822. X
  823. X# define    SC_SAFETY    100
  824. X# define    SC_ALL_SAFE    300
  825. X# define    SC_COUP        300
  826. X# define    SC_TRIP        400
  827. X# define    SC_SAFE        300
  828. X# define    SC_DELAY    300
  829. X# define    SC_EXTENSION    200
  830. X# define    SC_SHUT_OUT    500
  831. X
  832. X/*
  833. X * safety descriptions
  834. X */
  835. X
  836. X# define    S_UNKNOWN    0    /* location of safety unknown    */
  837. X# define    S_IN_HAND    1    /* safety in player's hand    */
  838. X# define    S_PLAYED    2    /* safety has been played    */
  839. X# define    S_GAS_SAFE    0    /* Gas safety card index    */
  840. X# define    S_SPARE_SAFE    1    /* Tire safety card index    */
  841. X# define    S_DRIVE_SAFE    2    /* Driveing safety card index    */
  842. X# define    S_RIGHT_WAY    3    /* Right-of-Way card index    */
  843. X# define    S_CONV        15    /* conversion from C_ to S_    */
  844. X
  845. X/*
  846. X * card numbers
  847. X */
  848. X
  849. X# define    C_INIT        -1
  850. X# define    C_25        0
  851. X# define    C_50        1
  852. X# define    C_75        2
  853. X# define    C_100        3
  854. X# define    C_200        4
  855. X# define    C_EMPTY        5
  856. X# define    C_FLAT        6    
  857. X# define    C_CRASH        7
  858. X# define    C_STOP        8
  859. X# define    C_LIMIT        9
  860. X# define    C_GAS        10
  861. X# define    C_SPARE        11
  862. X# define    C_REPAIRS    12
  863. X# define    C_GO        13
  864. X# define    C_END_LIMIT    14
  865. X# define    C_GAS_SAFE    15
  866. X# define    C_SPARE_SAFE    16
  867. X# define    C_DRIVE_SAFE    17
  868. X# define    C_RIGHT_WAY    18
  869. X
  870. Xtypedef struct {
  871. X    bool    coups[NUM_SAFE];
  872. X    bool    can_go;
  873. X    bool    new_battle;
  874. X    bool    new_speed;
  875. X    short    safety[NUM_SAFE];
  876. X    short    nummiles[NUM_MILES];
  877. X    CARD    hand[HAND_SZ];
  878. X    CARD    battle;
  879. X    CARD    speed;
  880. X    int    mileage;
  881. X    int    hand_tot;
  882. X    int    safescore;
  883. X    int    coupscore;
  884. X    int    total;
  885. X    int    games;
  886. X} PLAY;
  887. X
  888. X/*
  889. X * animation constants
  890. X */
  891. X
  892. X# define ANIMATE
  893. X# define ANIMATE_HAND        0
  894. X# define ANIMATE_DECK        1
  895. X# define ANIMATE_DISC        2
  896. X# define ANIMATE_MILES        3
  897. X# define ANIMATE_BATTLE        4
  898. X# define ANIMATE_SPEED        5
  899. X# define ANIMATE_OBATTLE    6
  900. X# define ANIMATE_OSPEED        7
  901. X# define ANIMATE_SAFETY        8
  902. X
  903. X/*
  904. X * macros
  905. X */
  906. X
  907. X# define    other(x)    (1 - x)
  908. X# define    nextplay()    (Play = other(Play))
  909. X# define    nextwin(x)    (1 - x)
  910. X# define    opposite(x)    (Opposite[x])
  911. X# define    issafety(x)    (x >= C_GAS_SAFE)
  912. X
  913. X/*
  914. X * externals
  915. X */
  916. X
  917. Xextern bool    Debug, Finished, Next, On_exit, Order, Saved;
  918. X
  919. Xextern char    *C_fmt, **C_name, *Fromfile, Initstr[];
  920. X
  921. Xextern int    Card_no, End, Handstart, Movetype, Numcards[], Numgos,
  922. X        Numneed[], Numseen[NUM_CARDS], Play, Value[], WIndow;
  923. X
  924. Xextern CARD    Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], *Topcard;
  925. X
  926. Xextern FILE    *outf;
  927. X
  928. Xextern PLAY    Player[2];
  929. X
  930. X/*
  931. X * functions
  932. X */
  933. X
  934. XCARD    getcard();
  935. END_OF_mille.h
  936. if test 3206 -ne `wc -c <mille.h`; then
  937.     echo shar: \"mille.h\" unpacked with wrong size!
  938. fi
  939. # end of overwriting check
  940. fi
  941. if test -f misc.c -a "${1}" != "-c" ; then 
  942.   echo shar: Will not over-write existing file \"misc.c\"
  943. else
  944. echo shar: Extracting \"misc.c\" \(1986 characters\)
  945. sed "s/^X//" >misc.c <<'END_OF_misc.c'
  946. X#include    "mille.h"
  947. X# ifdef    attron
  948. X#    include    <term.h>
  949. X#    define    _tty    cur_term->Nttyb
  950. X# endif    attron
  951. X
  952. X/*
  953. X * @(#)misc.c    1.3 (Berkeley) 7/2/83
  954. X */
  955. X
  956. X#define    NUMSAFE    4
  957. X
  958. X/* VARARGS1 */
  959. Xerror(str, arg)
  960. Xchar    *str;
  961. X{
  962. X    Error (str, arg);
  963. X    Beep ();
  964. X    update_ui ();
  965. X    return FALSE;
  966. X}
  967. X
  968. Xcheck_ext(forcomp)
  969. Xreg bool    forcomp; {
  970. X
  971. X
  972. X    if (End == 700)
  973. X        if (Play == PLAYER) {
  974. X            if (getyn("Extension? ")) {
  975. Xextend:
  976. X                if (!forcomp)
  977. X                    End = 1000;
  978. X                return TRUE;
  979. X            }
  980. X            else {
  981. Xdone:
  982. X                if (!forcomp)
  983. X                    Finished = TRUE;
  984. X                return FALSE;
  985. X            }
  986. X        }
  987. X        else {
  988. X            reg PLAY    *pp, *op;
  989. X            reg int        i, safe, miles;
  990. X
  991. X            pp = &Player[COMP];
  992. X            op = &Player[PLAYER];
  993. X            for (safe = 0, i = 0; i < NUMSAFE; i++)
  994. X                if (pp->safety[i] != S_UNKNOWN)
  995. X                    safe++;
  996. X            if (safe < 2)
  997. X                goto done;
  998. X            if (op->mileage == 0 || onecard(op)
  999. X                || (op->can_go && op->mileage >= 500))
  1000. X                goto done;
  1001. X            for (miles = 0, i = 0; i < NUMSAFE; i++)
  1002. X                if (op->safety[i] != S_PLAYED
  1003. X                    && pp->safety[i] == S_UNKNOWN)
  1004. X                    miles++;
  1005. X            if (miles + safe == NUMSAFE)
  1006. X                goto extend;
  1007. X            for (miles = 0, i = 0; i < HAND_SZ; i++)
  1008. X                if ((safe = pp->hand[i]) <= C_200)
  1009. X                    miles += Value[safe]; 
  1010. X            if (miles + (Topcard - Deck) * 3 > 1000)
  1011. X                goto extend;
  1012. X            goto done;
  1013. X        }
  1014. X    else
  1015. X        goto done;
  1016. X}
  1017. X
  1018. X/*
  1019. X *    Check to see if more games are desired.  If not, and game
  1020. X * came from a saved file, make sure that they don't want to restore
  1021. X * it.  Exit appropriately.
  1022. X */
  1023. Xcheck_more() {
  1024. X
  1025. X    FlushInput ();
  1026. X
  1027. X    On_exit = TRUE;
  1028. X    if (Player[PLAYER].total >= 5000 || Player[COMP].total >= 5000)
  1029. X        if (getyn("Another game? "))
  1030. X            return;
  1031. X        else {
  1032. X            /*
  1033. X             * must do accounting normally done in main()
  1034. X             */
  1035. X            if (Player[PLAYER].total > Player[COMP].total)
  1036. X                Player[PLAYER].games++;
  1037. X            else if (Player[PLAYER].total < Player[COMP].total)
  1038. X                Player[COMP].games++;
  1039. X            Player[COMP].total = 0;
  1040. X            Player[PLAYER].total = 0;
  1041. X        }
  1042. X    else
  1043. X        if (getyn("Another hand? "))
  1044. X            return;
  1045. X    if (!Saved && getyn("Save game? "))
  1046. X        if (!save())
  1047. X            return;
  1048. X    die();
  1049. X}
  1050. END_OF_misc.c
  1051. if test 1986 -ne `wc -c <misc.c`; then
  1052.     echo shar: \"misc.c\" unpacked with wrong size!
  1053. fi
  1054. # end of overwriting check
  1055. fi
  1056. if test -f move.c -a "${1}" != "-c" ; then 
  1057.   echo shar: Will not over-write existing file \"move.c\"
  1058. else
  1059. echo shar: Extracting \"move.c\" \(8310 characters\)
  1060. sed "s/^X//" >move.c <<'END_OF_move.c'
  1061. X#include    "mille.h"
  1062. X
  1063. X/*
  1064. X * @(#)move.c    1.3 (Berkeley) 7/2/83
  1065. X */
  1066. X
  1067. X#ifdef CTRL
  1068. X#undef CTRL
  1069. X#endif
  1070. X#define    CTRL(c)        (c - 'A' + 1)
  1071. X
  1072. Xchar    *Movenames[] = {
  1073. X        "M_DISCARD", "M_DRAW", "M_PLAY", "M_ORDER"
  1074. X    };
  1075. X
  1076. Xchar    *playcard (), *sprint ();
  1077. X
  1078. Xdomove()
  1079. X{
  1080. X    reg PLAY    *pp;
  1081. X    reg int        i, j;
  1082. X    reg bool    goodplay;
  1083. X    char        *foo;
  1084. X
  1085. X    pp = &Player[Play];
  1086. X    if (Play == PLAYER)
  1087. X        getmove();
  1088. X    else
  1089. X        calcmove();
  1090. X    Next = FALSE;
  1091. X    goodplay = TRUE;
  1092. X    switch (Movetype) {
  1093. X      case M_DISCARD:
  1094. Xtrydiscard:    ;
  1095. X        if (haspicked(pp)) {
  1096. X            if (pp->hand[Card_no] == C_INIT)
  1097. X                if (Card_no == 6)
  1098. X                    Finished = TRUE;
  1099. X                else
  1100. X                    error("no card there");
  1101. X            else {
  1102. X                Discard = pp->hand[Card_no];
  1103. X                pp->hand[Card_no] = C_INIT;
  1104. X#ifdef ANIMATE
  1105. X                animate_move (Play, ANIMATE_HAND, Card_no,
  1106. X                             ANIMATE_DISC, Discard);
  1107. X#endif
  1108. X                Next = TRUE;
  1109. X                if (Play == PLAYER)
  1110. X                    account(Discard);
  1111. X            }
  1112. X        }
  1113. X        else
  1114. X            error("must pick first");
  1115. X        break;
  1116. X      case M_REASONABLE:
  1117. X      case M_PLAY:
  1118. X        foo = playcard(pp);
  1119. X        if (foo) {
  1120. X            if (Movetype == M_REASONABLE)
  1121. X                goto trydiscard;
  1122. X            error (foo);
  1123. X            goodplay = 0;
  1124. X        } else
  1125. X            goodplay = 1;
  1126. X        break;
  1127. X      case M_DRAW:
  1128. X        Card_no = 0;
  1129. X        if (Topcard <= Deck)
  1130. X            error("no more cards");
  1131. X        else if (haspicked(pp))
  1132. X            error("already picked");
  1133. X        else {
  1134. X            pp->hand[0] = *--Topcard;
  1135. X#ifdef ANIMATE
  1136. X            animate_move (Play, ANIMATE_DECK, pp->hand[0], ANIMATE_HAND, 0);
  1137. X#endif
  1138. X            if (Debug)
  1139. X                fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
  1140. Xacc:
  1141. X            if (Play == COMP) {
  1142. X                account(*Topcard);
  1143. X                if (issafety(*Topcard))
  1144. X                    pp->safety[*Topcard-S_CONV] = S_IN_HAND;
  1145. X            }
  1146. X            if (pp->hand[1] == C_INIT && Topcard > Deck) {
  1147. X                Card_no = 1;
  1148. X                pp->hand[1] = *--Topcard;
  1149. X                if (Debug)
  1150. X                    fprintf(outf, "DOMOVE: Draw %s\n", C_name[*Topcard]);
  1151. X                goto acc;
  1152. X            }
  1153. X            pp->new_battle = FALSE;
  1154. X            pp->new_speed = FALSE;
  1155. X        }
  1156. X        break;
  1157. X
  1158. X      case M_ORDER:
  1159. X        break;
  1160. X    }
  1161. X    /*
  1162. X     * move blank card to top by one of two methods.  If the
  1163. X     * computer's hand was sorted, the randomness for picking
  1164. X     * between equally valued cards would be lost
  1165. X     */
  1166. X    if (Order && Movetype != M_DRAW && goodplay && pp == &Player[PLAYER])
  1167. X        sort(pp->hand);
  1168. X    else
  1169. X        for (i = 1; i < HAND_SZ; i++)
  1170. X            if (pp->hand[i] == C_INIT) {
  1171. X                for (j = 0; pp->hand[j] == C_INIT; j++)
  1172. X                    if (j >= HAND_SZ) {
  1173. X                        j = 0;
  1174. X                        break;
  1175. X                    }
  1176. X                pp->hand[i] = pp->hand[j];
  1177. X                pp->hand[j] = C_INIT;
  1178. X            }
  1179. X    if (Topcard <= Deck)
  1180. X        check_go();
  1181. X    if (Next)
  1182. X        nextplay();
  1183. X}
  1184. X
  1185. X/*
  1186. X *    Check and see if either side can go.  If they cannot,
  1187. X * the game is over
  1188. X */
  1189. Xcheck_go() {
  1190. X
  1191. X    reg CARD    card;
  1192. X    reg PLAY    *pp, *op;
  1193. X    reg int        i;
  1194. X
  1195. X    for (pp = Player; pp < &Player[2]; pp++) {
  1196. X        op = (pp == &Player[COMP] ? &Player[PLAYER] : &Player[COMP]);
  1197. X        for (i = 0; i < HAND_SZ; i++) {
  1198. X            card = pp->hand[i];
  1199. X            if (issafety(card) || canplay(pp, op, card)) {
  1200. X                if (Debug) {
  1201. X                    fprintf(outf, "CHECK_GO: can play %s (%d), ", C_name[card], card);
  1202. X                    fprintf(outf, "issafety(card) = %d, ", issafety(card));
  1203. X                    fprintf(outf, "canplay(pp, op, card) = %d\n", canplay(pp, op, card));
  1204. X                }
  1205. X                return;
  1206. X            }
  1207. X            else if (Debug)
  1208. X                fprintf(outf, "CHECK_GO: cannot play %s\n",
  1209. X                    C_name[card]);
  1210. X        }
  1211. X    }
  1212. X    Finished = TRUE;
  1213. X}
  1214. X
  1215. Xchar *
  1216. Xplaycard(pp)
  1217. Xreg PLAY    *pp;
  1218. X{
  1219. X    reg int        v;
  1220. X    reg CARD    card;
  1221. X
  1222. X    /*
  1223. X     * check and see if player has picked
  1224. X     */
  1225. X    switch (pp->hand[Card_no]) {
  1226. X      default:
  1227. X        if (!haspicked(pp))
  1228. Xmustpick:
  1229. X            return ("must pick first");
  1230. X      case C_GAS_SAFE:    case C_SPARE_SAFE:
  1231. X      case C_DRIVE_SAFE:    case C_RIGHT_WAY:
  1232. X        break;
  1233. X    }
  1234. X
  1235. X    card = pp->hand[Card_no];
  1236. X    if (Debug)
  1237. X        fprintf(outf, "PLAYCARD: Card = %s\n", C_name[card]);
  1238. X    Next = FALSE;
  1239. X    switch (card) {
  1240. X      case C_200:
  1241. X        if (pp->nummiles[C_200] == 2)
  1242. X            return ("only two 200's per hand");
  1243. X      case C_100:    case C_75:
  1244. X        if (pp->speed == C_LIMIT)
  1245. X            return ("limit of 50");
  1246. X      case C_50:
  1247. X        if (pp->mileage + Value[card] > End)
  1248. X            return sprint ("puts you over %d", End);
  1249. X      case C_25:
  1250. X        if (!pp->can_go)
  1251. X            return ("cannot move now");
  1252. X#ifdef ANIMATE
  1253. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_MILES, card);
  1254. X#endif
  1255. X        pp->nummiles[card]++;
  1256. X        v = Value[card];
  1257. X        pp->total += v;
  1258. X        pp->hand_tot += v;
  1259. X        if ((pp->mileage += v) == End)
  1260. X            check_ext(FALSE);
  1261. X        break;
  1262. X
  1263. X      case C_GAS:    case C_SPARE:    case C_REPAIRS:
  1264. X        if (pp->battle != opposite(card))
  1265. X            return sprint ("can't play \"%s\"", C_name[card]);
  1266. X#ifdef ANIMATE
  1267. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_BATTLE, card);
  1268. X#endif
  1269. X        pp->battle = card;
  1270. X        if (pp->safety[S_RIGHT_WAY] == S_PLAYED)
  1271. X            pp->can_go = TRUE;
  1272. X        break;
  1273. X
  1274. X      case C_GO:
  1275. X        if (pp->battle != C_INIT && pp->battle != C_STOP
  1276. X            && !isrepair(pp->battle))
  1277. X            return sprint ("cannot play \"Go\" on a \"%s\"",
  1278. X                C_name[pp->battle]);
  1279. X#ifdef ANIMATE
  1280. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_BATTLE, card);
  1281. X#endif
  1282. X        pp->battle = C_GO;
  1283. X        pp->can_go = TRUE;
  1284. X        break;
  1285. X
  1286. X      case C_END_LIMIT:
  1287. X        if (pp->speed != C_LIMIT)
  1288. X            return ("not limited");
  1289. X#ifdef ANIMATE
  1290. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_SPEED, card);
  1291. X#endif
  1292. X        pp->speed = C_END_LIMIT;
  1293. X        break;
  1294. X
  1295. X      case C_EMPTY:    case C_FLAT:    case C_CRASH:
  1296. X      case C_STOP:
  1297. X        pp = &Player[other(Play)];
  1298. X        if (!pp->can_go)
  1299. X            return ("opponent cannot go");
  1300. X        else if (pp->safety[safety(card) - S_CONV] == S_PLAYED)
  1301. Xprotected:
  1302. X            return ("opponent is protected");
  1303. X#ifdef ANIMATE
  1304. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_OBATTLE, card);
  1305. X#endif
  1306. X        pp->battle = card;
  1307. X        pp->new_battle = TRUE;
  1308. X        pp->can_go = FALSE;
  1309. X        pp = &Player[Play];
  1310. X        break;
  1311. X
  1312. X      case C_LIMIT:
  1313. X        pp = &Player[other(Play)];
  1314. X        if (pp->speed == C_LIMIT)
  1315. X            return ("opponent has limit");
  1316. X        if (pp->safety[S_RIGHT_WAY] == S_PLAYED)
  1317. X            goto protected;
  1318. X#ifdef ANIMATE
  1319. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_OSPEED, card);
  1320. X#endif
  1321. X        pp->speed = C_LIMIT;
  1322. X        pp->new_speed = TRUE;
  1323. X        pp = &Player[Play];
  1324. X        break;
  1325. X
  1326. X      case C_GAS_SAFE:    case C_SPARE_SAFE:
  1327. X      case C_DRIVE_SAFE:    case C_RIGHT_WAY:
  1328. X        if (pp->battle == opposite(card)
  1329. X            || (card == C_RIGHT_WAY && pp->speed == C_LIMIT)) {
  1330. X            if (!(card == C_RIGHT_WAY && !isrepair(pp->battle))) {
  1331. X                pp->battle = C_GO;
  1332. X                pp->can_go = TRUE;
  1333. X            }
  1334. X            if (card == C_RIGHT_WAY && pp->speed == C_LIMIT)
  1335. X                pp->speed = C_INIT;
  1336. X            if (pp->new_battle
  1337. X                || (pp->new_speed && card == C_RIGHT_WAY)) {
  1338. X                pp->coups[card - S_CONV] = TRUE;
  1339. X                pp->total += SC_COUP;
  1340. X                pp->hand_tot += SC_COUP;
  1341. X                pp->coupscore += SC_COUP;
  1342. X            }
  1343. X        }
  1344. X        /*
  1345. X         * if not coup, must pick first
  1346. X         */
  1347. X        else if (pp->hand[0] == C_INIT && Topcard > Deck)
  1348. X            goto mustpick;
  1349. X#ifdef ANIMATE
  1350. X        animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_SAFETY, card);
  1351. X#endif
  1352. X        pp->safety[card - S_CONV] = S_PLAYED;
  1353. X        pp->total += SC_SAFETY;
  1354. X        pp->hand_tot += SC_SAFETY;
  1355. X        if ((pp->safescore += SC_SAFETY) == NUM_SAFE * SC_SAFETY) {
  1356. X            pp->total += SC_ALL_SAFE;
  1357. X            pp->hand_tot += SC_ALL_SAFE;
  1358. X        }
  1359. X        if (card == C_RIGHT_WAY) {
  1360. X            if (pp->speed == C_LIMIT)
  1361. X                pp->speed = C_INIT;
  1362. X            if (pp->battle == C_STOP || pp->battle == C_INIT) {
  1363. X                pp->can_go = TRUE;
  1364. X                pp->battle = C_INIT;
  1365. X            }
  1366. X            if (!pp->can_go && isrepair(pp->battle))
  1367. X                pp->can_go = TRUE;
  1368. X        }
  1369. X        Next = -1;
  1370. X        break;
  1371. X
  1372. X      case C_INIT:
  1373. X        Next = -1;
  1374. X        return ("no card there");
  1375. X        break;
  1376. X    }
  1377. X    if (pp == &Player[PLAYER])
  1378. X        account(card);
  1379. X    pp->hand[Card_no] = C_INIT;
  1380. X    Next = (Next == -1 ? FALSE : TRUE);
  1381. X    return 0;
  1382. X}
  1383. X
  1384. Xchar *
  1385. Xsprint (string, arg)
  1386. X{
  1387. X    static char    buf[512];
  1388. X
  1389. X    sprintf (buf, string, arg);
  1390. X    return buf;
  1391. X}
  1392. X
  1393. X/*
  1394. X * return whether or not the player has picked
  1395. X */
  1396. Xhaspicked(pp)
  1397. Xreg PLAY    *pp; {
  1398. X
  1399. X    reg int    card;
  1400. X
  1401. X    if (Topcard <= Deck)
  1402. X        return TRUE;
  1403. X    switch (pp->hand[Card_no]) {
  1404. X      case C_GAS_SAFE:    case C_SPARE_SAFE:
  1405. X      case C_DRIVE_SAFE:    case C_RIGHT_WAY:
  1406. X        card = 1;
  1407. X        break;
  1408. X      default:
  1409. X        card = 0;
  1410. X        break;
  1411. X    }
  1412. X    return (pp->hand[card] != C_INIT);
  1413. X}
  1414. X
  1415. Xaccount(card)
  1416. Xreg CARD    card; {
  1417. X
  1418. X    reg CARD    oppos;
  1419. X
  1420. X    if (card == C_INIT)
  1421. X        return;
  1422. X    ++Numseen[card];
  1423. X    if (Play == COMP)
  1424. X        switch (card) {
  1425. X          case C_GAS_SAFE:
  1426. X          case C_SPARE_SAFE:
  1427. X          case C_DRIVE_SAFE:
  1428. X            oppos = opposite(card);
  1429. X            Numgos += Numcards[oppos] - Numseen[oppos];
  1430. X            break;
  1431. X          case C_CRASH:
  1432. X          case C_FLAT:
  1433. X          case C_EMPTY:
  1434. X          case C_STOP:
  1435. X            Numgos++;
  1436. X            break;
  1437. X        }
  1438. X}
  1439. X
  1440. Xsort(hand)
  1441. Xreg CARD    *hand;
  1442. X{
  1443. X    reg CARD    *cp, *tp;
  1444. X    reg int        j;
  1445. X    reg CARD    temp;
  1446. X
  1447. X    cp = hand;
  1448. X    hand += HAND_SZ;
  1449. X    for ( ; cp < &hand[-1]; cp++)
  1450. X        for (tp = cp + 1; tp < hand; tp++)
  1451. X            if (*cp > *tp) {
  1452. X                temp = *cp;
  1453. X                *cp = *tp;
  1454. X                *tp = temp;
  1455. X            }
  1456. X}
  1457. END_OF_move.c
  1458. if test 8310 -ne `wc -c <move.c`; then
  1459.     echo shar: \"move.c\" unpacked with wrong size!
  1460. fi
  1461. # end of overwriting check
  1462. fi
  1463. if test -f print.c -a "${1}" != "-c" ; then 
  1464.   echo shar: Will not over-write existing file \"print.c\"
  1465. else
  1466. echo shar: Extracting \"print.c\" \(65 characters\)
  1467. sed "s/^X//" >print.c <<'END_OF_print.c'
  1468. X# include    "mille.h"
  1469. X
  1470. X/*
  1471. X * @(#)print.c    1.1 (Berkeley) 4/1/82
  1472. X */
  1473. END_OF_print.c
  1474. if test 65 -ne `wc -c <print.c`; then
  1475.     echo shar: \"print.c\" unpacked with wrong size!
  1476. fi
  1477. # end of overwriting check
  1478. fi
  1479. if test -f roll.c -a "${1}" != "-c" ; then 
  1480.   echo shar: Will not over-write existing file \"roll.c\"
  1481. else
  1482. echo shar: Extracting \"roll.c\" \(575 characters\)
  1483. sed "s/^X//" >roll.c <<'END_OF_roll.c'
  1484. X/*
  1485. X *    This routine rolls ndie nside-sided dice.
  1486. X *
  1487. X * @(#)roll.c    1.1 (Berkeley) 4/1/82
  1488. X *
  1489. X */
  1490. X
  1491. X# define    reg    register
  1492. X
  1493. X# ifndef vax
  1494. X# define    MAXRAND    32767L
  1495. X
  1496. Xroll(ndie, nsides)
  1497. Xint    ndie, nsides; {
  1498. X
  1499. X    reg long    tot;
  1500. X    reg unsigned    n, r;
  1501. X
  1502. X    tot = 0;
  1503. X    n = ndie;
  1504. X    while (n--)
  1505. X        tot += rand();
  1506. X    return (int) ((tot * (long) nsides) / ((long) MAXRAND + 1)) + ndie;
  1507. X}
  1508. X
  1509. X# else
  1510. X
  1511. Xroll(ndie, nsides)
  1512. Xreg int    ndie, nsides; {
  1513. X
  1514. X    reg int        tot, r;
  1515. X    reg double    num_sides;
  1516. X
  1517. X    num_sides = nsides;
  1518. X    tot = 0;
  1519. X    while (ndie--)
  1520. X        tot += (r = rand()) * (num_sides / 017777777777) + 1;
  1521. X    return tot;
  1522. X}
  1523. X# endif
  1524. END_OF_roll.c
  1525. if test 575 -ne `wc -c <roll.c`; then
  1526.     echo shar: \"roll.c\" unpacked with wrong size!
  1527. fi
  1528. # end of overwriting check
  1529. fi
  1530. if test -f save.c -a "${1}" != "-c" ; then 
  1531.   echo shar: Will not over-write existing file \"save.c\"
  1532. else
  1533. echo shar: Extracting \"save.c\" \(1815 characters\)
  1534. sed "s/^X//" >save.c <<'END_OF_save.c'
  1535. X#include    "mille.h"
  1536. X#include    <sys/types.h>
  1537. X#include    <sys/stat.h>
  1538. X#include    <sys/time.h>
  1539. X# ifdef    attron
  1540. X#    include    <term.h>
  1541. X#    define    _tty    cur_term->Nttyb
  1542. X# endif    attron
  1543. X
  1544. X/*
  1545. X * @(#)save.c    1.4 (Berkeley) 7/3/83
  1546. X */
  1547. X
  1548. Xtypedef    struct stat    STAT;
  1549. Xtypedef    struct tm    TIME;
  1550. X
  1551. Xchar    *ctime();
  1552. X
  1553. Xint    read(), write();
  1554. X
  1555. X/*
  1556. X *    This routine saves the current game for use at a later date
  1557. X */
  1558. Xextern int    errno;
  1559. Xextern char    *sys_errlist[];
  1560. X
  1561. Xsave() {
  1562. X
  1563. X    reg char    *sp;
  1564. X    reg int        outf;
  1565. X    reg TIME    *tp;
  1566. X    char        buf[80];
  1567. X    TIME        tme;
  1568. X    STAT        junk;
  1569. X
  1570. X    tp = &tme;
  1571. X    if (Fromfile && getyn("Same file? "))
  1572. X        strcpy(buf, Fromfile);
  1573. X    else {
  1574. Xover:
  1575. X        
  1576. X        strcpy (buf, GetpromptedInput ("file: "));
  1577. X        sp = buf + strlen (buf);
  1578. X    }
  1579. X
  1580. X    /*
  1581. X     * check for existing files, and confirm overwrite if needed
  1582. X     */
  1583. X
  1584. X    if (sp == buf || (!Fromfile && stat(buf, &junk) > -1
  1585. X        && getyn("Overwrite File? ") == FALSE))
  1586. X        return FALSE;
  1587. X
  1588. X    if ((outf = creat(buf, 0644)) < 0) {
  1589. X        error(sys_errlist[errno]);
  1590. X        return FALSE;
  1591. X    }
  1592. X    Error (buf);
  1593. X    time(tp);            /* get current time        */
  1594. X    strcpy(buf, ctime(tp));
  1595. X    for (sp = buf; *sp != '\n'; sp++)
  1596. X        continue;
  1597. X    *sp = '\0';
  1598. X    varpush(outf, write);
  1599. X    close(outf);
  1600. X    return TRUE;
  1601. X}
  1602. X
  1603. X/*
  1604. X *    This does the actual restoring.  It returns TRUE if the
  1605. X * backup was made on exiting, in which case certain things must
  1606. X * be cleaned up before the game starts.
  1607. X */
  1608. Xrest_f(file)
  1609. Xreg char    *file; {
  1610. X
  1611. X    reg char    *sp;
  1612. X    reg int        inf;
  1613. X    char        buf[80];
  1614. X    STAT        sbuf;
  1615. X
  1616. X    if ((inf = open(file, 0)) < 0) {
  1617. X        perror(file);
  1618. X        exit(1);
  1619. X    }
  1620. X    if (fstat(inf, &sbuf) < 0) {        /* get file stats    */
  1621. X        perror(file);
  1622. X        exit(1);
  1623. X    }
  1624. X    varpush(inf, read);
  1625. X    close(inf);
  1626. X    strcpy(buf, ctime(&sbuf.st_mtime));
  1627. X    for (sp = buf; *sp != '\n'; sp++)
  1628. X        continue;
  1629. X    *sp = '\0';
  1630. X    /*
  1631. X     * initialize some necessary values
  1632. X     */
  1633. X    sprintf(Initstr, "%s [%s]\n", file, buf);
  1634. X    Fromfile = file;
  1635. X    return !On_exit;
  1636. X}
  1637. END_OF_save.c
  1638. if test 1815 -ne `wc -c <save.c`; then
  1639.     echo shar: \"save.c\" unpacked with wrong size!
  1640. fi
  1641. # end of overwriting check
  1642. fi
  1643. if test -f table.c -a "${1}" != "-c" ; then 
  1644.   echo shar: Will not over-write existing file \"table.c\"
  1645. else
  1646. echo shar: Extracting \"table.c\" \(431 characters\)
  1647. sed "s/^X//" >table.c <<'END_OF_table.c'
  1648. X# define    DEBUG
  1649. X
  1650. X/*
  1651. X * @(#)table.c    1.1 (Berkeley) 4/1/82
  1652. X */
  1653. X
  1654. X# include    "mille.h"
  1655. X
  1656. Xmain() {
  1657. X
  1658. X    reg int    i, j, count;
  1659. X
  1660. X    printf("   %16s -> %5s %5s %4s %s\n", "Card", "cards", "count", "need", "opposite");
  1661. X    for (i = 0; i < NUM_CARDS - 1; i++) {
  1662. X        for (j = 0, count = 0; j < DECK_SZ; j++)
  1663. X            if (Deck[j] == i)
  1664. X                count++;
  1665. X        printf("%2d %16s -> %5d %5d %4d %s\n", i, C_name[i], Numcards[i], count, Numneed[i], C_name[opposite(i)]);
  1666. X    }
  1667. X}
  1668. END_OF_table.c
  1669. if test 431 -ne `wc -c <table.c`; then
  1670.     echo shar: \"table.c\" unpacked with wrong size!
  1671. fi
  1672. # end of overwriting check
  1673. fi
  1674. if test -f types.c -a "${1}" != "-c" ; then 
  1675.   echo shar: Will not over-write existing file \"types.c\"
  1676. else
  1677. echo shar: Extracting \"types.c\" \(597 characters\)
  1678. sed "s/^X//" >types.c <<'END_OF_types.c'
  1679. X# include    "mille.h"
  1680. X
  1681. X/*
  1682. X * @(#)types.c    1.1 (Berkeley) 4/1/82
  1683. X */
  1684. X
  1685. Xisrepair(card)
  1686. Xreg CARD    card; {
  1687. X
  1688. X    return card == C_GAS || card == C_SPARE || card == C_REPAIRS || card == C_INIT;
  1689. X}
  1690. X
  1691. Xsafety(card)
  1692. Xreg CARD    card; {
  1693. X
  1694. X    switch (card) {
  1695. X      case C_EMPTY:
  1696. X      case C_GAS:
  1697. X      case C_GAS_SAFE:
  1698. X        return C_GAS_SAFE;
  1699. X      case C_FLAT:
  1700. X      case C_SPARE:
  1701. X      case C_SPARE_SAFE:
  1702. X        return C_SPARE_SAFE;
  1703. X      case C_CRASH:
  1704. X      case C_REPAIRS:
  1705. X      case C_DRIVE_SAFE:
  1706. X        return C_DRIVE_SAFE;
  1707. X      case C_GO:
  1708. X      case C_STOP:
  1709. X      case C_RIGHT_WAY:
  1710. X      case C_LIMIT:
  1711. X      case C_END_LIMIT:
  1712. X        return C_RIGHT_WAY;
  1713. X    }
  1714. X    /* NOTREACHED */
  1715. X}
  1716. END_OF_types.c
  1717. if test 597 -ne `wc -c <types.c`; then
  1718.     echo shar: \"types.c\" unpacked with wrong size!
  1719. fi
  1720. # end of overwriting check
  1721. fi
  1722. if test -f ui.h -a "${1}" != "-c" ; then 
  1723.   echo shar: Will not over-write existing file \"ui.h\"
  1724. else
  1725. echo shar: Extracting \"ui.h\" \(2948 characters\)
  1726. sed "s/^X//" >ui.h <<'END_OF_ui.h'
  1727. X# include    "color.h"
  1728. X# include    <X/Xlib.h>
  1729. X# include    "control/control.h"
  1730. X
  1731. Xextern Window    xwindow;
  1732. Xextern FontInfo    *font;
  1733. Xextern Bitmap    fill;
  1734. X
  1735. Xstruct plane {
  1736. X    Bitmap    bits;
  1737. X    int    pixel;
  1738. X};
  1739. X
  1740. Xstruct card {
  1741. X    int    nPlanes;
  1742. X    struct plane    planes[5];
  1743. X};
  1744. X
  1745. Xextern struct card    cards[];
  1746. Xextern struct card    backside;
  1747. Xextern struct card    eraseCard;
  1748. X
  1749. X
  1750. Xstruct safety_offset {
  1751. X    int    x;
  1752. X    int    y;
  1753. X};
  1754. X
  1755. Xextern struct safety_offset    safety_offsets[4];
  1756. X
  1757. X# define PAD_CARD    (5)
  1758. X# define MILE_OFFSET    (5)
  1759. X# define PAD_TEXT    (20)
  1760. X# define DIST_HEIGHT    (15)
  1761. X# define DIST_WIDTH    ((WIDTH + PAD_CARD) * 5 - PAD_CARD)
  1762. X# define DIST_MARK    (4)
  1763. X
  1764. X# define COMP_HAND_X    (PAD_CARD)
  1765. X# define COMP_HAND_Y    (-HEIGHT)
  1766. X# define COMP_DIST_TX    (PAD_CARD + (WIDTH + PAD_CARD) * 2)
  1767. X# define COMP_DIST_TY    (PAD_CARD)
  1768. X# define COMP_DIST_MX    (COMP_DIST_TX)
  1769. X# define COMP_DIST_MY    (COMP_DIST_TY + PAD_TEXT)
  1770. X# define COMP_DIST_X    (COMP_DIST_MX)
  1771. X# define COMP_DIST_Y    (COMP_DIST_MY + DIST_MARK + 1)
  1772. X
  1773. X# define COMP_PLAY_X    PAD_CARD
  1774. X# define COMP_PLAY_Y    (COMP_DIST_Y + DIST_HEIGHT + PAD_CARD)
  1775. X
  1776. X# define COMP_SAFE_X    (COMP_PLAY_X + ((WIDTH + PAD_CARD) * 7))
  1777. X# define COMP_SAFE_Y    COMP_PLAY_Y
  1778. X
  1779. X# define COMP_CARD_TX    PAD_CARD
  1780. X# define COMP_CARD_TY    (COMP_PLAY_Y + HEIGHT + 6 * MILE_OFFSET + PAD_CARD)
  1781. X# define COMP_CARD_X    COMP_CARD_TX
  1782. X# define COMP_CARD_Y    (COMP_CARD_TY + PAD_TEXT)
  1783. X
  1784. X# define MESS_X        (PAD_CARD)
  1785. X# define MESS_Y        (COMP_PLAY_Y + HEIGHT + 6 * MILE_OFFSET + PAD_CARD + PAD_TEXT)
  1786. X# define MESS_W        150
  1787. X# define MESS_H        (font->height)
  1788. X# define PROMPT_X    MESS_X
  1789. X# define PROMPT_Y    (MESS_Y + PAD_TEXT)
  1790. X# define PROMPT_W    (MESS_W)
  1791. X# define PROMPT_H    (MESS_H)
  1792. X# define ERROR_X    PROMPT_X
  1793. X# define ERROR_Y    (PROMPT_Y + PAD_TEXT)
  1794. X# define ERROR_W    (MESS_W)
  1795. X# define ERROR_H    (MESS_H)
  1796. X
  1797. X# define QUIT_X        (MESS_X)
  1798. X# define QUIT_Y        (ERROR_Y + PAD_TEXT + PAD_CARD)
  1799. X# define SAVE_X        (QUIT_X + 75)
  1800. X# define SAVE_Y        (QUIT_Y)
  1801. X
  1802. X# define DISCARD_TX    (MESS_X + MESS_W + PAD_CARD)
  1803. X# define DISCARD_TY    (MESS_Y - PAD_TEXT)
  1804. X# define DISCARD_X    (DISCARD_TX)
  1805. X# define DISCARD_Y    (DISCARD_TY + PAD_TEXT)
  1806. X
  1807. X# define DECK_TX    (DISCARD_X + WIDTH + PAD_CARD)
  1808. X# define DECK_TY    (DISCARD_TY)
  1809. X# define DECK_X        (DECK_TX)
  1810. X# define DECK_Y        (DISCARD_Y)
  1811. X
  1812. X# define SCORE_W    (100)
  1813. X# define SCORE_H    (font->height)
  1814. X# define SCORE_N    13
  1815. X# define SCORE_X    (DECK_X + WIDTH + PAD_CARD + SCORE_W)
  1816. X# define SCORE_Y    (DECK_TY)
  1817. X
  1818. X# define HUM_DIST_TX    (COMP_DIST_TX)
  1819. X# define HUM_DIST_TY    (SCORE_Y + SCORE_N * SCORE_H + PAD_CARD)
  1820. X# define HUM_DIST_MX    (HUM_DIST_TX)
  1821. X# define HUM_DIST_MY    (HUM_DIST_TY + PAD_TEXT)
  1822. X# define HUM_DIST_X    (HUM_DIST_MX)
  1823. X# define HUM_DIST_Y    (HUM_DIST_MY + DIST_MARK + 1)
  1824. X
  1825. X# define HUM_PLAY_X    PAD_CARD
  1826. X# define HUM_PLAY_Y    (HUM_DIST_Y + DIST_HEIGHT + PAD_CARD)
  1827. X# define HUM_SAFE_X    (HUM_PLAY_X + ((WIDTH + PAD_CARD) * 7))
  1828. X# define HUM_SAFE_Y    (HUM_PLAY_Y)
  1829. X
  1830. X# define HUM_HAND_X    PAD_CARD
  1831. X# define HUM_HAND_Y    (HUM_PLAY_Y + HEIGHT + 6 * MILE_OFFSET + PAD_CARD)
  1832. X
  1833. X# define WINDOW_WIDTH    (HUM_SAFE_X + (WIDTH + PAD_CARD) * 2)
  1834. X# define WINDOW_HEIGHT    (HUM_HAND_Y + HEIGHT + PAD_CARD)
  1835. END_OF_ui.h
  1836. if test 2948 -ne `wc -c <ui.h`; then
  1837.     echo shar: \"ui.h\" unpacked with wrong size!
  1838. fi
  1839. # end of overwriting check
  1840. fi
  1841. if test -f varpush.c -a "${1}" != "-c" ; then 
  1842.   echo shar: Will not over-write existing file \"varpush.c\"
  1843. else
  1844. echo shar: Extracting \"varpush.c\" \(1170 characters\)
  1845. sed "s/^X//" >varpush.c <<'END_OF_varpush.c'
  1846. X# include    "mille.h"
  1847. X
  1848. X/*
  1849. X * @(#)varpush.c    1.1 (Berkeley) 4/1/82
  1850. X */
  1851. X
  1852. Xint    read(), write();
  1853. X
  1854. X/*
  1855. X *    push variables around via the routine func() on the file
  1856. X * channel file.  func() is either read or write.
  1857. X */
  1858. Xvarpush(file, func)
  1859. Xreg int    file;
  1860. Xreg int    (*func)(); {
  1861. X
  1862. X    int    temp;
  1863. X
  1864. X    (*func)(file, &Debug, sizeof Debug);
  1865. X    (*func)(file, &Finished, sizeof Finished);
  1866. X    (*func)(file, &Order, sizeof Order);
  1867. X    (*func)(file, &End, sizeof End);
  1868. X    (*func)(file, &On_exit, sizeof On_exit);
  1869. X    (*func)(file, &Handstart, sizeof Handstart);
  1870. X    (*func)(file, &Numgos, sizeof Numgos);
  1871. X    (*func)(file,  Numseen, sizeof Numseen);
  1872. X    (*func)(file, &Play, sizeof Play);
  1873. X    (*func)(file, &WIndow, sizeof WIndow);
  1874. X    (*func)(file,  Deck, sizeof Deck);
  1875. X    (*func)(file, &Discard, sizeof Discard);
  1876. X    (*func)(file,  Player, sizeof Player);
  1877. X    if (func == read) {
  1878. X        read(file, &temp, sizeof temp);
  1879. X        Topcard = &Deck[temp];
  1880. X        if (Debug) {
  1881. X            char    buf[80];
  1882. Xover:
  1883. X            printf("Debug file:");
  1884. X            gets(buf);
  1885. X            if ((outf = fopen(buf, "w")) == NULL) {
  1886. X                perror(buf);
  1887. X                goto over;
  1888. X            }
  1889. X            if (strcmp(buf, "/dev/null") != 0)
  1890. X                setbuf(outf, 0);
  1891. X        }
  1892. X    }
  1893. X    else {
  1894. X        temp = Topcard - Deck;
  1895. X        write(file, &temp, sizeof temp);
  1896. X    }
  1897. X}
  1898. END_OF_varpush.c
  1899. if test 1170 -ne `wc -c <varpush.c`; then
  1900.     echo shar: \"varpush.c\" unpacked with wrong size!
  1901. fi
  1902. # end of overwriting check
  1903. fi
  1904. echo shar: End of archive 2 \(of 3\).
  1905. cp /dev/null ark2isdone
  1906. MISSING=""
  1907. for I in 1 2 3 ; do
  1908.     if test ! -f ark${I}isdone ; then
  1909.     MISSING="${MISSING} ${I}"
  1910.     fi
  1911. done
  1912. if test "${MISSING}" = "" ; then
  1913.     echo You have unpacked all 3 archives.
  1914.     echo "Now uudecode and uncompress 'cards.Z.uu' and feed to sh"
  1915.     rm -f ark[1-9]isdone
  1916. else
  1917.     echo You still need to unpack the following archives:
  1918.     echo "        " ${MISSING}
  1919. fi
  1920. ##  End of shell archive.
  1921. exit 0
  1922.  
  1923.  
  1924.