[comp.sources.games.bugs] Official patch #1 for Reve v1.1

richb@sunaus.oz (Rich Burridge) (11/09/90)

/*
 *  Official patch #1 for Reve v1.1.
 *
 *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
 *  All rights reserved.
 *
 *  Permission is granted to copy this patch, for redistribution
 *  in patch form only, provided the news headers in "substantially
 *  unaltered format" are retained, the introductory messages are not
 *  removed, and no monies are exchanged.
 *
 *  Permission is also granted to copy this patch, without the news
 *  headers, for the purposes of patching the Reve source and making
 *  an executable copy by means of compilation, provided that such
 *  copy will not be used for the purposes of competition in any othello
 *  tournaments, without prior permission from the authors.
 */

CONTENTS:

1. What is reve?
2/ Changes made in this patch.
3/ How to install this patch.

----------------

1/ What is reve?

Reve is an othello game. It works under SunView, XView, X11 (Xlib) and on
dumb tty terminals.

Reve has nine levels of difficulty. Levels 1-3 should be useful to beginners,
levels 4-6 would satisfy amateurs, and the higher levels will give experts a
good game. Level 8 (30 minutes) is the tournament level.

----------------

2/ Changes made in this patch.

       * Time allocation function was out by 1. All the levels are shifted
         by 1. This explains why computer move selection at level 1 is so
         "slow".

       * The sandwich routine in makemove.c, was accessing out of bounds
         elements in the square array.

       * The play_reve routine in rev_ip.c, was accessing out-of bounds
         elements in the cpi, cpj and cpk arrays.

       * black_dpy and white_dpy were declared inconsistently in main.c and
         extern.h

       * If you select White->human, then Black->computer, Reve correctly
         plays the black computer move. If you then select Black->human
         followed by White->computer, Reve incorrectly made another move
         for black. There was a similar problem when starting a new game
         with Black being played by computer.

       * Fixed up a few other inconsistencies found by Saber-C.

       * Extraction of the optional X11 display names for the -b and -w
         options in get_options() was incorrect.

       * If you used the suggest button, to get the computer to suggest a
         move, it was decrementing the time allowed for the computer.

       * Adjusted entries 2191 and 2917 of the Reve edge stability table
         (in reve.edge2).

       * Added in the code for a new tree algorithm from Yves (rev_eval.c
         and rev_ip.c).

       * Added a -r command line option, which will write some computer
         move information to a reve.res file after each computer move. This
         is probably only of use to people trying to improve the computer
         algorithm. The manual pages has been updated.

       * The computer move timing function in rev_ip.c now uses an alarm and
         signal, so should be independent of the machine it's running on.

       * Changed the variable "depth" to "level". As Reve now uses a timing
         function to calculate it's computer moves, "depth" is not a true
         indication of depth.

       * Changed all #include <strings.h> to #include string.h or strings.h
         depending upon whether SYSV was defined.

       * The amount of computer time left for moves is now stored for each
         move, so that if a move is undone against the computer, the previous
         time left value is restored.

       * Added in a -m command line line, which will start up Reve in
         monochrome only, even on a color screen.

       * The last move made is now shown by putting a black square around
         the piece on the board. This is updated when a new move is made. The
         manual pages have been changed to mention this.

       * The "last" panel button has been replaced with a "moves?" panel
         button (and rearranged to be alphabetical), which displays all the
         valid moves at any particular time. This is very useful for
         beginners and for teaching purposes. The manual pages have been
         updated to reflect these changes.

       * Added in more hooks for two screen support for the X11 version.

       * From Jonathan I. Kamens <jik@pit-manager.MIT.EDU>
         - Supplied a standard Imakefile for use with the X11 version of reve.
           The Imakefile expects the manual pages in (nroff'able format) to
           be in a file called reve.man, so reve.man needs to be renamed to
           reve.man.text, and reve.6 needs to be renamed to reve.man. This is
           detailed explicitly at the beginning of the instructions on how to
           apply this patch.

         - If X11 is defined (It's defined in the Imake-generated Makefile),
           then include <X11/Xos.h>. That file does the index/strchr frobbing
           automatically. Affects boardstuff.c and main.c

         - Removed the definition of FREAD in reve.h. Some systems use
           FREAD as a constant in /usr/include/sys/file.h. Incidentally,
           it was no longer needed.

         - Only do the index/strchr frobbing if X11 isn't defined. Change
           to reve.h

         - As far as I know, void-returning signal handlers are NOT part of
           standard BSD4.3, so your #ifdef name for that is a bit wrong.
           This name has been changed to INT_SIGNAL, and all the appropriate
           files updated.

       * Included a new XView version of Reve from Valerie Haecky. Adjusted
         the "generic" sources to handle this. This involved moving
         draw_piece and draw_rect into boardstuff.c, and *not* including
         items.c when compiling the XView version. The XView version needs a
         -DXVIEW flag to correct setup five #defines in reve.h. The
         Makefile.dist has been updated to handle all this.

       * The introductory messages in each file have been changed to try to
         state our wishes in the correct manner.

       * From Krishnamurthy Ganesan <ganesan@cs.fau.edu>
         The processing of the readmask in the Xselect_input() routine in
         x11.c was incorrect for the non-BSD4.3 option. The parentheses
         were misplaced in two lines.

       * From Gordon C. Galligher <telxon!ping!source@uunet.UU.NET>
         Several icons in the images sub-directory have had their names
         changed to less than 14 characters, so that they can work on
         System V machines.

       * There was an offset problem when drawing the inverted piece
         for the first time on a mouse down. This was before it was
         dragged around.

----------------

3/ How to install this patch.

This patch consists of four parts. Save each one first. You should then
use Larry Wall's patch program to apply these changes. Assuming the four
files are called patch1-1, patch1-2, patch1-3 and patch1-4, do the following:

cd reve_src        # directory where your reve source files are.
patch <patch1-1
patch <patch1-2
patch <patch1-3
patch <patch1-4

Note that this will create one new file called Imakefile.

*IMPORTANT*
-----------

After applying this patch you need to rename several files. This is for two
reasons:

  1/ The Imakefile file expects the manual pages (in nroff'able format), to
     be in a file called reve.man. So the two filename changes there are:

       reve.man ==>  reve.man.text
       reve.6   ==>  reve.man

  2/ There are several files in the images sub-directory which are greater
     then the 14 character filename limit allowed under System V. The
     changes here are:

       button.invert.icon   ==> Ibutton.icon
       button.normal.icon   ==> Nbutton.icon
       button.stencil.icon  ==> Sbutton.icon
       cycle.glyph.icon     ==> Ncycle.icon
       cycle.linvert.icon   ==> Lcycle.icon
       cycle.rinvert.icon   ==> Rcycle.icon
       cycle.stencil.icon   ==> Scycle.icon
       reve.color.icon      ==> Creve.icon

If you are on a Unix machine, then you should run the following commands:

       mv reve.man                   reve.man.text
       mv reve.6                     reve.man
       mv images/button.invert.icon  images/Ibutton.icon
       mv images/button.normal.icon  images/Nbutton.icon
       mv images/button.stencil.icon images/Sbutton.icon
       mv images/cycle.glyph.icon    images/Ncycle.icon
       mv images/cycle.linvert.icon  images/Lcycle.icon
       mv images/cycle.rinvert.icon  images/Rcycle.icon
       mv images/cycle.stencil.icon  images/Scycle.icon
       mv images/reve.color.icon     images/Creve.icon
 
If you are running reve on another O/S, then you should do the equivalent
of these moves.

Copy Makefile.dist to Makefile, and adjust for your site. See the README
file for things you might have to tweak in order to get Reve to work on
your machine.

You will then have to do the appropriate make, to generate the graphics
version you require. Do a "make help" to obtain more information on this.

Finally, you should do a "make install". You will probably have to be
super-user to do this.

If you have any problems with Reve after applying this patch, and your
problem is not listed in the TODO file, please let us know.

Rich Burridge           richb@Aus.Sun.COM
Yves Gallot             galloty@cernvax.cern.ch

------CUT HERE------patch 1 - part 1------CUT HERE------

------- patchlevel.h -------
Prereq: 0
*** /tmp/da28531	Fri Nov  9 10:13:21 1990
--- patchlevel.h	Mon Nov  5 09:06:16 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 17,20 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  0
--- 22,25 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  1
*** /dev/null	Fri Nov  9 10:01:02 1990
--- Imakefile	Fri Nov  9 10:15:13 1990
***************
*** 0 ****
--- 1,88 ----
+ 
+ /*  @(#)Imakefile 1.2 90/11/09
+  *
+  *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
+  *  All rights reserved.
+  *
+  *  Permission is granted to copy this source, for redistribution
+  *  in source form only, provided the news headers in "substantially
+  *  unaltered format" are retained, the introductory messages are not
+  *  removed, and no monies are exchanged.
+  *
+  *  Permission is also granted to copy this source, without the
+  *  news headers, for the purposes of making an executable copy by
+  *  means of compilation, provided that such copy will not be used
+  *  for the purposes of competition in any othello tournaments, without
+  *  prior permission from the authors.
+  *
+  *  No responsibility is taken for any errors inherent either
+  *  to the comments or the code of this program, but if reported
+  *  (see README file), then an attempt will be made to fix them.
+  *
+  *------------------------------------------------------------------------
+  *  There are various small changes needed when compiling reve on
+  *  different systems. These have been isolated here, and should be
+  *  uncommented if needed.
+  *
+  *
+  *  Not every version of Unix (in particular System V derivitives) has the
+  *  select() system call. If your machine doesn't have this call, then you
+  *  need to uncomment the following definition.
+  *
+  *NOSELECT        = -DNOSELECT
+  *
+  *
+  *  Some machines do not have the usleep library function. If this is
+  *  true, then you will need to uncomment this definition.
+  *
+  *NO_USLEEP      = -DNO_USLEEP
+  */
+ 
+ #ifdef UltrixArchitecture
+ NO_USLEEP	= -DNO_USLEEP
+ #endif
+ 
+ /*  If you not running under a BSD4.3 derived system, the parameters
+  *  to the select call are different, and this definition should be
+  *  uncommented. You need to uncomment this for SunOS v3.x.
+  *
+  *SELTYPE        = -DNO_43SELECT
+  */
+ 
+ 
+ /*  YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW HERE.  */
+      
+ #if HasVoidSignalReturn == NO
+ SIGRET	=	-DINT_SIGNAL
+ #endif
+      
+ /*  Compilation flags and standard macro definitions.  */
+ 
+ SYS_LIBRARIES	= $(XLIB)     
+ CDEFS		= $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \
+ 		  $(SIGRET)
+ DEFINES         = $(CDEFS) -DX11
+ ETABLE		= reve.edgetable
+ LIBDIR		= $(USRLIBDIR)/reve
+      
+ /*
+  *  Full pathname of the reve edge table file. This can also be overridden
+  *  with a command line option.
+  */
+ EDGENAMEFILE    = $(LIBDIR)/$(ETABLE)
+ EDGENAME        = -DEDGENAME=\"$(EDGENAMEFILE)\"
+ 
+      
+ SRCS		= boardstuff.c events.c items.c makemove.c main.c \
+ 		  procs.c rev_eval.c rev_ip.c rev_iycp.c x11.c
+ OBJS		= boardstuff.o events.o items.o makemove.o main.o \
+ 		  procs.o rev_eval.o rev_ip.o rev_iycp.o x11.o
+ 
+ ComplexProgramTarget(reve)
+ MakeDirectories(install,$(LIBDIR))
+ InstallNonExec($(ETABLE),$(LIBDIR))
+ 
+ install:: install.man
+ 
+ $(ETABLE): reve.edge1 reve.edge2
+ 	cat reve.edge1 reve.edge2 > $(ETABLE)

------- CHANGES -------
*** /tmp/da28687	Fri Nov  9 10:24:57 1990
--- CHANGES	Fri Nov  9 10:17:27 1990
***************
*** 4,14 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 4,19 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 17,22 ****
--- 22,144 ----
  
  Reve change history.
  ====================
+ 
+ v1.1 - patchlevel 1. 9th November 1990.
+ 
+        * Time allocation function was out by 1. All the levels are shifted
+          by 1. This explains why computer move selection at level 1 is so
+          "slow".
+ 
+        * The sandwich routine in makemove.c, was accessing out of bounds
+          elements in the square array.
+ 
+        * The play_reve routine in rev_ip.c, was accessing out-of bounds
+          elements in the cpi, cpj and cpk arrays.
+ 
+        * black_dpy and white_dpy were declared inconsistently in main.c and
+          extern.h
+ 
+        * If you select White->human, then Black->computer, Reve correctly
+          plays the black computer move. If you then select Black->human
+          followed by White->computer, Reve incorrectly made another move
+          for black. There was a similar problem when starting a new game
+          with Black being played by computer.
+ 
+        * Fixed up a few other inconsistencies found by Saber-C.
+ 
+        * Extraction of the optional X11 display names for the -b and -w
+          options in get_options() was incorrect.
+ 
+        * If you used the suggest button, to get the computer to suggest a
+          move, it was decrementing the time allowed for the computer.
+ 
+        * Adjusted entries 2191 and 2917 of the Reve edge stability table
+          (in reve.edge2).
+ 
+        * Added in the code for a new tree algorithm from Yves (rev_eval.c
+          and rev_ip.c).
+ 
+        * Added a -r command line option, which will write some computer
+          move information to a reve.res file after each computer move. This
+          is probably only of use to people trying to improve the computer
+          algorithm. The manual pages has been updated.
+ 
+        * The computer move timing function in rev_ip.c now uses an alarm and
+          signal, so should be independent of the machine it's running on.
+ 
+        * Changed the variable "depth" to "level". As Reve now uses a timing
+          function to calculate it's computer moves, "depth" is not a true
+          indication of depth.
+ 
+        * Changed all #include <strings.h> to #include string.h or strings.h
+          depending upon whether SYSV was defined.
+ 
+        * The amount of computer time left for moves is now stored for each
+          move, so that if a move is undone against the computer, the previous
+          time left value is restored.
+ 
+        * Added in a -m command line line, which will start up Reve in
+          monochrome only, even on a color screen.
+ 
+        * The last move made is now shown by putting a black square around
+          the piece on the board. This is updated when a new move is made. The
+          manual pages have been changed to mention this.
+ 
+        * The "last" panel button has been replaced with a "moves?" panel
+          button (and rearranged to be alphabetical), which displays all the
+          valid moves at any particular time. This is very useful for
+          beginners and for teaching purposes. The manual pages have been
+          updated to reflect these changes.
+ 
+        * Added in more hooks for two screen support for the X11 version.
+ 
+        * From Jonathan I. Kamens <jik@pit-manager.MIT.EDU>
+          - Supplied a standard Imakefile for use with the X11 version of reve.
+            The Imakefile expects the manual pages in (nroff'able format) to
+            be in a file called reve.man, so reve.man needs to be renamed to
+            reve.man.text, and reve.6 needs to be renamed to reve.man. This is
+            detailed explicitly at the beginning of the instructions on how to
+            apply this patch.
+ 
+          - If X11 is defined (It's defined in the Imake-generated Makefile),
+            then include <X11/Xos.h>. That file does the index/strchr frobbing
+            automatically. Affects boardstuff.c and main.c
+ 
+          - Removed the definition of FREAD in reve.h. Some systems use
+            FREAD as a constant in /usr/include/sys/file.h. Incidentally,
+            it was no longer needed.
+ 
+          - Only do the index/strchr frobbing if X11 isn't defined. Change
+            to reve.h
+ 
+          - As far as I know, void-returning signal handlers are NOT part of
+            standard BSD4.3, so your #ifdef name for that is a bit wrong.
+            This name has been changed to INT_SIGNAL, and all the appropriate
+            files updated.
+ 
+        * Included a new XView version of Reve from Valerie Haecky. Adjusted
+          the "generic" sources to handle this. This involved moving
+          draw_piece and draw_rect into boardstuff.c, and *not* including
+          items.c when compiling the XView version. The XView version needs a
+          -DXVIEW flag to correct setup five #defines in reve.h. The
+          Makefile.dist has been updated to handle all this.
+ 
+        * The introductory messages in each file have been changed to try to
+          state our wishes in the correct manner.
+ 
+        * From Krishnamurthy Ganesan <ganesan@cs.fau.edu>
+          The processing of the readmask in the Xselect_input() routine in
+          x11.c was incorrect for the non-BSD4.3 option. The parentheses
+          were misplaced in two lines.
+ 
+        * From Gordon C. Galligher <telxon!ping!source@uunet.UU.NET>
+          Several icons in the images sub-directory have had their names
+          changed to less than 14 characters, so that they can work on
+          System V machines.
+ 
+        * There was an offset problem when drawing the inverted piece
+          for the first time on a mouse down. This was before it was
+          dragged around.
  
  v1.1 - patchlevel 0. 22nd October 1990.
  

------- Makefile.dist -------
*** /tmp/da28690	Fri Nov  9 10:24:58 1990
--- Makefile.dist	Thu Nov  8 10:35:39 1990
***************
*** 6,16 ****
  #  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  #  All rights reserved.
  #
! #  Permission is given to distribute these sources, as long as the
! #  introductory messages are not removed, and no monies are exchanged.
  #
! #  You are forbidden from using Reve as is, or in a modified state, in
! #  any tournaments, without the permission of the authors.
  #
  #  No responsibility is taken for any errors inherent either
  #  to the comments or the code of this program, but if reported
--- 6,21 ----
  #  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  #  All rights reserved.
  #
! #  Permission is granted to copy this source, for redistribution
! #  in source form only, provided the news headers in "substantially
! #  unaltered format" are retained, the introductory messages are not
! #  removed, and no monies are exchanged.
  #
! #  Permission is also granted to copy this source, without the
! #  news headers, for the purposes of making an executable copy by
! #  means of compilation, provided that such copy will not be used
! #  for the purposes of competition in any othello tournaments, without
! #  prior permission from the authors.
  #
  #  No responsibility is taken for any errors inherent either
  #  to the comments or the code of this program, but if reported
***************
*** 52,63 ****
  #
  #SELTYPE        = -DNO_43SELECT
  #-----------------------------------------------------------------------
! #  If you are not running under a BSD4.3 derived system, then the
! #  second parameter to a signal call is a pointer to an integer function,
! #  and this definition needs to be uncommented. You need to uncomment this
! #  for SunOS v3.x.
  #
! #SIGRET         = -DNO_4_3SIGNAL
  #-----------------------------------------------------------------------
  #  If you are running on a 80286 machine, Microport's 5.2 port of SYSV,
  #  SVAT, or Xenix286, then you will need to uncomment this definition.
--- 57,67 ----
  #
  #SELTYPE        = -DNO_43SELECT
  #-----------------------------------------------------------------------
! #  If you are running on a system, where the second parameter to a signal
! #  call is a pointer to an integer function, then this definition needs
! #  to be uncommented.
  #
! #SIGRET         = -DINT_SIGNAL
  #-----------------------------------------------------------------------
  #  If you are running on a 80286 machine, Microport's 5.2 port of SYSV,
  #  SVAT, or Xenix286, then you will need to uncomment this definition.
***************
*** 75,81 ****
  #  If you are compiling the XView version, then the following two lines
  #  should be uncommented, and set appropriately.
  #
! #XVIEWINCDIR      = -I$(OPENWINHOME)/include
  #XVIEWLIBDIR      = -L$(OPENWINHOME)/lib
  #
  #===========================================================================
--- 79,85 ----
  #  If you are compiling the XView version, then the following two lines
  #  should be uncommented, and set appropriately.
  #
! #XVIEWINCDIR      = -I$(OPENWINHOME)/include -DXVIEW
  #XVIEWLIBDIR      = -L$(OPENWINHOME)/lib
  #
  #===========================================================================
***************
*** 96,109 ****
  #
  #==========================================================================
  
  BINARIES        = sv_reve tty_reve xreve xv_reve
  ETABLE		= reve.edgetable
  
  CC              = cc
  
! STDSRCS         = boardstuff.c events.c items.c makemove.c main.c \
  		  procs.c rev_eval.c rev_ip.c rev_iycp.c
! STDOBJS         = boardstuff.o events.o items.o makemove.o main.o \
  		  procs.o rev_eval.o rev_ip.o rev_iycp.o
  
  GSRCS           = sunview.c tty.c x11.c xview.c
--- 100,115 ----
  #
  #==========================================================================
  
+ .KEEP_STATE:
+ 
  BINARIES        = sv_reve tty_reve xreve xv_reve
  ETABLE		= reve.edgetable
  
  CC              = cc
  
! STDSRCS         = boardstuff.c events.c makemove.c main.c \
  		  procs.c rev_eval.c rev_ip.c rev_iycp.c
! STDOBJS         = boardstuff.o events.o makemove.o main.o \
  		  procs.o rev_eval.o rev_ip.o rev_iycp.o
  
  GSRCS           = sunview.c tty.c x11.c xview.c
***************
*** 111,125 ****
  IDIR		= images
  IMAGES          = $(IDIR)/black.icon \
  		  $(IDIR)/reve.icon \
! 		  $(IDIR)/reve.color.icon \
  		  $(IDIR)/white.icon \
! 		  $(IDIR)/button.invert.icon \
! 		  $(IDIR)/button.normal.icon \
! 		  $(IDIR)/button.stencil.icon \
! 		  $(IDIR)/cycle.glyph.icon \
! 		  $(IDIR)/cycle.linvert.icon \
! 		  $(IDIR)/cycle.rinvert.icon \
! 		  $(IDIR)/cycle.stencil.icon \
  		  $(IDIR)/hglass.cursor \
  		  $(IDIR)/nocur.cursor
  
--- 117,131 ----
  IDIR		= images
  IMAGES          = $(IDIR)/black.icon \
  		  $(IDIR)/reve.icon \
! 		  $(IDIR)/Creve.icon \
  		  $(IDIR)/white.icon \
! 		  $(IDIR)/Ibutton.icon \
! 		  $(IDIR)/Nbutton.icon \
! 		  $(IDIR)/Sbutton.icon \
! 		  $(IDIR)/Ncycle.icon \
! 		  $(IDIR)/Lcycle.icon \
! 		  $(IDIR)/Rcycle.icon \
! 		  $(IDIR)/Scycle.icon \
  		  $(IDIR)/hglass.cursor \
  		  $(IDIR)/nocur.cursor
  
***************
*** 130,136 ****
  SFILES2		= boardstuff.c rev_eval.c rev_ip.c rev_iycp.c $(HDRS)
  SFILES3         = $(OTHERS)
  SFILES4         = tty.c x11.c xview.c
! SFILES5		= sunview.c $(IDIR)
  SFILES6		= reve.edge1
  SFILES7		= reve.edge2
  
--- 136,142 ----
  SFILES2		= boardstuff.c rev_eval.c rev_ip.c rev_iycp.c $(HDRS)
  SFILES3         = $(OTHERS)
  SFILES4         = tty.c x11.c xview.c
! SFILES5		= sunview.c $(IDIR) Imakefile
  SFILES6		= reve.edge1
  SFILES7		= reve.edge2
  
***************
*** 156,171 ****
  
  all:            $(BINARIES)
  
! sunview:        $(STDOBJS) sunview.o
! 		$(CC) -o sv_reve $(CFLAGS) $(STDOBJS) sunview.o $(SVIEWLIBS)
  		-cp sv_reve reve
  
! tty:            $(STDOBJS) tty.o
! 		$(CC) -o tty_reve $(CFLAGS) $(STDOBJS) tty.o $(TTYLIBS)
  		-cp tty_reve reve
  
! x11:            $(STDOBJS) x11.o
! 		$(CC) -o xreve $(X11LIBDIR) $(CFLAGS) $(STDOBJS) x11.o \
  			       $(X11LIBS)
  		-cp xreve reve
  
--- 162,180 ----
  
  all:            $(BINARIES)
  
! sunview:        $(STDOBJS) items.o sunview.o
! 		$(CC) -o sv_reve $(CFLAGS) $(STDOBJS) \
! 				items.o sunview.o $(SVIEWLIBS)
  		-cp sv_reve reve
  
! tty:            $(STDOBJS) items.o tty.o
! 		$(CC) -o tty_reve $(CFLAGS) $(STDOBJS) \
! 				items.o tty.o $(TTYLIBS)
  		-cp tty_reve reve
  
! x11:            $(STDOBJS) items.o x11.o
! 		$(CC) -o xreve $(X11LIBDIR) $(CFLAGS) $(STDOBJS) \
! 				items.o x11.o \
  			       $(X11LIBS)
  		-cp xreve reve
  
***************
*** 187,199 ****
  clean:;         rm -f *.o *.Z *.uu Part* *~ reve $(BINARIES) core
  
  lint:		lint-sunview lint-tty lint-xview lint-x11
! lint-sunview:;	lint $(CDEFS) $(STDSRCS) sunview.c $(SVIEWLIBS)
! lint-tty:;	lint $(CDEFS) $(STDSRCS) tty.c $(TTYLIBS)
  lint-xview:;	lint $(CDEFS) $(STDSRCS) xview.c $(XVIEWLIBS) 
! lint-x11:;	lint $(CDEFS) $(STDSRCS) x11.c $(X11LIBS) 
  
  saber:		$(STDSRCS) x11.c
! 		#load $(LDFLAGS) $(CDEFS) $(STDSRCS) x11.c $(X11LIBS)
  
  shar:;          shar.script $(SFILES1) > Part1
  		shar.script $(SFILES2) > Part2
--- 196,208 ----
  clean:;         rm -f *.o *.Z *.uu Part* *~ reve $(BINARIES) core
  
  lint:		lint-sunview lint-tty lint-xview lint-x11
! lint-sunview:;	lint $(CDEFS) $(STDSRCS) items.c sunview.c $(SVIEWLIBS)
! lint-tty:;	lint $(CDEFS) $(STDSRCS) items.c tty.c $(TTYLIBS)
  lint-xview:;	lint $(CDEFS) $(STDSRCS) xview.c $(XVIEWLIBS) 
! lint-x11:;	lint $(CDEFS) $(STDSRCS) items.c x11.c $(X11LIBS) 
  
  saber:		$(STDSRCS) x11.c
! 		#load $(LDFLAGS) $(CDEFS) $(STDSRCS) items.c x11.c $(X11LIBS)
  
  shar:;          shar.script $(SFILES1) > Part1
  		shar.script $(SFILES2) > Part2
***************
*** 204,210 ****
  		shar.script $(SFILES7) > Part7
  
  create:         SCCS
! 		-sccs create $(STDSRCS) $(GSRCS) $(HDRS) $(IMAGES) $(OTHERS)
  
  SCCS:
  		mkdir SCCS
--- 213,220 ----
  		shar.script $(SFILES7) > Part7
  
  create:         SCCS
! 		-sccs create $(STDSRCS) items.c $(GSRCS) $(HDRS) \
! 			     $(IMAGES) $(OTHERS)
  
  SCCS:
  		mkdir SCCS

------- README -------
*** /tmp/da28693	Fri Nov  9 10:24:59 1990
--- README	Wed Nov  7 11:41:54 1990
***************
*** 4,14 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 4,19 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 187,193 ****
  Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump, D. Hugh Redelmeier,
  Scott W. Danielson, Gary D. Kline, Kjetil Torgrim Homme, Peter Johansson,
  Alfred Nathaniel, Arnold Gill, Martin Chudley, W Mat Waites, Keith Moore,
! John Eras and Heather Rose for bug reports and/or bug fixes plus suggested
  enhancements.
  
  Suggestions for furthur improvement would be most welcome, plus bugs,
--- 192,199 ----
  Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump, D. Hugh Redelmeier,
  Scott W. Danielson, Gary D. Kline, Kjetil Torgrim Homme, Peter Johansson,
  Alfred Nathaniel, Arnold Gill, Martin Chudley, W Mat Waites, Keith Moore,
! John Eras, Heather Rose, Jonathan I. Kamens, Krishnamurthy Ganesan and
! Gordon C. Galligher for bug reports and/or bug fixes plus suggested
  enhancements.
  
  Suggestions for furthur improvement would be most welcome, plus bugs,

------- TODO -------
*** /tmp/da28696	Fri Nov  9 10:24:59 1990
--- TODO	Fri Nov  9 09:38:18 1990
***************
*** 4,14 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 4,19 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 20,37 ****
  
  1/ Finish off the X11 "two screens on two machines" version. The hooks are
     all in place, but not enough spare time...
  
  2/ Allow the computer to play itself. Currently this option is disabled,
     because of the inability with some of the graphics versions to interrupt
     it, once it's started.
  
! 3/ From Valerie Haecky <vmh@Eng>
!    It might be nice to have an additional button for <help>. It pops up an
!    alert, giving a short summary of the rules and explaining things, like
!    how Difficulty is measured.
  
! 4/ With the XView version, disable MS_LEFT whilst the computer is having
!    its move. At the moment, if you press the left mouse button while the
!    computer is doing something, the server will hang.
  
! 5/ The color icon doesn't display properly with the XView version.
--- 25,143 ----
  
  1/ Finish off the X11 "two screens on two machines" version. The hooks are
     all in place, but not enough spare time...
+    ~ The cursors in x11.c will need to be allocated for each screen
+      separately.
+    ~ In the process_event routine, only allow the FRAME_REPAINT event
+      through if it's now this persons go. Otherwise output a panel message
+      telling the user to wait her/his turn.
+    ~ Changing the Black: and White: cyclic items should have a null effect
+      if dtype is XTWO. Output a message to this effect.
+    ~ If dtype is XTWO, then message and draw_piece should output to both
+      screens. There are probably other routines where this should be the case.
+    ~ There will be a few other places where certain routines will need to
+      output to both displays if dtype is XTWO.
  
  2/ Allow the computer to play itself. Currently this option is disabled,
     because of the inability with some of the graphics versions to interrupt
     it, once it's started.
  
! 3/ From Valerie Haecky <vmh@Eng.Sun.COM>
!    It might be nice to have an additional button for <help>.
!    It pops up an alert, giving a short summary of the rules
!    and explaining non-obvious things, like how Difficulty is measured.
  
! 4/ There are several problems outstanding with the XView version:
!    ~ **IMPORTANT** Need to find some way to disable MS_LEFT whilst the
!                    computer is having its move. At the moment, if you press
!                    the left mouse button while the computer is doing something,
!                    the server will hang.
!    ~ The game panel doesn't correct repaint itself. You need to select
!      "Refresh" from the frame menu.
!    ~ The hourglass cursor should be drawn in XOR mode.
!    ~ The board window should not have a window menu.
!    ~ The game board isn't correctly painted with the -m command line option.
!    ~ When you click to get the panel window to the top, the game board should
!      also be raised.
!    ~ The alignment and size of some of the items needs to be adjusted to be
!      more consistent.
!    ~ The color icon doesn't get displayed properly.
!    ~ Would be nice to be able to close the game panel and leave the board
!      window open. Status information could be written to a title line and a
!      window footer (messages such as the number of stones each player
!      currently has; whose turn it is to move could be placed in the title
!      line, and panel messages such as invalid move could be written to the
!      footer.
  
! 5/ There appears to be a bug with the X11 implementation on an IBM RS6000.
!    When the computer moves a piece from the upper-left border to its place,
!    a "trace" appears along its path. The color of this trace is the color of
!    the background of the screen.
! 
! 6/ Need to allow options like -scale through on the command line. This can
!    be done by have an init_graphics() routine that gets called right at
!    the start, which strips off graphics specific options.
! 
! 7/ Need to add in the ability to show the last move, and show all moves to
!    the tty version.
! 
! 8/ From Valerie Haecky <vmh@Eng.Sun.COM>
!    Display the time left for the user[s] and computer.
! 
! 9/ From Valerie Haecky <vmh@Eng.Sun.COM>
!    Showing the last move could be optional.
! 
! 10/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     ~ Provide an option or button to toggle the animation of the computer
!       piece from the top-left corner onto the board. On slow workstations,
!       this is embarrassingly flickery and quite distracting.
! 
!     ~ Ditto for the flash of the turned over pieces - it slows down the game
!       when you just want a quick game.
! 
!     ~ Add the ability to change the default background colour of the board to
!       a (not too bright !) green colour. After all, that's the colour of the
!       othello sets you buy in the shops!
!  
!     [I'll do these with settable resources. I'll allow you to set some of
!      them on the command line, and I'll add a .reverc file, which will be read
!      from the users home directory. For the X11/XView versions, I'll allow the
!      resources to be set in all the standard X places, and the .reverc file can
!      superceed them - Rich.]
! 
! 11/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     Supply a way of forcing the computer to move before its search is complete.
!     This would be very handy at the higher levels.
! 
! 12/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     Allow the player to go forwards through a game as well as backwards (Undo
!     only performs the latter and not the former). In other words, "undo the
!     Undo" !
! 
! 13/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     As the computer is making it's move, highlight the best square found so
!     far during the computer search and display its rating in the Notes section.
! 
! 14/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     What about a 'Play Next Best' option? This would undo the last computer
!     move and play the second best move found rather than the best one. If
!     selected again, there would be another undo and the third best move would
!     be made instead and so on, until the move list is exhausted. It's great
!     for trying out different moves in the same position.
! 
! 15/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     Countdown clocks for blitz games (first to hit 00:00:00 loses if the game
!     is still in progress).
! 
! 16/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     Board editing.
! 
! 17/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     A display of the full tree for the best move rather than just the best
!     move itself.
! 
! 18/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     A resign feature if the search shows a completely lost endgame.
! 
! 19/ From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
!     A 'I will win/lose in x moves' announcement if a forced win/loss is
!     detected.

------- boardstuff.c -------
*** /tmp/da28701	Fri Nov  9 10:25:30 1990
--- boardstuff.c	Fri Nov  9 08:57:42 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,35 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #include <stdio.h>
  #include <ctype.h>
- 
- #ifndef SYSV
  #include <sys/time.h>
- #endif /*SYSV*/
  
! #include "color.h"
! #include "reve.h"
! #include "extern.h"
  
- 
  void
  animate_move(move)
  int move ;
--- 23,38 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #include "reve.h"
! #include "color.h"
! #include "extern.h"
  #include <ctype.h>
  #include <sys/time.h>
  
! #ifdef X11
! #include <X11/Xos.h>
! #endif /*X11*/
  
  void
  animate_move(move)
  int move ;
***************
*** 50,56 ****
          {
  #ifndef SYSV
            set_timer() ;
! #endif /*SYSV*/
            x0 = x ;
            y0 = y ;
            x += move_delta ;
--- 53,59 ----
          {
  #ifndef SYSV
            set_timer() ;
! #endif /*!SYSV*/
            x0 = x ;
            y0 = y ;
            x += move_delta ;
***************
*** 63,69 ****
            draw_piece(WHITE, x0, CY+y0, RINV) ;
  #ifndef SYSV
            nap_upto(1) ;
! #endif /*SYSV*/
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
--- 66,72 ----
            draw_piece(WHITE, x0, CY+y0, RINV) ;
  #ifndef SYSV
            nap_upto(1) ;
! #endif /*!SYSV*/
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
***************
*** 77,83 ****
          {
  #ifndef SYSV
            set_timer() ;
! #endif /*SYSV*/
            x0 = x ;
            y0 = y ;
            y += move_delta ;
--- 80,86 ----
          {
  #ifndef SYSV
            set_timer() ;
! #endif /*!SYSV*/
            x0 = x ;
            y0 = y ;
            y += move_delta ;
***************
*** 90,96 ****
            draw_piece(WHITE, x0, CY+y0, RINV) ;
  #ifndef SYSV
            nap_upto(1) ;
! #endif /*SYSV*/
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
--- 93,99 ----
            draw_piece(WHITE, x0, CY+y0, RINV) ;
  #ifndef SYSV
            nap_upto(1) ;
! #endif /*!SYSV*/
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
***************
*** 112,118 ****
        who_wins() ;
        last_cmode = cmode ;     /* Save previous value in case of undo. */
        cmode = GAME_OVER ;
!       message(PANEL_MES, "Game over") ;
        return(FALSE) ;
      }
    if ((move = valid_move(&board, player)) == FALSE)
--- 115,121 ----
        who_wins() ;
        last_cmode = cmode ;     /* Save previous value in case of undo. */
        cmode = GAME_OVER ;
!       message(PANEL_MES, "***GAME OVER***") ;
        return(FALSE) ;
      }
    if ((move = valid_move(&board, player)) == FALSE)
***************
*** 126,132 ****
            who_wins() ;
            last_cmode = cmode ;
            cmode = GAME_OVER ;
!           message(PANEL_MES, "Game over") ;
          }
        return(FALSE) ;
      }
--- 129,135 ----
            who_wins() ;
            last_cmode = cmode ;
            cmode = GAME_OVER ;
!           message(PANEL_MES, "***GAME OVER***") ;
          }
        return(FALSE) ;
      }
***************
*** 148,153 ****
--- 151,157 ----
      else
        { 
          if (cmode != GAME_OVER) cmode = (enum cantype) ((int) cmode - 1) ;
+         next_player = OPPONENT(next_player) ;
          return ;
        }
  }
***************
*** 180,185 ****
--- 184,216 ----
  }
  
  
+ void
+ draw_piece(piece, x, y, op)    /* Draw an othello piece on the board. */
+ int piece, x, y ;
+ enum optype op ;
+ {
+   switch (piece)
+     {
+       case BLACK : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
+                                 P_BLACK, P_BLACK) ;
+                    break ;
+       case WHITE : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
+                                 P_BLACK, P_WHITE) ;
+     }
+ }
+    
+  
+ void
+ draw_rect(x1, y1, x2, y2, op, color)
+ int x1, y1, x2, y2, op, color ;
+ {
+   draw_line(x1, y1, x2, y1, op, color) ;
+   draw_line(x1, y1, x1, y2, op, color) ;
+   draw_line(x2, y1, x2, y2, op, color) ;
+   draw_line(x1, y2, x2, y2, op, color) ;
+ }
+ 
+ 
  formfliplist(move, player)
  int move, player ;
  {        
***************
*** 196,201 ****
--- 227,233 ----
    moves[n].move = move ;
    moves[n].note = note ;
    moves[n].player = player ;
+   moves[n].timeleft = timeleft ;
  
    cnt = count(&board, player) ;
    return(cnt - old_cnt - 1) ;
***************
*** 263,269 ****
    initboard() ;
    last_move = -1 ;
    init_canvas() ;
!   message(NOTES_MES, "") ;
    while (fgets(buf, MAXLINE, fp) != NULL)
      {
        if (buf[0] == '\n' || buf[0] == '#') continue ;
--- 295,301 ----
    initboard() ;
    last_move = -1 ;
    init_canvas() ;
!   message(EVAL_MES, "") ;
    while (fgets(buf, MAXLINE, fp) != NULL)
      {
        if (buf[0] == '\n' || buf[0] == '#') continue ;
***************
*** 286,292 ****
        if (lptr < mptr) next_player = BLACK ;    /* Black move? */
        else             next_player = WHITE ;
        SSCANF(lptr, "<%c-%c>", &row, &col) ;
!       if (load_move(moveno, row, col) == 0)
          {
            SPRINTF(buf, "Load error: invalid move <%c-%c> on line %d",
                                      row, col, move) ;
--- 318,324 ----
        if (lptr < mptr) next_player = BLACK ;    /* Black move? */
        else             next_player = WHITE ;
        SSCANF(lptr, "<%c-%c>", &row, &col) ;
!       if (load_move(row, col) == 0)
          {
            SPRINTF(buf, "Load error: invalid move <%c-%c> on line %d",
                                      row, col, move) ;
***************
*** 309,318 ****
  }
  
  
! load_move(n, col, row)
! int n, col, row ;
  {
!   int i, taken, x, y ;
  
    if (row < '1' || row > '8') return(0) ;
    if (isupper(col)) col = tolower(col) ;
--- 341,350 ----
  }
  
  
! load_move(col, row)
! int col, row ;
  {
!   int i, x, y ;
  
    if (row < '1' || row > '8') return(0) ;
    if (isupper(col)) col = tolower(col) ;
***************
*** 319,325 ****
    if (col < 'a' || col > 'h') return(0) ;
    move = (row - '1') * BOARD_SIZE + (col - 'a') ;
    if (legal(move, next_player, &board) == FALSE) return(0) ;
!   taken = formfliplist(move, next_player) ;
    batch(IS_ON) ;
    FOR_BOARD(i)
      if (board.square[i] != old_board.square[i])
--- 351,357 ----
    if (col < 'a' || col > 'h') return(0) ;
    move = (row - '1') * BOARD_SIZE + (col - 'a') ;
    if (legal(move, next_player, &board) == FALSE) return(0) ;
!   (void) formfliplist(move, next_player) ;
    batch(IS_ON) ;
    FOR_BOARD(i)
      if (board.square[i] != old_board.square[i])
***************
*** 347,353 ****
    if (elapsed > n) return ;
    usleep((unsigned) (n - elapsed)) ;
  }
! #endif /*SYSV*/
  
  
  void
--- 379,385 ----
    if (elapsed > n) return ;
    usleep((unsigned) (n - elapsed)) ;
  }
! #endif /*!SYSV*/
  
  
  void
***************
*** 399,405 ****
  void
  set_score()
  {
!   SPRINTF(line, "Black: %2d, White: %2d",
                   count(&board, BLACK), count(&board, WHITE)) ;
    message(SCORE_MES, line) ;
  }
--- 431,437 ----
  void
  set_score()
  {
!   SPRINTF(line, "Stones: Black: %2d  White: %2d",
                   count(&board, BLACK), count(&board, WHITE)) ;
    message(SCORE_MES, line) ;
  }
***************
*** 422,431 ****
  
    GETTIMEOFDAY(&tp, &tzp) ;
  }
! #endif /*SYSV*/
  
  
  void
  show_suggestion()
  {
    enum optype rop ;
--- 454,528 ----
  
    GETTIMEOFDAY(&tp, &tzp) ;
  }
! #endif /*!SYSV*/
  
  
  void
+ show_all(state)
+ enum bltype state ;
+ {
+   int color, d, i, x, y ;
+ 
+   d = (int) cur_dpyno ;
+   batch(IS_ON) ;
+   if (state == IS_ON)
+     {
+       FOR_BOARD(i) s_all.square[i] = FREE ;
+       FOR_BOARD(i)
+         if (board.square[i] == FREE && legal(i, next_player, &board))
+           {
+             s_all.square[i] = next_player ;
+             if (iscolor[d])
+               {
+                 get_xy(i, &x, &y) ;
+                 draw_stencil(x, CY+y, PSIZE, PSIZE, RSRC, C_BLACK,
+                              P_WHITE, P_WHITE) ;
+               }
+             else
+               {
+                 x = BBORDER + ((i & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
+                 y = BBORDER + ((i >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
+                 draw_line(x-5, CY+y,   x+5, CY+y,   RSRC, C_BLACK) ;
+                 draw_line(x,   CY+y+5, x,   CY+y-5, RSRC, C_BLACK) ;
+               }
+           }
+     }
+   else
+     {
+       FOR_BOARD(i)
+         if (s_all.square[i] != FREE)
+           {
+             s_all.square[i] = FREE ;
+             x = (i & 7)  * CELL_SIZE + BBORDER + 1 ;
+             y = (i >> 3) * CELL_SIZE + BBORDER + 1 ;  
+             color = (iscolor[d]) ? C_LBROWN : C_WHITE ;
+             color_area(x, CY + y, CELL_SIZE - 2, CELL_SIZE - 2, color) ;
+           }
+     }    
+   batch(IS_OFF) ;
+   show_moves = (int) state ;
+ }
+ 
+ 
+ void
+ show_last(move, state)
+ int move ;
+ enum bltype state ;
+ {
+   int color, x, y ;
+ 
+   if (move == -1) return ;
+   if (iscolor[(int) cur_dpyno]) color = (state == IS_ON) ? C_BLACK : C_LBROWN ;
+   else                          color = (state == IS_ON) ? C_BLACK : C_WHITE ;
+ 
+   x = (move & 7)  * CELL_SIZE + BBORDER ;
+   y = (move >> 3) * CELL_SIZE + BBORDER ;
+   draw_rect(x + 2,             CY + y + 2,
+             x + CELL_SIZE - 2, CY + y + CELL_SIZE - 2, RSRC, color) ;
+ }
+ 
+ 
+ void
  show_suggestion()
  {
    enum optype rop ;
***************
*** 450,455 ****
--- 547,554 ----
  {
    int flips, i, piece, x, y ;
   
+   show_all(IS_OFF) ;
+   show_last(last_move, IS_OFF) ;
    show_suggestion() ;
    for (flips = 0; flips < 4; flips++)
      {
***************
*** 468,473 ****
--- 567,574 ----
        batch(IS_OFF) ;
        PAUSE ;
      }
+   show_last(move, IS_ON) ;
+   last_move = move ;
    set_score() ;
    set_turn(OPPONENT(player)) ;
    message(TURN_MES, line) ;
***************
*** 475,484 ****
      if ((player == BLACK && items[(int) BLACK_PLAYS].value == COMPUTER) ||
          (player == WHITE && items[(int) WHITE_PLAYS].value == COMPUTER))
        {
!         SPRINTF(line, "%s: <%c-%c> note : %ld",
                  (player == BLACK) ? "Black" : "White",
                  (move & 7) + 'a', (move >> 3) + '1', note) ;
!         message(NOTES_MES, line) ;
        }
  }
  
--- 576,585 ----
      if ((player == BLACK && items[(int) BLACK_PLAYS].value == COMPUTER) ||
          (player == WHITE && items[(int) WHITE_PLAYS].value == COMPUTER))
        {
!         SPRINTF(line, "%s: <%c-%c> eval : %ld",
                  (player == BLACK) ? "Black" : "White",
                  (move & 7) + 'a', (move >> 3) + '1', note) ;
!         message(EVAL_MES, line) ;
        }
  }
  

richb@sunaus.oz (Rich Burridge) (11/09/90)

------CUT HERE------patch1 - part2------CUT HERE------

------- color.h -------
*** /tmp/da28728	Fri Nov  9 10:28:40 1990
--- color.h	Mon Nov  5 09:10:15 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported

------- events.c -------
*** /tmp/da28731	Fri Nov  9 10:28:41 1990
--- events.c	Wed Nov  7 21:09:27 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,24 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
  #include "reve.h"
  #include "color.h"
  #include "extern.h"
--- 23,28 ----
***************
*** 166,172 ****
        switch (item)
          {
            case BLACK_PLAYS :
!                WHITE_PLAYS : if (item == BLACK_PLAYS) curx = 0 ;
                               else curx = BBORDER + (3*(BWIDTH+BGAP)) ;
                               switch (ch)
                                 {
--- 170,176 ----
        switch (item)
          {
            case BLACK_PLAYS :
!           case WHITE_PLAYS : if (item == BLACK_PLAYS) curx = 0 ;
                               else curx = BBORDER + (3*(BWIDTH+BGAP)) ;
                               switch (ch)
                                 {
***************
*** 247,254 ****
                                nextc == RIGHT_DOWN)
                              {
                                set_cursor(NOCURSOR) ;
!                               piece_x = curx - BBORDER - (PIECE_RAD) ;
!                               piece_y = cury - BBORDER - (PIECE_RAD) ;
                                draw_piece(next_player, piece_x, piece_y, RINV) ;
                                cmode = (enum cantype) ((int) cmode + 1) ;
                              }
--- 251,258 ----
                                nextc == RIGHT_DOWN)
                              {
                                set_cursor(NOCURSOR) ;
!                               piece_x = curx - PIECE_RAD ;
!                               piece_y = cury - PIECE_RAD ;
                                draw_piece(next_player, piece_x, piece_y, RINV) ;
                                cmode = (enum cantype) ((int) cmode + 1) ;
                              }
***************
*** 319,325 ****
        case 'W' : do_cycle_key(WHITE_PLAYS, nextc) ;
                   break ;
  
!       case 'l' : last() ;                              /* Button items. */
                   break ;
        case 'L' : curx = 0 ;
                   draw_textfield() ;
--- 323,329 ----
        case 'W' : do_cycle_key(WHITE_PLAYS, nextc) ;
                   break ;
  
!       case 'A' : show_all_moves() ;                    /* Button items. */
                   break ;
        case 'L' : curx = 0 ;
                   draw_textfield() ;

------- extern.h -------
*** /tmp/da28734	Fri Nov  9 10:28:42 1990
--- extern.h	Wed Nov  7 14:57:04 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 23,29 ****
  extern int cur_ch ;        /* Current character pressed. */
  extern int curx ;          /* Current mouse X position. */
  extern int cury ;          /* Current mouse Y position. */
- extern int depth ;         /* Depth of search for computers move. */
  extern int down ;          /* Indicates is a mouse button is down. */
  extern int first_move ;    /* Set if computer plays first move. */
  extern int iconic ;        /* Start as an icon if set. */
--- 28,33 ----
***************
*** 34,41 ****
--- 38,47 ----
  extern int ix ;            /* Initial X position of the icon. */
  extern int iy ;            /* Initial Y position of the icon. */
  extern int last_move ;     /* Last valid computer move. */
+ extern int level ;         /* Current difficulty level for computer moves. */
  extern int loadgame ;      /* Set if there is a game file to load. */
  extern int lsval ;         /* Set to 'l' or 's', if loading or saving. */
+ extern int monochrome ;    /* If set, display will be in monochrome. */
  extern int move ;          /* Current move being evaluated. */
  extern int move_delta ;    /* Delta for piece animation. */
  extern int nextc ;         /* Current event identifier. */
***************
*** 51,56 ****
--- 57,63 ----
  extern int s_player ;
  extern int s_row ;
  extern int s_col ;
+ extern int show_moves ;    /* If set, all possible moves are being shown. */
  extern int show_notes ;    /* If set, display notes value from play_reve. */
  extern int suggestion ;    /* Positive if a suggested move. */
  extern int suggest_x ;     /* X position of suggested move. */
***************
*** 62,67 ****
--- 69,75 ----
  extern int wx ;            /* Initial X position of the window. */
  extern int wy ;            /* Initial Y position of the window. */ 
  
+ extern time_t timeleft ;   /* Amount of time left for computer moves. */
  extern long note ;         /* Note value for current computer move. */
  
  extern char *diff_values[] ;     /* Values for cyclic difficulty button. */
***************
*** 74,81 ****
  extern char progname[] ;         /* The name of this program. */
  extern char revtable[] ;         /* Table for reversing bits in a byte. */
  
! extern char black_dpy[] ;        /* Black piece display information. */
! extern char white_dpy[] ;        /* White piece display information. */
  
  extern FILE *rem_fp ;
  extern struct timeval tp ;        /* Used by the nap_upto routine. */
--- 82,89 ----
  extern char progname[] ;         /* The name of this program. */
  extern char revtable[] ;         /* Table for reversing bits in a byte. */
  
! extern char *black_dpy ;         /* Black piece display information. */
! extern char *white_dpy ;         /* White piece display information. */
  
  extern FILE *rem_fp ;
  extern struct timeval tp ;        /* Used by the nap_upto routine. */
***************
*** 85,90 ****
--- 93,99 ----
  extern BOARD board ;              /* The current reve board. */
  extern BOARD old_board ;          /* The previous reve board. */
  extern BOARD *s_pos ;
+ extern BOARD s_all ;              /* List of valid positions for this move. */ 
  extern BOARD moves[64] ;          /* Complete array of board moves. */
  
  extern enum cantype cmode, last_cmode ;

------- images.h -------
*** /tmp/da28737	Fri Nov  9 10:28:42 1990
--- images.h	Tue Nov  6 18:21:08 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,48 ****
   */
  
  unsigned short button_stencil_image[] = {
! #include "images/button.stencil.icon"
  } ;
  
  unsigned short button_invert_image[] = {
! #include "images/button.invert.icon"
  } ;
  
  unsigned short button_normal_image[] = {
! #include "images/button.normal.icon"
  } ;
  
  unsigned short cycle_glyph_image[] = {
! #include "images/cycle.glyph.icon"
  } ;
  
  unsigned short cycle_stencil_image[] = {
! #include "images/cycle.stencil.icon"
  } ;
  
  unsigned short cycle_linvert_image[] = {
! #include "images/cycle.linvert.icon"
  } ;
  
  unsigned short cycle_rinvert_image[] = {
! #include "images/cycle.rinvert.icon"
  } ;
  
  unsigned short icon_image[] = {
--- 23,53 ----
   */
  
  unsigned short button_stencil_image[] = {
! #include "images/Sbutton.icon"
  } ;
  
  unsigned short button_invert_image[] = {
! #include "images/Ibutton.icon"
  } ;
  
  unsigned short button_normal_image[] = {
! #include "images/Nbutton.icon"
  } ;
  
  unsigned short cycle_glyph_image[] = {
! #include "images/Ncycle.icon"
  } ;
  
  unsigned short cycle_stencil_image[] = {
! #include "images/Scycle.icon"
  } ;
  
  unsigned short cycle_linvert_image[] = {
! #include "images/Lcycle.icon"
  } ;
  
  unsigned short cycle_rinvert_image[] = {
! #include "images/Rcycle.icon"
  } ;
  
  unsigned short icon_image[] = {
***************
*** 50,56 ****
  } ;
  
  unsigned short cicon_image[] = {
! #include "images/reve.color.icon"
  } ;
  
  unsigned short hglass_image[] = {
--- 55,61 ----
  } ;
  
  unsigned short cicon_image[] = {
! #include "images/Creve.icon"
  } ;
  
  unsigned short hglass_image[] = {

------- items.c -------
*** /tmp/da28740	Fri Nov  9 10:28:43 1990
--- items.c	Mon Nov  5 09:05:39 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,30 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
- #include <strings.h>
- #include "color.h"
  #include "reve.h"
  #include "extern.h"
  
  
  void
  draw_button(item, color, image)      /* Draw a panel button. */
  enum panel_type item ;
--- 23,39 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
  #include "reve.h"
+ #include "color.h"
  #include "extern.h"
  
+ #ifdef SYSV
+ #include "string.h"
+ #else
+ #include <strings.h>
+ #endif /*SYSV*/ 
  
+ 
  void
  draw_button(item, color, image)      /* Draw a panel button. */
  enum panel_type item ;
***************
*** 107,139 ****
  
  
  void
- draw_piece(piece, x, y, op)    /* Draw an othello piece on the board. */
- int piece, x, y ;
- enum optype op ;
- {
-   switch (piece)
-     {
-       case BLACK : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
-                                 P_BLACK, P_BLACK) ;
-                    break ;
-       case WHITE : draw_stencil(x, y, PSIZE, PSIZE, op, C_BLACK,
-                                 P_BLACK, P_WHITE) ;
-     }
- }
- 
- 
- void
- draw_rect(x1, y1, x2, y2)
- int x1, y1, x2, y2 ;
- {
-   draw_line(x1, y1, x2, y1, RSRC, C_BLACK) ;
-   draw_line(x1, y1, x1, y2, RSRC, C_BLACK) ;
-   draw_line(x2, y1, x2, y2, RSRC, C_BLACK) ;
-   draw_line(x1, y2, x2, y2, RSRC, C_BLACK) ;
- }
- 
- 
- void
  draw_textfield()
  {
    int x1, y1 ;
--- 116,121 ----
***************
*** 142,148 ****
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
    color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
!   draw_rect(x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1, y1 + BHEIGHT + BGAP - 1) ;
    draw_text(BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
              BFONT, C_BLACK, "File:") ;
--- 124,131 ----
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
    color_area(x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
!   draw_rect(x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
!                 y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
    draw_text(BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
              BFONT, C_BLACK, "File:") ;
***************
*** 210,219 ****
  void
  make_panel()
  {
-   draw_button(LAST_BUT,     C_LGREY, BUT_NORMAL) ;
    draw_button(LOAD_BUT,     C_LGREY, BUT_NORMAL) ;
    draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
    draw_button(SAVE_BUT,     C_LGREY, BUT_NORMAL) ;
    draw_button(SUGGEST_BUT,  C_LGREY, BUT_NORMAL) ;
    draw_button(UNDO_BUT,     C_LGREY, BUT_NORMAL) ;
  
--- 193,202 ----
  void
  make_panel()
  {
    draw_button(LOAD_BUT,     C_LGREY, BUT_NORMAL) ;
    draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
    draw_button(SAVE_BUT,     C_LGREY, BUT_NORMAL) ;
+   draw_button(SHOW_ALL_BUT, C_LGREY, BUT_NORMAL) ;
    draw_button(SUGGEST_BUT,  C_LGREY, BUT_NORMAL) ;
    draw_button(UNDO_BUT,     C_LGREY, BUT_NORMAL) ;
  
***************
*** 226,232 ****
    draw_cycle_item(NOTES,       notes_values,  C_LGREY, CY_NORMAL) ;
  
    make_message(PANEL_MES) ;
!   make_message(NOTES_MES) ;
    make_message(SCORE_MES) ;
    make_message(TURN_MES) ;
  }
--- 209,215 ----
    draw_cycle_item(NOTES,       notes_values,  C_LGREY, CY_NORMAL) ;
  
    make_message(PANEL_MES) ;
!   make_message(EVAL_MES) ;
    make_message(SCORE_MES) ;
    make_message(TURN_MES) ;
  }

------- reve.man -------
*** /tmp/da28765	Fri Nov  9 10:32:20 1990
--- reve.man	Fri Nov  9 10:31:20 1990
***************
*** 10,17 ****
  
  SYNOPSIS
       reve [ -b [ display ] ] [ -c ] [ -d difficulty ] [ -e  edge-
!      file  ] [ -g geometry ] [ -i ] [ -l gamefile ] [ -n ] [ -v ]
!      [ -w [ display ] ] [ -? ] [ -Wi ] [ -Wp x y ] [ -WP x y ]
  
  DESCRIPTION
       Reve is a version of the popular Othello game.  It  contains
--- 10,18 ----
  
  SYNOPSIS
       reve [ -b [ display ] ] [ -c ] [ -d difficulty ] [ -e  edge-
!      file  ] [ -g geometry ] [ -i ] [ -l gamefile ] [ -m ] [ -n ]
!      [ -r ] [ -v ] [ -w [ display ] ] [ -? ] [ -Wi ] [ -Wp x y  ]
!      [ -WP x y ]
  
  DESCRIPTION
       Reve is a version of the popular Othello game.  It  contains
***************
*** 38,44 ****
       go. Note that it is also possible to supply a number  and  a
       letter pair, to indicate where you would like your new piece
       to go. This is the only method to place pieces with the dumb
!      tty interface.
  
       There are various buttons and cyclic  selections  available.
       Their  meanings are given below, plus an indication of their
--- 39,47 ----
       go. Note that it is also possible to supply a number  and  a
       letter pair, to indicate where you would like your new piece
       to go. This is the only method to place pieces with the dumb
!      tty  interface.  The square containing the last move will be
!      shown with a black outline. This is updated  with  each  new
!      move.
  
       There are various buttons and cyclic  selections  available.
       Their  meanings are given below, plus an indication of their
***************
*** 54,62 ****
       other combination, then you should use the appropriate  com-
       mand line options (see below).
  
- REVE BUTTONS
-      With the graphics versions, there are eight buttons that are
-      normally  displayed  at  the top of the Reve window. Each of
  
  
  
--- 57,62 ----
***************
*** 71,81 ****
  
  
  
       these buttons, except  the  "done"  button  has  a  keyboard
       equivalent which is given in brackets below.
  
-      last [ l ]        Show the last move played.
- 
       load [ L ]        Load a game file. The format of this  game
                         file  is  given  below. With the graphical
                         versions,  a  text  field   is   displayed
--- 71,82 ----
  
  
  
+ REVE BUTTONS
+      With the graphics versions, there are eight buttons that are
+      normally  displayed  at  the top of the Reve window. Each of
       these buttons, except  the  "done"  button  has  a  keyboard
       equivalent which is given in brackets below.
  
       load [ L ]        Load a game file. The format of this  game
                         file  is  given  below. With the graphical
                         versions,  a  text  field   is   displayed
***************
*** 92,97 ****
--- 93,102 ----
                         game  file,  the piece is displayed on the
                         board, and the appropriate pieces flipped.
  
+      moves? [ A ]      Show all the valid moves for  the  current
+                        board.  This  is useful for beginners, and
+                        for teaching purposes.
+ 
       new game [ n ]    Start a new game of reve
  
       save [ S ]        Save the current game  to  file.  See  the
***************
*** 118,128 ****
       left mouse button, to increment  or  decrement  the  current
       selection  (depending  upon which half on the item you click
       over), or a selection can be made from a popup menu when you
-      click  with  the  right mouse button (SunView and XView ver-
-      sions only).  Each cycle value  has  a  keyboard  equivalent
-      which  is given in brackets below.  This must be followed by
-      the value of the new selection you wish to make.   The  dumb
-      tty  version  has the equivalent of these items displayed to
  
  
  
--- 123,128 ----
***************
*** 137,142 ****
--- 137,147 ----
  
  
  
+      click  with  the  right mouse button (SunView and XView ver-
+      sions only).  Each cycle value  has  a  keyboard  equivalent
+      which  is given in brackets below.  This must be followed by
+      the value of the new selection you wish to make.   The  dumb
+      tty  version  has the equivalent of these items displayed to
       the right of the reve board display.
  
       Black: [ B ]      Select whether the black player should  be
***************
*** 184,197 ****
            of  reve  it  is  possible  to give an optional display
            value.
  
-      -c   The computer will play. Presence or absence of  -b  and
-           -w options determine which piece the computer plays.
  
-      -d difficulty
-           The level of difficulty for  computer  moves.  See  the
  
  
- 
  Sun Release 4.1   Last change: 18 October 1990                  3
  
  
--- 189,197 ----
***************
*** 203,212 ****
  
  
  
            Difficulty:  cyclic  item  description  above  for more
            information.
  
!      -eedgefile
            Specify an alternate location for the reve edge stabil-
            ity  table  file. Normally the location of this file is
            compiled in when the program is created, but reve  will
--- 203,217 ----
  
  
  
+      -c   The computer will play. Presence or absence of  -b  and
+           -w options determine which piece the computer plays.
+ 
+      -d difficulty
+           The level of difficulty for  computer  moves.  See  the
            Difficulty:  cyclic  item  description  above  for more
            information.
  
!      -e edgefile
            Specify an alternate location for the reve edge stabil-
            ity  table  file. Normally the location of this file is
            compiled in when the program is created, but reve  will
***************
*** 226,233 ****
--- 231,245 ----
            Load a game file. The format of this game file is given
            below. The board will be setup with these pieces.
  
+      -m   Always display in monochrome, even on a color screen.
+ 
       -n   Display computer notes.
  
+      -r   Save a log of computer move  information  to  the  file
+           reve.res  as  the  game progresses. This information is
+           probably only useful to people trying  to  improve  the
+           computer algorithm.
+ 
       -?   Print the version number and  usage  message  for  this
            release of the reve program.
  
***************
*** 243,274 ****
            and  XView version of reve will automatically uses this
            flag, but the X11 version will also.
  
-      -Wp x y
-           Start the open window position at x y
  
-      -WP x y
-           Start the icon position at x y
  
- REVE GAMES FILE FORMAT
-      Reve has the ability to load or save games.  The  format  of
-      the games files are:
  
!           1,   <C-4>     -    [ remarks field ]
!           2,   -    <E-3>     [ remarks field ]
  
  
  
- Sun Release 4.1   Last change: 18 October 1990                  4
  
  
  
  
  
  
! REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
       There is one move per line. Lines starting with  a  '#'  and
       blank lines are ignored. The first field of each line is the
       move number. This will be present before the  comma.  It  is
--- 255,287 ----
            and  XView version of reve will automatically uses this
            flag, but the X11 version will also.
  
  
  
  
! Sun Release 4.1   Last change: 18 October 1990                  4
  
  
  
  
  
  
+ REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
!      -Wp x y
!           Start the open window position at x y
  
+      -WP x y
+           Start the icon position at x y
  
+ REVE GAMES FILE FORMAT
+      Reve has the ability to load or save games.  The  format  of
+      the games files are:
  
+           1,   <C-4>     -    [ remarks field ]
+           2,   -    <E-3>     [ remarks field ]
+ 
       There is one move per line. Lines starting with  a  '#'  and
       blank lines are ignored. The first field of each line is the
       move number. This will be present before the  comma.  It  is
***************
*** 297,315 ****
  AUTHORS
       Computer strategy:  Yves Gallot    galloty@cernvax.cern.ch
       Graphics interface: Rich Burridge  richb@Aus.Sun.COM
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
  
  
  
--- 310,315 ----

------- reve.6 -------
*** /tmp/da28768	Fri Nov  9 10:32:21 1990
--- reve.6	Fri Nov  9 10:31:13 1990
***************
*** 24,31 ****
--- 24,35 ----
  .B \-l
  .I gamefile
  ] [
+ .B \-m
+ ] [
  .B \-n
  ] [
+ .B \-r
+ ] [
  .B \-v
  ] [
  .B \-w
***************
*** 65,71 ****
  square in which you want your piece to go. Note that it is also possible
  to supply a number and a letter pair, to indicate where you would like your
  new piece to go. This is the only method to place pieces with the dumb tty
! interface.
  .LP
  There are various buttons and cyclic selections available. Their meanings
  are given below, plus an indication of their keyboard equivalents. With the
--- 69,76 ----
  square in which you want your piece to go. Note that it is also possible
  to supply a number and a letter pair, to indicate where you would like your
  new piece to go. This is the only method to place pieces with the dumb tty
! interface. The square containing the last move will be shown with a black
! outline. This is updated with each new move.
  .LP
  There are various buttons and cyclic selections available. Their meanings
  are given below, plus an indication of their keyboard equivalents. With the
***************
*** 83,90 ****
  displayed at the top of the Reve window. Each of these buttons, except
  the "done" button has a keyboard equivalent which is given in brackets below.
  .LP
- .IP "\fBlast [ l ]\fP" 18
- Show the last move played.
  .IP "\fBload [ L ]\fP" 18
  Load a game file. The format of this game file is given below. With the
  graphical versions, a text field is displayed between the \fBdone\fP and
--- 88,93 ----
***************
*** 95,100 ****
--- 98,106 ----
  stop on the invalid line, and display an error message. As each line is
  successfully read from the game file, the piece is displayed on the board,
  and the appropriate pieces flipped.
+ .IP "\fBmoves? [ A ]\fP" 18
+ Show all the valid moves for the current board. This is useful for beginners,
+ and for teaching purposes.
  .IP "\fBnew game [ n ]\fP" 18
  Start a new game of
  .I reve
***************
*** 178,184 ****
  The level of difficulty for computer moves. See the \fBDifficulty:\fP
  cyclic item description above for more information.
  .TP
! .BI \-e "edgefile"
  Specify an alternate location for the
  .I reve
  edge stability table file. Normally the location of this file is compiled
--- 184,190 ----
  The level of difficulty for computer moves. See the \fBDifficulty:\fP
  cyclic item description above for more information.
  .TP
! .BI \-e " edgefile"
  Specify an alternate location for the
  .I reve
  edge stability table file. Normally the location of this file is compiled
***************
*** 201,208 ****
--- 207,223 ----
  Load a game file. The format of this game file is given below. The board
  will be setup with these pieces.
  .TP
+ .B \-m
+ Always display in monochrome, even on a color screen.
+ .TP
  .B \-n
  Display computer notes.
+ .TP
+ .B \-r
+ Save a log of computer move information to the file
+ .I reve.res
+ as the game progresses. This information is probably only useful to
+ people trying to improve the computer algorithm.
  .TP
  .B \-?
  Print the version number and usage message for this release of the

------- main.c -------
*** /tmp/da28803	Fri Nov  9 10:34:47 1990
--- main.c	Wed Nov  7 15:04:18 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 17,28 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
- #include <strings.h>
- #include <sys/time.h>
- #include "color.h"
  #include "reve.h"
  #include "patchlevel.h"
  
  /* Text values for the cyclic buttons. */
  char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
--- 22,39 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
  #include "reve.h"
+ #include "color.h"
  #include "patchlevel.h"
+ #ifdef SYSV
+ #include <string.h>
+ #else
+ #include <strings.h>
+ #endif /*SYSV*/
+ #include <sys/time.h>
+ #ifdef X11
+ #include <X11/Xos.h>
+ #endif /*X11*/
  
  /* Text values for the cyclic buttons. */
  char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
***************
*** 45,51 ****
  int cur_ch ;            /* Current character pressed. */
  int curx ;              /* Current mouse X position. */
  int cury ;              /* Current mouse Y position. */
- int depth ;             /* Depth of search for computers move. */
  int down ;              /* Indicates is a mouse button is down. */
  int first_move = 0 ;    /* Set if computer plays first move. */
  int iconic ;            /* Set if window is currently iconic. */
--- 56,61 ----
***************
*** 58,65 ****
--- 68,77 ----
  int ix ;                /* Initial X position of the icon. */
  int iy ;                /* Initial Y position of the icon. */
  int last_move ;         /* Last valid computer move. */
+ int level ;             /* Current level of difficulty for computer moves. */
  int loadgame = 0 ;      /* Set if there is a game file to load. */
  int lsval = 0 ;         /* Set to 'l' or 's', if loading or saving. */
+ int monochrome = 0 ;    /* If set, display will be in monochrome. */
  int move ;              /* Current move being evaluated. */
  int move_delta ;        /* Delta for piece animation. */
  int nextc ;             /* Current event identifier. */
***************
*** 67,72 ****
--- 79,86 ----
  int nfont_height ;      /* Height in pixels for normal font. */
  int play_computer ;     /* Set if playing against the computer. */
  int posspec ;           /* Set if -Wp or -g option is present (for X11) */
+ int saveres = 0 ;       /* If set, save computer results to log file. */
+ int show_moves = 0 ;    /* If set, all possible moves are being shown. */
  int show_notes ;        /* If set, display notes value from play_reve. */
  int suggestion = -1 ;   /* Positive if a suggested move. */
  int suggest_x ;         /* X position of suggested move. */
***************
*** 93,98 ****
--- 107,113 ----
  BOARD old_board ;          /* The previous reve board. */
  BOARD board ;              /* The current reve board. */
  BOARD *s_pos ;
+ BOARD s_all ;              /* List of valid positions for this move. */
  
  BOARD moves[64] ;          /* Complete array of board moves. */
  
***************
*** 101,110 ****
  /*   type   x   y   width   height   text   value   function */
  
  { P_BUTTON,  BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
!              BWIDTH, BHEIGHT, "last",     0, last },
  
  { P_BUTTON,  BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
!              BWIDTH, BHEIGHT, "load",     0, draw_textfield },
  
  { P_BUTTON,  BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
               BWIDTH, BHEIGHT, "new game", 0, new_game },
--- 116,125 ----
  /*   type   x   y   width   height   text   value   function */
  
  { P_BUTTON,  BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
!              BWIDTH, BHEIGHT, "load",     0, draw_textfield },
  
  { P_BUTTON,  BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
!              BWIDTH, BHEIGHT, "moves?",   0, show_all_moves },
  
  { P_BUTTON,  BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
               BWIDTH, BHEIGHT, "new game", 0, new_game },
***************
*** 170,175 ****
--- 185,191 ----
  long c1, c2, c3 ;            /* Constants used in evaluation function */
  long edges[6561] ;           /* Edges Stability Table */
  long note ;                  /* Note value for current computer move. */
+ time_t timeleft ;            /* Amount of time left for computer moves. */
  
  extern enum gr_type gtype ;                     /* Graphics type. */ 
  
***************
*** 190,195 ****
--- 206,226 ----
        FPRINTF(stderr,"Error initialising window system.\n") ;
        exit(1) ;
      }
+   generate_graphics(argc, argv, DPY1) ;
+   if (dtype == XTWO) generate_graphics(argc, argv, DPY2) ;
+   start_tool(dtype) ;           /* Event handling loop. */
+   exit(0) ;
+ /*NOTREACHED*/
+ }
+ 
+ 
+ void
+ generate_graphics(argc, argv, dpyno)
+ enum dpy_type dpyno ;
+ int argc ;
+ char *argv[] ;
+ {
+   cur_dpyno = dpyno ;
    make_icon() ;
    make_frame(argc, argv) ;      /* Create reve window/icon. */
    make_canvas() ;               /* Create drawing canvas. */
***************
*** 200,208 ****
    create_menu(NOTES,       notes_values) ;
    initboard() ;
    set_cursor(CANVASCUR) ;
-   start_tool(dtype) ;           /* Event handling loop. */
-   exit(0) ;
- /*NOTREACHED*/
  }
  
  
--- 231,236 ----
***************
*** 212,217 ****
--- 240,246 ----
  char *argv[] ;
  {
    char next[MAXLINE] ;    /* The next command line parameter. */
+   int i ;
  
    INC ;
    while (argc > 0)
***************
*** 220,226 ****
          switch (argv[0][1])
            {
              case 'b' : isblack = 1 ;
!                        if (*argv != NULL && argv[0][0] != '-')
                           {
                             INC ;
                             black_dpy = *argv ;
--- 249,255 ----
          switch (argv[0][1])
            {
              case 'b' : isblack = 1 ;
!                        if (*(argv+1) != NULL && argv[1][0] != '-')
                           {
                             INC ;
                             black_dpy = *argv ;
***************
*** 230,238 ****
                         break ;
              case 'd' : INC ;
                         getparam(next, argv, "-d needs difficulty") ;
!                        depth = atoi(next) ;
!                        if (depth < 1 || depth > MAXDIFF) depth = INIT_DEPTH ;
!                        items[(int) DIFFICULTY].value = depth - 1 ;
                         break ;
              case 'e' : INC ;
                         getparam(edgefile, argv, "-e needs an edgetable file") ;
--- 259,267 ----
                         break ;
              case 'd' : INC ;
                         getparam(next, argv, "-d needs difficulty") ;
!                        level = atoi(next) ;
!                        if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
!                        items[(int) DIFFICULTY].value = level - 1 ;
                         break ;
              case 'e' : INC ;
                         getparam(edgefile, argv, "-e needs an edgetable file") ;
***************
*** 247,260 ****
                         getparam(gamefile, argv, "-l needs a game file") ;
                         loadgame = 1 ;        /* Game file to load. */
                         break ;
              case 'n' : show_notes = 1 ;      /* Display computer notes. */
                         items[(int) NOTES].value = 1 ;
                         break ;
              case '?' :
              case 'v' : usage() ;
  
              case 'w' : iswhite = 1 ;
!                        if (*argv != NULL && argv[0][0] != '-')
                           {
                             INC ;
                             white_dpy = *argv ;
--- 276,294 ----
                         getparam(gamefile, argv, "-l needs a game file") ;
                         loadgame = 1 ;        /* Game file to load. */
                         break ;
+             case 'm' : monochrome = 1 ;      /* Force display to mono. */
+                        for (i = 0; i < MAXDPY; i++) iscolor[i] = 0 ;
+                        break ;
              case 'n' : show_notes = 1 ;      /* Display computer notes. */
                         items[(int) NOTES].value = 1 ;
                         break ;
+             case 'r' : saveres = 1 ;       /* Save computer results to file. */
+                        break ;
              case '?' :
              case 'v' : usage() ;
  
              case 'w' : iswhite = 1 ;
!                        if (*(argv+1) != NULL && argv[1][0] != '-')
                           {
                             INC ;
                             white_dpy = *argv ;
***************
*** 382,387 ****
--- 416,422 ----
                  BFONT, color, sa) ;
      }
    batch(IS_OFF) ;
+   show_last(last_move, IS_ON) ;
    show_suggestion() ;
    batch(IS_ON) ;
    FOR_BOARD(i)
***************
*** 423,430 ****
    show_notes    = FALSE ;
    isblack       = 0 ;
    iswhite       = 0 ;
!   depth         = INIT_DEPTH ;
!   items[(int) DIFFICULTY].value = depth - 1 ;
  
    black_dpy = NULL ;              /* X11 black piece display information. */
    white_dpy = NULL ;              /* X11 white piece display information. */
--- 458,465 ----
    show_notes    = FALSE ;
    isblack       = 0 ;
    iswhite       = 0 ;
!   level         = INIT_DEPTH ;
!   items[(int) DIFFICULTY].value = level - 1 ;
  
    black_dpy = NULL ;              /* X11 black piece display information. */
    white_dpy = NULL ;              /* X11 white piece display information. */
***************
*** 512,517 ****
--- 547,553 ----
  void
  set_display_types()
  {
+        if (isblack && iswhite) play_computer = 0 ;
         if (isblack && iswhite) dtype = XBOTH ;
    else if (isblack)            dtype = XBLACK ;
    else if (iswhite)            dtype = XWHITE ;
***************
*** 553,559 ****
  int player ;
  {
    set_cursor(HOURGLASS) ;
!   play_reve(board.square, player, depth, &move, &note) ;
    set_cursor(CANVASCUR) ;
    animate_move(move) ;
    do_move(player) ;
--- 589,596 ----
  int player ;
  {
    set_cursor(HOURGLASS) ;
!   move = TRUE ;            /* Make sure the computer clock is decremented. */
!   play_reve(board.square, player, level, &move, &note) ;
    set_cursor(CANVASCUR) ;
    animate_move(move) ;
    do_move(player) ;

------- makemove.c -------
*** /tmp/da28806	Fri Nov  9 10:34:48 1990
--- makemove.c	Mon Nov  5 09:06:03 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,24 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
  #include "reve.h"
  #include "extern.h"
  
--- 23,28 ----
***************
*** 101,106 ****
--- 105,111 ----
    register int square,offset ;
    int row_offset,col_offset,piece,piece_count ;
  
+   if ((s_move+increment) < 0 || (s_move+increment) > 63) return(FALSE) ;
    if (s_pos->square[s_move+increment] != s_opponent) return(FALSE) ;
   
  /*  Quick test to catch most failures -

------- procs.c -------
*** /tmp/da28809	Fri Nov  9 10:34:49 1990
--- procs.c	Thu Nov  8 10:46:31 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,24 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
  #include "color.h"
  #include "reve.h"
  #include "extern.h"
--- 23,28 ----
***************
*** 27,33 ****
  void
  difficulty()
  {
!   depth = next_setting(DIFFICULTY, diff_values) + 1 ;
  }
  
  
--- 31,37 ----
  void
  difficulty()
  {
!   level = next_setting(DIFFICULTY, diff_values) + 1 ;
  }
  
  
***************
*** 46,53 ****
    else
      {
        draw_piece(next_player, piece_x, piece_y, RINV) ;
!       cx = (piece_x + PIECE_RAD) / CELL_SIZE ;
!       cy = ((piece_y - CY) + PIECE_RAD) / CELL_SIZE ;
        move = cy * BOARD_SIZE + cx ;
        make_move() ;
      }
--- 50,57 ----
    else
      {
        draw_piece(next_player, piece_x, piece_y, RINV) ;
!       cx = (piece_x + PIECE_RAD - BBORDER) / CELL_SIZE ;
!       cy = (piece_y + PIECE_RAD - CY - BBORDER) / CELL_SIZE ;
        move = cy * BOARD_SIZE + cx ;
        make_move() ;
      }
***************
*** 66,72 ****
  init_notes()
  {
    show_notes = next_setting(NOTES, notes_values) ;
!   if (show_notes == FALSE) message(NOTES_MES, "") ;
  }
  
  
--- 70,76 ----
  init_notes()
  {
    show_notes = next_setting(NOTES, notes_values) ;
!   if (show_notes == FALSE) message(EVAL_MES, "") ;
  }
  
  
***************
*** 102,110 ****
        message(PANEL_MES, "Computer can't play both players.") ;
      }
    if (curi == HUMAN    && curo == COMPUTER)
!     dtype = (next_player == BLACK) ? XBLACK : XWHITE ;
    else if (curi == COMPUTER && curo == HUMAN)
!     dtype = (next_player == BLACK) ? XWHITE : XBLACK ;
    else if (curi == HUMAN    && curo == HUMAN)
      dtype = (dtype == XTWO) ? XTWO : XBOTH ; 
  
--- 106,114 ----
        message(PANEL_MES, "Computer can't play both players.") ;
      }
    if (curi == HUMAN    && curo == COMPUTER)
!     dtype = (item == BLACK_PLAYS) ? XBLACK : XWHITE ;
    else if (curi == COMPUTER && curo == HUMAN)
!     dtype = (item == BLACK_PLAYS) ? XWHITE : XBLACK ;
    else if (curi == HUMAN    && curo == HUMAN)
      dtype = (dtype == XTWO) ? XTWO : XBOTH ; 
  
***************
*** 116,139 ****
  
  
  void
- last()
- {
-   enum optype rop ;
-   int flips, player, x, y ;
- 
-   if (last_move == -1) return ;        /* No last move. */
-   player = board.square[last_move] ;
-   for (flips = 0; flips < 4; flips++)
-     {
-       get_xy(last_move, &x, &y) ;
-       rop = flips % 2 ? RSRC : RCLR ;
-       draw_piece(player, x, CY+y, rop) ;
-       PAUSE ;
-     }
- }
- 
- 
- void
  make_move()
  {
    if (legal(move, next_player, &board) == FALSE)
--- 120,125 ----
***************
*** 149,160 ****
        case XBLACK :
        case XWHITE : computer_move(OPPONENT(next_player)) ;
                      return ;
!       case XBOTH  : if (check(next_player) == TRUE) break ;
                      (void) check(OPPONENT(next_player)) ;
                      return ;
-       case XTWO   : FPRINTF(stderr, "Multi display not supported yet.\n") ;
      }
- 
    cmode = (enum cantype) (OPPONENT(next_player) + 1) ;
    next_player = OPPONENT(next_player) ;
  }
--- 135,145 ----
        case XBLACK :
        case XWHITE : computer_move(OPPONENT(next_player)) ;
                      return ;
!       case XBOTH  :
!       case XTWO   : if (check(next_player) == TRUE) break ;
                      (void) check(OPPONENT(next_player)) ;
                      return ;
      }
    cmode = (enum cantype) (OPPONENT(next_player) + 1) ;
    next_player = OPPONENT(next_player) ;
  }
***************
*** 168,174 ****
    last_move = -1 ;
    if (items[(int) BLACK_PLAYS].value == COMPUTER) first_move = 1 ;
    init_canvas() ;
!   message(NOTES_MES, "") ;
    message(PANEL_MES, "Use left mouse button to move") ;
    draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
  }
--- 153,159 ----
    last_move = -1 ;
    if (items[(int) BLACK_PLAYS].value == COMPUTER) first_move = 1 ;
    init_canvas() ;
!   message(EVAL_MES, "") ;
    message(PANEL_MES, "Use left mouse button to move") ;
    draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
  }
***************
*** 208,213 ****
--- 193,206 ----
  
  
  void
+ show_all_moves()
+ {
+   if (show_moves) show_all(IS_OFF) ;
+   else            show_all(IS_ON) ;
+ }
+ 
+ 
+ void
  suggest()
  {
    int player ;
***************
*** 216,222 ****
    if (cmode == GAME_OVER) return ;
    if (cmode == WHITE_START) player = WHITE ;
    else                      player = BLACK ;
!   play_reve(&board.square[0], player, depth, &suggestion, &note) ;
  
    suggest_x = BBORDER + ((suggestion & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
    suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
--- 209,216 ----
    if (cmode == GAME_OVER) return ;
    if (cmode == WHITE_START) player = WHITE ;
    else                      player = BLACK ;
!   suggestion = FALSE ;   /* Make sure the computer clock isn't decremented. */
!   play_reve(&board.square[0], player, level, &suggestion, &note) ;
  
    suggest_x = BBORDER + ((suggestion & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
    suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
***************
*** 259,269 ****
--- 253,266 ----
  
    if (n >= 3)
      {
+       show_last(last_move, IS_OFF) ;
        FOR_BOARD(i) board.square[i] = moves[n].square[i] ;
        board.moves_left = moves[n].moves_left ;
        board.player     = moves[n].player ;
        board.move       = moves[n].move ;
        board.note       = moves[n].note ;
+       board.timeleft   = moves[n].timeleft ;
+       last_move        = board.move ;
        moves[n+1].move  = -1 ;
  
        FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
***************
*** 271,277 ****
--- 268,277 ----
        old_board.player     = moves[n-1].player ;
        old_board.move       = moves[n-1].move ;
        old_board.note       = moves[n-1].note ;
+       old_board.timeleft   = moves[n-1].timeleft ;
  
+       timeleft = board.timeleft ;
+ 
        if (OPPONENT(player) == BLACK) cmode = BLACK_START ;
        else                           cmode = WHITE_START ;
        message(PANEL_MES, "") ;
***************
*** 284,289 ****
--- 284,290 ----
                         (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ;
            else draw_piece(board.square[i], x, CY+y, RSRC) ;
          }
+       if (n > 3) show_last(last_move, IS_ON) ;
        next_player = OPPONENT(board.player) ;
      }
    else message(PANEL_MES, "No moves to undo.") ;

richb@sunaus.oz (Rich Burridge) (11/09/90)

------CUT HERE------patch1 - part3------CUT HERE------

------- rev_eval.c -------
*** /tmp/da28908	Fri Nov  9 10:39:56 1990
--- rev_eval.c	Mon Nov  5 09:06:42 1990
***************
*** 3,13 ****
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 3,18 ----
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 23,36 ****
  extern long c1, c2, c3 ;
  extern long edges[6561] ;
  
! /*  Evaluation function : give a note to a board = damier[ niv ].
   *  It computes 4 components :
   *     - Edge Stability, using Edge Stability Table pre-computed before
   *     - Current Mobility, in fact computed during alpha-beta pruning
   *     - X squares Values
   *     - Potential Mobility, looking at squares contacts
!  *  And then Eval = c1 * ES + c2 * CM + c3 * XV + c4 * PM
!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positif
   *  if macouleur ( my color ) has a good position and negatif if tacouleur
   *  position is good.
   *  If we are "near" the end of the game, then Eval is equal to final disc
--- 28,41 ----
  extern long c1, c2, c3 ;
  extern long edges[6561] ;
  
! /*  Evaluation function : gives a note to a board = damier[ niv ].
   *  It computes 4 components :
   *     - Edge Stability, using Edge Stability Table pre-computed before
   *     - Current Mobility, in fact computed during alpha-beta pruning
   *     - X squares Values
   *     - Potential Mobility, looking at squares contacts
!  *  And then Eval = c1 * ES + c2 * ( CM + cx * XV ) + c3 * PM
!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positive
   *  if macouleur ( my color ) has a good position and negatif if tacouleur
   *  position is good.
   *  If we are "near" the end of the game, then Eval is equal to final disc
***************
*** 45,51 ****
    register int i, x, y ;
    register long note ;
    register int vp, vo ;
!   register long tnote ;
  
    d = damier[niv] ;
  
--- 50,56 ----
    register int i, x, y ;
    register long note ;
    register int vp, vo ;
!   register long tnote, cx ;
  
    d = damier[niv] ;
  
***************
*** 105,135 ****
          }
        note += edges[i] ;
  
        if (d[0] == FREE)
          {
!                if (d[9] == macouleur) note -= c3 ;
!           else if (d[9] == tacouleur) note += c3 ;
          }
  
        if (d[7] == FREE)
          {
!                if (d[14] == macouleur) note -= c3 ;
!           else if (d[14] == tacouleur) note += c3 ;
          }
  
        if (d[56] == FREE)
          {
!                if (d[49] == macouleur) note -= c3 ;
!           else if (d[49] == tacouleur) note += c3 ;
          }
  
        if (d[63] == FREE)
          {
!                if (d[54] == macouleur) note -= c3 ;
!           else if (d[54] == tacouleur) note += c3 ;
          }
  
!       tnote = c1 * note + c2 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
  
        vp = vo = 0 ;
        for (x = 0; x < 8; x++)
--- 110,142 ----
          }
        note += edges[i] ;
  
+       cx = 8 * (50 - mnb - profmax) ;
+ 
        if (d[0] == FREE)
          {
!                if (d[9] == macouleur) note -= cx ;
!           else if (d[9] == tacouleur) note += cx ;
          }
  
        if (d[7] == FREE)
          {
!                if (d[14] == macouleur) note -= cx ;
!           else if (d[14] == tacouleur) note += cx ;
          }
  
        if (d[56] == FREE)
          {
!                if (d[49] == macouleur) note -= cx ;
!           else if (d[49] == tacouleur) note += cx ;
          }
  
        if (d[63] == FREE)
          {
!                if (d[54] == macouleur) note -= cx ;
!           else if (d[54] == tacouleur) note += cx ;
          }
  
!       tnote = c1 * note + c2 * (long) 1000 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
  
        vp = vo = 0 ;
        for (x = 0; x < 8; x++)
***************
*** 219,225 ****
            }
  
        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
!       tnote += 99 * note ;
!       return(tnote) ;
      }
  }
--- 226,232 ----
            }
  
        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
!       tnote += c3 * note ;
!       return(tnote / 1000) ;
      }
  }

------- rev_ip.c -------
*** /tmp/da28911	Fri Nov  9 10:39:56 1990
--- rev_ip.c	Mon Nov  5 09:07:12 1990
***************
*** 3,11 ****
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
   *  (see README file), then an attempt will be made to fix them.
--- 3,19 ----
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
+  *  Permission is also granted to copy this source, without the
+  *  news headers, for the purposes of making an executable copy by
+  *  means of compilation, provided that such copy will not be used
+  *  for the purposes of competition in any othello tournaments, without
+  *  prior permission from the authors.
+  *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
   *  (see README file), then an attempt will be made to fix them.
***************
*** 12,22 ****
   */
  
  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/time.h>
  #include "reve.h"
  
! extern time_t time() ;
  extern int damier[NIVEAUMAX][64] ;
  extern int tacouleur, macouleur ;
  extern int mnb, profmax ;
--- 20,33 ----
   */
  
  #include <stdio.h>
+ #include <signal.h>
+ #include <setjmp.h>
  #include <sys/types.h>
  #include <sys/time.h>
  #include "reve.h"
  
! extern int saveres ;
! extern time_t timeleft, time() ;
  extern int damier[NIVEAUMAX][64] ;
  extern int tacouleur, macouleur ;
  extern int mnb, profmax ;
***************
*** 58,81 ****
  
  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
  
! static int cpi[60], cpj[60], cpk[60] ;
  
  static int locallevel = -1 ;
! static time_t timeleft ;
  
  static long jeplonge() ;
  static long tuplonges() ;
  long evalue() ;
  
  play_reve(board, color, level, rtnmv, rtnnote)
  int *board, color, level, *rtnmv ;
  long *rtnnote ;
  {
    register int *d0, *d1 ;
!   register int k, cp, cpmax ;
!   register long lnote, note ;
!   register int count, fact ;
!   time_t firsttime, timeused, allotime ;
  
    for (k = 0; k < 60; k++)
      {
--- 69,105 ----
  
  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
  
! static int cpi[60], cpj[60], cpk[60], cpf[60] ;
! static int cpi2[60], cpj2[60], cpk2[60] ;
! static int cpmaxi[4] ;
  
  static int locallevel = -1 ;
! static firsttime, timeused, allotime ;
  
+ jmp_buf jumper ;
+ 
  static long jeplonge() ;
  static long tuplonges() ;
  long evalue() ;
  
+ 
+ static void
+ catcher()
+ {
+   longjmp(jumper, 1) ;
+ }
+ 
+ 
  play_reve(board, color, level, rtnmv, rtnnote)
  int *board, color, level, *rtnmv ;
  long *rtnnote ;
  {
    register int *d0, *d1 ;
!   register int k, cp ;
!   register long lnote ;
!   register int count ;
!   static int cpmax, note, oldnote ;
!   FILE *fp ;
  
    for (k = 0; k < 60; k++)
      {
***************
*** 119,125 ****
            mnb++ ;
            cp = 0 ;
            while (cpk[cp] != k) cp++ ;
!           for ( ; cp < 60; cp++)
              {
                cpi[cp] = cpi[cp + 1] ;
                cpj[cp] = cpj[cp + 1] ;
--- 143,149 ----
            mnb++ ;
            cp = 0 ;
            while (cpk[cp] != k) cp++ ;
!           for ( ; cp < 59; cp++)
              {
                cpi[cp] = cpi[cp + 1] ;
                cpj[cp] = cpj[cp + 1] ;
***************
*** 129,135 ****
  
    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
      {
!       timeleft = timevals[level] * 60 ;
        locallevel = level ;
      }
  
--- 153,159 ----
  
    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
      {
!       timeleft = timevals[level-1] * 60 ;
        locallevel = level ;
      }
  
***************
*** 137,171 ****
    for (cp = 0; cp <= 60 - mnb; cp++)
      if (d0[cpk[cp]] == JPJ) k++ ;
  
!   if ((k == 1) || (mnb == 1))
      {
-       note = 0 ;
-       timeused = profmax = 1 ;
        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
        cpi[0] = cpi[cp] ;
        cpj[0] = cpj[cp] ;
        cpk[0] = cpk[cp] ;
      }
    else
!     { 
!       count = 0 ;
!       profmax = 1 ;
!       allotime = timeleft * 2 / (60 - mnb) ;
        firsttime = time((time_t *) NULL) ;
        do
          {
            note = -1000000000 ;
  
            c1 = 312 + 6 * (mnb + profmax) ;
            if (mnb + profmax < 25)
!             c2 = 1000 * (long) (50 + 2 * (mnb + profmax)) ;
            else
!             c2 = 1000 * (long) (75 + mnb + profmax) ;
!           c3 = 4 * (50 - mnb - profmax) ;
  
            profmax++ ;
-           if (profmax > 55 - mnb) profmax = 61 - mnb ;
  
            for (cp = 0; cp <= 60 - mnb; cp++)
              {
                if (d0[cpk[cp]] == JPJ)
--- 161,256 ----
    for (cp = 0; cp <= 60 - mnb; cp++)
      if (d0[cpk[cp]] == JPJ) k++ ;
  
!   count = note = cpmax = 0 ;
!   timeused = profmax = 1 ;
! 
!   if (((k == 1) && (mnb < 52)) || (mnb == 1))
      {
        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
        cpi[0] = cpi[cp] ;
        cpj[0] = cpj[cp] ;
        cpk[0] = cpk[cp] ;
      }
+   else if (mnb == 2)
+     {
+       if (d0[2 * 8 + 3] == BLACK)
+         {
+           cpi[0] = 4 ;
+           cpj[0] = 2 ;
+         }
+       else if (d0[3 * 8 + 2] == BLACK)
+         {
+           cpi[0] = 2 ;
+           cpj[0] = 4 ;
+         }
+       else if (d0[4 * 8 + 5] == BLACK)
+         {
+           cpi[0] = 5 ;
+           cpj[0] = 3 ;
+         }
+       else if (d0[5 * 8 + 4] == BLACK)
+         {
+           cpi[0] = 3 ;
+           cpj[0] = 5 ;
+         }
+       cpk[0] = cpi[0] * 8 + cpj[0] ;
+     }
+   else if (mnb == 3)
+     {
+       if (d0[4 * 8 + 2] == WHITE)
+         {
+           cpi[0] = 5 ;
+           cpj[0] = 3 ;
+         }
+       else if (d0[2 * 8 + 2] == WHITE)
+         {
+           cpi[0] = 3 ;
+           cpj[0] = 2 ;
+         }
+       else if (d0[2 * 8 + 4] == WHITE)
+         {
+           cpi[0] = 3 ;
+           cpj[0] = 5 ;
+         }
+       cpk[0] = cpi[0] * 8 + cpj[0] ;
+     }
    else
!     {
!       allotime = timeleft * 3 / (61 - mnb) ;
        firsttime = time((time_t *) NULL) ;
+ 
+       signal(SIGALRM, catcher) ;
+ 
+       if (setjmp(jumper) != 0)
+         {
+           if (cpmax == 0) note = oldnote ;
+           profmax = -profmax ;
+           goto trap ;
+         }
+ 
        do
          {
+           oldnote = note ;
            note = -1000000000 ;
  
+           if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
+ 
            c1 = 312 + 6 * (mnb + profmax) ;
            if (mnb + profmax < 25)
!             c2 = 50 + 2 * (mnb + profmax) ;
            else
!             c2 = 75 + mnb + profmax ;
!           c3 = 99 ;
  
            profmax++ ;
  
+           if (profmax > 53 - mnb)
+             {
+               profmax = 61 - mnb ;
+               allotime = timeleft * 3 / 5 ;
+               if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
+             }
+ 
            for (cp = 0; cp <= 60 - mnb; cp++)
              {
                if (d0[cpk[cp]] == JPJ)
***************
*** 185,215 ****
                      }
                  }
              }
!           if (cpmax == 0) count++ ;
            else
              {
!               count = 1 ;
!               k = cpi[0] ;
!               cpi[0] = cpi[cpmax] ;
!               cpi[cpmax] = k ;
!               k = cpj[0] ;
!               cpj[0] = cpj[cpmax] ;
!               cpj[cpmax] = k ;
!               k = cpk[0] ;
!               cpk[0] = cpk[cpmax] ;
!               cpk[cpmax] = k ;
              }
            timeused = time((time_t *) NULL) - firsttime ;
!           if (count < 3) fact = 1 ;
!           else           fact = 3 ;
          }
!       while ((timeused * fact < allotime) && (profmax <= 60 - mnb)) ;
        if (timeused == 0) timeused = 1 ;
      }
  
!   timeleft -= timeused ;
  
!   *rtnmv = cpk[0] ;
    *rtnnote = note ;
  }
  
--- 270,349 ----
                      }
                  }
              }
! 
!           alarm(0) ;
!           cpmaxi[0] = cpmax ;
! 
!           if ((mnb < 57) && (cpmaxi[0] != cpmaxi[1])
!               && (cpmaxi[1] != cpmaxi[2]) && (cpmaxi[0] != cpmaxi[2]))
!             {
!               if (cpmax == 0) count++ ; else count = 1 ;
!               for (cp = 0; cp <= 60 - mnb; cp++) cpf[cp] = TRUE ;
!               for (k = 0; k < 3; k++)
!                 {
!                   cpi2[k] = cpi[cpmaxi[k]] ;
!                   cpj2[k] = cpj[cpmaxi[k]] ;
!                   cpk2[k] = cpk[cpmaxi[k]] ;
!                   cpf[cpmaxi[k]] = FALSE ;
!                 }
!               k = 3 ;
!               for (cp = 0; cp <= 60 - mnb; cp++)
!                 if (cpf[cp] == TRUE)
!                   {
!                     cpi2[k] = cpi[cp] ;
!                     cpj2[k] = cpj[cp] ;
!                     cpk2[k] = cpk[cp] ;
!                     k++ ;
!                   }
!               for (cp = 0; cp <= 60 - mnb; cp++)
!                 {
!                   cpi[cp] = cpi2[cp] ;
!                   cpj[cp] = cpj2[cp] ;
!                   cpk[cp] = cpk2[cp] ;
!                 }
!             }
            else
              {
!               cpi2[0] = cpi[cpmax] ;
!               cpj2[0] = cpj[cpmax] ;
!               cpk2[0] = cpk[cpmax] ;
!               cpi[cpmax] = cpi[0] ;
!               cpj[cpmax] = cpj[0] ;
!               cpk[cpmax] = cpk[0] ;
!               cpi[0] = cpi2[0] ;
!               cpj[0] = cpj2[0] ;
!               cpk[0] = cpk2[0] ;
              }
+           cpmax = 0 ;
            timeused = time((time_t *) NULL) - firsttime ;
!           if ((mnb == 4) && (profmax == 3)) break ;
          }
!       while ((timeused * count < allotime * 5 / 4) && (profmax != 61 - mnb)) ;
! trap:
!       timeused = time((time_t *) NULL) - firsttime ;
        if (timeused == 0) timeused = 1 ;
      }
  
!   if (*rtnmv == TRUE) timeleft -= timeused ;
!   if ((int) timeleft < 0) timeleft = 0 ;
  
!   if (saveres)
!     {
!       if ((mnb == 1) || (mnb == 2))
!         {
!           fp = fopen("reve.res", "w") ;
!           FPRINTF(fp, "\n") ;
!           FCLOSE(fp) ;
!         }
!       fp = fopen("reve.res", "a") ;
!       FPRINTF(fp, "%2d, <%c-%c>, ", mnb, 'A' + cpj[cpmax], '1' + cpi[cpmax]) ;
!       FPRINTF(fp, "nt : %5d, pmax : %3d, tmleft : %d, level : %d, ",
!                    note,     profmax,    timeleft, level) ;
!       FPRINTF(fp, "exp : <%c-%c>\n", 'A' + cpj[1], '1' + cpi[1]) ;
!       FCLOSE(fp) ;
!     }
! 
!   *rtnmv = cpk[cpmax] ;
    *rtnnote = note ;
  }
  
***************
*** 220,226 ****
  long alpha, beta ;
  {
    register int *d0, *d1 ;
!   register int k, cp ;
    register long lnote, note ;
  
    d0 = damier[niv] ;
--- 354,360 ----
  long alpha, beta ;
  {
    register int *d0, *d1 ;
!   register int k, cp, cpmax ;
    register long lnote, note ;
  
    d0 = damier[niv] ;
***************
*** 241,250 ****
              lnote = tuplonges(niv + 1, alpha, note) ;
            else
              lnote = evalue(niv + 1) ;
!           if (lnote < note) note = lnote ;
            if (note <= alpha) return note ;
          }
      }
    return note ;
  }
  
--- 375,397 ----
              lnote = tuplonges(niv + 1, alpha, note) ;
            else
              lnote = evalue(niv + 1) ;
!           if (lnote < note)
!             {
!               note = lnote ;
!               cpmax = cp ;
!             }
            if (note <= alpha) return note ;
          }
      }
+ 
+   if (niv == 1)
+     {
+       cpmaxi[1] = cpmax ;
+       cpmaxi[2] = cpmaxi[3] ;
+     }
+   else if (niv == 2)
+     cpmaxi[3] = cpmax ;
+ 
    return note ;
  }
  
***************
*** 255,261 ****
  long alpha, beta ;
  {
    register int *d0, *d1 ;
!   register int k, cp ;
    register long lnote, note ;
  
    d0 = damier[niv] ;
--- 402,408 ----
  long alpha, beta ;
  {
    register int *d0, *d1 ;
!   register int k, cp, cpmax ;
    register long lnote, note ;
  
    d0 = damier[niv] ;
***************
*** 276,284 ****
              lnote = jeplonge(niv + 1, note, beta) ;
            else
              lnote = evalue(niv + 1) ;
!           if (lnote > note) note = lnote ;
            if (note >= beta) return note ;
          }
      }
    return note ;
  }
--- 423,444 ----
              lnote = jeplonge(niv + 1, note, beta) ;
            else
              lnote = evalue(niv + 1) ;
!           if (lnote > note)
!             {
!               note = lnote ;
!               cpmax = cp ;
!             }
            if (note >= beta) return note ;
          }
      }
+ 
+   if (niv == 1)
+     {
+       cpmaxi[1] = cpmax ;
+       cpmaxi[2] = cpmaxi[3] ;
+     }
+   else if (niv == 2)
+     cpmaxi[3] = cpmax ;
+ 
    return note ;
  }

------- rev_iycp.c -------
*** /tmp/da28914	Fri Nov  9 10:39:57 1990
--- rev_iycp.c	Mon Nov  5 09:10:39 1990
***************
*** 3,13 ****
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 3,18 ----
   *
   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported

------- reve.h -------
*** /tmp/da28917	Fri Nov  9 10:39:58 1990
--- reve.h	Mon Nov  5 09:07:58 1990
***************
*** 6,16 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 6,21 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors on inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 17,26 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
  #define  FCLOSE        (void) fclose      /* To make lint happy. */
  #define  FFLUSH        (void) fflush
  #define  FGETS         (void) fgets
- #define  FREAD         (void) fread
  #define  FSEEK         (void) fseek
  #define  FPRINTF       (void) fprintf
  #define  GETTIMEOFDAY  (void) gettimeofday
--- 22,33 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
+ #include <stdio.h>
+ #include <sys/types.h>
+ 
  #define  FCLOSE        (void) fclose      /* To make lint happy. */
  #define  FFLUSH        (void) fflush
  #define  FGETS         (void) fgets
  #define  FSEEK         (void) fseek
  #define  FPRINTF       (void) fprintf
  #define  GETTIMEOFDAY  (void) gettimeofday
***************
*** 42,57 ****
  #define  BGAP          10       /* Width of the gap between buttons. */
  #define  BHEIGHT       32       /* Height of a reve button item. */
  #define  BWIDTH        64       /* Width of a reve button item. */
- #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
  #define  CHEIGHT       20       /* Height of a reve cycle item. */
  #define  CWIDTH        32       /* Width of a reve cycle item. */
- #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
  #define  NOBUTS        6        /* Number of reve buttons. */
- #define  NOROWS        6        /* Number of rows of reve items. */
  #define  PIECE_MARGIN  8
  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
  
  /* States that the the Reve squares can be in. */
  #define  BLACK         (-1)    /* Piece definitions. */
--- 49,73 ----
  #define  BGAP          10       /* Width of the gap between buttons. */
  #define  BHEIGHT       32       /* Height of a reve button item. */
  #define  BWIDTH        64       /* Width of a reve button item. */
  #define  CHEIGHT       20       /* Height of a reve cycle item. */
  #define  CWIDTH        32       /* Width of a reve cycle item. */
  #define  NOBUTS        6        /* Number of reve buttons. */
  #define  PIECE_MARGIN  8
  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
+ 
+ #ifdef XVIEW
+ #define  CELL_SIZE     54
+ #define  CY            0
+ #define  NOROWS        0
+ #define  TOTAL_HEIGHT  (8 * CELL_SIZE) + (2 * BBORDER)
+ #define  TOTAL_WIDTH   (8 * CELL_SIZE) + (2 * BBORDER)
+ #else
+ #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
+ #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
+ #define  NOROWS        6        /* Number of rows of reve items. */
  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
+ #endif /*XVIEW*/
  
  /* States that the the Reve squares can be in. */
  #define  BLACK         (-1)    /* Piece definitions. */
***************
*** 91,104 ****
  
  #ifndef  MAXLINE
  #define  MAXLINE       80      /* Length of character strings. */
! #endif /*MAXLINE*/
  
  #define  MAXMENUS      4       /* Maximum number of popup menus. */
  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  
  #ifdef  NOINDEX
  #define  index         strchr
  #endif /*NOINDEX*/
  
  #define  NOMOVE        -1
  #define  OPPONENT(p)   p * -1
--- 107,122 ----
  
  #ifndef  MAXLINE
  #define  MAXLINE       80      /* Length of character strings. */
! #endif /*!MAXLINE*/
  
  #define  MAXMENUS      4       /* Maximum number of popup menus. */
  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  
+ #ifndef X11
  #ifdef  NOINDEX
  #define  index         strchr
  #endif /*NOINDEX*/
+ #endif /*!X11*/
  
  #define  NOMOVE        -1
  #define  OPPONENT(p)   p * -1
***************
*** 116,128 ****
  
  #ifndef  EDGENAME
  #define  EDGENAME      "reve.edgetable"
! #endif /*EDGENAME*/
  
! #ifndef  NO_4_3SIGNAL
  #define  SIGRET        void
  #else
  #define  SIGRET        int
! #endif /*NO_4_3SIGNAL*/
  
  #define  VINVUL        50
  
--- 134,146 ----
  
  #ifndef  EDGENAME
  #define  EDGENAME      "reve.edgetable"
! #endif /*!EDGENAME*/
  
! #ifndef  INT_SIGNAL
  #define  SIGRET        void
  #else
  #define  SIGRET        int
! #endif /*!INT_SIGNAL*/
  
  #define  VINVUL        50
  
***************
*** 140,146 ****
  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  #define  IGNORE_EVENT     111    /* No interest in this event. */
  
! /* Batch or locking direction (ON or OFF). */
  enum bltype   { IS_OFF, IS_ON } ;
  
  /* Reve move status. */
--- 158,164 ----
  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  #define  IGNORE_EVENT     111    /* No interest in this event. */
  
! /* Batch, last move, locking or show all direction (ON or OFF). */
  enum bltype   { IS_OFF, IS_ON } ;
  
  /* Reve move status. */
***************
*** 167,176 ****
  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
  
  /* Different panel items. */
! enum panel_type { LAST_BUT,    LOAD_BUT, NEW_GAME_BUT, SAVE_BUT,
                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
!                   PANEL_MES, NOTES_MES, SCORE_MES, TURN_MES } ;
  
  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  
--- 185,194 ----
  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
  
  /* Different panel items. */
! enum panel_type { LOAD_BUT, NEW_GAME_BUT, SAVE_BUT, SHOW_ALL_BUT,
                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
!                   PANEL_MES, EVAL_MES, SCORE_MES, TURN_MES } ;
  
  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  
***************
*** 187,192 ****
--- 205,211 ----
            int move ;
            int moves_left ;
            long note ;
+           time_t timeleft ;
  } BOARD ;
  
  struct iteminfo               /* Item information record. */
***************
*** 213,233 ****
  void done(),               draw_button(),        draw_cycle() ;
  void draw_cycle_item(),    draw_image(),         draw_line() ;
  void draw_piece(),         draw_rect(),          draw_stencil() ;
! void draw_text(),          draw_textfield(),     get_filename() ;
  void get_options(),        get_xy(),             getparam() ;
  void handle_board_event(), handle_event(),       handle_item() ;
  void handle_key(),         init_canvas(),        init_edge_table() ;
  void init_fonts(),         init_notes(),         init_player() ;
  void initboard(),          initialise() ;
! void last(),               load_colors(),        load_game() ;
! void lock_screen() ;
  void make_canvas(),        make_frame(),         make_icon() ;
  void make_message(),       make_move(),          make_panel() ;
! void message(),            nap_upto() ;
! void new_game(),           process_event(),      quit() ;
  void remove_textfield(),   save_game(),          set_cursor() ;
  void set_cycle(),          set_display_types() ;
  void set_timer(),          set_score(),          set_turn() ;
  void show_suggestion(),    start_tool() ;
  void suggest(),            think(),              undo() ;
  void update_board_image(), usage(),              who_wins() ;
--- 232,253 ----
  void done(),               draw_button(),        draw_cycle() ;
  void draw_cycle_item(),    draw_image(),         draw_line() ;
  void draw_piece(),         draw_rect(),          draw_stencil() ;
! void draw_text(),          draw_textfield() ;
! void generate_graphics(),  get_filename() ;
  void get_options(),        get_xy(),             getparam() ;
  void handle_board_event(), handle_event(),       handle_item() ;
  void handle_key(),         init_canvas(),        init_edge_table() ;
  void init_fonts(),         init_notes(),         init_player() ;
  void initboard(),          initialise() ;
! void load_colors(),        load_game(),          lock_screen() ;
  void make_canvas(),        make_frame(),         make_icon() ;
  void make_message(),       make_move(),          make_panel() ;
! void message(),            nap_upto(),           new_game() ;
! void position_popup(),     process_event(),      quit() ;
  void remove_textfield(),   save_game(),          set_cursor() ;
  void set_cycle(),          set_display_types() ;
  void set_timer(),          set_score(),          set_turn() ;
+ void show_all(),           show_all_moves(),     show_last() ;
  void show_suggestion(),    start_tool() ;
  void suggest(),            think(),              undo() ;
  void update_board_image(), usage(),              who_wins() ;

------- tty.c -------
*** /tmp/da28926	Fri Nov  9 10:40:00 1990
--- tty.c	Mon Nov  5 09:08:40 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,36 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #include <stdio.h>
! #include <strings.h>
  #include <sys/ioctl.h>
  #include <signal.h>
  
  #ifdef SYSV
  #include <sgtty.h>
  #endif /*SYSV*/
  
- #include "reve.h"
- #include "color.h"
- #include "extern.h"
- 
  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
  
  enum gr_type gtype = GTTY ;      /* Graphics type. */
--- 23,41 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #include "reve.h"
! #include "color.h"
! #include "extern.h"
  #include <sys/ioctl.h>
  #include <signal.h>
  
  #ifdef SYSV
+ #include <string.h>
  #include <sgtty.h>
+ #else
+ #include <strings.h>
  #endif /*SYSV*/
  
  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
  
  enum gr_type gtype = GTTY ;      /* Graphics type. */
***************
*** 60,69 ****
  } ;
  
  struct tty_info ttyvals[MAXITEMS] = {
!       {  1,  1,  33,  33, },      /* Last */
!       { 11,  1, 107,  33, },      /* Load */
!       { 22,  1, 167,  33, },      /* New game */
!       { 33,  1, 255,  33, },      /* Save */
        { 44,  1, 318,  33, },      /* Suggest */
        { 55,  1, 403,  33, },      /* Undo */
        { -1, -1,  33,  75, },      /* Done   (not displayed). */
--- 65,74 ----
  } ;
  
  struct tty_info ttyvals[MAXITEMS] = {
!       {  1,  1,  33,  33, },      /* Load */
!       { 11,  1, 107,  33, },      /* New game */
!       { 22,  1, 167,  33, },      /* Save */
!       { 33,  1, 255,  33, },      /* Show all */
        { 44,  1, 318,  33, },      /* Suggest */
        { 55,  1, 403,  33, },      /* Undo */
        { -1, -1,  33,  75, },      /* Done   (not displayed). */
***************
*** 85,94 ****
  } ;
  
  struct other_info othervals[MAXITEMS] = {
-       { -1, -1, },       /* Last     (ignored). */
        { -1, -1, },       /* Load     (ignored). */
        { -1, -1, },       /* New game (ignored). */
        { -1, -1, },       /* Save     (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
        { -1, -1, },       /* Done     (ignored). */
--- 90,99 ----
  } ;
  
  struct other_info othervals[MAXITEMS] = {
        { -1, -1, },       /* Load     (ignored). */
        { -1, -1, },       /* New game (ignored). */
        { -1, -1, },       /* Save     (ignored). */
+       { -1, -1, },       /* Show all (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
        { -1, -1, },       /* Done     (ignored). */
***************
*** 346,353 ****
      }
    else if (x == 237 && y == 195)       /* Note message. */
      {
!       draw_string(othervals[(int) NOTES_MES].column,
!                   othervals[(int) NOTES_MES].row, str, TRUE) ;
        return ;
      }
    else if (x == 15 && y == 237)        /* Score message. */
--- 351,358 ----
      }
    else if (x == 237 && y == 195)       /* Note message. */
      {
!       draw_string(othervals[(int) EVAL_MES].column,
!                   othervals[(int) EVAL_MES].row, str, TRUE) ;
        return ;
      }
    else if (x == 15 && y == 237)        /* Score message. */
***************
*** 371,378 ****
      if (EQUAL(str, items[i].text))
        if (ttyvals[i].column != -1)
          {
!                if (EQUAL(str, "load")) STRCPY(str, "Load") ;
!           else if (EQUAL(str, "save")) STRCPY(str, "Save") ;
            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
            return ;
          }
--- 376,384 ----
      if (EQUAL(str, items[i].text))
        if (ttyvals[i].column != -1)
          {
!                if (EQUAL(str, "load"))     STRCPY(str, "Load") ;
!           else if (EQUAL(str, "save"))     STRCPY(str, "Save") ;
!           else if (EQUAL(str, "show all")) STRCPY(str, "show All") ;
            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
            return ;
          }

------- x11.c -------
*** /tmp/da28929	Fri Nov  9 10:40:00 1990
--- x11.c	Thu Nov  8 10:28:39 1990
***************
*** 7,17 ****
   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,30 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
- #include <strings.h>
- #include <sys/time.h>
  #include "reve.h"
  #include "color.h"
  #include "extern.h"
  #include "images.h"
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xatom.h>
--- 23,40 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
  #include "reve.h"
  #include "color.h"
  #include "extern.h"
  #include "images.h"
+ #include <sys/time.h>
+ 
+ #ifdef SYSV
+ #include <string.h>
+ #else
+ #include <strings.h>
+ #endif /*SYSV*/
+ 
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xatom.h>
***************
*** 53,59 ****
  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
! Pixmap load_color_icon(), load_image(), reve_icon ;
  Window frame[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
--- 63,69 ----
  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
! Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
  Window frame[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
***************
*** 62,68 ****
  XSizeHints size ;
  XWMHints wm_hints ;
  XGCValues gc_val ;              /* Used to setup graphics context values. */
- int cmap_loaded ;               /* Set if we've already loaded the colormap. */
  int gc_flags ;                  /* Used to set up graphics context flags. */
  int screen[MAXDPY] ;            /* Default graphics display screen. */
  int xfd[MAXDPY] ;               /* Server connection file descriptors. */
--- 72,77 ----
***************
*** 79,85 ****
  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
  fd_set readmask ;            /* Readmask used in select call. */
  #endif /*NO_43SELECT*/
! #endif /*NOSELECT*/
  
  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
   *  used to convert between MSBFirst and LSBFirst image formats.
--- 88,94 ----
  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
  fd_set readmask ;            /* Readmask used in select call. */
  #endif /*NO_43SELECT*/
! #endif /*!NOSELECT*/
  
  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
   *  used to convert between MSBFirst and LSBFirst image formats.
***************
*** 221,227 ****
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
!   else            gc_val.foreground = foregnd[d] ;
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
--- 230,240 ----
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
!   else
!     {
!       if (color == C_WHITE) gc_val.foreground = backgnd[d] ;
!       else                  gc_val.foreground = foregnd[d] ;
!     }
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
***************
*** 356,362 ****
  #else
    FD_ZERO(&fullmask) ;
  #endif /*NO_43SELECT*/
! #endif /*NOSELECT*/
  
    if (dtype == XTWO)
      {
--- 369,375 ----
  #else
    FD_ZERO(&fullmask) ;
  #endif /*NO_43SELECT*/
! #endif /*!NOSELECT*/
  
    if (dtype == XTWO)
      {
***************
*** 364,370 ****
        init_X(DPY2, XWHITE) ;
      }
    else init_X(DPY1, dtype) ;
-   cmap_loaded = 0 ;
    move_delta = 10 ;
  
    images[(int) BUT_STENCIL] = load_image(button_stencil_image) ;
--- 377,382 ----
***************
*** 394,400 ****
    u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
    int d, i, numcolors ;
  
-   if (cmap_loaded) return ;
    d = (int) cur_dpyno ;
    iscolor[d] = 0 ;
    if (DisplayCells(dpy[d], screen[d]) > 2)
--- 406,411 ----
***************
*** 417,423 ****
            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
            exit(1) ;
          }
-       cmap_loaded = 1 ;
      }
  }
  
--- 428,433 ----
***************
*** 491,499 ****
    opvals[(int) RSRC] = GXcopy ;
    opvals[(int) RINV] = GXxor ;
  
!   load_colors() ;
!   if (iscolor[d]) reve_icon = load_color_icon(cicon_image) ;
!   else            reve_icon = load_image(icon_image) ;
  
    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
    size.x = 0 ;
--- 501,509 ----
    opvals[(int) RSRC] = GXcopy ;
    opvals[(int) RINV] = GXxor ;
  
!   if (!monochrome) load_colors() ;
!   if (iscolor[d]) reve_icon[d] = load_color_icon(cicon_image) ;
!   else            reve_icon[d] = load_image(icon_image) ;
  
    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
    size.x = 0 ;
***************
*** 527,539 ****
    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
           
!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon,
                           argv, argc, &size) ;
  
    wm_hints.icon_x = ix ;
    wm_hints.icon_y = iy ;
    wm_hints.input = True ;
!   wm_hints.icon_pixmap = reve_icon ;
    wm_hints.flags = InputHint | IconPixmapHint ;
    if (iconic)
      {    
--- 537,549 ----
    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
           
!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon[d],
                           argv, argc, &size) ;
  
    wm_hints.icon_x = ix ;
    wm_hints.icon_y = iy ;
    wm_hints.input = True ;
!   wm_hints.icon_pixmap = reve_icon[d] ;
    wm_hints.flags = InputHint | IconPixmapHint ;
    if (iconic)
      {    
***************
*** 587,593 ****
  #else
    FD_SET(xfd[d], &fullmask) ;
  #endif /*NO_43SELECT*/
! #endif /*NOSELECT*/
  
    return(dpy) ;
  }
--- 597,603 ----
  #else
    FD_SET(xfd[d], &fullmask) ;
  #endif /*NO_43SELECT*/
! #endif /*!NOSELECT*/
  
    return(dpy) ;
  }
***************
*** 704,710 ****
    for (;;)
      {
        get_event() ;          /* Get next canvas event. */
-       process_event() ;      /* Find out what kind it is. */
        handle_event() ;       /* And do the apropriate action. */
      }
  }
--- 714,719 ----
***************
*** 713,728 ****
  Xselect_input()
  {
    int fd = -1 ;              /* File descriptor with this event. */
!   struct timeval tval ;      /* To set checking period. */
  
-   tval.tv_usec = 0 ;
-   tval.tv_sec = 0 ;
- 
    for (;;)
      {
!       XSync(dpy[0], 0) ;
!       if (dtype == XTWO) XSync(dpy[1], 0) ;
! 
  #ifdef NOSELECT
        fd = 0 ;
  #else
--- 722,734 ----
  Xselect_input()
  {
    int fd = -1 ;              /* File descriptor with this event. */
! /**  static struct timeval tval = { 0, 0 } ; **/
!   struct timeval *tval = NULL ;
  
    for (;;)
      {
!       XFlush(dpy[(int) DPY1]) ;
!       XFlush(dpy[(int) DPY2]) ;
  #ifdef NOSELECT
        fd = 0 ;
  #else
***************
*** 730,737 ****
        readmask = fullmask ;
  #ifdef NO_43SELECT
        SELECT(32, &readmask, 0, 0, &tval) ;
!            if (readmask && (1 << xfd)[0]) fd = 0 ;
!       else if (readmask && (1 << xfd)[1]) fd = 1 ;
  #else
        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
--- 736,743 ----
        readmask = fullmask ;
  #ifdef NO_43SELECT
        SELECT(32, &readmask, 0, 0, &tval) ;
!            if (readmask && (1 << xfd[0])) fd = 0 ;
!       else if (readmask && (1 << xfd[1])) fd = 1 ;
  #else
        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
***************
*** 741,754 ****
   
        if (fd >= 0)
          {
!           cur_dpyno = (enum dpy_type) fd ;
!           do
              {
!               get_event() ;            /* Get next canvas event. */
!               process_event() ;        /* Find out what kind it is. */
!               handle_event() ;         /* And do appropriate action. */
              }             
!           while (XPending(dpy[fd])) ;
          }
      }
  }
--- 747,767 ----
   
        if (fd >= 0)
          {
!           fd = 0 ;
!           cur_dpyno = DPY1 ;
!           while (XPending(dpy[fd]))
              {
!               get_event() ;                  /* Get next canvas event. */
!               handle_event() ;               /* And do appropriate action. */
              }             
! 
!           fd = 1 ;
!           cur_dpyno = DPY2 ;
!           while (XPending(dpy[fd]))
!             {
!               get_event() ;                  /* Get next canvas event. */
!               handle_event() ;               /* And do appropriate action. */
!             }             
          }
      }
  }

------- FILES -------
*** /tmp/da28932	Fri Nov  9 10:40:01 1990
--- FILES	Sat Nov  3 21:03:34 1990
***************
*** 33,38 ****
--- 33,39 ----
  reve.edge1                  - first half of the Reve edge stability table.
  reve.edge2                  - second half of the Reve edge stability table.
  Makefile.dist               - master Makefile used to build mp on Unix systems.
+ Imakefile                   - Imakefile for the X11 version of reve.
  
  sunview.c                   - Sun SunView graphics routines.
  tty.c                       - dumb tty "graphics" routines.

------- MANIFEST -------
*** /tmp/da28935	Fri Nov  9 10:40:02 1990
--- MANIFEST	Sat Nov  3 21:04:35 1990
***************
*** 32,37 ****
--- 32,38 ----
  x11.c                                  |    4
  xview.c                                |    4
  sunview.c                              |    5
+ Imakefile                              |    5
  images/black.icon                      |    5
  images/reve.icon                       |    5
  images/reve.color.icon                 |    5

------- reve.edge2 -------
*** /tmp/da28938	Fri Nov  9 10:40:03 1990
--- reve.edge2	Fri Oct 26 12:05:37 1990
***************
*** 549,555 ****
  edges[2188] =     -80 [ -oooooo- ]
  edges[2189] =    1304 [ xoooooo- ]
  edges[2190] =   -1166 [ o-ooooo- ]
! edges[2191] =      34 [ --ooooo- ]
  edges[2192] =    1234 [ x-ooooo- ]
  edges[2193] =    1434 [ oxooooo- ]
  edges[2194] =     -36 [ -xooooo- ]
--- 549,555 ----
  edges[2188] =     -80 [ -oooooo- ]
  edges[2189] =    1304 [ xoooooo- ]
  edges[2190] =   -1166 [ o-ooooo- ]
! edges[2191] =     100 [ --ooooo- ]
  edges[2192] =    1234 [ x-ooooo- ]
  edges[2193] =    1434 [ oxooooo- ]
  edges[2194] =     -36 [ -xooooo- ]
***************
*** 1275,1281 ****
  edges[2914] =      36 [ -xxxxxo- ]
  edges[2915] =    6511 [ xxxxxxo- ]
  edges[2916] =   -6441 [ oooooo-- ]
! edges[2917] =      34 [ -ooooo-- ]
  edges[2918] =    1234 [ xooooo-- ]
  edges[2919] =   -1236 [ o-oooo-- ]
  edges[2920] =     -36 [ --oooo-- ]
--- 1275,1281 ----
  edges[2914] =      36 [ -xxxxxo- ]
  edges[2915] =    6511 [ xxxxxxo- ]
  edges[2916] =   -6441 [ oooooo-- ]
! edges[2917] =     100 [ -ooooo-- ]
  edges[2918] =    1234 [ xooooo-- ]
  edges[2919] =   -1236 [ o-oooo-- ]
  edges[2920] =     -36 [ --oooo-- ]

richb@sunaus.oz (Rich Burridge) (11/09/90)

------CUT HERE------patch1 - part4------CUT HERE------ 

------- xview.c -------
*** /tmp/da28887	Fri Nov  9 10:38:30 1990
--- xview.c	Thu Nov  8 10:31:17 1990
***************
*** 7,17 ****
   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,24 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
  #include "reve.h"
  #include "color.h"
  #include "extern.h"
--- 23,28 ----
***************
*** 25,30 ****
--- 29,35 ----
  #include "images.h"
  #include <xview/xview.h>
  #include <xview/canvas.h>
+ #include <xview/panel.h>
  #include <xview/cms.h>
  #include <xview/cursor.h>
  #include <xview/svrimage.h>
***************
*** 33,57 ****
  
  enum gr_type gtype = GXVIEW ;      /* Graphics type. */
  
! #define  XV_SET       (void) xv_set
! #define  WINDOW_DONE  (void) window_done
  
! #define  BOLDFONT     "lucidasanstypewriter-bold-12"
! #define  DEFFONT      "fixed"
! #define  NORMALFONT   "lucidasanstypewriter-12"
  
! static void menu_proc() ;
  
! mpr_static(icon_pr,  64, 64, 1, icon_image) ;
! mpr_static(cicon_pr, 64, 64, 8, cicon_image) ;
  
  Canvas canvas ;
  Canvas_paint_window cpw ;
  Event *cur_event ;
! Frame frame ;
! Icon reve_icon ;
  Menu menus[MAXMENUS] ;
! Notify_value destroy() ;
  Server_image hglass_pr, nocur_pr ;
  Xv_Cursor cursor[MAXCURSORS] ;
  
--- 38,76 ----
  
  enum gr_type gtype = GXVIEW ;      /* Graphics type. */
  
! enum popup_pos {P_BELOW, P_RIGHT } ;   /* Positions relative to main frame. */
  
! #define  FRAME_BORDER_SIZE  7
! #define  FRAME_LABEL_SIZE   30
  
! #define  XV_CREATE          (void) xv_create
! #define  XV_SET             (void) xv_set
  
! #define  BOLDFONT           "lucidasanstypewriter-bold-12"
! #define  DEFFONT            "fixed"
! #define  NORMALFONT         "lucidasanstypewriter-12"
  
  Canvas canvas ;
  Canvas_paint_window cpw ;
  Event *cur_event ;
! Frame cframe ;                  /* Frame for Reve game board. */
! Frame frame ;                   /* Frame for control panel. */
! Frame ls_frame ;                /* Frame for load/save pop-up window. */
! Icon  creve_icon ;              /* Icon for game board. */
! Icon  reve_icon ;               /* Icon for control panel. */
! Panel panel ;                   /* Xview interface panel. */
! 
! Frame ls_frame ;                /* Frame for load/save pop-up window. */
! Panel ls_panel ;                /* Panel for load/save operations. */
! Panel_item ls_button ;          /* Button to start load/save operation. */
! Panel_item ls_text ;            /* Load/Save text filename item. */
! Panel_item mes_items[4] ;       /* Four generic message items. */
! Panel_setting start_load_save() ;
! Menu game_menu ;                /* Menu for 'New Game' button. */
  Menu menus[MAXMENUS] ;
! Notify_value quit_proc() ;
! Panel_item black_item ;
! Panel_item white_item ;
  Server_image hglass_pr, nocur_pr ;
  Xv_Cursor cursor[MAXCURSORS] ;
  
***************
*** 75,81 ****
--- 94,106 ----
  int opvals[3] ;         /* Pixrect rasterop values. */
  int started ;           /* Set just before window is displayed. */
  
+ void destroy_frame() ;
+ static void menu_proc(),  new_game_proc(), pop_props(),    set_depth() ;
+ static void set_player(), unimplemented(), xv_load_game(), xv_save_game() ;
  
+ extern int mnb ;        /* Number of current move */
+ 
+ 
  void
  batch(state)            /* Turn graphics batching on or off. */
  enum bltype state ;
***************
*** 155,161 ****
  void
  destroy_frame()        /* Destroy reve window. */
  {
!   WINDOW_DONE(frame) ;
  }
  
  
--- 180,188 ----
  void
  destroy_frame()        /* Destroy reve window. */
  {
!   xv_destroy_safe(frame) ;
!   xv_destroy_safe(cframe) ;
!   exit(0) ;
  }
  
  
***************
*** 170,176 ****
--- 197,223 ----
  }
  
  
+ /*ARGSUSED*/
  void
+ draw_button(item, color, image)      /* **DUMMY ROUTINE** */
+ enum panel_type item ;
+ int color ;
+ enum image_type image ;
+ {
+ }
+ 
+ 
+ /*ARGSUSED*/
+ void
+ draw_cycle(item, color, image)       /* **DUMMY ROUTINE** */
+ enum panel_type item ;
+ int color ;
+ enum image_type image ;
+ {
+ }
+ 
+ 
+ void
  draw_image(x, y, width, height, image)
  int x, y, width, height ;
  enum image_type image ;
***************
*** 193,199 ****
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
!   else            gc_val.foreground = foregnd ;
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
    XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ;
--- 240,250 ----
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
!   else
!     { 
!       if (color == C_WHITE) gc_val.foreground = backgnd ;
!       else                  gc_val.foreground = foregnd ;
!     }
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ;
    XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ;
***************
*** 248,253 ****
--- 299,336 ----
  }
  
  
+ void
+ draw_textfield()                      /* **DUMMY ROUTINE** */
+ {
+ }
+ 
+ 
+ static Notify_value
+ frame_event(frame, event, arg, type)
+ Frame frame ;
+ Event *event ;
+ Notify_arg arg ;
+ Notify_event_type type ;
+ {
+   int action ;
+ 
+   action = event_action(event) ;
+   if (action == ACTION_CLOSE) XV_SET(cframe, XV_SHOW, FALSE, 0) ;
+   if (action == WIN_RESIZE)
+     {
+       position_popup(frame, cframe, P_BELOW) ;
+       XV_SET(cframe, XV_SHOW, TRUE, 0) ;
+     }
+   return(notify_next_event_func(frame, event, arg, type)) ;
+ }
+ 
+ 
+ void
+ get_filename()            /* **DUMMY ROUTINE** */
+ {
+ }
+ 
+ 
  XFontStruct *
  get_font(name)
  char *name ;
***************
*** 286,291 ****
--- 369,375 ----
  
  init_ws_type()
  {
+   show_notes = TRUE ;   /* Override generic value for XView version. */
    move_delta = 10 ;
    cur_dpyno = DPY1 ;
    started = 0 ;       /* Kludge to correctly handle repaints. */
***************
*** 331,339 ****
  void
  make_canvas()               /* Create canvas for game board. */
  {
!   canvas = xv_create(frame,               CANVAS,
                       CANVAS_RETAINED,     FALSE,
!                      OPENWIN_AUTO_CLEAR,  FALSE,
                       XV_HEIGHT,           TOTAL_HEIGHT,
                       XV_WIDTH,            TOTAL_WIDTH,
                       CANVAS_PAINTWINDOW_ATTRS,
--- 415,431 ----
  void
  make_canvas()               /* Create canvas for game board. */
  {
!   cframe = xv_create(XV_NULL,                  FRAME,
!                      XV_SHOW,                  FALSE,
!                      FRAME_ICON,               creve_icon,
!                      FRAME_NO_CONFIRM,         TRUE,
!                      WIN_ERROR_MSG,            "Reve: Can't create window.",
!                      FRAME_SHOW_RESIZE_CORNER, FALSE,
!                      FRAME_SHOW_HEADER,        FALSE,
!                      0) ;
!   canvas = xv_create(cframe,              CANVAS,
                       CANVAS_RETAINED,     FALSE,
!                      OPENWIN_AUTO_CLEAR,  FALSE, 
                       XV_HEIGHT,           TOTAL_HEIGHT,
                       XV_WIDTH,            TOTAL_WIDTH,
                       CANVAS_PAINTWINDOW_ATTRS,
***************
*** 348,358 ****
                         WIN_EVENT_PROC,    canvas_proc,
                         0,
                       0) ;
    cpw = canvas_paint_window(canvas) ;
!   cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR) ;
  
!   dpy = (Display *) xv_get(frame, XV_DISPLAY) ;
!   xid = (Drawable) xv_get(cpw, XV_XID) ;
  
    screen = DefaultScreen(dpy) ;
    root = RootWindow(dpy, screen) ;
--- 440,453 ----
                         WIN_EVENT_PROC,    canvas_proc,
                         0,
                       0) ;
+   window_fit(cframe) ;
+   notify_interpose_destroy_func(cframe, quit_proc) ;
+ 
    cpw = canvas_paint_window(canvas) ;
!   cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR, NULL) ;
  
!   dpy = (Display *) xv_get(frame, XV_DISPLAY, NULL) ;
!   xid = (Drawable) xv_get(cpw, XV_XID, NULL) ;
  
    screen = DefaultScreen(dpy) ;
    root = RootWindow(dpy, screen) ;
***************
*** 387,415 ****
    cursor[(int) NOCURSOR] = xv_create(XV_NULL,      CURSOR,
                                       CURSOR_IMAGE, nocur_pr,
                                       0) ;
!   load_colors() ;
  
-   images[(int) BUT_STENCIL] = make_server_image(button_stencil_image) ;
-   images[(int) BUT_INVERT]  = make_server_image(button_invert_image) ;
-   images[(int) BUT_NORMAL]  = make_server_image(button_normal_image) ;
-   images[(int) CY_NORMAL]   = make_server_image(cycle_glyph_image) ;
-   images[(int) CY_STENCIL]  = make_server_image(cycle_stencil_image) ;
-   images[(int) CY_LINVERT]  = make_server_image(cycle_linvert_image) ;
-   images[(int) CY_RINVERT]  = make_server_image(cycle_rinvert_image) ;
    images[(int) P_WHITE]     = make_server_image(white_image) ;
    images[(int) P_BLACK]     = make_server_image(black_image) ;
  }
  
  
! void
! make_frame(argc, argv)      /* Create reve window. */
  int argc ;
  char *argv[] ;
  {
    opvals[(int) RCLR] = GXclear ;
    opvals[(int) RSRC] = GXcopy ;
    opvals[(int) RINV] = GXxor ;
  
    xv_init(XV_INIT_ARGS, argc, argv, 0) ;
    frame = xv_create(XV_NULL,                  FRAME,
                      FRAME_ICON,               reve_icon,
--- 482,507 ----
    cursor[(int) NOCURSOR] = xv_create(XV_NULL,      CURSOR,
                                       CURSOR_IMAGE, nocur_pr,
                                       0) ;
!   if (!monochrome) load_colors() ;
  
    images[(int) P_WHITE]     = make_server_image(white_image) ;
    images[(int) P_BLACK]     = make_server_image(black_image) ;
  }
  
  
! void 
! make_frame(argc, argv)     /* Create frame and the panel, buttons, menus. */
  int argc ;
  char *argv[] ;
  {
+   Menu_item item ;
+ 
    opvals[(int) RCLR] = GXclear ;
    opvals[(int) RSRC] = GXcopy ;
    opvals[(int) RINV] = GXxor ;
  
+ /* Create the frame and the control panel */
+ 
    xv_init(XV_INIT_ARGS, argc, argv, 0) ;
    frame = xv_create(XV_NULL,                  FRAME,
                      FRAME_ICON,               reve_icon,
***************
*** 416,423 ****
                      FRAME_LABEL,              line,
                      FRAME_NO_CONFIRM,         TRUE,
                      FRAME_SHOW_RESIZE_CORNER, FALSE,
!                     WIN_ERROR_MSG,            "Can't create window.",
!                     0) ;
    iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
  }
  
--- 508,693 ----
                      FRAME_LABEL,              line,
                      FRAME_NO_CONFIRM,         TRUE,
                      FRAME_SHOW_RESIZE_CORNER, FALSE,
!                     WIN_ERROR_MSG,            "Reve: Can't create window.",
!                     NULL) ;
! 
!   panel = (Panel) xv_create(frame, PANEL, 0) ;
! 
! /* Menu for the 'new game' button */
! 
!   game_menu = (Menu) xv_create(XV_NULL, MENU,
!                                MENU_NOTIFY_PROC, new_game_proc,
!                                MENU_STRINGS,
!                                  "Human (black)    vs. Computer (white)",
!                                  "Computer (black) vs. Human (white)",
!                                  "Human (black)    vs. Human (white)",
!                                  0,
!                                0) ;
! 
! /* Create the buttons and other controls. */
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 0),
!             PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "New Game",
!             PANEL_ITEM_MENU,    game_menu,
!             0) ;
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 15),
!             PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "Load Game...",
!             PANEL_NOTIFY_PROC,  xv_load_game,
!             0) ;
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 30),
!             PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "Save Game...",
!             PANEL_NOTIFY_PROC,  xv_save_game,
!             0) ;
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 45),
!             PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "     Help      ",
!             PANEL_NOTIFY_PROC,  unimplemented,
!             0) ;
!  
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 0),
!             PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "   Moves?   ",
!             PANEL_NOTIFY_PROC,  show_all_moves,
!             0) ;
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 15),
!             PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "   Suggest  ",
!             PANEL_NOTIFY_PROC,  suggest,
!             0) ;        
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 30),
!             PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "     Undo     ",
!             PANEL_NOTIFY_PROC,  undo,
!             0) ;        
! 
!   XV_CREATE(panel,              PANEL_BUTTON,
!             PANEL_ITEM_X,       xv_col(panel, 45),
!             PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "     Quit     ",
!             PANEL_NOTIFY_PROC,  destroy_frame,
!             0) ;
! 
!   XV_CREATE(panel,              PANEL_CHECK_BOX,
!             PANEL_ITEM_X,       xv_col(panel, 0),
!             PANEL_ITEM_Y,       xv_row(panel, 4),
!             PANEL_LABEL_STRING, "Show Info  ",
!             PANEL_NOTIFY_PROC,  pop_props,
!             PANEL_VALUE,        1,
!             0) ;
! 
!   black_item = xv_create(panel,                PANEL_CHOICE_STACK,
!                          PANEL_ITEM_X,         xv_col(panel, 0),
!                          PANEL_ITEM_Y,         xv_row(panel, 2),
!                          PANEL_LABEL_STRING,   "Black:",
!                          PANEL_CHOICE_STRINGS,
!                            "human",
!                            "computer",
!                            0,
!                          PANEL_NOTIFY_PROC,    set_player,
!                          PANEL_VALUE,          items[(int) BLACK_PLAYS].value,
!                          0) ;
! 
!   white_item = xv_create(panel,                PANEL_CHOICE_STACK,
!                          PANEL_ITEM_X,         xv_col(panel, 0),
!                          PANEL_ITEM_Y,         xv_row(panel, 3),
!                          PANEL_LABEL_STRING,   "White:",
!                          PANEL_CHOICE_STRINGS,
!                            "human",
!                            "computer",
!                            0,
!                          PANEL_NOTIFY_PROC,    set_player,
!                          PANEL_VALUE,          items[(int) WHITE_PLAYS].value,
!                          0) ;
! 
!   mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
!                        PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 2),
!                        PANEL_LABEL_STRING, "Black to move",
!                        0) ;
!  
!   mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
!                        PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 3),
!                        PANEL_LABEL_STRING, "",
!                        0) ;
!  
!   mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
!                        PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 4),
!                        PANEL_LABEL_STRING, "",
!                        0) ;
!  
!  
!   mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
!                        PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 5),
!                        PANEL_LABEL_STRING, "",
!                        0) ;
!  
!   XV_CREATE(panel,                PANEL_CHOICE_STACK,
!             PANEL_ITEM_X,         xv_col(panel, 0),
!             PANEL_ITEM_Y,         xv_row(panel, 5),
!             PANEL_LABEL_STRING,   "Difficulty: ",
!             PANEL_CHOICE_STRINGS,
!               " Instant",
!               " 1 Minute",
!               " 3 Minutes",
!               " 5 Minutes",
!               "10 Minutes",
!               "15 Minutes",
!               "20 Minutes",
!               "Tournament (30)",
!               "60 MInutes",
!               0,
!             PANEL_NOTIFY_PROC,     set_depth,
!             PANEL_VALUE,           0,
!             0) ;
! 
!   window_fit(panel) ;
!   window_fit(frame) ;
!   notify_interpose_event_func(frame, frame_event, NOTIFY_SAFE) ;
!   notify_interpose_destroy_func(frame, quit_proc) ;
! 
!   ls_frame = xv_create(frame,                FRAME_CMD,
!                        FRAME_LABEL,          "Name your Game ...",
!                        FRAME_CMD_PUSHPIN_IN, TRUE,
!                        0) ;
!    
!   ls_panel = (Panel) xv_get(ls_frame, FRAME_CMD_PANEL) ;
! 
!   ls_text = XV_CREATE(ls_panel,                   PANEL_TEXT,
!                       PANEL_ITEM_X,               xv_col(ls_panel, 0),
!                       PANEL_ITEM_Y,               xv_row(ls_panel, 0),
!                       PANEL_LABEL_STRING,         "Load File: ",
!                       PANEL_VALUE,                gamefile,
!                       PANEL_VALUE_DISPLAY_LENGTH, 30,
!                       PANEL_VALUE_STORED_LENGTH,  255,
!                       0) ; 
! 
!   ls_button = xv_create(ls_panel,         PANEL_BUTTON,
!                         PANEL_LABEL_STRING, "Load",
!                         PANEL_NOTIFY_PROC,  start_load_save,
!                         XV_X,               xv_col(ls_panel, 18),
!                         XV_Y,               xv_row(ls_panel, 1),
!                         0) ;
!   window_fit(ls_panel) ;
!   window_fit(ls_frame) ;
! 
    iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
  }
  
