[comp.sources.games] v11i057: reve - an othello game, Part06/07

billr@saab.CNA.TEK.COM (Bill Randle) (11/02/90)

Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 11, Issue 57
Archive-name: reve/Part06
Environment: SunView, XView, X11, termcap


#! /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 6 (of 7)."
# Contents:  CHANGES Makefile.dist images.h rev_eval.c reve.6 reve.h
#   reve.man
# Wrapped by billr@saab on Thu Nov  1 14:02:54 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CHANGES'\"
else
echo shar: Extracting \"'CHANGES'\" \(8470 characters\)
sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
X
X/*  @(#)CHANGES 1.9 90/10/20
X *
X *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X *  All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  introductory messages are not removed, and no monies are exchanged.
X *
X *  You are forbidden from using Reve as is, or in a modified state, in
X *  any tournaments, without the permission of the authors.
X *
X *  No responsibility is taken for any errors on inaccuracies inherent
X *  either to the comments or the code of this program, but if reported
X *  (see README file), then an attempt will be made to fix them.
X */
X
XReve change history.
X====================
X
Xv1.1 - patchlevel 0. 22nd October 1990.
X
X       * A #include <ctype.h> is needed in boardstuff.c to handle the
X         islower() macro. SunOS v4.1 didn't require this.
X
X       * If black is being played by the computer, and you select a new
X         game, the first move was not being made.
X
X       * Changed the default playing mode. If you startup reve now with
X         no command line options, then black is played by a human, and
X         the computer plays white. The manual pages have been updated to
X         mention this.
X
X       * Disabled the time allocation function for the computer when the
X         level of difficulty is 1. This means the computer makes a fast
X         simple move. Level #2 is now set to a total of one minute. The
X         manual pages have been updated to reflect this.
X
X       * Reve was incorrectly giving notes when humans were making moves.
X
X       * If the user has undone a few moves, the save operation still
X         saved the undone moves.
X
X       * The score message should be Black: first, followed by  White:,
X         and not the other way around.
X
X       * If a player is forced to pass the turn message was not being set
X         correctly.
X
X       * The load/save text field was being incorrectly removed with the
X         monochrome version.
X
X       * Increased the version number to v1.1; reset the patchlevel to 0.
X
X         [Posted to comp.sources.games].
X
Xv1.0 - patchlevel 6. 18th October 1990.
X
X       * Fixed up the tty version to work with all the new panel items.
X
X       * Keyboard input equivalents of each button/cycle now appear to be
X         working.
X
X       * Improved error messages when loading a game file.
X
X       * If the user requests a new game, and the computer was playing
X         black, then the computer now correctly makes the first move.
X
X       * The black/white plays cyclic items have been implemented.
X
X       * The manual pages has been completed. A plain text of the manual
X         pages has been included with the distribution. The FILES, MANIFEST
X         and Makefile.dist files have been updated.
X
X       * The undo routine has been fixed.
X
X       * Changed Makefile.dist to compile reve with -O by default.
X
X         [Made available internally via anon ftp, and to ACSnet sites in
X          Australia via fetchfile].
X
Xv1.0 - patchlevel 5. 17th October 1990.
X
X       * Added in the ability to load a game, either from the command line
X         or via the Load panel button. The initial variables are initialised
X         appropriately, and the board is displayed.
X
X       * Added in the save_game() code.
X
X       * Added an XFlush call to get_event() in the X11 driver. Also set
X         a couple of WM hints. Divided start_tool into two input handling
X         routines depending upon whether XTWO is set. Xnext_input() uses the
X         normal X input handling, and Xselect_input uses the select call
X         (which is not working properly yet).
X
X       * The text field is now correctly redrawn if there was a FRAME_REPAINT
X         event whilst a load or a save was in progress.
X
Xv1.0 - patchlevel 4. 15th October 1990.
X
X       * Added the "done" and "quit" buttons back (albeit on a new second
X         row), and their associated functions.
X
X       * Added in a text input field, which gets displayed when either the
X         load or save buttons are pressed. This allows a filename for the
X         load/save operation to be specified.
X
X       * Added a "-l <gamefile>" command line option, which allows you to
X         specify a game file to initially load. Updated the usage message.
X
X       * Reve will now ignore lines starting with a hash (comments), and
X         blank lines, when reading in the Reve edgetable.
X
X       * Added the hooks (load_game and save_game()) for loading and saving
X         game files. These routines still need to be written.
X
Xv1.0 - patchlevel 3. 8th October 1990.
X
X       * Incorporated new reveinit.[c,h] files from Yves. Adjusted
X         Makefile.dist to not include these files, just thr reve.edgetable.
X
X       * Modified make_move to correctly allow human vs human, and human
X         vs computer.
X
X       * Modified init_canvas, such that if the computer is playing black,
X         it correctly makes it's first move.
X
X       * The cyclic item "Notes:" has been implemented. Two new panel message
X         items have been added; NOTES_MES and TURN_MES.
X
Xv1.0 - patchlevel 2. 2nd October 1990.
X
X       * Finished the strategy section of the README file.
X
X       * Fixed up Makefile.dist to correctly shar up the images directory.
X
X       * Reve now has nine levels of difficulty. This is described in more
X         detail in the README file.
X
X       * Added in Gary Klines' SysV mods (for othello) to the Reve code.
X
X       * reveinit has been linted and modified to generate the edge table in
X         ASCII format. This will make it easily distributable, and save
X         people with slow machines from having to regenerate it. Reve has
X         been modified to read the edge table in ASCII format.
X
X       * A -d <difficulty> command line has been added. This allows you to
X         specify an initial difficulty for Reve.
X
X       * The update_board_image() routine nows outputs who's turn it is next.
X
Xv1.0 - patchlevel 1. 20th September 1990.
X
X       * Inclusion of command line support for -w <display> and -b <display>
X         With the X11 version, this allows two humans on the network to play
X         Reve against each other. All the hooks are there; this just needs to
X         be finished.
X
X       * Included in Yves' new Reve computer strategy that uses a timing
X         function.
X
X       * Increased the number of levels of difficulty to six. These relate
X         to times of 1, 3, 5, 10, 20 and 30 minutes respectively.
X
X       * Completed the README file (except for part of the Reve strategy
X         section).
X
X       * Added the SELTYPE definition to Makefile.dist for non BSD-4.3
X         derived systems.
X
X       * Included the minimum number of #include files with each source
X         file.
X
X       * Changed definitions of BLANC/NOIR/VIDE to WHITE/BLACK/FREE.
X
X       * Adjusted the style of the reve computer strategy modules to be the
X         same as the rest of the Reve code.
X
X       * Made as many routines as possible void. Definitions added to reve.h.
X
X       * All versions (SunView, X11, XView and tty) are now working with the
X         new hooks. This all needs to be finished.
X
Xv1.0 - patchlevel 0. 16th September 1990.
X
X       * Started.
X
X       * Removed all references to othello (replacing them with references
X         to reve). Renamed various files appropriately.
X
X       * All images moved into a sub-directory called images, and images.h
X         adjusted accordingly.
X
X       * All references to Chris Miller's computer move and remarks code
X         have been removed. Two cycle items (for aspiration and remarks?)
X         plus one panel message item have been removed, and the graphics
X         adjusted accordingly.
X
X       * Added in a -? command line option. This and the -v option will
X         display the current reve version number and the usage message then
X         exit.
X
X       * During initialisation, reve will look for a file called
X         reve.edgetable. The location of this file can be set in the Makefile,
X         and also overridden with the -e command line option. Reve will look
X         in every directory on the search path if it's not in the given
X         location.
X
X       * The Makefile has been modified to generated the reve edge table at
X         installation time, if it's not already made.
X
X       * All versions (SunView, X11, XView and tty) are now working with the
X         new graphical layout.
X
X       * The suggest routine now correctly interfaces with the play_reve
X         routine.
END_OF_FILE
if test 8470 -ne `wc -c <'CHANGES'`; then
    echo shar: \"'CHANGES'\" unpacked with wrong size!
