home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / MacGnuGo 0.5e / gnugo.src / eval.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-06  |  584 b   |  29 lines  |  [TEXT/R*ch]

  1. #include "comment.header"
  2.  
  3. extern unsigned char p[19][19], l[19][19];
  4. extern int lib, MAXX, MAXY;
  5. extern void countlib(int i, int j, int color);
  6.  
  7. void eval(int color)
  8.      /* evaluate liberty of color pieces */
  9. {
  10.   int i, j;
  11.   
  12.   /* find liberty of each piece */
  13.   for (i = 0; i < MAXX; i++)
  14.     for (j = 0; j < MAXY; j++)
  15.       if (p[i][j] == color)
  16.     {
  17.       lib = 0;
  18.       countlib(i, j, color);
  19.       l[i][j] = lib;
  20.     }
  21. #ifdef debug
  22.   for (i = 0; i < MAXX; i++) {
  23.     for (j = 0; j < MAXY; j++) printf("%2d ",l[MAXX-i-1][j]);
  24.     putchar('\n');
  25.   }
  26.   putchar('\n');
  27. #endif
  28. }  /* end eval */
  29.