***************
*** 425,436 ****
  void
  make_icon()
  {
    reve_icon = xv_create(XV_NULL,    ICON,
!                         ICON_IMAGE, &icon_pr,
                          0) ;
  }
  
  
  Drawable
  make_server_image(image)
  unsigned short image[] ;
--- 695,727 ----
  void
  make_icon()
  {
+ 
+ /* XXX: Need to correctly handle color icons on a color screen. */
+ 
+   Server_image icon_sv ;
+ 
+   icon_sv = xv_create(XV_NULL, SERVER_IMAGE,
+                       SERVER_IMAGE_BITS,  icon_image,
+                       SERVER_IMAGE_DEPTH, 1,
+                       XV_WIDTH,           64,
+                       XV_HEIGHT,          64,
+                       0) ;
+ 
    reve_icon = xv_create(XV_NULL,    ICON,
!                         ICON_IMAGE, icon_sv,
                          0) ;
+   creve_icon = xv_create(XV_NULL,    ICON,
+                          ICON_IMAGE, icon_sv,
+                          0) ;
  }
  
  
+ void
+ make_panel()                   /* **DUMMY ROUTINE** */
+ {
+ }
+ 
+ 
  Drawable
  make_server_image(image)
  unsigned short image[] ;
***************
*** 442,448 ****
                     XV_HEIGHT,         64,
                     SERVER_IMAGE_BITS, image,
                     0) ;