fi
# end of 'CHANGES'
fi
if test -f 'Makefile.dist' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile.dist'\"
else
echo shar: Extracting \"'Makefile.dist'\" \(8068 characters\)
sed "s/^X//" >'Makefile.dist' <<'END_OF_FILE'
X#
X#  Makefile for Reve (an othello game).
X#
X#  @(#)Makefile.dist 1.7 90/10/18
X#
X#  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X#  All rights reserved.
X#
X#  Permission is given to distribute these sources, as long as the
X#  introductory messages are not removed, and no monies are exchanged.
X#
X#  You are forbidden from using Reve as is, or in a modified state, in
X#  any tournaments, without the permission of the authors.
X#
X#  No responsibility is taken for any errors inherent either
X#  to the comments or the code of this program, but if reported
X#  (see README file), then an attempt will be made to fix them.
X#
X#========================================================================
X#
X#  There are various small changes needed when compiling reve on
X#  different systems. These have been isolated here, and should be
X#  uncommented if needed.
X#
X#=======================================================================
X#  Full pathname of the reve edge table file. This can also be overridden
X#  with a command line option.
X#
XEDGENAMEFILE    = $(LIBDIR)/reve.edgetable
XEDGENAME        = -DEDGENAME=\"$(EDGENAMEFILE)\"
X#-----------------------------------------------------------------------
X#  Not all machines have the index() string library function. If you
X#  don't have this function then you should uncomment the NOINDEX
X#  definition below.
X#
X#NOINDEX         = -DNOINDEX
X#-----------------------------------------------------------------------
X#  Not every version of Unix (in particular System V derivitives) has the
X#  select() system call. If your machine doesn't have this call, then you
X#  need to uncomment the following definition.
X#
X#NOSELECT        = -DNOSELECT
X#-----------------------------------------------------------------------
X#  Some machines do not have the usleep library function. If this is
X#  true, then you will need to uncomment this definition.
X#
X#NO_USLEEP      = -DNO_USLEEP
X#-----------------------------------------------------------------------
X#  If you not running under a BSD4.3 derived system, the parameters
X#  to the select call are different, and this definition should be
X#  uncommented. You need to uncomment this for SunOS v3.x.
X#
X#SELTYPE        = -DNO_43SELECT
X#-----------------------------------------------------------------------
X#  If you are not running under a BSD4.3 derived system, then the
X#  second parameter to a signal call is a pointer to an integer function,
X#  and this definition needs to be uncommented. You need to uncomment this
X#  for SunOS v3.x.
X#
X#SIGRET         = -DNO_4_3SIGNAL
X#-----------------------------------------------------------------------
X#  If you are running on a 80286 machine, Microport's 5.2 port of SYSV,
X#  SVAT, or Xenix286, then you will need to uncomment this definition.
X#  This ought to work under 5.3 as well.
X#
X#SYSV  = -DSYSV
X#-----------------------------------------------------------------------
X#  If you are compiling the X11 version and the X11 include and
X#  library files are not in a standard place, then the following
X#  two lines should be uncommented, and set appropriately.
X#
X#X11INCDIR         = -I$(OPENWINHOME)/include
X#X11LIBDIR         = -L$(OPENWINHOME)/lib
X#------------------------------------------------------------------------
X#  If you are compiling the XView version, then the following two lines
X#  should be uncommented, and set appropriately.
X#
X#XVIEWINCDIR      = -I$(OPENWINHOME)/include
X#XVIEWLIBDIR      = -L$(OPENWINHOME)/lib
X#
X#===========================================================================
X#
X#  Default locations where Othello files will be installed.
X#  You might wish to alter these values.
X#
XBINDIR          = /usr/local/games
XLIBDIR          = /usr/local/lib
XMANDIR          = /usr/man/man$(MANSECT)
XMANSECT         = l
X#
X#  Compilation flags and standard macro definitions.
X#
XCDEFS		= $(NOINDEX) $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \
X		  $(SIGRET) $(SYSV) $(X11INCDIR) $(XVIEWINCDIR)
XCFLAGS          = -O $(CDEFS)
X#
X#==========================================================================
X
XBINARIES        = sv_reve tty_reve xreve xv_reve
XETABLE		= reve.edgetable
X
XCC              = cc
X
XSTDSRCS         = boardstuff.c events.c items.c makemove.c main.c \
X		  procs.c rev_eval.c rev_ip.c rev_iycp.c
XSTDOBJS         = boardstuff.o events.o items.o makemove.o main.o \
X		  procs.o rev_eval.o rev_ip.o rev_iycp.o
X
XGSRCS           = sunview.c tty.c x11.c xview.c
XHDRS            = color.h extern.h images.h reve.h patchlevel.h
XIDIR		= images
XIMAGES          = $(IDIR)/black.icon \
X		  $(IDIR)/reve.icon \
X		  $(IDIR)/reve.color.icon \
X		  $(IDIR)/white.icon \
X		  $(IDIR)/button.invert.icon \
X		  $(IDIR)/button.normal.icon \
X		  $(IDIR)/button.stencil.icon \
X		  $(IDIR)/cycle.glyph.icon \
X		  $(IDIR)/cycle.linvert.icon \
X		  $(IDIR)/cycle.rinvert.icon \
X		  $(IDIR)/cycle.stencil.icon \
X		  $(IDIR)/hglass.cursor \
X		  $(IDIR)/nocur.cursor
X
XOTHERS          = CHANGES README TODO reve.6 MANIFEST FILES \
X		  reve.man Makefile.dist
X
XSFILES1         = events.c items.c makemove.c main.c procs.c
XSFILES2		= boardstuff.c rev_eval.c rev_ip.c rev_iycp.c $(HDRS)
XSFILES3         = $(OTHERS)
XSFILES4         = tty.c x11.c xview.c
XSFILES5		= sunview.c $(IDIR)
XSFILES6		= reve.edge1
XSFILES7		= reve.edge2
X
XSVIEWLIBS       = -lsuntool -lsunwindow -lpixrect
XTTYLIBS         = -ltermcap
XX11LIBS         = -lX11
XXVIEWLIBS       = -lxview -lolgx -lX11
X
Xhelp:
X		@echo
X		@echo "You need to specify one of the following options:"
X		@echo
X		@echo "  make sunview    - to make the SunView version."
X		@echo "  make tty        - to make the dumb tty version."
X		@echo "  make x11        - to make the X11 version."
X		@echo "  make xview      - to make the XView version."
X		@echo
X		@echo "This should be followed by:"
X		@echo
X		@echo "  make install"
X		@echo "  make clean"
X		@echo
X
Xall:            $(BINARIES)
X
Xsunview:        $(STDOBJS) sunview.o
X		$(CC) -o sv_reve $(CFLAGS) $(STDOBJS) sunview.o $(SVIEWLIBS)
X		-cp sv_reve reve
X
Xtty:            $(STDOBJS) tty.o
X		$(CC) -o tty_reve $(CFLAGS) $(STDOBJS) tty.o $(TTYLIBS)
X		-cp tty_reve reve
X
Xx11:            $(STDOBJS) x11.o
X		$(CC) -o xreve $(X11LIBDIR) $(CFLAGS) $(STDOBJS) x11.o \
X			       $(X11LIBS)
X		-cp xreve reve
X
Xxview:          $(STDOBJS) xview.o
X		$(CC) -o xv_reve $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) \
X				xview.o $(XVIEWLIBS)
X		-cp xv_reve reve
X
Xinstall:
X		-cp reve $(BINDIR)
X		-chmod 751 $(BINDIR)/reve
X		-strip $(BINDIR)/reve
X		-cat reve.edge1 reve.edge2 > $(ETABLE)
X		-cp $(ETABLE) $(LIBDIR)
X		-chmod 644 $(LIBDIR)/$(ETABLE)
X		-cp reve.6 $(MANDIR)/reve.$(MANSECT)
X		-chmod 644 $(MANDIR)/reve.$(MANSECT)
X
Xclean:;         rm -f *.o *.Z *.uu Part* *~ reve $(BINARIES) core
X
Xlint:		lint-sunview lint-tty lint-xview lint-x11
Xlint-sunview:;	lint $(CDEFS) $(STDSRCS) sunview.c $(SVIEWLIBS)
Xlint-tty:;	lint $(CDEFS) $(STDSRCS) tty.c $(TTYLIBS)
Xlint-xview:;	lint $(CDEFS) $(STDSRCS) xview.c $(XVIEWLIBS) 
Xlint-x11:;	lint $(CDEFS) $(STDSRCS) x11.c $(X11LIBS) 
X
Xsaber:		$(STDSRCS) x11.c
X		#load $(LDFLAGS) $(CDEFS) $(STDSRCS) x11.c $(X11LIBS)
X
Xshar:;          shar.script $(SFILES1) > Part1
X		shar.script $(SFILES2) > Part2
X		shar.script $(SFILES3) > Part3
X		shar.script $(SFILES4) > Part4
X		shar.script $(SFILES5) > Part5
X		shar.script $(SFILES6) > Part6
X		shar.script $(SFILES7) > Part7
X
Xcreate:         SCCS
X		-sccs create $(STDSRCS) $(GSRCS) $(HDRS) $(IMAGES) $(OTHERS)
X
XSCCS:
X		mkdir SCCS
X		chmod 755 SCCS
X
Xboardstuff.o:   boardstuff.c color.h reve.h extern.h
Xevents.o:       events.c reve.h color.h extern.h
Xitems.o:        items.c color.h reve.h extern.h
Xmakemove.o:     makemove.c reve.h extern.h
Xmain.o:         main.c reve.h color.h patchlevel.h
Xprocs.o:        procs.c color.h reve.h extern.h
Xrev_eval.o:     rev_eval.c reve.h
Xrev_ip.o:       rev_ip.c reve.h
Xrev_iycp.o:     rev_iycp.c reve.h
Xsunview.o:      sunview.c reve.h color.h extern.h images.h $(IMAGES)
Xtty.o:          tty.c reve.h color.h extern.h
Xx11.o:          x11.c reve.h color.h extern.h images.h $(IMAGES)
Xxview.o:        xview.c reve.h color.h extern.h images.h $(IMAGES)
END_OF_FILE
if test 8068 -ne `wc -c <'Makefile.dist'`; then
    echo shar: \"'Makefile.dist'\" unpacked with wrong size!
