home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / games / gnugo / c / exambord < prev    next >
Encoding:
Text File  |  1995-03-11  |  2.3 KB  |  97 lines

  1. /*
  2.                 GNU GO - the game of Go (Wei-Chi)
  3.                 Version 1.1   last revised 3-1-89
  4.            Copyright (C) Free Software Foundation, Inc.
  5.                       written by Man L. Li
  6.                       modified by Wayne Iba
  7.                     documented by Bob Webber
  8. */
  9. /*
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation - version 1.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License in file COPYING for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. Please report any bug/fix, modification, suggestion to
  24.  
  25. mail address:   Man L. Li
  26.                 Dept. of Computer Science
  27.                 University of Houston
  28.                 4800 Calhoun Road
  29.                 Houston, TX 77004
  30.  
  31. e-mail address: manli@cs.uh.edu         (Internet)
  32.                 coscgbn@uhvax1.bitnet   (BITNET)
  33.                 70070,404               (CompuServe)
  34. */
  35. #include "header.h"
  36. #include <stdio.h>
  37.  
  38. int mik,mjk,uik,ujk;
  39.  
  40. void examboard(color)
  41. /* examine pieces */
  42. int color;
  43.   {
  44.    int i, j, n;
  45.  
  46.  
  47. /* find liberty of each piece */
  48.    eval(color);
  49.  
  50. /* initialize piece captured */
  51.    if (color == mymove)
  52.      {
  53.       mik = -1;
  54.       mjk = -1;
  55.     }
  56.    else
  57.      {
  58.       uik = -1;
  59.       ujk = -1;
  60.     }
  61.    n = 0; /* The number of captures this move for Ko purposes */
  62.  
  63. /* remove all piece of zero liberty */
  64.    for (i = 0; i < 19; i++)
  65.      for (j = 0; j < 19; j++)
  66.        if ((p[i][j] == color) && (l[i][j] == 0))
  67.      {
  68.       p[i][j] = EMPTY;
  69. /* record piece captured */
  70.       if (color == mymove)
  71.         {
  72.          mik = i;
  73.          mjk = j;
  74.          ++mk;
  75.        }
  76.       else
  77.         {
  78.          uik = i;
  79.          ujk = j;
  80.          ++uk;
  81.        }
  82.       ++n;  /* increment number of captures on this move */
  83.     }
  84. /* reset to -1 if more than one stone captured since  no Ko possible */
  85.    if (color == mymove && n > 1)
  86.      {
  87.        mik = -1;   
  88.        mjk = -1;
  89.      }
  90.    else if ( n > 1 )
  91.      {
  92.        uik = -1;
  93.        ujk = -1;
  94.      }
  95. }  /* end examboard */
  96.  
  97.