!   return((int) xv_get(temp, XV_XID)) ;
  }
  
  
--- 733,739 ----
                     XV_HEIGHT,         64,
                     SERVER_IMAGE_BITS, image,
                     0) ;
!   return((int) xv_get(temp, XV_XID, NULL)) ;
  }
  
  
***************
*** 459,464 ****
--- 750,840 ----
  
  
  void
+ message(mtype, str)
+ enum panel_type mtype ;
+ char *str ;
+ {
+   XV_SET(mes_items[(int) (mtype - PANEL_MES)], PANEL_LABEL_STRING, str, 0) ;
+ }
+ 
+ 
+ static void
+ new_game_proc(menu, menu_item)
+ Menu menu ;
+ Menu_item menu_item ;
+ {
+   switch((int) xv_get(menu_item, MENU_VALUE))
+     {
+       case 1 : items[(int) BLACK_PLAYS].value = HUMAN ;
+                items[(int) WHITE_PLAYS].value = COMPUTER ;
+                cmode = WHITE_START ;
+                dtype = XBLACK ;
+                break ;
+ 
+       case 2 : items[(int) BLACK_PLAYS].value = COMPUTER ;
+                items[(int) WHITE_PLAYS].value = HUMAN ;
+                cmode = BLACK_START ;
+                dtype = XWHITE ;
+                break ;
+ 
+       case 3 : items[(int) BLACK_PLAYS].value = HUMAN ;
+                items[(int) WHITE_PLAYS].value = HUMAN ;
+                cmode = BLACK_START ;
+                dtype = XBOTH ;
+     }
+   XV_SET(black_item, PANEL_VALUE, items[(int) BLACK_PLAYS].value) ;
+   XV_SET(white_item, PANEL_VALUE, items[(int) WHITE_PLAYS].value) ;
+   new_game() ;
+ }
+ 
+ 
+ /* Callback for the check box to show/hide evaluation and score. */
+ 
+ static void
+ pop_props(item, value, event)
+ {
+   show_notes = !show_notes ;
+   if (!show_notes)
+     {
+       XV_SET(mes_items[(int) (EVAL_MES - PANEL_MES)],
+              PANEL_LABEL_STRING, "",
+              0) ;
+       XV_SET(mes_items[(int) (SCORE_MES - PANEL_MES)],
+              PANEL_LABEL_STRING, "",
+              0) ;
+     }
+ }
+ 
+ 
+ void
+ position_popup(parent, child, position)
+ Frame parent, child ;
+ int position ;
+ {
+   Rect crect, prect ;
+   int height, width ;
+ 
+   if (((int) xv_get(child, XV_SHOW)) && position == P_RIGHT) return ;
+   frame_get_rect(parent, &prect) ;
+   frame_get_rect(child,  &crect) ;
+   height = (int) xv_get(parent, XV_HEIGHT) ;
+   width  = (int) xv_get(parent, XV_WIDTH) ;
+ 
+   switch (position)
+     {
+       case P_BELOW : crect.r_left = prect.r_left + FRAME_BORDER_SIZE ;
+                      crect.r_top  = prect.r_top + height + FRAME_LABEL_SIZE +
+                                     FRAME_BORDER_SIZE ;
+                      break ;
+       case P_RIGHT : crect.r_left = prect.r_left + width +
+                                                    (2 * FRAME_BORDER_SIZE) ;
+                      crect.r_top  = prect.r_top ;
+     }
+   frame_set_rect(child, &crect) ;
+ }
+ 
+ 
+ void
  process_event()       /* Process the next canvas event. */
  {
    int id ;
***************
*** 493,499 ****
--- 869,896 ----
  }
  
  