fi
# end of 'Makefile.dist'
fi
if test -f 'images.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images.h'\"
else
echo shar: Extracting \"'images.h'\" \(1659 characters\)
sed "s/^X//" >'images.h' <<'END_OF_FILE'
X
X/*  @(#)images.h 1.3 90/09/24
X *
X *  Various images used by the graphics versions of reve.
X *
X *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X *  All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  introductory messages are not removed, and no monies are exchanged.
X *
X *  You are forbidden from using Reve as is, or in a modified state, in
X *  any tournaments, without the permission of the authors.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if reported
X *  (see README file), then an attempt will be made to fix them.
X */
X
Xunsigned short button_stencil_image[] = {
X#include "images/button.stencil.icon"
X} ;
X
Xunsigned short button_invert_image[] = {
X#include "images/button.invert.icon"
X} ;
X
Xunsigned short button_normal_image[] = {
X#include "images/button.normal.icon"
X} ;
X
Xunsigned short cycle_glyph_image[] = {
X#include "images/cycle.glyph.icon"
X} ;
X
Xunsigned short cycle_stencil_image[] = {
X#include "images/cycle.stencil.icon"
X} ;
X
Xunsigned short cycle_linvert_image[] = {
X#include "images/cycle.linvert.icon"
X} ;
X
Xunsigned short cycle_rinvert_image[] = {
X#include "images/cycle.rinvert.icon"
X} ;
X
Xunsigned short icon_image[] = {
X#include "images/reve.icon"
X} ;
X
Xunsigned short cicon_image[] = {
X#include "images/reve.color.icon"
X} ;
X
Xunsigned short hglass_image[] = {
X#include "images/hglass.cursor"
X} ;
X
Xunsigned short nocur_image[] = {
X#include "images/nocur.cursor"
X} ;
X
Xunsigned short white_image[]  = {
X#include "images/white.icon"
X} ;
X
Xunsigned short black_image[]  = {
X#include "images/black.icon"
X} ;
END_OF_FILE
if test 1659 -ne `wc -c <'images.h'`; then
    echo shar: \"'images.h'\" unpacked with wrong size!
