home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!zephyr.ens.tek.com!master!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v13i012: xmake5 - connect five-in-a-row game, Part03/03
- Message-ID: <2162@masterCNA.TEK.COM>
- Date: 13 Dec 91 22:21:53 GMT
- Sender: news@masterCNA.TEK.COM
- Lines: 254
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: hsiehch@SPUNKY.CS.NYU.EDU (Chih-Hung Hsieh)
- Posting-number: Volume 13, Issue 12
- Archive-name: xmake5/Part03
- Environment: C++, X11, curses
-
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 3 (of 3)."
- # Contents: COPYRIGHT board.xbm cmake5.6 line_val.inc printhelp.c
- # xmake5.h
- # Wrapped by billr@saab on Fri Dec 13 14:14:56 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'COPYRIGHT'\"
- else
- echo shar: Extracting \"'COPYRIGHT'\" \(560 characters\)
- sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
- XCopyright 1991 Chih-Hung Hsieh
- X
- XAll rights reserved.
- X
- XPermission to use, copy, modify, and distribute this program
- Xfor any purpose and without fee is hereby granted, provided
- Xthat the above copy right notice and this permission notice
- Xappear in all copies, and that the name of the author not be
- Xused in advertising or publicity pertaining to this document
- Xwithout specific, written prior permission. The author make
- Xno representations about the suitability of this document for
- Xany purpose. It is provided ``as is'' without expressed or
- Ximplied warranty.
- END_OF_FILE
- if test 560 -ne `wc -c <'COPYRIGHT'`; then
- echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
- fi
- # end of 'COPYRIGHT'
- fi
- if test -f 'board.xbm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'board.xbm'\"
- else
- echo shar: Extracting \"'board.xbm'\" \(102 characters\)
- sed "s/^X//" >'board.xbm' <<'END_OF_FILE'
- X#define board_width 4
- X#define board_height 4
- Xstatic char board_bits[] = {
- X 0x01, 0x04, 0x02, 0x08};
- END_OF_FILE
- if test 102 -ne `wc -c <'board.xbm'`; then
- echo shar: \"'board.xbm'\" unpacked with wrong size!
- fi
- # end of 'board.xbm'
- fi
- if test -f 'cmake5.6' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cmake5.6'\"
- else
- echo shar: Extracting \"'cmake5.6'\" \(2035 characters\)
- sed "s/^X//" >'cmake5.6' <<'END_OF_FILE'
- X.TH CMAKE5 6 "28 November 1991"
- X.SH NAME
- Xcmake5 \- the game of 5-in-a-row
- X.SH SYNOPSIS
- X.B cmake5
- X.SH DESCRIPTION
- X.I Make5
- Xis a game similar to Tic-Tac-Toe.
- XIt is called Wu3-Zi3-Qi2 in Chinese and is
- Xvery popular in the Far East.
- X5-in-a-row and Go-Moku are the other names
- Xfor this game.
- XYou may also find it called "Chess"
- Xon some Nitendo game cartridges.
- XI call it Make5 because the goal of this game
- Xis to make five continuous stones in a line.
- X.LP
- XThis game was originally played by two players
- Xon a board of infinite size. Each player puts
- Xa stone at one empty cross-point at a time.
- XThe winner is the one who first puts five
- Xcontinuous stones in a line, vertically,
- Xhorizontally, or diagonally.
- X.LP
- XHowever, this program plays the game on a finite
- Xboard the same size as a GO game board, which has
- X19 by 19 cross-points.
- X.I The only tricky rule
- X.I is that you must make
- X.I exactly five continuous
- X.I stones in a line to win.
- X.I Six or more stones in
- X.I a line do not count.
- X.LP
- XSome people play this game with a rule which
- Xprohibits the first player to make double-3 or
- Xdouble-4 attacking patterns. But I do not
- Xlike this rule and did not include it in this
- Xprogram.
- X.LP
- X.SH OPTIONS
- XSince this program is designed for the situation
- Xwhen an X terminal is not available, only a
- Xlimited user interface and options are supported.
- XWhenever X is available, you would use
- X.B xmake5
- Xinstead.
- X.LP
- XOnly three playing modes are supported in cmake5:
- X(1) challenge (computer moves first),
- X(2) computer vs. human (computer moves first),
- X(3) human vs. computer (human moves first).
- XIn the challenge mode,
- Xyou can not undo or get suggestions
- Xfrom the computer. If you beat the computer, your
- Xname would be added into the list of winners.
- X.LP
- XHave fun!
- X
- X.SH BUGS
- X.nf
- XPlease send bugs to "hsiehch@cs.nyu.edu".
- X.LP
- XThis program does not have any learning ability.
- XYou could use the same strategy to beat it again and again.
- X.fi
- X.sp
- X.SH AUTHOR
- XChih-Hung Hsieh
- X.sp
- X.SH "SEE ALSO"
- Xxmake5 \- a better version with an X interface.
- X
- X
- X
- END_OF_FILE
- if test 2035 -ne `wc -c <'cmake5.6'`; then
- echo shar: \"'cmake5.6'\" unpacked with wrong size!
- fi
- # end of 'cmake5.6'
- fi
- if test -f 'line_val.inc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'line_val.inc'\"
- else
- echo shar: Extracting \"'line_val.inc'\" \(1550 characters\)
- sed "s/^X//" >'line_val.inc' <<'END_OF_FILE'
- Xconst line_val_type line_val = {
- X20,20,20,20,20,20,20,20,20,19,20,20,20,16,11,20,20,20,16,11,
- X11,20,20,20,11, 5, 5, 1,20,19,16,18,16,14,11,18,20,16,11,16,
- X20,11,20,16,14,20,16,11,14,11, 8, 5,14,16,11,20,11, 5,11,20,
- X 5,20,11,11,20,20,20,16,11,14,11, 8, 5,14,11, 8, 5, 6,20,11,
- X 5,11,20, 5,20,11, 8,11, 5, 3, 2,20,11, 5, 8, 5, 2, 1, 8,11,
- X 5,20, 2, 5, 1,20, 5, 1, 5,20, 1,20, 5, 5,20,20, 1, 1,20,20,
- X19,18,16,18,16,14,11,18,16,14,11,14,11, 8, 5,17,16,16,20,16,
- X14,16,11,16,16,14,11,14,11, 8, 5,16,15,16,14,11,14,16,11,20,
- X14,14,16,11,11, 8,11, 5,13,12,12,11,11,20,11,11,20,20,11,11,
- X11, 8,16,11,11, 5,11,10,10, 9,16,14,11,14,11, 8, 5,14,14,11,
- X16, 8,11, 5,20,13,12,12,10,10,11,11,20,11, 8,11, 5,11,11, 8,
- X11,11,20, 5,20,11,10,10, 9, 7, 6,11, 8, 5, 8,11, 5,20, 8, 8,
- X11,11, 5, 5,20,20, 8, 7, 7, 6,10, 9, 9, 5, 5,20, 5, 5,20,20,
- X 5, 5, 5, 5,20,20,20,20, 5, 4, 4, 3, 4, 3, 3, 2,16,14,11,14,
- X11, 8, 5,12,10, 7, 4, 6, 3, 2, 1,12,14,10,14, 7,11, 4,16, 6,
- X11,11,20,11, 8,11, 5,10, 9, 6, 3, 8, 5, 2, 1,10,11, 9,11, 6,
- X 8, 3,11, 8,11,11, 8, 5, 8,11, 5,20, 7, 6, 9, 3, 3, 2, 5, 1,
- X 7, 8, 6, 8, 9,11, 3,11, 3, 5, 2, 5, 5,20, 5, 5,20,20, 4, 3,
- X 3, 2,11, 5, 5, 1, 4, 5, 3, 5, 3, 5, 2, 5,11,20, 5,20,11, 8,
- X 5, 6, 3, 2, 1, 6, 8, 3,11, 2, 5, 1,20, 6, 6, 8, 8, 3, 3,11,
- X11, 2, 2, 5, 5, 1, 5, 5,20, 3, 2, 5, 1, 3, 5, 2, 5, 5,20, 1,
- X20, 3, 3, 5, 5, 2, 2, 5, 5, 5, 5,20,20, 1, 1, 5, 2, 1, 2, 5,
- X 1,20, 2, 2, 5, 5, 1, 1,20,20, 2, 2, 2, 2, 5, 5, 5, 5, 1, 1,
- X 1, 1,20,20,20, 1, 1,20, 1, 1,20,20, 1, 1, 1, 1,20,20,20,20,
- X 1, 1, 1, 1, 1, 1, 1, 1,20,20,20,20,20,20,20,20,20};
- END_OF_FILE
- if test 1550 -ne `wc -c <'line_val.inc'`; then
- echo shar: \"'line_val.inc'\" unpacked with wrong size!
- fi
- # end of 'line_val.inc'
- fi
- if test -f 'printhelp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'printhelp.c'\"
- else
- echo shar: Extracting \"'printhelp.c'\" \(69 characters\)
- sed "s/^X//" >'printhelp.c' <<'END_OF_FILE'
- Xextern char *helptext;
- Xmain(){
- X printf("%s",helptext);
- X exit(0);
- X}
- END_OF_FILE
- if test 69 -ne `wc -c <'printhelp.c'`; then
- echo shar: \"'printhelp.c'\" unpacked with wrong size!
- fi
- # end of 'printhelp.c'
- fi
- if test -f 'xmake5.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xmake5.h'\"
- else
- echo shar: Extracting \"'xmake5.h'\" \(982 characters\)
- sed "s/^X//" >'xmake5.h' <<'END_OF_FILE'
- X#define BoardLines 19
- X#define BoardSize 21
- X#define empty_stone 2
- X#define black_stone 0
- X#define white_stone 1
- X
- X#define max(a,b) ((a>b)?a:b)
- X#define BoardX(x) (x%BoardSize-1)
- X#define BoardY(x) (x/BoardSize-1)
- X
- Xextern Display *display;
- Xextern int screen_num;
- Xextern Widget toplevel;
- X
- Xextern char player_name[2];
- Xextern int step, player; /* used in make5.C */
- Xextern int game_over;
- Xextern int last_move_rec, move_rec[360];
- Xextern char board_stones[BoardLines][BoardLines];
- X
- X/**********************************************************************/
- Xextern int num_of_suggestion, suggest_position[];
- Xextern char *helptext;
- Xextern void init_data(); /* in make5.C */
- Xextern char *get_warning();
- Xextern int is_game_over();
- Xextern void take_out();
- X/**********************************************************************/
- Xextern void check_computer_move(), make_computer_move(), make_a_move();
- Xextern void mark_last_move(), unmark_last_move();
- END_OF_FILE
- if test 982 -ne `wc -c <'xmake5.h'`; then
- echo shar: \"'xmake5.h'\" unpacked with wrong size!
- fi
- # end of 'xmake5.h'
- fi
- echo shar: End of archive 3 \(of 3\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 3 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-