extern.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /* $NetBSD: extern.c,v 1.7 2003/08/07 09:37:25 agc Exp $ */
  2. /*
  3. * Copyright (c) 1982, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of the University nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. */
  30. #include <sys/cdefs.h>
  31. #ifndef lint
  32. #if 0
  33. static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
  34. #else
  35. __RCSID("$NetBSD: extern.c,v 1.7 2003/08/07 09:37:25 agc Exp $");
  36. #endif
  37. #endif /* not lint */
  38. # include "mille.h"
  39. /*
  40. * @(#)extern.c 1.1 (Berkeley) 4/1/82
  41. */
  42. bool Debug, /* set if debugging code on */
  43. Finished, /* set if current hand is finished */
  44. Next, /* set if changing players */
  45. On_exit, /* set if game saved on exiting */
  46. Order, /* set if hand should be sorted */
  47. Saved; /* set if game just saved */
  48. char Initstr[100]; /* initial string for error field */
  49. const char *C_fmt = "%-18.18s", /* format for printing cards */
  50. *Fromfile = NULL, /* startup file for game */
  51. *const _cn[NUM_CARDS] = { /* Card name buffer */
  52. "",
  53. "25",
  54. "50",
  55. "75",
  56. "100",
  57. "200",
  58. "Out of Gas",
  59. "Flat Tire",
  60. "Accident",
  61. "Stop",
  62. "Speed Limit",
  63. "Gasoline",
  64. "Spare Tire",
  65. "Repairs",
  66. "Go",
  67. "End of Limit",
  68. "Extra Tank",
  69. "Puncture Proof",
  70. "Driving Ace",
  71. "Right of Way"
  72. },
  73. *const *C_name = &_cn[1]; /* Card names */
  74. int Card_no, /* Card number for current move */
  75. End, /* End value for current hand */
  76. Handstart = COMP, /* Player who starts hand */
  77. Movetype, /* Current move type */
  78. Play, /* Current player */
  79. Numgos, /* Number of Go cards used by computer */
  80. Window = W_SMALL, /* Current window wanted */
  81. Numseen[NUM_CARDS]; /* Number of cards seen in current hand */
  82. const int Value[NUM_MILES] = { /* Value of mileage cards */
  83. 25, 50, 75, 100, 200
  84. },
  85. Numcards[NUM_CARDS] = { /* Number of cards in deck */
  86. 10, /* C_25 */
  87. 10, /* C_50 */
  88. 10, /* C_75 */
  89. 12, /* C_100 */
  90. 4, /* C_200 */
  91. 2, /* C_EMPTY */
  92. 2, /* C_FLAT */
  93. 2, /* C_CRASH */
  94. 4, /* C_STOP */
  95. 3, /* C_LIMIT */
  96. 6, /* C_GAS */
  97. 6, /* C_SPARE */
  98. 6, /* C_REPAIRS */
  99. 14, /* C_GO */
  100. 6, /* C_END_LIMIT */
  101. 1, /* C_GAS_SAFE */
  102. 1, /* C_SPARE_SAFE */
  103. 1, /* C_DRIVE_SAFE */
  104. 1, /* C_RIGHT_WAY */
  105. 0 /* C_INIT */
  106. };
  107. int Numneed[NUM_CARDS] = { /* number of cards needed per hand */
  108. 0, /* C_25 */
  109. 0, /* C_50 */
  110. 0, /* C_75 */
  111. 0, /* C_100 */
  112. 0, /* C_200 */
  113. 2, /* C_EMPTY */
  114. 2, /* C_FLAT */
  115. 2, /* C_CRASH */
  116. 4, /* C_STOP */
  117. 3, /* C_LIMIT */
  118. 2, /* C_GAS */
  119. 2, /* C_SPARE */
  120. 2, /* C_REPAIRS */
  121. 10, /* C_GO */
  122. 3, /* C_END_LIMIT */
  123. 1, /* C_GAS_SAFE */
  124. 1, /* C_SPARE_SAFE */
  125. 1, /* C_DRIVE_SAFE */
  126. 1, /* C_RIGHT_WAY */
  127. 0 /* C_INIT */
  128. };
  129. CARD Discard, /* Top of discard pile */
  130. Sh_discard, /* Last discard card shown */
  131. *Topcard; /* Pointer to next card to be picked */
  132. const CARD Opposite[NUM_CARDS] = { /* Opposites of each card */
  133. C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
  134. C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
  135. C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
  136. };
  137. CARD Deck[DECK_SZ] = { /* Current deck */
  138. C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
  139. C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
  140. C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
  141. C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100,
  142. C_100, C_100, C_100,
  143. C_200, C_200, C_200, C_200,
  144. C_EMPTY, C_EMPTY,
  145. C_FLAT, C_FLAT,
  146. C_CRASH, C_CRASH,
  147. C_STOP, C_STOP, C_STOP, C_STOP,
  148. C_LIMIT, C_LIMIT, C_LIMIT,
  149. C_GAS, C_GAS, C_GAS, C_GAS, C_GAS, C_GAS,
  150. C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE,
  151. C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS,
  152. C_REPAIRS,
  153. C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT,
  154. C_END_LIMIT,
  155. C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO,
  156. C_GO, C_GO, C_GO, C_GO,
  157. C_GAS_SAFE, C_SPARE_SAFE, C_DRIVE_SAFE, C_RIGHT_WAY
  158. };
  159. FILE *outf;
  160. PLAY Player[2]; /* Player descriptions */
  161. WINDOW *Board, /* Playing field screen */
  162. *Miles, /* Mileage screen */
  163. *Score; /* Score screen */