fi
# end of 'images.h'
fi
if test -f 'rev_eval.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rev_eval.c'\"
else
echo shar: Extracting \"'rev_eval.c'\" \(8171 characters\)
sed "s/^X//" >'rev_eval.c' <<'END_OF_FILE'
X
X/*  @(#)rev_eval.c 1.3 90/09/24
X *
X *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  introductory messages are not removed, and no monies are exchanged.
X *
X *  You are forbidden from using Reve as is, or in a modified state, in
X *  any tournaments, without the permission of the authors.
X *
X *  No responsibility is taken for any errors on inaccuracies inherent
X *  either to the comments or the code of this program, but if reported
X *  (see README file), then an attempt will be made to fix them.
X */
X
X#include "reve.h"
X
Xextern int damier[NIVEAUMAX][64] ;
Xextern int tacouleur, macouleur ;
Xextern int mnb, profmax ;
Xextern int vp0, vo0 ;
Xextern long c1, c2, c3 ;
Xextern long edges[6561] ;
X
X/*  Evaluation function : give a note to a board = damier[ niv ].
X *  It computes 4 components :
X *     - Edge Stability, using Edge Stability Table pre-computed before
X *     - Current Mobility, in fact computed during alpha-beta pruning
X *     - X squares Values
X *     - Potential Mobility, looking at squares contacts
X *  And then Eval = c1 * ES + c2 * CM + c3 * XV + c4 * PM
X *  Eval is replaced by - Eval if Black is replaced by White. Eval is positif
X *  if macouleur ( my color ) has a good position and negatif if tacouleur
X *  position is good.
X *  If we are "near" the end of the game, then Eval is equal to final disc
X *  differential.
X */
X
Xlong
Xevalue(niv)
Xint niv ;
X{
X  register int *d, *p ;
X  register int i, x, y ;
X  register long note ;
X  register int vp, vo ;
X  register long tnote ;
X
X  d = damier[niv] ;
X
X  if (mnb > 60 - profmax)
X    {
X      note = 0 ;
X      for (p = &d[0]; p < &d[64]; p++)
X             if (*p == macouleur) note++ ;
X        else if (*p == tacouleur) note-- ;
X      return(note) ;
X    }
X  else
X    {
X      x = y = 0 ;
X      for (p = &d[0]; p < &d[64]; p++)
X             if (*p == macouleur) x++ ;
X        else if (*p == tacouleur) y++ ;
X      if (x == 0) return(-100000000) ;
X      if (y == 0) return( 100000000) ;
X
X      for (p = &d[0]; p < &d[64]; p++)
X        if ((*p == TPJ) || (*p == JPJ)) *p = FREE ;
X
X      i = 0 ;
X      for (p = &d[0]; p < &d[8]; p++)
X        {
X          i += i + i ;
X               if (*p == FREE)      i++ ;
X          else if (*p == macouleur) i += 2 ;
X        }
X      note = edges[i] ;
X
X      i = 0 ;
X      for (p = &d[56]; p < &d[64]; p++)
X        {
X          i += i + i ;
X               if (*p == FREE)      i++ ;
X          else if (*p == macouleur) i += 2 ;
X        }
X      note += edges[i] ;
X
X      i = 0 ;
X      for (p = &d[0]; p < &d[64]; p += 8)
X        {
X          i += i + i ;
X               if (*p == FREE)      i++ ;
X          else if (*p == macouleur) i += 2 ;
X        }
X      note += edges[i] ;
X
X      i = 0 ;
X      for (p = &d[7]; p < &d[64]; p += 8)
X        {
X          i += i + i ;
X               if (*p == FREE)      i++ ;
X          else if (*p == macouleur) i += 2 ;
X        }
X      note += edges[i] ;
X
X      if (d[0] == FREE)
X        {
X               if (d[9] == macouleur) note -= c3 ;
X          else if (d[9] == tacouleur) note += c3 ;
X        }
X
X      if (d[7] == FREE)
X        {
X               if (d[14] == macouleur) note -= c3 ;
X          else if (d[14] == tacouleur) note += c3 ;
X        }
X
X      if (d[56] == FREE)
X        {
X               if (d[49] == macouleur) note -= c3 ;
X          else if (d[49] == tacouleur) note += c3 ;
X        }
X
X      if (d[63] == FREE)
X        {
X               if (d[54] == macouleur) note -= c3 ;
X          else if (d[54] == tacouleur) note += c3 ;
X        }
X
X      tnote = c1 * note + c2 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
X
X      vp = vo = 0 ;
X      for (x = 0; x < 8; x++)
X        for (y = 0; y < 8; y++)
X          {
X            i = (x << 3) + y ;
X            if (d[i] == tacouleur)
X              {
X                     if ((x > 0) && (d[i - 8] == FREE))            vp++ ;
X                else if ((x < 7) && (d[i + 8] == FREE))            vp++ ;
X                else if ((y > 0) && (d[i - 1] == FREE))            vp++ ;
X                else if ((y < 7) && (d[i + 1] == FREE))            vp++ ;
X                else if ((x > 0) && (y > 0) && (d[i - 9] == FREE)) vp++ ;
X                else if ((x < 7) && (y > 0) && (d[i + 7] == FREE)) vp++ ;
X                else if ((x > 0) && (y < 7) && (d[i - 7] == FREE)) vp++ ;
X                else if ((x < 7) && (y < 7) && (d[i + 9] == FREE)) vp++ ;
X              }
X            if (d[i] == macouleur)
X              {
X                     if ((x > 0) && (d[i - 8] == FREE))             vo++ ;
X                else if ((x < 7) && (d[i + 8] == FREE))             vo++ ;
X                else if ((y > 0) && (d[i - 1] == FREE))             vo++ ;
X                else if ((y < 7) && (d[i + 1] == FREE))             vo++ ;
X                else if ((x > 0) && (y > 0) && ( d[i - 9] == FREE)) vo++ ;
X                else if ((x < 7) && (y > 0) && ( d[i + 7] == FREE)) vo++ ;
X                else if ((x > 0) && (y < 7) && ( d[i - 7] == FREE)) vo++ ;
X                else if ((x < 7) && (y < 7) && ( d[i + 9] == FREE)) vo++ ;
X              }
X          }
X
X      note = ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
X
X      vp = vo = 0 ;
X      for (x = 0; x < 8; x++)
X        for (y = 0; y < 8; y++)
X          {
X            i = (x << 3) + y ;
X            if (d[i] == FREE)
X              {
X                     if ((x > 0) && (d[i - 8] == tacouleur))            vp++ ;
X                else if ((x < 7) && (d[i + 8] == tacouleur))            vp++ ;
X                else if ((y > 0) && (d[i - 1] == tacouleur))            vp++ ;
X                else if ((y < 7) && (d[i + 1] == tacouleur))            vp++ ;
X                else if ((x > 0) && (y > 0) && (d[i - 9] == tacouleur)) vp++ ;
X                else if ((x < 7) && (y > 0) && (d[i + 7] == tacouleur)) vp++ ;
X                else if ((x > 0) && (y < 7) && (d[i - 7] == tacouleur)) vp++ ;
X                else if ((x < 7) && (y < 7) && (d[i + 9] == tacouleur)) vp++ ;
X
X                     if ((x > 0) && (d[i - 8] == macouleur))            vo++ ;
X                else if ((x < 7) && (d[i + 8] == macouleur))            vo++ ;
X                else if ((y > 0) && (d[i - 1] == macouleur))            vo++ ;
X                else if ((y < 7) && (d[i + 1] == macouleur))            vo++ ;
X                else if ((x > 0) && (y > 0) && (d[i - 9] == macouleur)) vo++ ;
X                else if ((x < 7) && (y > 0) && (d[i + 7] == macouleur)) vo++ ;
X                else if ((x > 0) && (y < 7) && (d[i - 7] == macouleur)) vo++ ;
X                else if ((x < 7) && (y < 7) && (d[i + 9] == macouleur)) vo++ ;
X              }
X          }
X
X      note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
X
X      vp = vo = 0 ;
X      for (x = 0; x < 8; x++)
X        for (y = 0; y < 8; y++)
X          {
X            i = (x << 3) + y ;
X            if (d[i] == FREE)
X              {
X                if ((x > 0) && (d[i - 8] == tacouleur))            vp++ ;
X                if ((x < 7) && (d[i + 8] == tacouleur))            vp++ ;
X                if ((y > 0) && (d[i - 1] == tacouleur))            vp++ ;
X                if ((y < 7) && (d[i + 1] == tacouleur))            vp++ ;
X                if ((x > 0) && (y > 0) && (d[i - 9] == tacouleur)) vp++ ;
X                if ((x < 7) && (y > 0) && (d[i + 7] == tacouleur)) vp++ ;
X                if ((x > 0) && (y < 7) && (d[i - 7] == tacouleur)) vp++ ;
X                if ((x < 7) && (y < 7) && (d[i + 9] == tacouleur)) vp++ ;
X
X                if ((x > 0) && (d[i - 8] == macouleur))            vo++ ;
X                if ((x < 7) && (d[i + 8] == macouleur))            vo++ ;
X                if ((y > 0) && (d[i - 1] == macouleur))            vo++ ;
X                if ((y < 7) && (d[i + 1] == macouleur))            vo++ ;
X                if ((x > 0) && (y > 0) && (d[i - 9] == macouleur)) vo++ ;
X                if ((x < 7) && (y > 0) && (d[i + 7] == macouleur)) vo++ ;
X                if ((x > 0) && (y < 7) && (d[i - 7] == macouleur)) vo++ ;
X                if ((x < 7) && (y < 7) && (d[i + 9] == macouleur)) vo++ ;
X              }
X          }
X
X      note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
X      tnote += 99 * note ;
X      return(tnote) ;
X    }
X}
END_OF_FILE
if test 8171 -ne `wc -c <'rev_eval.c'`; then
    echo shar: \"'rev_eval.c'\" unpacked with wrong size!
