[comp.sources.games] v11i063: reve - an othello game, Patch1c

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

Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 11, Issue 63
Archive-name: reve/Patch1c
Patch-To: reve: Volume 11, Issue 52-58
Environment: SunView, XView, X11R4, termcap



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 4)."
# Contents:  patches01c
# Wrapped by billr@saab on Fri Nov 16 10:46:44 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches01c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches01c'\"
else
echo shar: Extracting \"'patches01c'\" \(48717 characters\)
sed "s/^X//" >'patches01c' <<'END_OF_FILE'
X
X------- rev_eval.c -------
X*** /tmp/da28908	Fri Nov  9 10:39:56 1990
X--- rev_eval.c	Mon Nov  5 09:06:42 1990
X***************
X*** 3,13 ****
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X!  *  You are forbidden from using Reve as is, or in a modified state, in
X!  *  any tournaments, without the permission of the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X--- 3,18 ----
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X!  *  Permission is also granted to copy this source, without the
X!  *  news headers, for the purposes of making an executable copy by
X!  *  means of compilation, provided that such copy will not be used
X!  *  for the purposes of competition in any othello tournaments, without
X!  *  prior permission from the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X***************
X*** 23,36 ****
X  extern long c1, c2, c3 ;
X  extern long edges[6561] ;
X  
X! /*  Evaluation function : give a note to a board = damier[ niv ].
X   *  It computes 4 components :
X   *     - Edge Stability, using Edge Stability Table pre-computed before
X   *     - Current Mobility, in fact computed during alpha-beta pruning
X   *     - X squares Values
X   *     - Potential Mobility, looking at squares contacts
X!  *  And then Eval = c1 * ES + c2 * CM + c3 * XV + c4 * PM
X!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positif
X   *  if macouleur ( my color ) has a good position and negatif if tacouleur
X   *  position is good.
X   *  If we are "near" the end of the game, then Eval is equal to final disc
X--- 28,41 ----
X  extern long c1, c2, c3 ;
X  extern long edges[6561] ;
X  
X! /*  Evaluation function : gives a note to a board = damier[ niv ].
X   *  It computes 4 components :
X   *     - Edge Stability, using Edge Stability Table pre-computed before
X   *     - Current Mobility, in fact computed during alpha-beta pruning
X   *     - X squares Values
X   *     - Potential Mobility, looking at squares contacts
X!  *  And then Eval = c1 * ES + c2 * ( CM + cx * XV ) + c3 * PM
X!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positive
X   *  if macouleur ( my color ) has a good position and negatif if tacouleur
X   *  position is good.
X   *  If we are "near" the end of the game, then Eval is equal to final disc
X***************
X*** 45,51 ****
X    register int i, x, y ;
X    register long note ;
X    register int vp, vo ;
X!   register long tnote ;
X  
X    d = damier[niv] ;
X  
X--- 50,56 ----
X    register int i, x, y ;
X    register long note ;
X    register int vp, vo ;
X!   register long tnote, cx ;
X  
X    d = damier[niv] ;
X  
X***************
X*** 105,135 ****
X          }
X        note += edges[i] ;
X  
X        if (d[0] == FREE)
X          {
X!                if (d[9] == macouleur) note -= c3 ;
X!           else if (d[9] == tacouleur) note += c3 ;
X          }
X  
X        if (d[7] == FREE)
X          {
X!                if (d[14] == macouleur) note -= c3 ;
X!           else if (d[14] == tacouleur) note += c3 ;
X          }
X  
X        if (d[56] == FREE)
X          {
X!                if (d[49] == macouleur) note -= c3 ;
X!           else if (d[49] == tacouleur) note += c3 ;
X          }
X  
X        if (d[63] == FREE)
X          {
X!                if (d[54] == macouleur) note -= c3 ;
X!           else if (d[54] == tacouleur) note += c3 ;
X          }
X  
X!       tnote = c1 * note + c2 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
X  
X        vp = vo = 0 ;
X        for (x = 0; x < 8; x++)
X--- 110,142 ----
X          }
X        note += edges[i] ;
X  
X+       cx = 8 * (50 - mnb - profmax) ;
X+ 
X        if (d[0] == FREE)
X          {
X!                if (d[9] == macouleur) note -= cx ;
X!           else if (d[9] == tacouleur) note += cx ;
X          }
X  
X        if (d[7] == FREE)
X          {
X!                if (d[14] == macouleur) note -= cx ;
X!           else if (d[14] == tacouleur) note += cx ;
X          }
X  
X        if (d[56] == FREE)
X          {
X!                if (d[49] == macouleur) note -= cx ;
X!           else if (d[49] == tacouleur) note += cx ;
X          }
X  
X        if (d[63] == FREE)
X          {
X!                if (d[54] == macouleur) note -= cx ;
X!           else if (d[54] == tacouleur) note += cx ;
X          }
X  
X!       tnote = c1 * note + c2 * (long) 1000 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
X  
X        vp = vo = 0 ;
X        for (x = 0; x < 8; x++)
X***************
X*** 219,225 ****
X            }
X  
X        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
X!       tnote += 99 * note ;
X!       return(tnote) ;
X      }
X  }
X--- 226,232 ----
X            }
X  
X        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
X!       tnote += c3 * note ;
X!       return(tnote / 1000) ;
X      }
X  }
X
X------- rev_ip.c -------
X*** /tmp/da28911	Fri Nov  9 10:39:56 1990
X--- rev_ip.c	Mon Nov  5 09:07:12 1990
X***************
X*** 3,11 ****
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X   *  (see README file), then an attempt will be made to fix them.
X--- 3,19 ----
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X+  *  Permission is also granted to copy this source, without the
X+  *  news headers, for the purposes of making an executable copy by
X+  *  means of compilation, provided that such copy will not be used
X+  *  for the purposes of competition in any othello tournaments, without
X+  *  prior permission from the authors.
X+  *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X   *  (see README file), then an attempt will be made to fix them.
X***************
X*** 12,22 ****
X   */
X  
X  #include <stdio.h>
X  #include <sys/types.h>
X  #include <sys/time.h>
X  #include "reve.h"
X  
X! extern time_t time() ;
X  extern int damier[NIVEAUMAX][64] ;
X  extern int tacouleur, macouleur ;
X  extern int mnb, profmax ;
X--- 20,33 ----
X   */
X  
X  #include <stdio.h>
X+ #include <signal.h>
X+ #include <setjmp.h>
X  #include <sys/types.h>
X  #include <sys/time.h>
X  #include "reve.h"
X  
X! extern int saveres ;
X! extern time_t timeleft, time() ;
X  extern int damier[NIVEAUMAX][64] ;
X  extern int tacouleur, macouleur ;
X  extern int mnb, profmax ;
X***************
X*** 58,81 ****
X  
X  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
X  
X! static int cpi[60], cpj[60], cpk[60] ;
X  
X  static int locallevel = -1 ;
X! static time_t timeleft ;
X  
X  static long jeplonge() ;
X  static long tuplonges() ;
X  long evalue() ;
X  
X  play_reve(board, color, level, rtnmv, rtnnote)
X  int *board, color, level, *rtnmv ;
X  long *rtnnote ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp, cpmax ;
X!   register long lnote, note ;
X!   register int count, fact ;
X!   time_t firsttime, timeused, allotime ;
X  
X    for (k = 0; k < 60; k++)
X      {
X--- 69,105 ----
X  
X  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
X  
X! static int cpi[60], cpj[60], cpk[60], cpf[60] ;
X! static int cpi2[60], cpj2[60], cpk2[60] ;
X! static int cpmaxi[4] ;
X  
X  static int locallevel = -1 ;
X! static firsttime, timeused, allotime ;
X  
X+ jmp_buf jumper ;
X+ 
X  static long jeplonge() ;
X  static long tuplonges() ;
X  long evalue() ;
X  
X+ 
X+ static void
X+ catcher()
X+ {
X+   longjmp(jumper, 1) ;
X+ }
X+ 
X+ 
X  play_reve(board, color, level, rtnmv, rtnnote)
X  int *board, color, level, *rtnmv ;
X  long *rtnnote ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp ;
X!   register long lnote ;
X!   register int count ;
X!   static int cpmax, note, oldnote ;
X!   FILE *fp ;
X  
X    for (k = 0; k < 60; k++)
X      {
X***************
X*** 119,125 ****
X            mnb++ ;
X            cp = 0 ;
X            while (cpk[cp] != k) cp++ ;
X!           for ( ; cp < 60; cp++)
X              {
X                cpi[cp] = cpi[cp + 1] ;
X                cpj[cp] = cpj[cp + 1] ;
X--- 143,149 ----
X            mnb++ ;
X            cp = 0 ;
X            while (cpk[cp] != k) cp++ ;
X!           for ( ; cp < 59; cp++)
X              {
X                cpi[cp] = cpi[cp + 1] ;
X                cpj[cp] = cpj[cp + 1] ;
X***************
X*** 129,135 ****
X  
X    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
X      {
X!       timeleft = timevals[level] * 60 ;
X        locallevel = level ;
X      }
X  
X--- 153,159 ----
X  
X    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
X      {
X!       timeleft = timevals[level-1] * 60 ;
X        locallevel = level ;
X      }
X  
X***************
X*** 137,171 ****
X    for (cp = 0; cp <= 60 - mnb; cp++)
X      if (d0[cpk[cp]] == JPJ) k++ ;
X  
X!   if ((k == 1) || (mnb == 1))
X      {
X-       note = 0 ;
X-       timeused = profmax = 1 ;
X        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
X        cpi[0] = cpi[cp] ;
X        cpj[0] = cpj[cp] ;
X        cpk[0] = cpk[cp] ;
X      }
X    else
X!     { 
X!       count = 0 ;
X!       profmax = 1 ;
X!       allotime = timeleft * 2 / (60 - mnb) ;
X        firsttime = time((time_t *) NULL) ;
X        do
X          {
X            note = -1000000000 ;
X  
X            c1 = 312 + 6 * (mnb + profmax) ;
X            if (mnb + profmax < 25)
X!             c2 = 1000 * (long) (50 + 2 * (mnb + profmax)) ;
X            else
X!             c2 = 1000 * (long) (75 + mnb + profmax) ;
X!           c3 = 4 * (50 - mnb - profmax) ;
X  
X            profmax++ ;
X-           if (profmax > 55 - mnb) profmax = 61 - mnb ;
X  
X            for (cp = 0; cp <= 60 - mnb; cp++)
X              {
X                if (d0[cpk[cp]] == JPJ)
X--- 161,256 ----
X    for (cp = 0; cp <= 60 - mnb; cp++)
X      if (d0[cpk[cp]] == JPJ) k++ ;
X  
X!   count = note = cpmax = 0 ;
X!   timeused = profmax = 1 ;
X! 
X!   if (((k == 1) && (mnb < 52)) || (mnb == 1))
X      {
X        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
X        cpi[0] = cpi[cp] ;
X        cpj[0] = cpj[cp] ;
X        cpk[0] = cpk[cp] ;
X      }
X+   else if (mnb == 2)
X+     {
X+       if (d0[2 * 8 + 3] == BLACK)
X+         {
X+           cpi[0] = 4 ;
X+           cpj[0] = 2 ;
X+         }
X+       else if (d0[3 * 8 + 2] == BLACK)
X+         {
X+           cpi[0] = 2 ;
X+           cpj[0] = 4 ;
X+         }
X+       else if (d0[4 * 8 + 5] == BLACK)
X+         {
X+           cpi[0] = 5 ;
X+           cpj[0] = 3 ;
X+         }
X+       else if (d0[5 * 8 + 4] == BLACK)
X+         {
X+           cpi[0] = 3 ;
X+           cpj[0] = 5 ;
X+         }
X+       cpk[0] = cpi[0] * 8 + cpj[0] ;
X+     }
X+   else if (mnb == 3)
X+     {
X+       if (d0[4 * 8 + 2] == WHITE)
X+         {
X+           cpi[0] = 5 ;
X+           cpj[0] = 3 ;
X+         }
X+       else if (d0[2 * 8 + 2] == WHITE)
X+         {
X+           cpi[0] = 3 ;
X+           cpj[0] = 2 ;
X+         }
X+       else if (d0[2 * 8 + 4] == WHITE)
X+         {
X+           cpi[0] = 3 ;
X+           cpj[0] = 5 ;
X+         }
X+       cpk[0] = cpi[0] * 8 + cpj[0] ;
X+     }
X    else
X!     {
X!       allotime = timeleft * 3 / (61 - mnb) ;
X        firsttime = time((time_t *) NULL) ;
X+ 
X+       signal(SIGALRM, catcher) ;
X+ 
X+       if (setjmp(jumper) != 0)
X+         {
X+           if (cpmax == 0) note = oldnote ;
X+           profmax = -profmax ;
X+           goto trap ;
X+         }
X+ 
X        do
X          {
X+           oldnote = note ;
X            note = -1000000000 ;
X  
X+           if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
X+ 
X            c1 = 312 + 6 * (mnb + profmax) ;
X            if (mnb + profmax < 25)
X!             c2 = 50 + 2 * (mnb + profmax) ;
X            else
X!             c2 = 75 + mnb + profmax ;
X!           c3 = 99 ;
X  
X            profmax++ ;
X  
X+           if (profmax > 53 - mnb)
X+             {
X+               profmax = 61 - mnb ;
X+               allotime = timeleft * 3 / 5 ;
X+               if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
X+             }
X+ 
X            for (cp = 0; cp <= 60 - mnb; cp++)
X              {
X                if (d0[cpk[cp]] == JPJ)
X***************
X*** 185,215 ****
X                      }
X                  }
X              }
X!           if (cpmax == 0) count++ ;
X            else
X              {
X!               count = 1 ;
X!               k = cpi[0] ;
X!               cpi[0] = cpi[cpmax] ;
X!               cpi[cpmax] = k ;
X!               k = cpj[0] ;
X!               cpj[0] = cpj[cpmax] ;
X!               cpj[cpmax] = k ;
X!               k = cpk[0] ;
X!               cpk[0] = cpk[cpmax] ;
X!               cpk[cpmax] = k ;
X              }
X            timeused = time((time_t *) NULL) - firsttime ;
X!           if (count < 3) fact = 1 ;
X!           else           fact = 3 ;
X          }
X!       while ((timeused * fact < allotime) && (profmax <= 60 - mnb)) ;
X        if (timeused == 0) timeused = 1 ;
X      }
X  
X!   timeleft -= timeused ;
X  
X!   *rtnmv = cpk[0] ;
X    *rtnnote = note ;
X  }
X  
X--- 270,349 ----
X                      }
X                  }
X              }
X! 
X!           alarm(0) ;
X!           cpmaxi[0] = cpmax ;
X! 
X!           if ((mnb < 57) && (cpmaxi[0] != cpmaxi[1])
X!               && (cpmaxi[1] != cpmaxi[2]) && (cpmaxi[0] != cpmaxi[2]))
X!             {
X!               if (cpmax == 0) count++ ; else count = 1 ;
X!               for (cp = 0; cp <= 60 - mnb; cp++) cpf[cp] = TRUE ;
X!               for (k = 0; k < 3; k++)
X!                 {
X!                   cpi2[k] = cpi[cpmaxi[k]] ;
X!                   cpj2[k] = cpj[cpmaxi[k]] ;
X!                   cpk2[k] = cpk[cpmaxi[k]] ;
X!                   cpf[cpmaxi[k]] = FALSE ;
X!                 }
X!               k = 3 ;
X!               for (cp = 0; cp <= 60 - mnb; cp++)
X!                 if (cpf[cp] == TRUE)
X!                   {
X!                     cpi2[k] = cpi[cp] ;
X!                     cpj2[k] = cpj[cp] ;
X!                     cpk2[k] = cpk[cp] ;
X!                     k++ ;
X!                   }
X!               for (cp = 0; cp <= 60 - mnb; cp++)
X!                 {
X!                   cpi[cp] = cpi2[cp] ;
X!                   cpj[cp] = cpj2[cp] ;
X!                   cpk[cp] = cpk2[cp] ;
X!                 }
X!             }
X            else
X              {
X!               cpi2[0] = cpi[cpmax] ;
X!               cpj2[0] = cpj[cpmax] ;
X!               cpk2[0] = cpk[cpmax] ;
X!               cpi[cpmax] = cpi[0] ;
X!               cpj[cpmax] = cpj[0] ;
X!               cpk[cpmax] = cpk[0] ;
X!               cpi[0] = cpi2[0] ;
X!               cpj[0] = cpj2[0] ;
X!               cpk[0] = cpk2[0] ;
X              }
X+           cpmax = 0 ;
X            timeused = time((time_t *) NULL) - firsttime ;
X!           if ((mnb == 4) && (profmax == 3)) break ;
X          }
X!       while ((timeused * count < allotime * 5 / 4) && (profmax != 61 - mnb)) ;
X! trap:
X!       timeused = time((time_t *) NULL) - firsttime ;
X        if (timeused == 0) timeused = 1 ;
X      }
X  
X!   if (*rtnmv == TRUE) timeleft -= timeused ;
X!   if ((int) timeleft < 0) timeleft = 0 ;
X  
X!   if (saveres)
X!     {
X!       if ((mnb == 1) || (mnb == 2))
X!         {
X!           fp = fopen("reve.res", "w") ;
X!           FPRINTF(fp, "\n") ;
X!           FCLOSE(fp) ;
X!         }
X!       fp = fopen("reve.res", "a") ;
X!       FPRINTF(fp, "%2d, <%c-%c>, ", mnb, 'A' + cpj[cpmax], '1' + cpi[cpmax]) ;
X!       FPRINTF(fp, "nt : %5d, pmax : %3d, tmleft : %d, level : %d, ",
X!                    note,     profmax,    timeleft, level) ;
X!       FPRINTF(fp, "exp : <%c-%c>\n", 'A' + cpj[1], '1' + cpi[1]) ;
X!       FCLOSE(fp) ;
X!     }
X! 
X!   *rtnmv = cpk[cpmax] ;
X    *rtnnote = note ;
X  }
X  
X***************
X*** 220,226 ****
X  long alpha, beta ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp ;
X    register long lnote, note ;
X  
X    d0 = damier[niv] ;
X--- 354,360 ----
X  long alpha, beta ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp, cpmax ;
X    register long lnote, note ;
X  
X    d0 = damier[niv] ;
X***************
X*** 241,250 ****
X              lnote = tuplonges(niv + 1, alpha, note) ;
X            else
X              lnote = evalue(niv + 1) ;
X!           if (lnote < note) note = lnote ;
X            if (note <= alpha) return note ;
X          }
X      }
X    return note ;
X  }
X  
X--- 375,397 ----
X              lnote = tuplonges(niv + 1, alpha, note) ;
X            else
X              lnote = evalue(niv + 1) ;
X!           if (lnote < note)
X!             {
X!               note = lnote ;
X!               cpmax = cp ;
X!             }
X            if (note <= alpha) return note ;
X          }
X      }
X+ 
X+   if (niv == 1)
X+     {
X+       cpmaxi[1] = cpmax ;
X+       cpmaxi[2] = cpmaxi[3] ;
X+     }
X+   else if (niv == 2)
X+     cpmaxi[3] = cpmax ;
X+ 
X    return note ;
X  }
X  
X***************
X*** 255,261 ****
X  long alpha, beta ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp ;
X    register long lnote, note ;
X  
X    d0 = damier[niv] ;
X--- 402,408 ----
X  long alpha, beta ;
X  {
X    register int *d0, *d1 ;
X!   register int k, cp, cpmax ;
X    register long lnote, note ;
X  
X    d0 = damier[niv] ;
X***************
X*** 276,284 ****
X              lnote = jeplonge(niv + 1, note, beta) ;
X            else
X              lnote = evalue(niv + 1) ;
X!           if (lnote > note) note = lnote ;
X            if (note >= beta) return note ;
X          }
X      }
X    return note ;
X  }
X--- 423,444 ----
X              lnote = jeplonge(niv + 1, note, beta) ;
X            else
X              lnote = evalue(niv + 1) ;
X!           if (lnote > note)
X!             {
X!               note = lnote ;
X!               cpmax = cp ;
X!             }
X            if (note >= beta) return note ;
X          }
X      }
X+ 
X+   if (niv == 1)
X+     {
X+       cpmaxi[1] = cpmax ;
X+       cpmaxi[2] = cpmaxi[3] ;
X+     }
X+   else if (niv == 2)
X+     cpmaxi[3] = cpmax ;
X+ 
X    return note ;
X  }
X
X------- rev_iycp.c -------
X*** /tmp/da28914	Fri Nov  9 10:39:57 1990
X--- rev_iycp.c	Mon Nov  5 09:10:39 1990
X***************
X*** 3,13 ****
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X!  *  You are forbidden from using Reve as is, or in a modified state, in
X!  *  any tournaments, without the permission of the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X--- 3,18 ----
X   *
X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X!  *  Permission is also granted to copy this source, without the
X!  *  news headers, for the purposes of making an executable copy by
X!  *  means of compilation, provided that such copy will not be used
X!  *  for the purposes of competition in any othello tournaments, without
X!  *  prior permission from the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X
X------- reve.h -------
X*** /tmp/da28917	Fri Nov  9 10:39:58 1990
X--- reve.h	Mon Nov  5 09:07:58 1990
X***************
X*** 6,16 ****
X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X!  *  You are forbidden from using Reve as is, or in a modified state, in
X!  *  any tournaments, without the permission of the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X--- 6,21 ----
X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X!  *  Permission is also granted to copy this source, without the
X!  *  news headers, for the purposes of making an executable copy by
X!  *  means of compilation, provided that such copy will not be used
X!  *  for the purposes of competition in any othello tournaments, without
X!  *  prior permission from the authors.
X   *
X   *  No responsibility is taken for any errors on inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X***************
X*** 17,26 ****
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X  #define  FCLOSE        (void) fclose      /* To make lint happy. */
X  #define  FFLUSH        (void) fflush
X  #define  FGETS         (void) fgets
X- #define  FREAD         (void) fread
X  #define  FSEEK         (void) fseek
X  #define  FPRINTF       (void) fprintf
X  #define  GETTIMEOFDAY  (void) gettimeofday
X--- 22,33 ----
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X+ #include <stdio.h>
X+ #include <sys/types.h>
X+ 
X  #define  FCLOSE        (void) fclose      /* To make lint happy. */
X  #define  FFLUSH        (void) fflush
X  #define  FGETS         (void) fgets
X  #define  FSEEK         (void) fseek
X  #define  FPRINTF       (void) fprintf
X  #define  GETTIMEOFDAY  (void) gettimeofday
X***************
X*** 42,57 ****
X  #define  BGAP          10       /* Width of the gap between buttons. */
X  #define  BHEIGHT       32       /* Height of a reve button item. */
X  #define  BWIDTH        64       /* Width of a reve button item. */
X- #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
X  #define  CHEIGHT       20       /* Height of a reve cycle item. */
X  #define  CWIDTH        32       /* Width of a reve cycle item. */
X- #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
X  #define  NOBUTS        6        /* Number of reve buttons. */
X- #define  NOROWS        6        /* Number of rows of reve items. */
X  #define  PIECE_MARGIN  8
X  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
X  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
X  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
X  
X  /* States that the the Reve squares can be in. */
X  #define  BLACK         (-1)    /* Piece definitions. */
X--- 49,73 ----
X  #define  BGAP          10       /* Width of the gap between buttons. */
X  #define  BHEIGHT       32       /* Height of a reve button item. */
X  #define  BWIDTH        64       /* Width of a reve button item. */
X  #define  CHEIGHT       20       /* Height of a reve cycle item. */
X  #define  CWIDTH        32       /* Width of a reve cycle item. */
X  #define  NOBUTS        6        /* Number of reve buttons. */
X  #define  PIECE_MARGIN  8
X  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
X+ 
X+ #ifdef XVIEW
X+ #define  CELL_SIZE     54
X+ #define  CY            0
X+ #define  NOROWS        0
X+ #define  TOTAL_HEIGHT  (8 * CELL_SIZE) + (2 * BBORDER)
X+ #define  TOTAL_WIDTH   (8 * CELL_SIZE) + (2 * BBORDER)
X+ #else
X+ #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
X+ #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
X+ #define  NOROWS        6        /* Number of rows of reve items. */
X  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
X  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
X+ #endif /*XVIEW*/
X  
X  /* States that the the Reve squares can be in. */
X  #define  BLACK         (-1)    /* Piece definitions. */
X***************
X*** 91,104 ****
X  
X  #ifndef  MAXLINE
X  #define  MAXLINE       80      /* Length of character strings. */
X! #endif /*MAXLINE*/
X  
X  #define  MAXMENUS      4       /* Maximum number of popup menus. */
X  #define  NIVEAUMAX     25      /* Maximum possible depth. */
X  
X  #ifdef  NOINDEX
X  #define  index         strchr
X  #endif /*NOINDEX*/
X  
X  #define  NOMOVE        -1
X  #define  OPPONENT(p)   p * -1
X--- 107,122 ----
X  
X  #ifndef  MAXLINE
X  #define  MAXLINE       80      /* Length of character strings. */
X! #endif /*!MAXLINE*/
X  
X  #define  MAXMENUS      4       /* Maximum number of popup menus. */
X  #define  NIVEAUMAX     25      /* Maximum possible depth. */
X  
X+ #ifndef X11
X  #ifdef  NOINDEX
X  #define  index         strchr
X  #endif /*NOINDEX*/
X+ #endif /*!X11*/
X  
X  #define  NOMOVE        -1
X  #define  OPPONENT(p)   p * -1
X***************
X*** 116,128 ****
X  
X  #ifndef  EDGENAME
X  #define  EDGENAME      "reve.edgetable"
X! #endif /*EDGENAME*/
X  
X! #ifndef  NO_4_3SIGNAL
X  #define  SIGRET        void
X  #else
X  #define  SIGRET        int
X! #endif /*NO_4_3SIGNAL*/
X  
X  #define  VINVUL        50
X  
X--- 134,146 ----
X  
X  #ifndef  EDGENAME
X  #define  EDGENAME      "reve.edgetable"
X! #endif /*!EDGENAME*/
X  
X! #ifndef  INT_SIGNAL
X  #define  SIGRET        void
X  #else
X  #define  SIGRET        int
X! #endif /*!INT_SIGNAL*/
X  
X  #define  VINVUL        50
X  
X***************
X*** 140,146 ****
X  #define  MOUSE_MOVING     110    /* Mouse is moving. */
X  #define  IGNORE_EVENT     111    /* No interest in this event. */
X  
X! /* Batch or locking direction (ON or OFF). */
X  enum bltype   { IS_OFF, IS_ON } ;
X  
X  /* Reve move status. */
X--- 158,164 ----
X  #define  MOUSE_MOVING     110    /* Mouse is moving. */
X  #define  IGNORE_EVENT     111    /* No interest in this event. */
X  
X! /* Batch, last move, locking or show all direction (ON or OFF). */
X  enum bltype   { IS_OFF, IS_ON } ;
X  
X  /* Reve move status. */
X***************
X*** 167,176 ****
X  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
X  
X  /* Different panel items. */
X! enum panel_type { LAST_BUT,    LOAD_BUT, NEW_GAME_BUT, SAVE_BUT,
X                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
X                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
X!                   PANEL_MES, NOTES_MES, SCORE_MES, TURN_MES } ;
X  
X  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
X  
X--- 185,194 ----
X  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
X  
X  /* Different panel items. */
X! enum panel_type { LOAD_BUT, NEW_GAME_BUT, SAVE_BUT, SHOW_ALL_BUT,
X                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
X                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
X!                   PANEL_MES, EVAL_MES, SCORE_MES, TURN_MES } ;
X  
X  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
X  
X***************
X*** 187,192 ****
X--- 205,211 ----
X            int move ;
X            int moves_left ;
X            long note ;
X+           time_t timeleft ;
X  } BOARD ;
X  
X  struct iteminfo               /* Item information record. */
X***************
X*** 213,233 ****
X  void done(),               draw_button(),        draw_cycle() ;
X  void draw_cycle_item(),    draw_image(),         draw_line() ;
X  void draw_piece(),         draw_rect(),          draw_stencil() ;
X! void draw_text(),          draw_textfield(),     get_filename() ;
X  void get_options(),        get_xy(),             getparam() ;
X  void handle_board_event(), handle_event(),       handle_item() ;
X  void handle_key(),         init_canvas(),        init_edge_table() ;
X  void init_fonts(),         init_notes(),         init_player() ;
X  void initboard(),          initialise() ;
X! void last(),               load_colors(),        load_game() ;
X! void lock_screen() ;
X  void make_canvas(),        make_frame(),         make_icon() ;
X  void make_message(),       make_move(),          make_panel() ;
X! void message(),            nap_upto() ;
X! void new_game(),           process_event(),      quit() ;
X  void remove_textfield(),   save_game(),          set_cursor() ;
X  void set_cycle(),          set_display_types() ;
X  void set_timer(),          set_score(),          set_turn() ;
X  void show_suggestion(),    start_tool() ;
X  void suggest(),            think(),              undo() ;
X  void update_board_image(), usage(),              who_wins() ;
X--- 232,253 ----
X  void done(),               draw_button(),        draw_cycle() ;
X  void draw_cycle_item(),    draw_image(),         draw_line() ;
X  void draw_piece(),         draw_rect(),          draw_stencil() ;
X! void draw_text(),          draw_textfield() ;
X! void generate_graphics(),  get_filename() ;
X  void get_options(),        get_xy(),             getparam() ;
X  void handle_board_event(), handle_event(),       handle_item() ;
X  void handle_key(),         init_canvas(),        init_edge_table() ;
X  void init_fonts(),         init_notes(),         init_player() ;
X  void initboard(),          initialise() ;
X! void load_colors(),        load_game(),          lock_screen() ;
X  void make_canvas(),        make_frame(),         make_icon() ;
X  void make_message(),       make_move(),          make_panel() ;
X! void message(),            nap_upto(),           new_game() ;
X! void position_popup(),     process_event(),      quit() ;
X  void remove_textfield(),   save_game(),          set_cursor() ;
X  void set_cycle(),          set_display_types() ;
X  void set_timer(),          set_score(),          set_turn() ;
X+ void show_all(),           show_all_moves(),     show_last() ;
X  void show_suggestion(),    start_tool() ;
X  void suggest(),            think(),              undo() ;
X  void update_board_image(), usage(),              who_wins() ;
X
X------- tty.c -------
X*** /tmp/da28926	Fri Nov  9 10:40:00 1990
X--- tty.c	Mon Nov  5 09:08:40 1990
X***************
X*** 7,17 ****
X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X!  *  You are forbidden from using Reve as is, or in a modified state, in
X!  *  any tournaments, without the permission of the authors.
X   *
X   *  No responsibility is taken for any errors or inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X--- 7,22 ----
X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X!  *  Permission is also granted to copy this source, without the
X!  *  news headers, for the purposes of making an executable copy by
X!  *  means of compilation, provided that such copy will not be used
X!  *  for the purposes of competition in any othello tournaments, without
X!  *  prior permission from the authors.
X   *
X   *  No responsibility is taken for any errors or inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X***************
X*** 18,36 ****
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X! #include <stdio.h>
X! #include <strings.h>
X  #include <sys/ioctl.h>
X  #include <signal.h>
X  
X  #ifdef SYSV
X  #include <sgtty.h>
X  #endif /*SYSV*/
X  
X- #include "reve.h"
X- #include "color.h"
X- #include "extern.h"
X- 
X  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
X  
X  enum gr_type gtype = GTTY ;      /* Graphics type. */
X--- 23,41 ----
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X! #include "reve.h"
X! #include "color.h"
X! #include "extern.h"
X  #include <sys/ioctl.h>
X  #include <signal.h>
X  
X  #ifdef SYSV
X+ #include <string.h>
X  #include <sgtty.h>
X+ #else
X+ #include <strings.h>
X  #endif /*SYSV*/
X  
X  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
X  
X  enum gr_type gtype = GTTY ;      /* Graphics type. */
X***************
X*** 60,69 ****
X  } ;
X  
X  struct tty_info ttyvals[MAXITEMS] = {
X!       {  1,  1,  33,  33, },      /* Last */
X!       { 11,  1, 107,  33, },      /* Load */
X!       { 22,  1, 167,  33, },      /* New game */
X!       { 33,  1, 255,  33, },      /* Save */
X        { 44,  1, 318,  33, },      /* Suggest */
X        { 55,  1, 403,  33, },      /* Undo */
X        { -1, -1,  33,  75, },      /* Done   (not displayed). */
X--- 65,74 ----
X  } ;
X  
X  struct tty_info ttyvals[MAXITEMS] = {
X!       {  1,  1,  33,  33, },      /* Load */
X!       { 11,  1, 107,  33, },      /* New game */
X!       { 22,  1, 167,  33, },      /* Save */
X!       { 33,  1, 255,  33, },      /* Show all */
X        { 44,  1, 318,  33, },      /* Suggest */
X        { 55,  1, 403,  33, },      /* Undo */
X        { -1, -1,  33,  75, },      /* Done   (not displayed). */
X***************
X*** 85,94 ****
X  } ;
X  
X  struct other_info othervals[MAXITEMS] = {
X-       { -1, -1, },       /* Last     (ignored). */
X        { -1, -1, },       /* Load     (ignored). */
X        { -1, -1, },       /* New game (ignored). */
X        { -1, -1, },       /* Save     (ignored). */
X        { -1, -1, },       /* Suggest  (ignored). */
X        { -1, -1, },       /* Undo     (ignored). */
X        { -1, -1, },       /* Done     (ignored). */
X--- 90,99 ----
X  } ;
X  
X  struct other_info othervals[MAXITEMS] = {
X        { -1, -1, },       /* Load     (ignored). */
X        { -1, -1, },       /* New game (ignored). */
X        { -1, -1, },       /* Save     (ignored). */
X+       { -1, -1, },       /* Show all (ignored). */
X        { -1, -1, },       /* Suggest  (ignored). */
X        { -1, -1, },       /* Undo     (ignored). */
X        { -1, -1, },       /* Done     (ignored). */
X***************
X*** 346,353 ****
X      }
X    else if (x == 237 && y == 195)       /* Note message. */
X      {
X!       draw_string(othervals[(int) NOTES_MES].column,
X!                   othervals[(int) NOTES_MES].row, str, TRUE) ;
X        return ;
X      }
X    else if (x == 15 && y == 237)        /* Score message. */
X--- 351,358 ----
X      }
X    else if (x == 237 && y == 195)       /* Note message. */
X      {
X!       draw_string(othervals[(int) EVAL_MES].column,
X!                   othervals[(int) EVAL_MES].row, str, TRUE) ;
X        return ;
X      }
X    else if (x == 15 && y == 237)        /* Score message. */
X***************
X*** 371,378 ****
X      if (EQUAL(str, items[i].text))
X        if (ttyvals[i].column != -1)
X          {
X!                if (EQUAL(str, "load")) STRCPY(str, "Load") ;
X!           else if (EQUAL(str, "save")) STRCPY(str, "Save") ;
X            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
X            return ;
X          }
X--- 376,384 ----
X      if (EQUAL(str, items[i].text))
X        if (ttyvals[i].column != -1)
X          {
X!                if (EQUAL(str, "load"))     STRCPY(str, "Load") ;
X!           else if (EQUAL(str, "save"))     STRCPY(str, "Save") ;
X!           else if (EQUAL(str, "show all")) STRCPY(str, "show All") ;
X            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
X            return ;
X          }
X
X------- x11.c -------
X*** /tmp/da28929	Fri Nov  9 10:40:00 1990
X--- x11.c	Thu Nov  8 10:28:39 1990
X***************
X*** 7,17 ****
X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is given to distribute these sources, as long as the
X!  *  introductory messages are not removed, and no monies are exchanged.
X   *
X!  *  You are forbidden from using Reve as is, or in a modified state, in
X!  *  any tournaments, without the permission of the authors.
X   *
X   *  No responsibility is taken for any errors or inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X--- 7,22 ----
X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
X   *  All rights reserved.
X   *
X!  *  Permission is granted to copy this source, for redistribution
X!  *  in source form only, provided the news headers in "substantially
X!  *  unaltered format" are retained, the introductory messages are not
X!  *  removed, and no monies are exchanged.
X   *
X!  *  Permission is also granted to copy this source, without the
X!  *  news headers, for the purposes of making an executable copy by
X!  *  means of compilation, provided that such copy will not be used
X!  *  for the purposes of competition in any othello tournaments, without
X!  *  prior permission from the authors.
X   *
X   *  No responsibility is taken for any errors or inaccuracies inherent
X   *  either to the comments or the code of this program, but if reported
X***************
X*** 18,30 ****
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X- #include <stdio.h>
X- #include <strings.h>
X- #include <sys/time.h>
X  #include "reve.h"
X  #include "color.h"
X  #include "extern.h"
X  #include "images.h"
X  #include <X11/Xlib.h>
X  #include <X11/Xutil.h>
X  #include <X11/Xatom.h>
X--- 23,40 ----
X   *  (see README file), then an attempt will be made to fix them.
X   */
X  
X  #include "reve.h"
X  #include "color.h"
X  #include "extern.h"
X  #include "images.h"
X+ #include <sys/time.h>
X+ 
X+ #ifdef SYSV
X+ #include <string.h>
X+ #else
X+ #include <strings.h>
X+ #endif /*SYSV*/
X+ 
X  #include <X11/Xlib.h>
X  #include <X11/Xutil.h>
X  #include <X11/Xatom.h>
X***************
X*** 53,59 ****
X  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
X  Pixmap images[MAXIMAGES] ;
X  Pixmap no_pixmap ;
X! Pixmap load_color_icon(), load_image(), reve_icon ;
X  Window frame[MAXDPY], root[MAXDPY] ;
X  XClassHint class_hint = { "reve", "Reve" } ;
X  XColor BGcolor, FGcolor ;
X--- 63,69 ----
X  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
X  Pixmap images[MAXIMAGES] ;
X  Pixmap no_pixmap ;
X! Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
X  Window frame[MAXDPY], root[MAXDPY] ;
X  XClassHint class_hint = { "reve", "Reve" } ;
X  XColor BGcolor, FGcolor ;
X***************
X*** 62,68 ****
X  XSizeHints size ;
X  XWMHints wm_hints ;
X  XGCValues gc_val ;              /* Used to setup graphics context values. */
X- int cmap_loaded ;               /* Set if we've already loaded the colormap. */
X  int gc_flags ;                  /* Used to set up graphics context flags. */
X  int screen[MAXDPY] ;            /* Default graphics display screen. */
X  int xfd[MAXDPY] ;               /* Server connection file descriptors. */
X--- 72,77 ----
X***************
X*** 79,85 ****
X  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
X  fd_set readmask ;            /* Readmask used in select call. */
X  #endif /*NO_43SELECT*/
X! #endif /*NOSELECT*/
X  
X  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
X   *  used to convert between MSBFirst and LSBFirst image formats.
X--- 88,94 ----
X  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
X  fd_set readmask ;            /* Readmask used in select call. */
X  #endif /*NO_43SELECT*/
X! #endif /*!NOSELECT*/
X  
X  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
X   *  used to convert between MSBFirst and LSBFirst image formats.
X***************
X*** 221,227 ****
X  
X    d = (int) cur_dpyno ;
X    if (iscolor[d]) gc_val.foreground = palette[color] ;
X!   else            gc_val.foreground = foregnd[d] ;
X    gc_val.function = opvals[(int) op] ;
X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
X    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
X--- 230,240 ----
X  
X    d = (int) cur_dpyno ;
X    if (iscolor[d]) gc_val.foreground = palette[color] ;
X!   else
X!     {
X!       if (color == C_WHITE) gc_val.foreground = backgnd[d] ;
X!       else                  gc_val.foreground = foregnd[d] ;
X!     }
X    gc_val.function = opvals[(int) op] ;
X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
X    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
X***************
X*** 356,362 ****
X  #else
X    FD_ZERO(&fullmask) ;
X  #endif /*NO_43SELECT*/
X! #endif /*NOSELECT*/
X  
X    if (dtype == XTWO)
X      {
X--- 369,375 ----
X  #else
X    FD_ZERO(&fullmask) ;
X  #endif /*NO_43SELECT*/
X! #endif /*!NOSELECT*/
X  
X    if (dtype == XTWO)
X      {
X***************
X*** 364,370 ****
X        init_X(DPY2, XWHITE) ;
X      }
X    else init_X(DPY1, dtype) ;
X-   cmap_loaded = 0 ;
X    move_delta = 10 ;
X  
X    images[(int) BUT_STENCIL] = load_image(button_stencil_image) ;
X--- 377,382 ----
X***************
X*** 394,400 ****
X    u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
X    int d, i, numcolors ;
X  
X-   if (cmap_loaded) return ;
X    d = (int) cur_dpyno ;
X    iscolor[d] = 0 ;
X    if (DisplayCells(dpy[d], screen[d]) > 2)
X--- 406,411 ----
X***************
X*** 417,423 ****
X            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
X            exit(1) ;
X          }
X-       cmap_loaded = 1 ;
X      }
X  }
X  
X--- 428,433 ----
X***************
X*** 491,499 ****
X    opvals[(int) RSRC] = GXcopy ;
X    opvals[(int) RINV] = GXxor ;
X  
X!   load_colors() ;
X!   if (iscolor[d]) reve_icon = load_color_icon(cicon_image) ;
X!   else            reve_icon = load_image(icon_image) ;
X  
X    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
X    size.x = 0 ;
X--- 501,509 ----
X    opvals[(int) RSRC] = GXcopy ;
X    opvals[(int) RINV] = GXxor ;
X  
X!   if (!monochrome) load_colors() ;
X!   if (iscolor[d]) reve_icon[d] = load_color_icon(cicon_image) ;
X!   else            reve_icon[d] = load_image(icon_image) ;
X  
X    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
X    size.x = 0 ;
X***************
X*** 527,539 ****
X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
X           
X!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon,
X                           argv, argc, &size) ;
X  
X    wm_hints.icon_x = ix ;
X    wm_hints.icon_y = iy ;
X    wm_hints.input = True ;
X!   wm_hints.icon_pixmap = reve_icon ;
X    wm_hints.flags = InputHint | IconPixmapHint ;
X    if (iconic)
X      {    
X--- 537,549 ----
X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
X           
X!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon[d],
X                           argv, argc, &size) ;
X  
X    wm_hints.icon_x = ix ;
X    wm_hints.icon_y = iy ;
X    wm_hints.input = True ;
X!   wm_hints.icon_pixmap = reve_icon[d] ;
X    wm_hints.flags = InputHint | IconPixmapHint ;
X    if (iconic)
X      {    
X***************
X*** 587,593 ****
X  #else
X    FD_SET(xfd[d], &fullmask) ;
X  #endif /*NO_43SELECT*/
X! #endif /*NOSELECT*/
X  
X    return(dpy) ;
X  }
X--- 597,603 ----
X  #else
X    FD_SET(xfd[d], &fullmask) ;
X  #endif /*NO_43SELECT*/
X! #endif /*!NOSELECT*/
X  
X    return(dpy) ;
X  }
X***************
X*** 704,710 ****
X    for (;;)
X      {
X        get_event() ;          /* Get next canvas event. */
X-       process_event() ;      /* Find out what kind it is. */
X        handle_event() ;       /* And do the apropriate action. */
X      }
X  }
X--- 714,719 ----
X***************
X*** 713,728 ****
X  Xselect_input()
X  {
X    int fd = -1 ;              /* File descriptor with this event. */
X!   struct timeval tval ;      /* To set checking period. */
X  
X-   tval.tv_usec = 0 ;
X-   tval.tv_sec = 0 ;
X- 
X    for (;;)
X      {
X!       XSync(dpy[0], 0) ;
X!       if (dtype == XTWO) XSync(dpy[1], 0) ;
X! 
X  #ifdef NOSELECT
X        fd = 0 ;
X  #else
X--- 722,734 ----
X  Xselect_input()
X  {
X    int fd = -1 ;              /* File descriptor with this event. */
X! /**  static struct timeval tval = { 0, 0 } ; **/
X!   struct timeval *tval = NULL ;
X  
X    for (;;)
X      {
X!       XFlush(dpy[(int) DPY1]) ;
X!       XFlush(dpy[(int) DPY2]) ;
X  #ifdef NOSELECT
X        fd = 0 ;
X  #else
X***************
X*** 730,737 ****
X        readmask = fullmask ;
X  #ifdef NO_43SELECT
X        SELECT(32, &readmask, 0, 0, &tval) ;
X!            if (readmask && (1 << xfd)[0]) fd = 0 ;
X!       else if (readmask && (1 << xfd)[1]) fd = 1 ;
X  #else
X        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
X             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
X--- 736,743 ----
X        readmask = fullmask ;
X  #ifdef NO_43SELECT
X        SELECT(32, &readmask, 0, 0, &tval) ;
X!            if (readmask && (1 << xfd[0])) fd = 0 ;
X!       else if (readmask && (1 << xfd[1])) fd = 1 ;
X  #else
X        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
X             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
X***************
X*** 741,754 ****
X   
X        if (fd >= 0)
X          {
X!           cur_dpyno = (enum dpy_type) fd ;
X!           do
X              {
X!               get_event() ;            /* Get next canvas event. */
X!               process_event() ;        /* Find out what kind it is. */
X!               handle_event() ;         /* And do appropriate action. */
X              }             
X!           while (XPending(dpy[fd])) ;
X          }
X      }
X  }
X--- 747,767 ----
X   
X        if (fd >= 0)
X          {
X!           fd = 0 ;
X!           cur_dpyno = DPY1 ;
X!           while (XPending(dpy[fd]))
X              {
X!               get_event() ;                  /* Get next canvas event. */
X!               handle_event() ;               /* And do appropriate action. */
X              }             
X! 
X!           fd = 1 ;
X!           cur_dpyno = DPY2 ;
X!           while (XPending(dpy[fd]))
X!             {
X!               get_event() ;                  /* Get next canvas event. */
X!               handle_event() ;               /* And do appropriate action. */
X!             }             
X          }
X      }
X  }
X
X------- FILES -------
X*** /tmp/da28932	Fri Nov  9 10:40:01 1990
X--- FILES	Sat Nov  3 21:03:34 1990
X***************
X*** 33,38 ****
X--- 33,39 ----
X  reve.edge1                  - first half of the Reve edge stability table.
X  reve.edge2                  - second half of the Reve edge stability table.
X  Makefile.dist               - master Makefile used to build mp on Unix systems.
X+ Imakefile                   - Imakefile for the X11 version of reve.
X  
X  sunview.c                   - Sun SunView graphics routines.
X  tty.c                       - dumb tty "graphics" routines.
X
X------- MANIFEST -------
X*** /tmp/da28935	Fri Nov  9 10:40:02 1990
X--- MANIFEST	Sat Nov  3 21:04:35 1990
X***************
X*** 32,37 ****
X--- 32,38 ----
X  x11.c                                  |    4
X  xview.c                                |    4
X  sunview.c                              |    5
X+ Imakefile                              |    5
X  images/black.icon                      |    5
X  images/reve.icon                       |    5
X  images/reve.color.icon                 |    5
X
X------- reve.edge2 -------
X*** /tmp/da28938	Fri Nov  9 10:40:03 1990
X--- reve.edge2	Fri Oct 26 12:05:37 1990
X***************
X*** 549,555 ****
X  edges[2188] =     -80 [ -oooooo- ]
X  edges[2189] =    1304 [ xoooooo- ]
X  edges[2190] =   -1166 [ o-ooooo- ]
X! edges[2191] =      34 [ --ooooo- ]
X  edges[2192] =    1234 [ x-ooooo- ]
X  edges[2193] =    1434 [ oxooooo- ]
X  edges[2194] =     -36 [ -xooooo- ]
X--- 549,555 ----
X  edges[2188] =     -80 [ -oooooo- ]
X  edges[2189] =    1304 [ xoooooo- ]
X  edges[2190] =   -1166 [ o-ooooo- ]
X! edges[2191] =     100 [ --ooooo- ]
X  edges[2192] =    1234 [ x-ooooo- ]
X  edges[2193] =    1434 [ oxooooo- ]
X  edges[2194] =     -36 [ -xooooo- ]
X***************
X*** 1275,1281 ****
X  edges[2914] =      36 [ -xxxxxo- ]
X  edges[2915] =    6511 [ xxxxxxo- ]
X  edges[2916] =   -6441 [ oooooo-- ]
X! edges[2917] =      34 [ -ooooo-- ]
X  edges[2918] =    1234 [ xooooo-- ]
X  edges[2919] =   -1236 [ o-oooo-- ]
X  edges[2920] =     -36 [ --oooo-- ]
X--- 1275,1281 ----
X  edges[2914] =      36 [ -xxxxxo- ]
X  edges[2915] =    6511 [ xxxxxxo- ]
X  edges[2916] =   -6441 [ oooooo-- ]
X! edges[2917] =     100 [ -ooooo-- ]
X  edges[2918] =    1234 [ xooooo-- ]
X  edges[2919] =   -1236 [ o-oooo-- ]
X  edges[2920] =     -36 [ --oooo-- ]
X
X
END_OF_FILE
if test 48717 -ne `wc -c <'patches01c'`; then
    echo shar: \"'patches01c'\" unpacked with wrong size!
fi
# end of 'patches01c'
fi
echo shar: End of archive 3 \(of 4\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 4 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0