home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume13 / xmake5 / part03 < prev    next >
Encoding:
Text File  |  1992-01-12  |  8.8 KB  |  265 lines

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v13i012:  xmake5 - connect five-in-a-row game, Part03/03
  5. Message-ID: <2162@masterCNA.TEK.COM>
  6. Date: 13 Dec 91 22:21:53 GMT
  7. Sender: news@masterCNA.TEK.COM
  8. Lines: 254
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: hsiehch@SPUNKY.CS.NYU.EDU (Chih-Hung Hsieh)
  12. Posting-number: Volume 13, Issue 12
  13. Archive-name: xmake5/Part03
  14. Environment: C++, X11, curses
  15.  
  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 3 (of 3)."
  25. # Contents:  COPYRIGHT board.xbm cmake5.6 line_val.inc printhelp.c
  26. #   xmake5.h
  27. # Wrapped by billr@saab on Fri Dec 13 14:14:56 1991
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'COPYRIGHT'\"
  31. else
  32. echo shar: Extracting \"'COPYRIGHT'\" \(560 characters\)
  33. sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
  34. XCopyright 1991 Chih-Hung Hsieh
  35. X
  36. XAll rights reserved.
  37. X
  38. XPermission to use, copy, modify, and distribute this program
  39. Xfor any purpose and without fee is hereby granted, provided
  40. Xthat the above copy right notice and this permission notice
  41. Xappear in all copies, and that the name of the author not be 
  42. Xused in advertising or publicity pertaining to this document 
  43. Xwithout specific, written prior permission.  The author make
  44. Xno representations about the suitability of this document for
  45. Xany purpose.  It is provided ``as is'' without expressed or
  46. Ximplied warranty.
  47. END_OF_FILE
  48. if test 560 -ne `wc -c <'COPYRIGHT'`; then
  49.     echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
  50. fi
  51. # end of 'COPYRIGHT'
  52. fi
  53. if test -f 'board.xbm' -a "${1}" != "-c" ; then 
  54.   echo shar: Will not clobber existing file \"'board.xbm'\"
  55. else
  56. echo shar: Extracting \"'board.xbm'\" \(102 characters\)
  57. sed "s/^X//" >'board.xbm' <<'END_OF_FILE'
  58. X#define board_width 4
  59. X#define board_height 4
  60. Xstatic char board_bits[] = {
  61. X   0x01, 0x04, 0x02, 0x08};
  62. END_OF_FILE
  63. if test 102 -ne `wc -c <'board.xbm'`; then
  64.     echo shar: \"'board.xbm'\" unpacked with wrong size!
  65. fi
  66. # end of 'board.xbm'
  67. fi
  68. if test -f 'cmake5.6' -a "${1}" != "-c" ; then 
  69.   echo shar: Will not clobber existing file \"'cmake5.6'\"
  70. else
  71. echo shar: Extracting \"'cmake5.6'\" \(2035 characters\)
  72. sed "s/^X//" >'cmake5.6' <<'END_OF_FILE'
  73. X.TH CMAKE5 6  "28 November 1991"
  74. X.SH NAME
  75. Xcmake5 \- the game of 5-in-a-row
  76. X.SH SYNOPSIS
  77. X.B cmake5
  78. X.SH DESCRIPTION
  79. X.I Make5
  80. Xis a game similar to Tic-Tac-Toe.
  81. XIt is called Wu3-Zi3-Qi2 in Chinese and is 
  82. Xvery popular in the Far East.
  83. X5-in-a-row and Go-Moku are the other names
  84. Xfor this game.
  85. XYou may also find it called "Chess" 
  86. Xon some Nitendo game cartridges.
  87. XI call it Make5 because the goal of this game
  88. Xis to make five continuous stones in a line.
  89. X.LP
  90. XThis game was originally played by two players
  91. Xon a board of infinite size.  Each player puts
  92. Xa stone at one empty cross-point at a time.  
  93. XThe winner is the one who first puts five
  94. Xcontinuous stones in a line, vertically, 
  95. Xhorizontally, or diagonally.
  96. X.LP
  97. XHowever, this program plays the game on a finite
  98. Xboard the same size as a GO game board, which has
  99. X19 by 19 cross-points.
  100. X.I The only tricky rule 
  101. X.I is that you must make
  102. X.I exactly five continuous 
  103. X.I stones in a line to win.  
  104. X.I Six or more stones in
  105. X.I a line do not count.
  106. X.LP
  107. XSome people play this game with a rule which
  108. Xprohibits the first player to make double-3 or 
  109. Xdouble-4 attacking patterns.  But I do not
  110. Xlike this rule and did not include it in this 
  111. Xprogram.
  112. X.LP
  113. X.SH OPTIONS
  114. XSince this program is designed for the situation
  115. Xwhen an X terminal is not available, only a
  116. Xlimited user interface and options are supported.
  117. XWhenever X is available, you would use 
  118. X.B xmake5 
  119. Xinstead.
  120. X.LP
  121. XOnly three playing modes are supported in cmake5:
  122. X(1) challenge (computer moves first), 
  123. X(2) computer vs. human (computer moves first),
  124. X(3) human vs. computer (human moves first).
  125. XIn the challenge mode,
  126. Xyou can not undo or get suggestions
  127. Xfrom the computer.  If you beat the computer, your
  128. Xname would be added into the list of winners.
  129. X.LP
  130. XHave fun!
  131. X
  132. X.SH BUGS
  133. X.nf
  134. XPlease send bugs to "hsiehch@cs.nyu.edu".
  135. X.LP
  136. XThis program does not have any learning ability.  
  137. XYou could use the same strategy to beat it again and again.
  138. X.fi
  139. X.sp
  140. X.SH AUTHOR
  141. XChih-Hung Hsieh
  142. X.sp
  143. X.SH "SEE ALSO"
  144. Xxmake5 \- a better version with an X interface.
  145. X
  146. X
  147. X
  148. END_OF_FILE
  149. if test 2035 -ne `wc -c <'cmake5.6'`; then
  150.     echo shar: \"'cmake5.6'\" unpacked with wrong size!
  151. fi
  152. # end of 'cmake5.6'
  153. fi
  154. if test -f 'line_val.inc' -a "${1}" != "-c" ; then 
  155.   echo shar: Will not clobber existing file \"'line_val.inc'\"
  156. else
  157. echo shar: Extracting \"'line_val.inc'\" \(1550 characters\)
  158. sed "s/^X//" >'line_val.inc' <<'END_OF_FILE'
  159. Xconst line_val_type line_val = {
  160. X20,20,20,20,20,20,20,20,20,19,20,20,20,16,11,20,20,20,16,11,
  161. X11,20,20,20,11, 5, 5, 1,20,19,16,18,16,14,11,18,20,16,11,16,
  162. X20,11,20,16,14,20,16,11,14,11, 8, 5,14,16,11,20,11, 5,11,20,
  163. X 5,20,11,11,20,20,20,16,11,14,11, 8, 5,14,11, 8, 5, 6,20,11,
  164. X 5,11,20, 5,20,11, 8,11, 5, 3, 2,20,11, 5, 8, 5, 2, 1, 8,11,
  165. X 5,20, 2, 5, 1,20, 5, 1, 5,20, 1,20, 5, 5,20,20, 1, 1,20,20,
  166. X19,18,16,18,16,14,11,18,16,14,11,14,11, 8, 5,17,16,16,20,16,
  167. X14,16,11,16,16,14,11,14,11, 8, 5,16,15,16,14,11,14,16,11,20,
  168. X14,14,16,11,11, 8,11, 5,13,12,12,11,11,20,11,11,20,20,11,11,
  169. X11, 8,16,11,11, 5,11,10,10, 9,16,14,11,14,11, 8, 5,14,14,11,
  170. X16, 8,11, 5,20,13,12,12,10,10,11,11,20,11, 8,11, 5,11,11, 8,
  171. X11,11,20, 5,20,11,10,10, 9, 7, 6,11, 8, 5, 8,11, 5,20, 8, 8,
  172. X11,11, 5, 5,20,20, 8, 7, 7, 6,10, 9, 9, 5, 5,20, 5, 5,20,20,
  173. X 5, 5, 5, 5,20,20,20,20, 5, 4, 4, 3, 4, 3, 3, 2,16,14,11,14,
  174. X11, 8, 5,12,10, 7, 4, 6, 3, 2, 1,12,14,10,14, 7,11, 4,16, 6,
  175. X11,11,20,11, 8,11, 5,10, 9, 6, 3, 8, 5, 2, 1,10,11, 9,11, 6,
  176. X 8, 3,11, 8,11,11, 8, 5, 8,11, 5,20, 7, 6, 9, 3, 3, 2, 5, 1,
  177. X 7, 8, 6, 8, 9,11, 3,11, 3, 5, 2, 5, 5,20, 5, 5,20,20, 4, 3,
  178. X 3, 2,11, 5, 5, 1, 4, 5, 3, 5, 3, 5, 2, 5,11,20, 5,20,11, 8,
  179. X 5, 6, 3, 2, 1, 6, 8, 3,11, 2, 5, 1,20, 6, 6, 8, 8, 3, 3,11,
  180. X11, 2, 2, 5, 5, 1, 5, 5,20, 3, 2, 5, 1, 3, 5, 2, 5, 5,20, 1,
  181. X20, 3, 3, 5, 5, 2, 2, 5, 5, 5, 5,20,20, 1, 1, 5, 2, 1, 2, 5,
  182. X 1,20, 2, 2, 5, 5, 1, 1,20,20, 2, 2, 2, 2, 5, 5, 5, 5, 1, 1,
  183. X 1, 1,20,20,20, 1, 1,20, 1, 1,20,20, 1, 1, 1, 1,20,20,20,20,
  184. X 1, 1, 1, 1, 1, 1, 1, 1,20,20,20,20,20,20,20,20,20};
  185. END_OF_FILE
  186. if test 1550 -ne `wc -c <'line_val.inc'`; then
  187.     echo shar: \"'line_val.inc'\" unpacked with wrong size!
  188. fi
  189. # end of 'line_val.inc'
  190. fi
  191. if test -f 'printhelp.c' -a "${1}" != "-c" ; then 
  192.   echo shar: Will not clobber existing file \"'printhelp.c'\"
  193. else
  194. echo shar: Extracting \"'printhelp.c'\" \(69 characters\)
  195. sed "s/^X//" >'printhelp.c' <<'END_OF_FILE'
  196. Xextern char *helptext;
  197. Xmain(){
  198. X  printf("%s",helptext);
  199. X  exit(0);
  200. X}
  201. END_OF_FILE
  202. if test 69 -ne `wc -c <'printhelp.c'`; then
  203.     echo shar: \"'printhelp.c'\" unpacked with wrong size!
  204. fi
  205. # end of 'printhelp.c'
  206. fi
  207. if test -f 'xmake5.h' -a "${1}" != "-c" ; then 
  208.   echo shar: Will not clobber existing file \"'xmake5.h'\"
  209. else
  210. echo shar: Extracting \"'xmake5.h'\" \(982 characters\)
  211. sed "s/^X//" >'xmake5.h' <<'END_OF_FILE'
  212. X#define  BoardLines 19
  213. X#define  BoardSize  21
  214. X#define  empty_stone 2
  215. X#define  black_stone 0
  216. X#define  white_stone 1
  217. X
  218. X#define max(a,b)  ((a>b)?a:b)
  219. X#define BoardX(x) (x%BoardSize-1)
  220. X#define BoardY(x) (x/BoardSize-1)
  221. X
  222. Xextern Display  *display;
  223. Xextern int      screen_num;
  224. Xextern Widget   toplevel;
  225. X
  226. Xextern char   player_name[2];
  227. Xextern int    step, player;              /* used in make5.C  */
  228. Xextern int    game_over;
  229. Xextern int    last_move_rec, move_rec[360];
  230. Xextern char   board_stones[BoardLines][BoardLines];
  231. X
  232. X/**********************************************************************/
  233. Xextern int  num_of_suggestion, suggest_position[];
  234. Xextern char *helptext;
  235. Xextern void init_data();       /* in make5.C */
  236. Xextern char *get_warning();
  237. Xextern int  is_game_over();
  238. Xextern void take_out();
  239. X/**********************************************************************/
  240. Xextern void check_computer_move(), make_computer_move(), make_a_move();
  241. Xextern void mark_last_move(), unmark_last_move();
  242. END_OF_FILE
  243. if test 982 -ne `wc -c <'xmake5.h'`; then
  244.     echo shar: \"'xmake5.h'\" unpacked with wrong size!
  245. fi
  246. # end of 'xmake5.h'
  247. fi
  248. echo shar: End of archive 3 \(of 3\).
  249. cp /dev/null ark3isdone
  250. MISSING=""
  251. for I in 1 2 3 ; do
  252.     if test ! -f ark${I}isdone ; then
  253.     MISSING="${MISSING} ${I}"
  254.     fi
  255. done
  256. if test "${MISSING}" = "" ; then
  257.     echo You have unpacked all 3 archives.
  258.     rm -f ark[1-9]isdone
  259. else
  260.     echo You still need to unpack the following archives:
  261.     echo "        " ${MISSING}
  262. fi
  263. ##  End of shell archive.
  264. exit 0
  265.