fi
# end of 'rev_eval.c'
fi
if test -f 'reve.6' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'reve.6'\"
else
echo shar: Extracting \"'reve.6'\" \(8823 characters\)
sed "s/^X//" >'reve.6' <<'END_OF_FILE'
X.\" @(#)reve.6 1.4 90/10/20
X.TH REVE 6 "18 October 1990"
X.SH NAME
Xreve \- an othello game.
X.SH SYNOPSIS
X.B "reve
X[
X.B \-b
X.I [ display ]
X] [
X.B \-c
X] [
X.B \-d
X.I difficulty
X] [
X.B \-e
X.I edgefile
X] [
X.B \-g
X.I geometry
X] [
X.B \-i
X] [
X.B \-l
X.I gamefile
X] [
X.B \-n
X] [
X.B \-v
X] [
X.B \-w
X.I [ display ]
X] [
X.B \-?
X] [
X.B \-Wi
X] [
X.B \-Wp
X.I x y
X] [
X.B \-WP
X.I x y
X]
X.SH DESCRIPTION
X.I Reve
Xis a version of the popular Othello game. It contains graphical interfaces
Xfor SunView, X11 and XView, as well as being able to function on
Xnormal display terminals using a termcap interface.
X.LP
XReve is played on an 8 x 8 board, with pieces which should be considered to
Xbe black on one side and white on the other. A legal move consists of placing
Xa piece of one's own color on the board so as to "sandwich" one or more rows
X(orthogonal or diagonal) of pieces of the opposite color between the piece
Xjust placed and another piece of the same color. All pieces so sandwiched are
Xflipped over to reveal the color of the other side (your own color).
X.LP
XThe object of the game, is to have more pieces than the opponent at
Xthe end of the game (ie. when the board is full or neither side has
Xa legal move). If you have no legal move, you simply miss a turn.
XBlack goes first.
X.LP
XWith
X.I reve,
Xto place one of your own pieces simply click with the mouse over the
Xsquare in which you want your piece to go. Note that it is also possible
Xto supply a number and a letter pair, to indicate where you would like your
Xnew piece to go. This is the only method to place pieces with the dumb tty
Xinterface.
X.LP
XThere are various buttons and cyclic selections available. Their meanings
Xare given below, plus an indication of their keyboard equivalents. With the
Xcyclic selections, clicking over the left half of the cycle item increments
Xthe selection, and clicking over the right half of the cycle item decrements
Xthe selection. With the SunView and XView versions, it is also possible to
Xmake a selection from a popup menu using the right mouse button.
X.LP
XBy default, a human will play black, and the computer will play white. If
Xyou want a human vs human startup or some other combination, then you should
Xuse the appropriate command line options (see below).
X.SH REVE BUTTONS
X.LP
XWith the graphics versions, there are eight buttons that are normally
Xdisplayed at the top of the Reve window. Each of these buttons, except
Xthe "done" button has a keyboard equivalent which is given in brackets below.
X.LP
X.IP "\fBlast [ l ]\fP" 18
XShow the last move played.
X.IP "\fBload [ L ]\fP" 18
XLoad a game file. The format of this game file is given below. With the
Xgraphical versions, a text field is displayed between the \fBdone\fP and
X\fBquit\fP buttons for you to enter the filename of this game file. Clicking
Xover the \fBcancel\fP button or pressing the Escape key will cancel the
Xload operation. When you press the Return key, filename entry is complete,
Xand the program will try to load this file. If it's unsuccessful, it will
Xstop on the invalid line, and display an error message. As each line is
Xsuccessfully read from the game file, the piece is displayed on the board,
Xand the appropriate pieces flipped.
X.IP "\fBnew game [ n ]\fP" 18
XStart a new game of
X.I reve
X.IP "\fBsave [ S ]\fP" 18
XSave the current game to file. See the entry for the \fBload\fP button
Xabove for details of how to enter the filename.
X.IP "\fBsuggest [ s ]\fP" 18
XLet the computer suggest a good move for you. This move will be dependent
Xupon the current level of difficulty set.
X.IP "\fBundo [ u ]\fP" 18
XUndo the last "move". If the opponent is the computer, the two "moves" are
Xundone. A "move" is considered to be all previous consecutive moves by
Xthe opponent.
X.IP "\fBdone [ No keyboard equivalent]\fP" 18
XChange \fIreve\fP to an icon.
X.IP "\fBquit [ q ]\fP" 18
XExit the
X.I reve
Xprogram.
X.SH REVE CYCLIC SELECTIONS
XWith the graphical versions, just below the eight buttons are four cycle items.
XThese can either be selected with the left mouse button, to increment or
Xdecrement the current selection (depending upon which half on the item
Xyou click over), or a selection can be made from a popup menu when you
Xclick with the right mouse button (SunView and XView versions only).
XEach cycle value has a keyboard equivalent which is given in brackets below.
XThis must be followed by the value of the new selection you wish to make.
XThe dumb tty version has the equivalent of these items displayed to the
Xright of the reve board display.
X.LP
X.IP "\fBBlack: [ B ]\fP" 18
XSelect whether the black player should be a human or the computer. The
Xkeyboard equivalents are 'h' for human, and 'c' for computer.
X.IP "\fBWhite: [ W ]\fP" 18
XSelect whether the white player should be a human or the computer. The
Xkeyboard equivalents are the same as for the \fBBlack:\fP item.
X.IP "\fBDifficulty: [ D ]\fP" 18
XSets the degree of difficulty for the computers moves. Keyboard selection
Xvalues are in the range '1' to '9'. The computer move is determined on a
Xtime basis. The degree of difficulty determines the total amount of time
Xthat the computer will take to make all its moves. Here are the time periods
Xfor each level of difficulty:
X.LP
X	Difficulty	Time
X.LP
X	1		Time allocation disabled (fast simple move).
X.br
X	2		1 minutes.
X.br
X	3		3 minutes.
X.br
X	4		5 minutes.
X.br
X	5		10 minutes.
X.br
X	6		15 minutes.
X.br
X	7		20 minutes.
X.br
X	8		30 minutes.
X.br
X	9		60 minutes.
X.LP
XLevel eight is tournament level.
X.IP "\fBNotes: [ N ]\fP" 18
XSelect whether computer notes are displayed. When you are playing against
Xthe computer, the note gives the position of the last computer move, and
Xan indication of whether it was a good or bad move.
X.SH OPTIONS
X.TP
X.BI \-b " [ display ]"
XBlack will be played by a human. With the X11 variant of
X.I reve
Xit is possible to give an optional display value.
X.TP
X.B \-c
XThe computer will play. Presence or absence of \fB\-b\fP and \fB\-w\fP
Xoptions determine which piece the computer plays.
X.TP
X.BI \-d " difficulty"
XThe level of difficulty for computer moves. See the \fBDifficulty:\fP
Xcyclic item description above for more information.
X.TP
X.BI \-e "edgefile"
XSpecify an alternate location for the
X.I reve
Xedge stability table file. Normally the location of this file is compiled
Xin when the program is created, but
X.I reve
Xwill search every directory on your search path looking file a file called
X.I reve.edgetable.
X.TP
X.BI \-g " geometry"
XUsed with the X11 variant of
X.I reve
Xto give geometry information.
X.TP
X.B \-i
XInvert the reve window before displaying it. For use by people who
Xstarted their graphics environment in inverse mode. This option is
Xcurrently only implemented for the SunView version.
X.TP
X.BI \-l " gamefile"
XLoad a game file. The format of this game file is given below. The board
Xwill be setup with these pieces.
X.TP
X.B \-n
XDisplay computer notes.
X.TP
X.B \-?
XPrint the version number and usage message for this release of the
X.I reve
Xprogram.
X.TP
X.B \-v
XPrint the version number and usage message for this release of the
X.I reve
Xprogram.
X.TP
X.BI \-w " [ display ]"
XWhite will be played by a human. With the X11 variant of
X.I reve
Xit is possible to give an optional display value.
X.TP
X.B \-Wi
XStart the
X.I reve
Xprogram up in iconic form. The SunView and XView version of
X.I reve
Xwill automatically uses this flag, but the X11 version will also.
X.TP
X.BI \-Wp " x y"
XStart the open window position at
X.I x y
X.TP
X.BI \-WP " x y"
XStart the icon position at
X.I x y
X.SH REVE GAMES FILE FORMAT
X.I Reve
Xhas the ability to load or save games. The format of the games files are:
X.LP
X	1,	<C-4>	-	[ remarks field ]
X.br
X	2,	-	<E-3>	[ remarks field ]
X.LP
XThere is one move per line. Lines starting with a '#' and blank lines
Xare ignored. The first field of each line is the move number. This will
Xbe present before the comma. It is used as a consistency check. Next are
Xthe black and white fields. If the '<' character is present before the
X'-' character, then this is a move for black, otherwise it's a move for
Xwhite. The three characters between the '<' and '>' are the move, and
Xgive the column and row. The column letter can be in either lower or
Xupper case.
X.LP
XIt is possible for one piece to have two or more consequentive moves, hence
Xthe need for the above scheme.
X.I Reve
Xis flexible about white space (except between the '<' and '>' characters).
XThe remarks field is ignored. The program will stop on the first line it
Xthinks is in error, and display the reason for this. As valid lines are
Xread from a game file, the board is updated.
X.SH FILES
X.TP
X.B /usr/local/lib/reve.edgetable
Xedge stability table for all possible edge combinations.
X.SH BUGS
XSee the TODO file for the list of known problems.
X.SH AUTHORS
X.br
XComputer strategy:	Yves Gallot	galloty@cernvax.cern.ch
X.br
XGraphics interface:	Rich Burridge	richb@Aus.Sun.COM
END_OF_FILE
if test 8823 -ne `wc -c <'reve.6'`; then
    echo shar: \"'reve.6'\" unpacked with wrong size!