+ static Notify_value
+ quit_proc(frame, status)
+ Frame frame ;
+ Destroy_status status ;
+ {
+   if (status == DESTROY_PROCESS_DEATH || status == DESTROY_CLEANUP)
+     {
+       xv_destroy_safe(frame) ;
+       xv_destroy_safe(cframe) ;
+       exit(0) ;
+     }
+   return(notify_next_destroy_func(frame, status)) ;
+ }
+ 
+ 
  void
+ remove_textfield()         /* **DUMMY ROUTINE** */
+ {
+ }
+ 
+ 
+ void
  set_cursor(ctype)
  enum curtype ctype ;
  {
***************
*** 505,522 ****
  
  /*ARGSUSED*/
  void
! start_tool(dtype)      /* Display window and start the notifier. */
! enum disp_type dtype ;
  {
!   if (iscolor[(int) cur_dpyno])
      {
!       reve_icon = (Icon) xv_get(frame, FRAME_ICON) ;
!       XV_SET(reve_icon,
!              ICON_IMAGE, &cicon_pr,
!              0) ;
!       XV_SET(frame, FRAME_ICON, reve_icon, 0) ;
      }
!   window_fit(frame) ;
    started = 1 ;
    xv_main_loop(frame) ;
  }
--- 902,1025 ----
  
  /*ARGSUSED*/
  void
! set_cycle(mtype, str)                    /* **DUMMY ROUTINE** */
! enum panel_type mtype ;
! char *str ;
  {
! }
! 
! 
! static void 
! set_depth(item, value, event)   /* Callback to set the level of difficulty */
! Panel_item item ;
! int value ;
! Event *event ;
! {
!   level = value + 1 ;
!   items[(int) DIFFICULTY].value = level - 1 ;
! }
! 
! 
! static void
! set_player(item, value, event)   /* Callback to set black/white player. */
! Panel_item item ;
! int value ;
! Event *event ;
! {
!   char *label ;
!   enum panel_type this, other ;
!   int curi, curo ;
! 
!   label = (char *) xv_get(item, PANEL_LABEL_STRING) ;
!   if (EQUAL(label, "Black"))
      {
!       this = BLACK_PLAYS ;
!       other = WHITE_PLAYS ;
      }
!   else
!     {
!       this = WHITE_PLAYS ;
!       other = BLACK_PLAYS ;
!     }
! 
!   curi = items[(int) this].value = value ;
!   curo = items[(int) other].value ;
! 
!   if (curi == COMPUTER && curo == COMPUTER)
!     {
!       curi = HUMAN ;
!       XV_SET(item, PANEL_VALUE, curi, 0) ;
!       items[(int) this].value = curi ;
!       message(PANEL_MES, "Computer can't play both players.") ;
!     }
!   if (curi == HUMAN    && curo == COMPUTER)
!     dtype = (this == BLACK_PLAYS) ? XBLACK : XWHITE ;
!   else if (curi == COMPUTER && curo == HUMAN)
!     dtype = (this == BLACK_PLAYS) ? XWHITE : XBLACK ;
!   else if (curi == HUMAN    && curo == HUMAN)
!     dtype = (dtype == XTWO) ? XTWO : XBOTH ;
!  
!   if (curi == COMPUTER)
!     if ((this == BLACK_PLAYS && cmode == BLACK_START) ||
!         (this == WHITE_PLAYS && cmode == WHITE_START))
!       computer_move(next_player) ;
! }
! 
! 
! Panel_setting
! start_load_save(item, event)
! Panel_item item ;
! Event *event ;
! {
!   char *label ;
! 
!   XV_SET(ls_frame, XV_SHOW, FALSE, NULL) ;
!   STRCPY(gamefile, (char *) xv_get(ls_text, PANEL_VALUE)) ;
!   label = (char *) xv_get(ls_button, PANEL_LABEL_STRING) ;
!   if (EQUAL(label, "Load")) load_game() ;
!   else                      save_game() ;
!   return(PANEL_NONE) ;
! }
! 
! 
! /*ARGSUSED*/
! void
! start_tool(dtype)      /* Display window and start the notifier. */
! enum disp_type dtype ;
! {
    started = 1 ;
    xv_main_loop(frame) ;
+ }
+ 
+ 
+ static void         /* Dummy function for unimplemented callbacks */
+ unimplemented()
+ {
+   message(PANEL_MES, "Not implemented yet.\n") ;
+ }
+ 
+ 
+ static void 
+ xv_load_game(item, value, event)    /* Callback for loading a game button. */
+ Panel_item item ;
+ int value ;
+ Event *event ;
+ {
+   position_popup(frame, ls_frame, P_RIGHT) ;
+   XV_SET(ls_text, PANEL_LABEL_STRING, "Load File: ", 0) ;
+   XV_SET(ls_button, PANEL_LABEL_STRING, "Load", 0) ;
+   XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
+ }
+ 
+ 
+ static void 
+ xv_save_game(item, value, event)    /* Callback load saving a game button. */
+ Panel_item item ;
+ int value ;
+ Event *event ;
+ {
+   position_popup(frame, ls_frame, P_RIGHT) ;
+   XV_SET(ls_text, PANEL_LABEL_STRING, "Save File: ", 0) ;
+   XV_SET(ls_button, PANEL_LABEL_STRING, "Save", 0) ; 
+   XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
  }

------- sunview.c -------
*** /tmp/da28890	Fri Nov  9 10:38:31 1990
--- sunview.c	Mon Nov  5 09:08:30 1990
***************
*** 7,17 ****
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is given to distribute these sources, as long as the
!  *  introductory messages are not removed, and no monies are exchanged.
   *
!  *  You are forbidden from using Reve as is, or in a modified state, in
!  *  any tournaments, without the permission of the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
--- 7,22 ----
   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
   *  All rights reserved.
   *
!  *  Permission is granted to copy this source, for redistribution
!  *  in source form only, provided the news headers in "substantially
!  *  unaltered format" are retained, the introductory messages are not
!  *  removed, and no monies are exchanged.
   *
!  *  Permission is also granted to copy this source, without the
!  *  news headers, for the purposes of making an executable copy by
!  *  means of compilation, provided that such copy will not be used
!  *  for the purposes of competition in any othello tournaments, without
!  *  prior permission from the authors.
   *
   *  No responsibility is taken for any errors or inaccuracies inherent
   *  either to the comments or the code of this program, but if reported
***************
*** 18,26 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
- #include <stdio.h>
- #include "color.h"
  #include "reve.h"
  #include "extern.h"
  #include "images.h"
  #include <suntool/sunview.h>
--- 23,30 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
  #include "reve.h"
+ #include "color.h"
  #include "extern.h"
  #include "images.h"
  #include <suntool/sunview.h>
***************
*** 316,322 ****
    CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
    cursor[(int) NOCURSOR]  = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ;
    CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
!   load_colors() ;
  
    images[(int) BUT_STENCIL] = &button_stencil_pr ;
    images[(int) BUT_INVERT]  = &button_invert_pr ;
--- 320,326 ----
    CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
    cursor[(int) NOCURSOR]  = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ;
    CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
!   if (!monochrome) load_colors() ;
  
    images[(int) BUT_STENCIL] = &button_stencil_pr ;
    images[(int) BUT_INVERT]  = &button_invert_pr ;