fi
# end of 'reve.6'
fi
if test -f 'reve.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'reve.h'\"
else
echo shar: Extracting \"'reve.h'\" \(9505 characters\)
sed "s/^X//" >'reve.h' <<'END_OF_FILE'
X
X/*  @(#)reve.h 1.9 90/10/20
X *
X *  Definitions used by the reve program.
X *
X *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X *  All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  introductory messages are not removed, and no monies are exchanged.
X *
X *  You are forbidden from using Reve as is, or in a modified state, in
X *  any tournaments, without the permission of the authors.
X *
X *  No responsibility is taken for any errors on inaccuracies inherent
X *  either to the comments or the code of this program, but if reported
X *  (see README file), then an attempt will be made to fix them.
X */
X
X#define  FCLOSE        (void) fclose      /* To make lint happy. */
X#define  FFLUSH        (void) fflush
X#define  FGETS         (void) fgets
X#define  FREAD         (void) fread
X#define  FSEEK         (void) fseek
X#define  FPRINTF       (void) fprintf
X#define  GETTIMEOFDAY  (void) gettimeofday
X#define  IOCTL         (void) ioctl
X#define  PUTC          (void) putc
X#define  READ          (void) read
X#define  SSCANF        (void) sscanf
X#define  SELECT        (void) select
X#define  SIGNAL        (void) signal
X#define  SPRINTF       (void) sprintf
X#define  STRCAT        (void) strcat
X#define  STRCPY        (void) strcpy
X#define  STRNCAT       (void) strncat
X#define  STRNCPY       (void) strncpy
X#define  WRITE         (void) write
X
X#define  BBORDER       15       /* Width of the reve border. */
X#define  BOARD_SIZE    8        /* 8x8 playing board */
X#define  BGAP          10       /* Width of the gap between buttons. */
X#define  BHEIGHT       32       /* Height of a reve button item. */
X#define  BWIDTH        64       /* Width of a reve button item. */
X#define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
X#define  CHEIGHT       20       /* Height of a reve cycle item. */
X#define  CWIDTH        32       /* Width of a reve cycle item. */
X#define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
X#define  NOBUTS        6        /* Number of reve buttons. */
X#define  NOROWS        6        /* Number of rows of reve items. */
X#define  PIECE_MARGIN  8
X#define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
X#define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
X#define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
X
X/* States that the the Reve squares can be in. */
X#define  BLACK         (-1)    /* Piece definitions. */
X#define  FREE          0
X#define  WHITE         1
X#define  JPJ           2       /* A square where the computer can play. */
X#define  TPJ           (-2)    /* A square where the opponent can play. */
X
X#define  FALSE         0       /* Boolean definitions. */
X#define  TRUE          1
X
X#define  HUMAN         0       /* Player definitions. */
X#define  COMPUTER      1
X
X#define  BACKSPACE      8       /* Used for filename construction. */
X#define  DEL            127
X#define  LINEFEED       13
X#define  RETURN         10
X
X#define  ESCAPE        27      /* ASCII escape character. */
X#define  EQUAL(a, b)   !strncmp(a, b, strlen(b))
X#define  FOR_BOARD(i)  for (i = 0; i < 64; i++)
X#define  ICONHEIGHT    64      /* Height in pixels for reve icon. */
X#define  ICONWIDTH     64      /* Width in pixels of reve icon. */
X#define  INC           argc-- ; argv++ ;
X#define  INFINITY      10000
X#define  INIT_DEPTH    1
X#define  ISMOVE(pos, player) \
X         (nextmove(pos, NOMOVE, (BOARD *) NULL, player) != NOMOVE)
X#define  MAXCHOICES    7       /* Limit on number of choices for cyclic. */
X#define  MAXCURSORS    3       /* Maximum number of cursor types. */
X#define  MAXDIFF       9       /* Number of levels of difficulty. */
X#define  MAXDPY        2       /* Maximum possible number of displays. */
X#define  MAXFONTS      2       /* Maximum number of font types. */
X#define  MAXIMAGES     9       /* Maximum number of image types. */
X#define  MAXITEMS      17      /* Number of buttons, cyclics and messages. */
X
X#ifndef  MAXLINE
X#define  MAXLINE       80      /* Length of character strings. */
X#endif /*MAXLINE*/
X
X#define  MAXMENUS      4       /* Maximum number of popup menus. */
X#define  NIVEAUMAX     25      /* Maximum possible depth. */
X
X#ifdef  NOINDEX
X#define  index         strchr
X#endif /*NOINDEX*/
X
X#define  NOMOVE        -1
X#define  OPPONENT(p)   p * -1
X
X#ifdef SYSV
X
X/*  SysV (at least 5.2) does not support usleep. Makes little difference. */
X
X#define  PAUSE         sleep(1)
X#else
X#define  PAUSE         usleep(500000)    /* 0.5 second. */
X#endif /*SYSV*/
X
X#define  PSIZE         40      /* Diameter of playing piece. */
X
X#ifndef  EDGENAME
X#define  EDGENAME      "reve.edgetable"
X#endif /*EDGENAME*/
X
X#ifndef  NO_4_3SIGNAL
X#define  SIGRET        void
X#else
X#define  SIGRET        int
X#endif /*NO_4_3SIGNAL*/
X
X#define  VINVUL        50
X
X/* Various pseudo events used by the Reve program. */
X#define  FRAME_REPAINT    100    /* Reve window needs repainting. */
X#define  ENTER_WINDOW     101    /* Mouse has entered the reve window. */
X#define  EXIT_WINDOW      102    /* Mouse has exited reve window. */
X#define  LEFT_DOWN        103    /* Left mouse button was depressed. */
X#define  LEFT_UP          104    /* Left mouse button was debounced. */
X#define  MIDDLE_DOWN      105    /* Middle mouse button was depressed. */
X#define  MIDDLE_UP        106    /* Middle mouse button was debounced. */
X#define  RIGHT_DOWN       107    /* Right mouse button was depressed. */
X#define  RIGHT_UP         108    /* Right mouse button was debounced. */
X#define  KEYBOARD         109    /* Keyboard character has been pressed. */
X#define  MOUSE_MOVING     110    /* Mouse is moving. */
X#define  IGNORE_EVENT     111    /* No interest in this event. */
X
X/* Batch or locking direction (ON or OFF). */
Xenum bltype   { IS_OFF, IS_ON } ;
X
X/* Reve move status. */
Xenum cantype  { BLACK_START, BLACK_MOVING,
X                WHITE_START, WHITE_MOVING, GAME_OVER } ;
X
X/* Current cursor type. */
Xenum curtype  { CANVASCUR, HOURGLASS, NOCURSOR } ;
X
Xenum disp_type { XBLACK, XBOTH, XTWO, XWHITE } ;  /* Possible displays. */
X
Xenum dpy_type { DPY1, DPY2 } ;                    /* Possible dpy types. */
X
Xenum font_type { NFONT, BFONT } ;                 /* Text font definitions. */
X
Xenum gr_type { GSUNVIEW, GTTY, GX11, GXVIEW } ;   /* Graphical systems. */
X
X/* Different types of graphic images. */
Xenum image_type { BUT_NORMAL, BUT_INVERT, BUT_STENCIL,
X                  CY_NORMAL, CY_LINVERT, CY_RINVERT, CY_STENCIL,
X                  P_WHITE, P_BLACK } ;
X
X/* Different types of panel items. */
Xenum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
X
X/* Different panel items. */
Xenum panel_type { LAST_BUT,    LOAD_BUT, NEW_GAME_BUT, SAVE_BUT,
X                  SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
X                  BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
X                  PANEL_MES, NOTES_MES, SCORE_MES, TURN_MES } ;
X
Xenum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
X
Xenum optype   { RCLR, RINV, RSRC } ;       /* Rasterop codes. */
X
Xenum playtype { PLAY_BLACK, PLAY_WHITE } ; /* What the computer is playing. */
X
Xextern char *getenv() ;
Xextern void exit() ;
X
Xtypedef struct {
X          int square[64] ;
X          int player ;
X          int move ;
X          int moves_left ;
X          long note ;
X} BOARD ;
X
Xstruct iteminfo               /* Item information record. */
X  {
X    enum item_type type ;     /* Item type. */
X    int x ;                   /* X position of this panel item. */
X    int y ;                   /* Y position of this panel item. */
X    int width ;               /* Width of this panel item. */
X    int height ;              /* Height of this panel item. */
X    char text[60] ;           /* Text string associated with this item. */
X    int value ;               /* Current value of item. */
X    void (*func)() ;          /* Function to obey for this panel item. */
X  } ;
X
Xchar *index() ;
X
Xvoid animate_move(),       batch() ;
Xvoid check_button_down(),  check_cycle_down(),   check_item_down() ;
Xvoid check_item_up(),      close_frame(),        color_area() ;
Xvoid computer_move(),      computer_plays() ;
Xvoid create_menu(),        destroy_frame(),      difficulty() ;
Xvoid do_action(),          do_cycle_key(),       do_key_move() ;
Xvoid do_move(),            do_selection(),       domove() ;
Xvoid done(),               draw_button(),        draw_cycle() ;
Xvoid draw_cycle_item(),    draw_image(),         draw_line() ;
Xvoid draw_piece(),         draw_rect(),          draw_stencil() ;
Xvoid draw_text(),          draw_textfield(),     get_filename() ;
Xvoid get_options(),        get_xy(),             getparam() ;
Xvoid handle_board_event(), handle_event(),       handle_item() ;
Xvoid handle_key(),         init_canvas(),        init_edge_table() ;
Xvoid init_fonts(),         init_notes(),         init_player() ;
Xvoid initboard(),          initialise() ;
Xvoid last(),               load_colors(),        load_game() ;
Xvoid lock_screen() ;
Xvoid make_canvas(),        make_frame(),         make_icon() ;
Xvoid make_message(),       make_move(),          make_panel() ;
Xvoid message(),            nap_upto() ;
Xvoid new_game(),           process_event(),      quit() ;
Xvoid remove_textfield(),   save_game(),          set_cursor() ;
Xvoid set_cycle(),          set_display_types() ;
Xvoid set_timer(),          set_score(),          set_turn() ;
Xvoid show_suggestion(),    start_tool() ;
Xvoid suggest(),            think(),              undo() ;
Xvoid update_board_image(), usage(),              who_wins() ;
END_OF_FILE
if test 9505 -ne `wc -c <'reve.h'`; then
    echo shar: \"'reve.h'\" unpacked with wrong size!
fi
# end of 'reve.h'
fi
if test -f 'reve.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'reve.man'\"
else
echo shar: Extracting \"'reve.man'\" \(11086 characters\)
sed "s/^X//" >'reve.man' <<'END_OF_FILE'
X
X
X
XREVE(6)                  GAMES AND DEMOS                  REVE(6)
X
X
X
XNAME
X     reve - an othello game.
X
XSYNOPSIS
X     reve [ -b [ display ] ] [ -c ] [ -d difficulty ] [ -e  edge-
X     file  ] [ -g geometry ] [ -i ] [ -l gamefile ] [ -n ] [ -v ]
X     [ -w [ display ] ] [ -? ] [ -Wi ] [ -Wp x y ] [ -WP x y ]
X
XDESCRIPTION
X     Reve is a version of the popular Othello game.  It  contains
X     graphical  interfaces for SunView, X11 and XView, as well as
X     being able to function on normal display terminals  using  a
X     termcap interface.
X
X     Reve is played on an 8 x 8 board, with pieces  which  should
X     be  considered  to  be  black  on  one side and white on the
X     other. A legal move consists of placing a piece of one's own
X     color  on  the  board  so  as to "sandwich" one or more rows
X     (orthogonal or diagonal) of pieces  of  the  opposite  color
X     between  the piece just placed and another piece of the same
X     color. All pieces so sandwiched are flipped over  to  reveal
X     the color of the other side (your own color).
X
X     The object of the game, is to  have  more  pieces  than  the
X     opponent  at the end of the game (ie. when the board is full
X     or neither side has a legal move).  If  you  have  no  legal
X     move, you simply miss a turn.  Black goes first.
X
X     With reve, to place one of your own pieces simply click with
X     the  mouse  over  the square in which you want your piece to
X     go. Note that it is also possible to supply a number  and  a
X     letter pair, to indicate where you would like your new piece
X     to go. This is the only method to place pieces with the dumb
X     tty interface.
X
X     There are various buttons and cyclic  selections  available.
X     Their  meanings are given below, plus an indication of their
X     keyboard equivalents. With the cyclic  selections,  clicking
X     over  the  left half of the cycle item increments the selec-
X     tion, and clicking over the right half  of  the  cycle  item
X     decrements  the  selection.  With the SunView and XView ver-
X     sions, it is also possible to make a selection from a  popup
X     menu using the right mouse button.
X
X     By default, a human will play black, and the  computer  will
X     play  white.  If  you  want a human vs human startup or some
X     other combination, then you should use the appropriate  com-
X     mand line options (see below).
X
XREVE BUTTONS
X     With the graphics versions, there are eight buttons that are
X     normally  displayed  at  the top of the Reve window. Each of
X
X
X
XSun Release 4.1   Last change: 18 October 1990                  1
X
X
X
X
X
X
XREVE(6)                  GAMES AND DEMOS                  REVE(6)
X
X
X
X     these buttons, except  the  "done"  button  has  a  keyboard
X     equivalent which is given in brackets below.
X
X     last [ l ]        Show the last move played.
X
X     load [ L ]        Load a game file. The format of this  game
X                       file  is  given  below. With the graphical
X                       versions,  a  text  field   is   displayed
X                       between  the done and quit buttons for you
X                       to enter the filename of this  game  file.
X                       Clicking  over the cancel button or press-
X                       ing the Escape key will  cancel  the  load
X                       operation.  When you press the Return key,
X                       filename entry is complete, and  the  pro-
X                       gram  will  try to load this file. If it's
X                       unsuccessful, it will stop on the  invalid
X                       line,  and  display  an  error message. As
X                       each line is successfully  read  from  the
X                       game  file,  the piece is displayed on the
X                       board, and the appropriate pieces flipped.
X
X     new game [ n ]    Start a new game of reve
X
X     save [ S ]        Save the current game  to  file.  See  the
X                       entry   for  the  load  button  above  for
X                       details of how to enter the filename.
X
X     suggest [ s ]     Let the computer suggest a good  move  for
X                       you.  This move will be dependent upon the
X                       current level of difficulty set.
X
X     undo [ u ]        Undo the last "move". If the  opponent  is
X                       the  computer, the two "moves" are undone.
X                       A "move" is considered to be all  previous
X                       consecutive moves by the opponent.
X
X     done [ No keyboard equivalent]
X                       Change reve to an icon.
X
X     quit [ q ]        Exit the reve program.
X
XREVE CYCLIC SELECTIONS
X     With the graphical versions, just below  the  eight  buttons
X     are four cycle items.  These can either be selected with the
X     left mouse button, to increment  or  decrement  the  current
X     selection  (depending  upon which half on the item you click
X     over), or a selection can be made from a popup menu when you
X     click  with  the  right mouse button (SunView and XView ver-
X     sions only).  Each cycle value  has  a  keyboard  equivalent
X     which  is given in brackets below.  This must be followed by
X     the value of the new selection you wish to make.   The  dumb
X     tty  version  has the equivalent of these items displayed to
X
X
X
XSun Release 4.1   Last change: 18 October 1990                  2
X
X
X
X
X
X
XREVE(6)                  GAMES AND DEMOS                  REVE(6)
X
X
X
X     the right of the reve board display.
X
X     Black: [ B ]      Select whether the black player should  be
X                       a  human  or  the  computer.  The keyboard
X                       equivalents are 'h' for human, and 'c' for
X                       computer.
X
X     White: [ W ]      Select whether the white player should  be
X                       a  human  or  the  computer.  The keyboard
X                       equivalents are the same as for the Black:
X                       item.
X
X     Difficulty: [ D ] Sets the degree of difficulty for the com-
X                       puters  moves.  Keyboard  selection values
X                       are in the range '1' to '9'. The  computer
X                       move  is  determined  on a time basis. The
X                       degree of difficulty determines the  total
X                       amount of time that the computer will take
X                       to make all its moves. Here are  the  time
X                       periods for each level of difficulty:
X
X          Difficulty     Time
X
X          1         Time allocation disabled (fast simple move).
X          2         1 minutes.
X          3         3 minutes.
X          4         5 minutes.
X          5         10 minutes.
X          6         15 minutes.
X          7         20 minutes.
X          8         30 minutes.
X          9         60 minutes.
X
X     Level eight is tournament level.
X
X     Notes: [ N ]      Select   whether   computer   notes    are
X                       displayed.  When  you  are playing against
X                       the computer, the note gives the  position
X                       of  the last computer move, and an indica-
X                       tion of whether it was a good or bad move.
X
XOPTIONS
X     -b [ display ]
X          Black will be played by a human. With the  X11  variant
X          of  reve  it  is  possible  to give an optional display
X          value.
X
X     -c   The computer will play. Presence or absence of  -b  and
X          -w options determine which piece the computer plays.
X
X     -d difficulty
X          The level of difficulty for  computer  moves.  See  the
X
X
X
XSun Release 4.1   Last change: 18 October 1990                  3
X
X
X
X
X
X
XREVE(6)                  GAMES AND DEMOS                  REVE(6)
X
X
X
X          Difficulty:  cyclic  item  description  above  for more
X          information.
X
X     -eedgefile
X          Specify an alternate location for the reve edge stabil-
X          ity  table  file. Normally the location of this file is
X          compiled in when the program is created, but reve  will
X          search every directory on your search path looking file
X          a file called reve.edgetable.
X
X     -g geometry
X          Used with the X11 variant  of  reve  to  give  geometry
X          information.
X
X     -i   Invert the reve window before displaying it. For use by
X          people   who  started  their  graphics  environment  in
X          inverse mode. This option is currently only implemented
X          for the SunView version.
X
X     -l gamefile
X          Load a game file. The format of this game file is given
X          below. The board will be setup with these pieces.
X
X     -n   Display computer notes.
X
X     -?   Print the version number and  usage  message  for  this
X          release of the reve program.
X
X     -v   Print the version number and  usage  message  for  this
X          release of the reve program.
X
X     -w [ display ]
X          White will be played by a human. With the  X11  variant
X          of  reve  it  is  possible  to give an optional display
X          value.
X
X     -Wi  Start the reve program up in iconic form.  The  SunView
X          and  XView version of reve will automatically uses this
X          flag, but the X11 version will also.
X
X     -Wp x y
X          Start the open window position at x y
X
X     -WP x y
X          Start the icon position at x y
X
XREVE GAMES FILE FORMAT
X     Reve has the ability to load or save games.  The  format  of
X     the games files are:
X
X          1,   <C-4>     -    [ remarks field ]
X          2,   -    <E-3>     [ remarks field ]
X
X
X
XSun Release 4.1   Last change: 18 October 1990                  4
X
X
X
X
X
X
XREVE(6)                  GAMES AND DEMOS                  REVE(6)
X
X
X
X     There is one move per line. Lines starting with  a  '#'  and
X     blank lines are ignored. The first field of each line is the
X     move number. This will be present before the  comma.  It  is
X     used  as  a  consistency check. Next are the black and white
X     fields. If the '<' character is present  before  the  white.
X     The  three  characters between the '<' and '>' are the move,
X     and give the column and row. The column  letter  can  be  in
X     either lower or upper case.
X
X     It is possible for one piece to have two or more  consequen-
X     tive  moves,  hence  the need for the above scheme.  Reve is
X     flexible about white space (except between the '<'  and  '>'
X     characters).  The remarks field is ignored. The program will
X     stop on the first line it thinks is in  error,  and  display
X     the  reason  for  this.  As valid lines are read from a game
X     file, the board is updated.
X
XFILES
X     /usr/local/lib/reve.edgetable
X          edge stability table for  all  possible  edge  combina-
X          tions.
X
XBUGS
X     See the TODO file for the list of known problems.
X
XAUTHORS
X     Computer strategy:  Yves Gallot    galloty@cernvax.cern.ch
X     Graphics interface: Rich Burridge  richb@Aus.Sun.COM
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XSun Release 4.1   Last change: 18 October 1990                  5
X
X
X
END_OF_FILE
if test 11086 -ne `wc -c <'reve.man'`; then
    echo shar: \"'reve.man'\" unpacked with wrong size!
fi
# end of 'reve.man'
fi
echo shar: End of archive 6 \(of 7\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 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