gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] Cleanup patch


From: Inge Wallin
Subject: [gnugo-devel] Cleanup patch
Date: Sat, 2 Feb 2002 13:58:02 +0100 (MET)

I have started to go trough all the source files systematically to fix
all remaining 1D issues in comments and code.  Here is a patch in that
series.

Summary:
 - cleanup of clock.c, filllib.c, fuseki.c, genmove.c, globals.c,
   gnugo.h, hash.h, printutils.c, reading.c, showbord.c, utils.c,
   worm.c
 - New function gfprintf in printutils.c

        -Inge

diff -ur gnugo/engine/clock.c gnugo-iw/engine/clock.c
--- gnugo/engine/clock.c        Fri Feb  1 19:02:19 2002
+++ gnugo-iw/engine/clock.c     Sat Feb  2 00:34:47 2002
@@ -42,18 +42,19 @@
 #include "clock.h"
 
 /* parameters */
-#define CLOCK_MAX_MOVES 500 /* max number of moves for a game */
-#define CLOCK_STEP 0.4  /* modification step for level */
-#define CLOCK_HURRY 10   /* Last chance limit: */
-#define CLOCK_HURRYR 0.02 /* (10 sec or or 2% of main_time) */
-#define CLOCK_HURRY_LEVEL 1 /* Last chance level: */
-#define CLOCK_SAFE  300   /* Keep Ahead limit: */
-#define CLOCK_SAFER 0.20 /* (5min or 20% of time) */
-#define CLOCK_DELTA  10  /* Maximal time difference: */
-#define CLOCK_DELTAR 0.10 /* 10sec or 10% of left time */
-#define CLOCK_TIME_CONTRACT 0.75 /* 75% of time to play */
-#define CLOCK_MOVE_CONTRACT(b) (((b)*(b))/2)
-#define CLOCK_CONTRACT_MIN_LEVEL 5
+#define CLOCK_MAX_MOVES           500   /* max number of moves for a game */
+#define CLOCK_STEP                0.4   /* modification step for level */
+#define CLOCK_HURRY               10    /* Last chance limit: */
+#define CLOCK_HURRYR              0.02  /* (10 sec or or 2% of main_time) */
+#define CLOCK_HURRY_LEVEL         1     /* Last chance level: */
+#define CLOCK_SAFE                300   /* Keep Ahead limit: */
+#define CLOCK_SAFER               0.20  /* (5min or 20% of time) */
+#define CLOCK_DELTA               10    /* Maximal time difference: */
+#define CLOCK_DELTAR              0.10  /* 10sec or 10% of left time */
+#define CLOCK_TIME_CONTRACT       0.75  /* 75% of time to play */
+#define CLOCK_MOVE_CONTRACT(b)    (((b)*(b))/2)
+#define CLOCK_CONTRACT_MIN_LEVEL  5
+
 
 /*************************/
 /* Datas and other stuff */
@@ -64,30 +65,30 @@
 typedef struct {
 
   /* clock parameters */
-  int clock_on;
-  int ready;
-  double main_time;
-  double byoyomi_time; /* zero if no byo-yomi */
-  int byoyomi_stones;
+  int     clock_on;
+  int     ready;
+  double  main_time;
+  double  byoyomi_time; /* zero if no byo-yomi */
+  int     byoyomi_stones;
 
   /* clock status */
-  double timer[3];
-  double btimer[3];
-  int byoyomi[3];
-  int dead[3];
+  double  timer[3];
+  double  btimer[3];
+  int     byoyomi[3];
+  int     dead[3];
 
   /* dates of each move */
-  int moveno; /* invariant: COLOR(clk.moveno) = color of last move */
-  double date[CLOCK_MAX_MOVES];
+  int     moveno; /* invariant: COLOR(clk.moveno) = color of last move */
+  double  date[CLOCK_MAX_MOVES];
 
   /* adapative system parameters */
-  int autolevel_on;
-  double min_level;
-  double level;
-  double levels[CLOCK_MAX_MOVES];
-  double expected[CLOCK_MAX_MOVES];
-  double max_level;
-  double error; /* time/move estimation error */
+  int     autolevel_on;
+  double  min_level;
+  double  level;
+  double  levels[CLOCK_MAX_MOVES];
+  double  expected[CLOCK_MAX_MOVES];
+  double  max_level;
+  double  error; /* time/move estimation error */
 } gnugo_clock;
 
 static gnugo_clock clk;
@@ -96,7 +97,7 @@
  *   WHITE : odd moves
  *   BLACK : even moves. 
  */
-#define COLOR(m) ((m) % 2 ? WHITE : BLACK)
+#define COLOR(m)  ((m) % 2 ? WHITE : BLACK)
 
 
 static const char *pname[3] = {"     ", "White", "Black"};
@@ -112,15 +113,15 @@
 /* Echo a time value in STANDARD format */
 
 static void
-timeval_print(FILE* f, double tv)
+timeval_print(FILE* outfile, double tv)
 {
-  int min;
-  double sec;
+  int     min;
+  double  sec;
 
   min = (int) tv / 60;
   sec = tv - min*60;
 
-  fprintf(f, "%3dmin %.2fsec ", min, sec);
+  fprintf(outfile, "%3dmin %.2fsec ", min, sec);
 }
 
 /******************************/
@@ -130,13 +131,13 @@
 
 /*
  * Initialize the structure.
- * -1 mean "do not modify this value".
- * clock_init(-1, -1, -1) only reset the clock.
+ * -1 means "do not modify this value".
+ * clock_init(-1, -1, -1) only resets the clock.
  */
 void
 clock_init(int time, int byo_time, int byo_stones)
 {
-  int color;
+  int  color;
 
   if (time > 0) {
     clk.main_time = time;
@@ -158,6 +159,7 @@
   }
 }
 
+
 /*
  * Activate the clock.
  */
@@ -188,12 +190,12 @@
   clk.autolevel_on = 1;
 }
 
+
 /***********************/
 /*  Access functions.  */
 /***********************/
 
 
-
 /* 
  * Maintain timers and all stuff up to date
  * (used by push_button).
@@ -207,17 +209,17 @@
   if (clk.byoyomi[color])
     clk.btimer[color] = clk.btimer[color] + dt;
  
-  /* check if player is just begining byoyomi */
+  /* Check if player is just begining byoyomi. */
   if (clk.timer[color] < clk.main_time && !clk.byoyomi[color]) {
     clk.byoyomi[color] = clk.moveno;
     clk.btimer[color] = dt;
   }
   
-  /* check if player is time-out. */
+  /* Check if player is time-out. */
   clk.dead[color] |= (clock_is_byoyomi(color)
                      && clk.byoyomi_time < clk.btimer[color]);
 
-  /* check byoyomi period reset */
+  /* Check byoyomi period reset. */
   if (clk.byoyomi[color]
       && clk.moveno - clk.byoyomi[color] == 2 * clk.byoyomi_stones - 1) {
     clk.byoyomi[color] = clk.moveno;
@@ -225,13 +227,14 @@
   }
 }
 
+
 /*
  * Update the clock.
  */
 void
 clock_push_button(int color)
 {
-  double now, dt, tme;
+  double  now, dt, tme;
 
   if (!clk.clock_on)
     return;
@@ -239,10 +242,8 @@
   now = gg_gettimeofday();
   gg_assert(clk.ready);
 
-  
   /* time/move estimation */
   tme = estimate_time_by_move(color, clk.moveno);
-  
 
   /* first move */
   if (clk.moveno == -1) {
@@ -260,22 +261,22 @@
   /* fprintf(stderr, "clock: %s push the button.\n", pname[color]);*/
   /* fprintf(stderr, "clock: %s's turn.\n", pname[COLOR(clk.moveno+1)]);*/
 
-  /* push twice on the button does nothing */
+  /* Pushing twice on the button does nothing. */
   if (color != COLOR(clk.moveno+1)) {
     fprintf(stderr, "clock: double push.\n");
     return;
   }
 
-  /* other moves (clk. moveno > -1) */
+  /* Other moves (clk. moveno > -1) */
   clk.moveno++;
   gg_assert(clk.moveno < CLOCK_MAX_MOVES);
   clk.date[clk.moveno] = now;
 
-  /* update main timer */
+  /* Update main timer. */
   dt = clk.date[clk.moveno] - clk.date[clk.moveno - 1];
   clk.timer[color] += dt;
 
-  /* estimate prediction error for next move */
+  /* Estimate prediction error for next move. */
   if (clk.moveno > 11)
     clk.error = (clk.error + 2 * gg_abs(dt-tme))/3;
   else
@@ -305,18 +306,18 @@
     return;
   }
 
-  /* update main timer */
+  /* Update main timer. */
   dt = clk.date[clk.moveno] - clk.date[clk.moveno - 1];
   clk.timer[color] -= dt;
   clk.moveno--;
 
-  /* check if back from byoyomi */
+  /* Check if back from byoyomi. */
   if (clk.timer[color] < clk.main_time) {
     clk.byoyomi[color] = 0;
     clk.btimer[color] = 0;
   }
      
-  /* update byoyomi timer */
+  /* Update byoyomi timer. */
   if (clk.byoyomi[color])
     clk.btimer[color] -= dt;
 
@@ -364,7 +365,7 @@
 
 
 /*
- * return the (exact) main timer value.
+ * Return the (exact) main timer value.
  */
 double
 clock_get_btimer(int color)
@@ -447,9 +448,9 @@
 
 
 
-/* write the time/move to f */
+/* Write the time/move to outfile */
 void 
-clock_report_autolevel(FILE *f, int color)
+clock_report_autolevel(FILE *outfile, int color)
 {
   int i, first;
   double dt, est, exp;
@@ -457,13 +458,13 @@
   if (!clk.autolevel_on)
     return;
 
-  if (f == NULL)
-    f = fopen("autolevel.dat", "w");
-  if (f == NULL)
+  if (outfile == NULL)
+    outfile = fopen("autolevel.dat", "w");
+  if (outfile == NULL)
     return;
 
-  fprintf(f, "#\n#  level  prediction   expected  time/move\n");  
-  fprintf(f, "#-----------------------------------------\n"); 
+  fprintf(outfile, "#\n#  level  prediction   expected  time/move\n");  
+  fprintf(outfile, "#-----------------------------------------\n"); 
 
   if (color == WHITE)
     first = 8;
@@ -474,7 +475,7 @@
     dt = clk.date[i+1] - clk.date[i];
     est = estimate_time_by_move(color, i);
     exp = clk.expected[i + 1];
-    fprintf(f, "%5.2f  %5.2f  %5.2f  %5.2f\n",
+    fprintf(outfile, "%5.2f  %5.2f  %5.2f  %5.2f\n",
            clk.levels[i + 1], est, exp, dt);
   }
 }
@@ -503,7 +504,7 @@
   gg_assert(COLOR(move) == OTHER_COLOR(color));
 
   res = 0;
-  for (i = 0 ; i != 5 ; i++)
+  for (i = 0 ; i < 5 ; i++)
     res += coef[i] * (clk.date[move-9+i] - clk.date[move-10+i]);
   
   return res;
@@ -583,8 +584,7 @@
 
 
 /* 
- * Modify the level during a game to avoid loosing by
- * time.
+ * Modify the level during a game to avoid loosing by time.
  */
 void
 clock_adapt_level(int *p_level, int color)
@@ -606,8 +606,7 @@
   
   /* 
    * Hurry strategy:
-   * behind this limit the only priority is 
-   * finish at all costs.
+   * Behind this limit the only priority is finish at all costs.
    */
   hurry_limit = gg_max(CLOCK_HURRY, CLOCK_HURRYR * clk.main_time);
   if (clock_get_time_left(color) < hurry_limit) {
@@ -626,14 +625,13 @@
 
   /* 
    * Keep ahead strategy:
-   * when the safe_limit is reached gnugo tries to keep
-   * ahead in time.
+   * When the safe_limit is reached gnugo tries to keep ahead in time.
    */
   safe_limit = gg_max(CLOCK_SAFE, CLOCK_SAFER * clk.main_time);
   if (clock_get_time_left(color) < safe_limit) 
     keep_ahead(color);
 
-  /* Update the level */
+  /* Update the level. */
   if (clk.level > clk.max_level)
     clk.level = clk.max_level;
   if (clk.level < clk.min_level)
diff -ur gnugo/engine/filllib.c gnugo-iw/engine/filllib.c
--- gnugo/engine/filllib.c      Sun Jan 20 19:58:10 2002
+++ gnugo-iw/engine/filllib.c   Sat Feb  2 00:33:19 2002
@@ -203,11 +203,11 @@
          return 1;
        }
        else if (defense_point != NO_MOVE) {
-         /* Safety not confirmed because the move at (m, n) would set
-           * up a double threat. (di, dj) is assumed to defend against
-           * this threat.
+         /* Safety not confirmed because the move at (pos) would set
+           * up a double threat. (defense_point) is assumed to defend
+           * against this threat.
           *
-          * FIXME: We should verify that (di, dj) really is effective.
+          * FIXME: We should verify that (defense_point) really is effective.
           */
          DEBUG(DEBUG_FILLLIB,
                "Filllib: Safety not confirmed, but %1m defends.\n",
@@ -449,7 +449,6 @@
       }
     }
   }
-
 
   if (found_one) {
   
diff -ur gnugo/engine/fuseki.c gnugo-iw/engine/fuseki.c
--- gnugo/engine/fuseki.c       Sun Dec 16 22:51:42 2001
+++ gnugo-iw/engine/fuseki.c    Sat Feb  2 00:33:19 2002
@@ -22,7 +22,6 @@
 
 
 
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -32,6 +31,7 @@
 
 #include "sgftree.h"
 
+
 /* Pointless to do fuseki database pattern matching after this number
  * of stones have been placed on the board.
  *
@@ -41,6 +41,7 @@
  */
 #define MAX_FUSEKI_DATABASE_STONES 19
 
+
 #define UPPER_LEFT  0
 #define UPPER_RIGHT 1
 #define LOWER_LEFT  2
@@ -56,19 +57,21 @@
 static int 
 openregion(int i1, int i2, int j1, int j2)
 {
- int x, y;
+  int x, y;
 
- if (i1 > i2)
-   return openregion(i2, i1, j1, j2);
- if (j1 > j2)
-   return openregion(i1, i2, j2, j1);
- for (x = i1; x <= i2; x++)
-     for (y = j1; y <= j2; y++)
-       if (BOARD(x, y) != EMPTY)
-        return 0;
- return 1;
+  if (i1 > i2)
+    return openregion(i2, i1, j1, j2);
+  if (j1 > j2)
+    return openregion(i1, i2, j2, j1);
+
+  for (x = i1; x <= i2; x++)
+    for (y = j1; y <= j2; y++)
+      if (BOARD(x, y) != EMPTY)
+       return 0;
+  return 1;
 }
 
+
 /* The corner moves. */
 
 static int corners[][2] =
@@ -243,7 +246,7 @@
     return 0;
 
   /* Choose randomly with respect to relative weights for matched moves. */
-  /* do not choose moves with less value than 20% of the best move */
+  /* Do not choose moves with less value than 20% of the best move */
   best_fuseki_value = fuseki_value[0];
   q = gg_rand() % fuseki_total_value;
   for (k = 0; k < num_fuseki_moves; k++) {
diff -ur gnugo/engine/genmove.c gnugo-iw/engine/genmove.c
--- gnugo/engine/genmove.c      Fri Feb  1 19:02:20 2002
+++ gnugo-iw/engine/genmove.c   Sat Feb  2 00:33:19 2002
@@ -28,6 +28,7 @@
 #include "liberty.h"
 #include "sgftree.h"
 
+
 /* Return one if x doesn't equal position_number and 0 otherwise.
  * After using this macro x will always have the value
  * position_number.
@@ -38,8 +39,8 @@
 static int do_genmove(int *move, int color, float pure_threat_value);
 
 static double slowest_time = 0.;
-static int slowest_move = NO_MOVE;
-static int slowest_movenum = 0;
+static int    slowest_move = NO_MOVE;
+static int    slowest_movenum = 0;
 static double total_time = 0.;
 
 /* Position numbers for which various examinations were last made. */
@@ -213,6 +214,7 @@
     /* Find out information about the worms and dragons. */
     examine_position(color, EXAMINE_ALL);
     compute_initial_influence(OTHER_COLOR(color), 1);
+
     /* The coefficients should match those close to the end of
      * estimate_influence_value() in move_reasons.c.
      */
@@ -366,6 +368,7 @@
        gprintf("\nScore estimate: %s %f to %s %f\n",
                lower_bound > 0 ? "W " : "B ", gg_abs(lower_bound),
                upper_bound > 0 ? "W " : "B ", gg_abs(upper_bound));
+      fflush(stderr);
     }
     time_report(1, "estimate score", NO_MOVE, 1.0);
 
diff -ur gnugo/engine/globals.c gnugo-iw/engine/globals.c
--- gnugo/engine/globals.c      Fri Feb  1 19:02:20 2002
+++ gnugo-iw/engine/globals.c   Sat Feb  2 00:33:19 2002
@@ -70,9 +70,9 @@
 int mandated_backfill_depth;    /* deep reading cut off, mandated value */
 int mandated_backfill2_depth;   /* deep reading cut off, mandated value */
 int mandated_superstring_depth; /* deep reading cut off, mandated value */
-int mandated_fourlib_depth;   /* deep reading cut off, mandated value */
-int mandated_ko_depth;        /* deep reading cut off, mandated value */
-int mandated_branch_depth;    /* deep reading cut off, mandated value */
+int mandated_fourlib_depth;     /* deep reading cut off, mandated value */
+int mandated_ko_depth;          /* deep reading cut off, mandated value */
+int mandated_branch_depth;      /* deep reading cut off, mandated value */
 int mandated_aa_depth;
 int mandated_aa_threat_depth = -1;
 int mandated_owl_distrust_depth;  
@@ -116,7 +116,7 @@
 int chinese_rules       = 0;    /* ruleset choice for GMP connection */
 /* use experimental semeai module */
 int experimental_semeai = EXPERIMENTAL_SEMEAI;
-int semeai_variations = DEFAULT_SEMEAI_VARIATIONS;
+int semeai_variations   = DEFAULT_SEMEAI_VARIATIONS;
 /* use experimental connection module */
 int experimental_connections = EXPERIMENTAL_CONNECTIONS;
 /* use alternate connection reading algorithm */
@@ -131,7 +131,7 @@
 int play_out_aftermath  = 0;    /* make everything unconditionally settled */
 
 float best_move_values[10];
-int best_moves[10];
+int   best_moves[10];
 
 /* Various statistics are collected here. */
 struct stats_data stats;
diff -ur gnugo/engine/gnugo.h gnugo-iw/engine/gnugo.h
--- gnugo/engine/gnugo.h        Fri Feb  1 19:02:21 2002
+++ gnugo-iw/engine/gnugo.h     Sat Feb  2 00:33:19 2002
@@ -300,6 +300,7 @@
 extern int mandated_owl_reading_depth;
 extern int mandated_owl_node_limit; 
 
+/* Keep this as 2D until we change the entire API. */
 extern float potential_moves[MAX_BOARD][MAX_BOARD];
 
 extern volatile int time_to_die;   /* set by signal handlers */
@@ -328,9 +329,10 @@
 /* printutils.c */
 void gprintf(const char *fmt, ...);
 void mprintf(const char *fmt, ...);
+void gfprintf(FILE *outfile, const char *fmt, ...);
 const char *color_to_string(int color);
 const char *location_to_string(int pos);
-void location_to_buffer(int pos, char *buf);
+void        location_to_buffer(int pos, char *buf);
 const char *status_to_string(int status);
 const char *safety_to_string(int status);
 const char *result_to_string(int result);
diff -ur gnugo/engine/hash.c gnugo-iw/engine/hash.c
--- gnugo/engine/hash.c Sun Dec 16 22:51:45 2001
+++ gnugo-iw/engine/hash.c      Sat Feb  2 00:33:19 2002
@@ -61,6 +61,7 @@
 {
   int i;
   Hashvalue h = 0;
+
   for (i = 0; 32*i < (int) (CHAR_BIT*sizeof(Hashvalue)); i++)
     h |= (Hashvalue) gg_urand() << 32*i;
 
@@ -154,15 +155,14 @@
 {
   int i;
 
-  fprintf(outfile, "Board:  ");
+  gfprintf(outfile, "Board:  ");
   for (i = 0; i < (int) COMPACT_BOARD_SIZE; ++i)
-     fprintf(outfile, " %lx", (unsigned long) pos->board[i]);
+    gfprintf(outfile, " %lx", (unsigned long) pos->board[i]);
 
   if (pos->ko_pos == 0)
-    fprintf(outfile, "  No ko");
+    gfprintf(outfile, "  No ko");
   else
-    fprintf(outfile, "  Ko position: (%d, %d)",
-           I(pos->ko_pos), J(pos->ko_pos));
+    gfprintf(outfile, "  Ko position: %1m", pos->ko_pos);
 }
 
 
@@ -222,7 +222,7 @@
     }
 
     if (!bits) {
-      /* this means the bit fell off the left side */
+      /* This means the bit fell off the left side. */
       bits = 1;
       index++;
       if (index < COMPACT_BOARD_SIZE)
@@ -384,12 +384,10 @@
   if (hd1->hashpos.ko_pos == 0 && hd2->hashpos.ko_pos == 0)
     fprintf(stderr, "\nNo ko\n");
   else if (hd1->hashpos.ko_pos == hd2->hashpos.ko_pos)
-    fprintf(stderr, "\nEqual Ko position:[%c%d]\n",
-           letter[I(hd1->hashpos.ko_pos)], J(hd1->hashpos.ko_pos));
+    gfprintf(stderr, "\nEqual Ko position:[%1m]\n", hd1->hashpos.ko_pos);
   else
-    fprintf(stderr, "\nDifferent Ko position:[%c%d] <==> [%c%d]\n",
-           letter[I(hd1->hashpos.ko_pos)], J(hd1->hashpos.ko_pos),
-           letter[I(hd2->hashpos.ko_pos)], J(hd2->hashpos.ko_pos));
+    gfprintf(stderr, "\nDifferent Ko position:[%1m] <==> [%1m]\n",
+           hd1->hashpos.ko_pos, hd2->hashpos.ko_pos);
 
   fprintf(stderr, "Total [%d,%d,%d,%d]",
          count1[0], count1[1], count1[2], count1[3]);
diff -ur gnugo/engine/liberty.h gnugo-iw/engine/liberty.h
--- gnugo/engine/liberty.h      Fri Feb  1 19:02:22 2002
+++ gnugo-iw/engine/liberty.h   Sat Feb  2 00:33:19 2002
@@ -369,8 +369,7 @@
 int owl_proper_eye(int apos, int bpos);
 void owl_reasons(int color);
 
-void unconditional_life(int unconditional_territory[MAX_BOARD][MAX_BOARD],
-                       int color);
+void unconditional_life(int unconditional_territory[BOARDMAX], int color);
 void find_superstring(int str, int *num_stones, int *stones);
 void find_superstring_liberties(int str, int *liberties, int *libs,
                                 int liberty_cap);
diff -ur gnugo/engine/movelist.c gnugo-iw/engine/movelist.c
--- gnugo/engine/movelist.c     Wed Dec  5 19:49:38 2001
+++ gnugo-iw/engine/movelist.c  Sat Feb  2 00:33:19 2002
@@ -27,11 +27,11 @@
 
 #include "liberty.h"
 
+
 static void movelist_sort_points(int max_points, int points[], int codes[]);
 static void swap_points_and_codes(int points[], int codes[], int m, int n);
 
 
-
 /* Return the code for the move if it is known.
  */
 int
@@ -66,7 +66,7 @@
     if (points[k] == move)
       break;
 
-  /* Yes, we did. */
+  /* Yes, we do. */
   if (k < max_points) {
     if (codes[k] <= code)
       return; /* Old news. */
diff -ur gnugo/engine/printutils.c gnugo-iw/engine/printutils.c
--- gnugo/engine/printutils.c   Fri Feb  1 19:02:30 2002
+++ gnugo-iw/engine/printutils.c        Sat Feb  2 00:33:19 2002
@@ -160,6 +160,20 @@
 
 
 /*
+ * required wrapper around vgprintf, writes to outfile.
+ */
+
+void 
+gfprintf(FILE *outfile, const char *fmt, ...)
+{
+  va_list ap;
+  va_start(ap, fmt);
+  vgprintf(outfile, fmt, ap);
+  va_end(ap);
+}
+
+
+/*
  * required wrapper around vgprintf, writes to stderr.
  */
 
diff -ur gnugo/engine/reading.c gnugo-iw/engine/reading.c
--- gnugo/engine/reading.c      Fri Feb  1 19:02:47 2002
+++ gnugo-iw/engine/reading.c   Sat Feb  2 00:33:19 2002
@@ -820,7 +820,7 @@
 /* ---------------------------------------------------------------- */
 
 
-/* Return up to max_threats threats to capture the string at pos.
+/* Return up to max_threats threats to capture the string at str.
  * If the string is directly attackable the number of threats
  * is reported to be 0.
  *
@@ -830,11 +830,11 @@
  *        yourself.
  *
  * FIXME: Shall we report upgrades, like we can capture in ko but
- *        have a threat to capture unconditionally.
+ *        have a threat to capture unconditionally?
  */
 
 int
-attack_threats(int pos, int max_points, int moves[], int codes[])
+attack_threats(int str, int max_points, int moves[], int codes[])
 {
   int other;
   int num_threats;
@@ -846,12 +846,12 @@
   int l;
   int r;
 
-  ASSERT1(IS_STONE(board[pos]), pos);
-  other = OTHER_COLOR(board[pos]);
+  ASSERT1(IS_STONE(board[str]), str);
+  other = OTHER_COLOR(board[str]);
 
   /* Only handle strings with no way to capture immediately.
    * For now, we treat ko the same as unconditionally. */
-  if (attack(pos, NULL) != 0)
+  if (attack(str, NULL) != 0)
     return 0;
 
   /* This test would seem to be unnecessary since we only threaten
@@ -861,14 +861,14 @@
    *
    * The test against 6 liberties is just an optimization.
    */
-  liberties = findlib(pos, MAXLIBS, libs);
+  liberties = findlib(str, MAXLIBS, libs);
   if (liberties > 1 && liberties < 6) {
     for (k = 0; k < liberties; k++) {
       int aa = libs[k];
 
       /* Try to threaten on the liberty. */
-      if (trymove(aa, other, "attack_threats-A", pos, EMPTY, NO_MOVE)) {
-       int acode = attack(pos, NULL);
+      if (trymove(aa, other, "attack_threats-A", str, EMPTY, NO_MOVE)) {
+       int acode = attack(str, NULL);
        if (acode != 0)
         movelist_change_point(aa, acode, max_points, moves, codes);
        popgo();
@@ -880,11 +880,11 @@
 
        if (!ON_BOARD(bb)
            || IS_STONE(board[bb])
-           || liberty_of_string(bb, pos))
+           || liberty_of_string(bb, str))
          continue;
 
-       if (trymove(bb, other, "attack_threats-B", pos, EMPTY, NO_MOVE)) {
-         int acode = attack(pos, NULL);
+       if (trymove(bb, other, "attack_threats-B", str, EMPTY, NO_MOVE)) {
+         int acode = attack(str, NULL);
          if (acode != 0)
           movelist_change_point(bb, acode, max_points, moves, codes);
          popgo();
@@ -894,48 +894,49 @@
   }
 
   /* Threaten to attack by saving weak neighbors. */
-  num_adj = chainlinks(pos, adjs);
+  num_adj = chainlinks(str, adjs);
   for (k = 0; k < num_adj; k++) {
     int bb;
     int dd;  /* Defense point of weak neighbor. */
     int acode;
     int dcode;
+
     attack_and_defend(adjs[k], &acode, NULL, &dcode, &dd);
-    if (acode != 0 && dcode != 0) {
-      for (r = -1; r < max_points; r++) {
-       /* -1 is used only when stackp > 0. */
-       if (stackp > 0) {
-         if (r == -1)
-           bb = dd;
-         else
-           break;
-       }
-       else {
-         if (r == -1)
-           continue;
-         if (worm[adjs[k]].defend_codes[r] == 0)
-           break;
-         bb = worm[adjs[k]].defense_points[r];
-       }
-       
-       if (trymove(bb, other, "attack_threats-C", pos, EMPTY, NO_MOVE)) {
-         if (board[pos] == EMPTY)
-           acode = WIN;
-         else
-           acode = attack(pos, NULL);
-         if (acode != 0)
-           movelist_change_point(bb, acode, max_points, moves, codes);
-         popgo();
-       }
+    if (acode == 0 || dcode == 0)
+      continue;
+
+    /* The strange code using r == -1 below is only avoid duplication
+     * of the code starting with "if (trymove..)" below.
+     * If r == -1 and stackp == 0 then use defense point what we got from
+     * attack_and_defend above.  Otherwise step through all defense points.
+     */
+    for (r = -1; r < max_points; r++) {
+      if (stackp == 0) {
+       if (r == -1)
+         continue;
+       if (worm[adjs[k]].defend_codes[r] == 0)
+         break;
+       bb = worm[adjs[k]].defense_points[r];
+      }
+      else {
+       if (r == -1)
+         bb = dd;
+       else
+         break;
+      }
+
+      /* Test the move and see if it is a threat. */
+      if (trymove(bb, other, "attack_threats-C", str, EMPTY, NO_MOVE)) {
+       if (board[str] == EMPTY)
+         acode = WIN;
+       else
+         acode = attack(str, NULL);
+       if (acode != 0)
+         movelist_change_point(bb, acode, max_points, moves, codes);
+       popgo();
       }
     }
   }
-
-
-  /* FIXME: Threaten to attack by saving weak neighbors.
-   *        Get it from worm.c.
-   */
-
 
   /* Return actual number of threats found regardless of attack code. */
   if (codes[max_points - 1] > 0)
diff -ur gnugo/engine/score.c gnugo-iw/engine/score.c
--- gnugo/engine/score.c        Mon Nov 26 19:52:04 2001
+++ gnugo-iw/engine/score.c     Sat Feb  2 00:33:20 2002
@@ -20,18 +20,22 @@
  * Boston, MA 02111, USA.                                        *
 \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
+
 #include <string.h>
 #include "liberty.h"
 #include "gg_utils.h"
 
+
 static int dilate_erode(int dilations, int erosions, 
                        int gb[BOARDMAX], int color);
 static void print_new_moyo(int dilations, int erosions);
 static void close_bubbles(int gb[BOARDMAX]);
 static int captured_territory(int pos, int color);
 
+
 #define ARRAYSIZE MAX_BOARD*MAX_BOARD
 
+
 /* As explained in the Texinfo documentation, this function
  * takes the characteristic function of the live groups,
  * dilates and erodes the required number of times. If
@@ -45,8 +49,7 @@
  */
 
 static int
-dilate_erode(int dilations, int erosions, int gb[BOARDMAX],
-            int color)
+dilate_erode(int dilations, int erosions, int gb[BOARDMAX], int color)
 {
   int i, j;
   int ii;
@@ -320,6 +323,7 @@
 print_new_moyo(int dilations, int erosions)
 {
   int gb[BOARDMAX];
+
   dilate_erode(dilations, erosions, gb, WHITE);
   close_bubbles(gb);
   print_regions(gb);
@@ -456,9 +460,9 @@
 }
 
 
-/* We do not count dead stones inside the eyespace as territory. Such a stone
- * is characterized as having matcher_status DEAD yet having only DEAD
- * dragons as neighbors.
+/* We do not count dead stones inside the eyespace as territory. Such a
+ * stone is characterized as having matcher_status DEAD yet having only
+ * DEAD dragons as neighbors.
  *
  * If (pos) is the location of a stone which is DEAD and which is
  * not an exception of this type then it is safe to count it as
diff -ur gnugo/engine/sgfdecide.c gnugo-iw/engine/sgfdecide.c
--- gnugo/engine/sgfdecide.c    Fri Feb  1 19:02:49 2002
+++ gnugo-iw/engine/sgfdecide.c Sat Feb  2 00:33:20 2002
@@ -34,7 +34,7 @@
 
 
 /* 
- * decide_string tries to attack and defend the string at (m, n),
+ * decide_string tries to attack and defend the string at (pos),
  * and then writes the number of variations considered in the attack
  * and defence to the sgf file.
  */
@@ -42,7 +42,7 @@
 void
 decide_string(int pos, const char *sgf_output)
 {
-  int apos, dpos;
+  int aa, dd;
   int acode, dcode;
   SGFTree  tree;
   
@@ -58,17 +58,17 @@
   reset_engine();
 
   count_variations = 1;
-  acode = attack(pos, &apos);
+  acode = attack(pos, &aa);
   if (acode) {
     if (acode == WIN)
       gprintf("%1m can be attacked at %1m (%d variations)\n", 
-             pos, apos, count_variations);
+             pos, aa, count_variations);
     else if (acode == KO_A)
        gprintf("%1m can be attacked with ko (good) at %1m (%d variations)\n", 
-             pos, apos, count_variations);
+             pos, aa, count_variations);
     else if (acode == KO_B)
        gprintf("%1m can be attacked with ko (bad) at %1m (%d variations)\n", 
-               pos, apos, count_variations);
+               pos, aa, count_variations);
 
     if (debug & DEBUG_READING_PERFORMANCE) {
       gprintf("Reading shadow: \n");
@@ -76,17 +76,17 @@
     }
 
     count_variations = 1;
-    dcode = find_defense(pos, &dpos);
+    dcode = find_defense(pos, &dd);
     if (dcode) {
       if (dcode == WIN)
        gprintf("%1m can be defended at %1m (%d variations)\n", 
-               pos, dpos, count_variations);
+               pos, dd, count_variations);
       else if (dcode == KO_A)
        gprintf("%1m can be defended with ko (good) at %1m (%d variations)\n", 
-               pos, dpos, count_variations);
+               pos, dd, count_variations);
       else if (dcode == KO_B)
        gprintf("%1m can be defended with ko (bad) at %1m (%d variations)\n", 
-               pos, dpos, count_variations);
+               pos, dd, count_variations);
     }
     else
       gprintf("%1m cannot be defended (%d variations)\n", 
@@ -115,7 +115,7 @@
 
 /* 
  * decide_connection tries to connect and disconnect the strings at
- * (ai, aj) and (bi, bj), and then writes the number of variations
+ * (apos) and (bpos), and then writes the number of variations
  * considered in the attack and defence to the sgf file.
  */
 
@@ -181,7 +181,7 @@
 
 
 /* 
- * decide_dragon tries to attack and defend the dragon at (m, n),
+ * decide_dragon tries to attack and defend the dragon at (pos),
  * and then writes the number of variations considered in the attack
  * and defence to the sgf file.
  */
diff -ur gnugo/engine/showbord.c gnugo-iw/engine/showbord.c
--- gnugo/engine/showbord.c     Sun Dec 16 22:52:13 2001
+++ gnugo-iw/engine/showbord.c  Sat Feb  2 00:33:20 2002
@@ -78,7 +78,9 @@
 
 static const int domain_colors[4] = {5, 1, 2, 3}; /* gray, black, white, both 
*/
 
-/* True if the coordinate is a hoshi point. */
+
+/* True if the coordinate is a hoshi point.
+ */
 static int
 is_hoshi_point(int m, int n)
 {
diff -ur gnugo/engine/utils.c gnugo-iw/engine/utils.c
--- gnugo/engine/utils.c        Fri Feb  1 19:02:50 2002
+++ gnugo-iw/engine/utils.c     Sat Feb  2 00:33:20 2002
@@ -1071,8 +1071,7 @@
  */
 
 void
-unconditional_life(int unconditional_territory[MAX_BOARD][MAX_BOARD],
-                  int color)
+unconditional_life(int unconditional_territory[BOARDMAX], int color)
 {
   int something_captured = 1; /* To get into the first turn of the loop. */
   int found_one;
@@ -1091,24 +1090,24 @@
     /* Visit all friendly strings on the board. */
     for (m = 0; m < board_size; m++)
       for (n = 0; n < board_size; n++) {
-       int pos = POS(m, n);
-       if (board[pos] != color || !is_worm_origin(pos, pos))
+       int ii = POS(m, n);
+       if (board[ii] != color || !is_worm_origin(ii, ii))
          continue;
        
        /* Try to capture the worm at (m, n). */
-       liberties = findlib(pos, MAXLIBS, libs);
+       liberties = findlib(ii, MAXLIBS, libs);
        save_moves = moves_played;
        for (k = 0; k < liberties; k++) {
-         if (trymove(libs[k], other, "unconditional_life", pos, EMPTY, 0))
+         if (trymove(libs[k], other, "unconditional_life", ii, EMPTY, 0))
            moves_played++;
        }
 
        /* Successful if already captured or a single liberty remains.
         * Otherwise we must rewind and take back the last batch of moves.
         */
-       if (board[pos] == EMPTY)
+       if (board[ii] == EMPTY)
          something_captured = 1;
-       else if (findlib(pos, 2, libs) == 1) {
+       else if (findlib(ii, 2, libs) == 1) {
          /* Need to use tryko as a defense against the extreme case
            * when the only opponent liberty that is not suicide is an
            * illegal ko capture, like in this 5x5 position:
@@ -1141,14 +1140,14 @@
    */
   for (m = 0; m < board_size; m++)
     for (n = 0; n < board_size; n++) {
-      int pos = POS(m, n);
-      if (board[pos] != color || !is_worm_origin(pos, pos))
+      int ii = POS(m, n);
+      if (board[ii] != color || !is_worm_origin(ii, ii))
        continue;
       
       /* Play as many liberties as we can. */
-      liberties = findlib(pos, MAXLIBS, libs);
+      liberties = findlib(ii, MAXLIBS, libs);
       for (k = 0; k < liberties; k++) {
-       if (trymove(libs[k], other, "unconditional_life", pos, EMPTY, 0))
+       if (trymove(libs[k], other, "unconditional_life", ii, EMPTY, 0))
          moves_played++;
       }
     }
@@ -1163,13 +1162,13 @@
 
     for (m = 0; m < board_size; m++)
       for (n = 0; n < board_size; n++) {
-       int pos = POS(m, n);
-       if (board[pos] != other || countlib(pos) > 1)
+       int ii = POS(m, n);
+       if (board[ii] != other || countlib(ii) > 1)
          continue;
        
        /* Try to extend the string at (m, n). */
-       findlib(pos, 1, libs);
-       if (trymove(libs[0], other, "unconditional_life", pos, EMPTY, 0)) {
+       findlib(ii, 1, libs);
+       if (trymove(libs[0], other, "unconditional_life", ii, EMPTY, 0)) {
          moves_played++;
          found_one = 1;
        }
@@ -1178,17 +1177,17 @@
 
   for (m = 0; m < board_size; m++)
     for (n = 0; n < board_size; n++) {
-      int pos = POS(m, n);
-      int apos;
-      int bpos;
+      int ii = POS(m, n);
+      int aa;
+      int bb;
       int aopen, bopen;
       int alib, blib;
-      if (board[pos] != other || countlib(pos) != 2)
+      if (board[ii] != other || countlib(ii) != 2)
        continue;
-      findlib(pos, 2, libs);
-      apos = libs[0];
-      bpos = libs[1];
-      if (abs(I(apos) - I(bpos)) + abs(J(apos) - J(bpos)) != 1)
+      findlib(ii, 2, libs);
+      aa = libs[0];
+      bb = libs[1];
+      if (abs(I(aa) - I(bb)) + abs(J(aa) - J(bb)) != 1)
        continue;
 
       /* Only two liberties and these are adjacent. Play one. We want
@@ -1204,38 +1203,39 @@
        * |..OX    |..OO.OX
        * +----    +-------
        */
-      aopen = approxlib(apos, color, 4, NULL);
-      bopen = approxlib(bpos, color, 4, NULL);
-      alib  = approxlib(apos, other, 4, NULL);
-      blib  = approxlib(bpos, other, 4, NULL);
+      aopen = approxlib(aa, color, 4, NULL);
+      bopen = approxlib(bb, color, 4, NULL);
+      alib  = approxlib(aa, other, 4, NULL);
+      blib  = approxlib(bb, other, 4, NULL);
 
       if (aopen > bopen || (aopen == bopen && alib >= blib)) {
-       trymove(apos, other, "unconditional_life", pos, EMPTY, 0);
+       trymove(aa, other, "unconditional_life", ii, EMPTY, 0);
        moves_played++;
       }
       else {
-       trymove(bpos, other, "unconditional_life", pos, EMPTY, 0);
+       trymove(bb, other, "unconditional_life", ii, EMPTY, 0);
        moves_played++;
       }
     }
-      
+
   /* Identify unconditionally alive stones and unconditional territory. */
-  memset(unconditional_territory, 0, sizeof(int) * MAX_BOARD * MAX_BOARD);
+  memset(unconditional_territory, 0, sizeof(int) * BOARDMAX);
   for (m = 0; m < board_size; m++)
     for (n = 0; n < board_size; n++) {
-      int pos = POS(m, n);
-      if (board[pos] == color) {
-       unconditional_territory[m][n] = 1;
-       if (is_worm_origin(pos, pos)) {
-         liberties = findlib(pos, MAXLIBS, libs);
+      int ii = POS(m, n);
+
+      if (board[ii] == color) {
+       unconditional_territory[ii] = 1;
+       if (is_worm_origin(ii, ii)) {
+         liberties = findlib(ii, MAXLIBS, libs);
          for (k = 0; k < liberties; k++)
-           unconditional_territory[I(libs[k])][J(libs[k])] = 2;
+           unconditional_territory[libs[k]] = 2;
        }
       }
-      else if (board[pos] == other && countlib(pos) == 1) {
-       unconditional_territory[m][n] = 2;
-       findlib(pos, 1, libs);
-       unconditional_territory[I(libs[0])][J(libs[0])] = 2;
+      else if (board[ii] == other && countlib(ii) == 1) {
+       unconditional_territory[ii] = 2;
+       findlib(ii, 1, libs);
+       unconditional_territory[libs[0]] = 2;
       }
     }
 
diff -ur gnugo/engine/worm.c gnugo-iw/engine/worm.c
--- gnugo/engine/worm.c Fri Feb  1 19:02:51 2002
+++ gnugo-iw/engine/worm.c      Sat Feb  2 00:33:20 2002
@@ -745,7 +745,7 @@
 static void
 compute_unconditional_status()
 {
-  int unconditional_territory[MAX_BOARD][MAX_BOARD];
+  int unconditional_territory[BOARDMAX];
   int m, n;
   int color;
   int other;
@@ -755,23 +755,24 @@
     unconditional_life(unconditional_territory, color);
     for (m = 0; m < board_size; m++)
       for (n = 0; n < board_size; n++) {
-       int pos = POS(m, n);
-       if (!unconditional_territory[m][n])
+       int ii = POS(m, n);
+
+       if (!unconditional_territory[ii])
          continue;
        
-       if (board[pos] == color) {
-         worm[pos].unconditional_status = ALIVE;
-         if (unconditional_territory[m][n] == 1)
-           worm[pos].invincible = 1;
+       if (board[ii] == color) {
+         worm[ii].unconditional_status = ALIVE;
+         if (unconditional_territory[ii] == 1)
+           worm[ii].invincible = 1;
        }
-       else if (board[pos] == EMPTY) {
+       else if (board[ii] == EMPTY) {
          if (color == WHITE)
-           worm[pos].unconditional_status = WHITE_BORDER;
+           worm[ii].unconditional_status = WHITE_BORDER;
          else
-           worm[pos].unconditional_status = BLACK_BORDER;
+           worm[ii].unconditional_status = BLACK_BORDER;
        }
        else
-         worm[pos].unconditional_status = DEAD;
+         worm[ii].unconditional_status = DEAD;
       }
   }
   gg_assert(stackp == 0);
diff -ur gnugo/patterns/helpers.c gnugo-iw/patterns/helpers.c
--- gnugo/patterns/helpers.c    Fri Feb  1 19:03:09 2002
+++ gnugo-iw/patterns/helpers.c Sat Feb  2 00:33:20 2002
@@ -270,7 +270,7 @@
 
 /* This is intended for use in autohelpers. */
 
-/* Check whether the string at (ai, aj) can attack any surrounding
+/* Check whether the string at (str) can attack any surrounding
  * string. If so, return false as the move to create a seki (probably)
  * wouldn't work.
  */
@@ -403,7 +403,7 @@
 /*
  * This is intended for use in autohelpers.
  *
- * Give a conservative estimate of the value of saving the string (ai, aj)
+ * Give a conservative estimate of the value of saving the string (str)
  * by capturing one opponent stone.
  */
 
@@ -418,7 +418,7 @@
 /*
  * This is intended for use in autohelpers.
  *
- * Estimate the value of capturing the string (ai, aj) and add this as
+ * Estimate the value of capturing the string (str) and add this as
  * a followup value. We don't do this for too stupid looking threats,
  * however, e.g. in a position like
  *
@@ -531,22 +531,23 @@
 /*
  * This is intended for use in autohelpers.
  *
- * Returns 1 if (ai, aj) is adjacent to a stone which can be captured by ko.
+ * Returns 1 if (pos) is adjacent to a stone which can be captured by ko.
  */
 
 int
-finish_ko_helper(int apos)
+finish_ko_helper(int pos)
 {
   int adj, adjs[MAXCHAIN];
   int k;
 
-  adj = chainlinks2(apos, adjs, 1);
+  adj = chainlinks2(pos, adjs, 1);
   for (k = 0; k < adj; k++) {
-    int bpos = adjs[k];
-    int xpos;
-    if (countstones(bpos) == 1) {
-      findlib(bpos, 1, &xpos);
-      if (is_ko(xpos, board[apos], NULL))
+    int aa = adjs[k];
+    int xx;
+
+    if (countstones(aa) == 1) {
+      findlib(aa, 1, &xx);
+      if (is_ko(xx, board[pos], NULL))
        return 1;
     }
   }
@@ -562,18 +563,18 @@
  */
 
 int
-squeeze_ko_helper(int apos)
+squeeze_ko_helper(int pos)
 {
   int libs[2];
   int liberties;
   int k;
 
-  liberties = findlib(apos, 2, libs);
-  ASSERT1(liberties == 2, apos);
+  liberties = findlib(pos, 2, libs);
+  ASSERT1(liberties == 2, pos);
 
   for (k = 0; k < liberties; k++) {
-    int bpos = libs[k];
-    if (is_ko(bpos, OTHER_COLOR(board[apos]), NULL))
+    int aa = libs[k];
+    if (is_ko(aa, OTHER_COLOR(board[pos]), NULL))
       return 1;
   }
 
diff -ur gnugo/TODO gnugo-iw/TODO
--- gnugo/TODO  Sat Dec 22 08:50:50 2001
+++ gnugo-iw/TODO       Sat Feb  2 00:33:03 2002
@@ -23,7 +23,7 @@
 // General
 //--------------------------------------------------------------
 
-1. If you can, send us bug FIXES as well as bug reports. If you see
+ * If you can, send us bug FIXES as well as bug reports. If you see
    some bad behavior, figure out what causes it, and what to do about
    fixing it. And send us a patch! If you find an interesting bug and
    cannot tell us how to fix it, we would be happy to have you tell us
@@ -45,28 +45,28 @@
 engine internals.  The issues are presented here in an approximate
 order of perceived difficulty.
 
-1. Add a check in patterns/mkpat.c that the main diagram and the
+ * Add a check in patterns/mkpat.c that the main diagram and the
    constraint diagram are consistent. Currently it is only verified
    that they have the same size.
 
-2. Complete the conversion to 1-dimensional representation.
+ * Complete the conversion to 1-dimensional representation.
    Check all comments before functions to make them agree with
    the actual function header.  In some cases these comments were
    missed when the function was converted to 1D.
 
-3. Break out handling of movelists into its own file and generalize it.
+ * Break out handling of movelists into its own file and generalize it.
    This is started in 3.1.16. Move lists are used, among other places, 
    in worms.c where it is used to store moves that capture, save, 
    threaten to capture and threaten to save the worm.
 
-4. Implement move lists storing important moves for dragons and eyes
+ * Implement move lists storing important moves for dragons and eyes
    in the same way as it is used for worms.  Half eyes are already
    halfway done.  The moves are stored, but not the attack and defend
    codes (LOSE, KO_A, KO_B and WIN).
 
-5. Make the cache not waste storage on 64 bit systems.
+ * Make the cache not waste storage on 64 bit systems.
 
-6. a) Add move history for "permanent" moves (i.e. ones done with
+ * a) Add move history for "permanent" moves (i.e. ones done with
    play_move(), in contrast to temporary moves done by
    trymove()/tryko()) in the board code. Notice that the move history
    must be added to the state in the Position struct.
@@ -79,35 +79,38 @@
    probably only want this optionally in play_move() and in a variant
    of is_legal().
 
-7. The dragon data is split into two arrays, dragon[] and dragon2[].
+ * The dragon data is split into two arrays, dragon[] and dragon2[].
    The dragon2 array only have one entry per dragon, in contrast to
    the dragon array where all the data is stored once for every
    intersection of the board.  Complete the conversion of eye_data,
    half_eye_data, worm and dragon to use the same structure as the
    dragon2 array.
 
-8. Support for ko in eyes.db and optics.c.
+ * Implement hashing and persistent caching in the semeai code. 
 
-9. Support for constraints in the eye patterns.
+ * Support for ko in eyes.db and optics.c.
 
-10. Create a paradigm for handling other types of ko (approach move ko,
-    multi-step ko, etc) and then write code that handles them. (Difficult!)
+ * Support for constraints in the eye patterns.
 
-11. GNU Go should be able to resign some games. This feature should
-    be able to be turned on or off since we don't want it during
-    tournament play. If all dragons are settled and GNU Go is
-    behind by a lot, it should be able to resign.
+ * Create a paradigm for handling other types of ko (approach move ko,
+   multi-step ko, etc) and then write code that handles them. 
+   (Difficult!)
+
+ * GNU Go should be able to resign some games. This feature should be
+   able to be turned on or off since we don't want it during
+   tournament play. If all dragons are settled and GNU Go is behind by
+   a lot, it should be able to resign.
 
-12. Implement hashing and persistent caching in the semeai code. 
 
 //--------------------------------------------------------------
 // long term issues
 //--------------------------------------------------------------
 
+
 These issues are strategic in nature. They will help us to improve the
 playing strength of the program and/or enhance certain aspects of it.
 
-1. Extend the regression test suites.
+ * Extend the regression test suites.
    See the texinfo manual in the doc directory for a description of
    how to do this. In particular it would be useful with test suites
    for common life and death problems. Currently second line groups, L
@@ -116,32 +119,33 @@
    square, and so on. Other areas where test suites would be most
    welcome are fuseki, tesuji, and endgame.
 
-2. Tuning the pattern databases. These are under constant revision 
+ * Tuning the pattern databases. These are under constant revision 
    This is a sort of art. It is not
    necessary to do any programming to do this since most of the
    patterns do not require helpers. We would like it if a few more Dan
    level players would learn this skill.
 
-3. Extend and tune the Joseki database.
+ * Extend and tune the Joseki database.
 
-4. The semeai module is vastly in need of improvement. In fact, semeai
+ * The semeai module is vastly in need of improvement. In fact, semeai
    can probably only be analyzed by reading to discover what
-   backfilling is needed before we can make atari. (This is underway.)
+   backfilling is needed before we can make atari. 
+   (This is underway.)
 
-5. The connection analysis is today completely static and has a hard
+ * The connection analysis is today completely static and has a hard
    time identifying mutually dependent connections or moves that
    simultaneously threatens two or more connections. This could be
    improved by writing a connection reader, which like the owl code
    uses pattern matching to find a small amount of key moves to try.
    (This is underway.)
 
-6. GNU Go has a problem with opponents that build big moyos.  This is
+ * GNU Go has a problem with opponents that build big moyos.  This is
    because there is no move generator that tries explicitly to neither
    build nor enter opponent moyos. Such a move generator could be
    built using the same type of code that is used in the owl life and
    death reader, or the connection reader mentioned in point 5 above.
 
-7. A much improved combination module.  The combination module of
+ * A much improved combination module.  The combination module of
    today only finds combinations of threats to capture enemy groups.
    A more useful combination module would e.g. find combinations of
    threats to capture a group or enter opponent territory.  It would
@@ -151,7 +155,7 @@
    using ordinary tree search algorithms. (Revision of combination.c
    is underway.)
 
-8. Speed up the tactical reading. GNU Go is reasonably accurate when
+ * Speed up the tactical reading. GNU Go is reasonably accurate when
    it comes to tactical reading, but not always very fast. The main
    problem is that too many ineffective moves are tested, leading to
    strange variations that shouldn't need consideration. To improve
@@ -159,7 +163,7 @@
    refined. Some improvements should also be possible to obtain by
    tuning the move ordering.
 
-9. Create a way to quickly assess the safety of a group.  This might
+ * Create a way to quickly assess the safety of a group.  This might
    take into account number of eyes / half eyes, moyo in corners, moyo
    along the edge, moyo in the center, proximity to living friendly
    groups, weak opponent groups etc.  The point is that it should
@@ -168,34 +172,35 @@
    group and/or weakens an opponent group and how strong/weak groups
    influence each other.
 
-10. A move generator that identifies invasions or places to make
-    reducing moves (and of course threats to make invasions).
+ * A move generator that identifies invasions or places to make
+   reducing moves (and of course threats to make invasions).
 
-11. In some positions GNU Go may report a group as alive or connected
-    with a living group. But after the opponent has placed one stone
-    GNU Go may change the status to dead, without going through a
-    critical status. It would be nice if these positions could be
-    identified and logged for later analysis of the GNU Go
-    team.
+ * In some positions GNU Go may report a group as alive or connected
+   with a living group. But after the opponent has placed one stone
+   GNU Go may change the status to dead, without going through a
+   critical status. It would be nice if these positions could be
+   identified and logged for later analysis of the GNU Go team.
+
+ * Automatic search for missing patterns by analysing games from
+   NNGS.
 
-12. Automatic search for missing patterns by analysing games from
-    NNGS.
 
 //--------------------------------------------------------------
 // Ideas
 //--------------------------------------------------------------
 
+
 These are some ideas that have been floated on the mailing list.  Some
 of them are down-to-earth, and some are just blue sky ramblings.  They
 are presented here for inspiration.
 
-1. A good GUI.
+ * A good GUI.
    A start is being made with GoThic, a goban widget based on the QT
    toolkit.  This is linked from the GNU Go development web page on
    gnu.org. Other starts have been made based on GTK, but so far
    nothing more than a start has been attempted.
 
-2. A graphical pattern editor.
+ * A graphical pattern editor.
    This would make it much easier for non-programmers to improve the
    strength of GNU Go.  It could also be used as a debugging tool for
    the programmers.  This project has the GUI as a prerequisite.
@@ -203,24 +208,24 @@
    create patterns but to make it easier to overview and maintain the
    database.
 
-3. Make the engine thread safe and use multiple CPUs on an SMP
+ * Make the engine thread safe and use multiple CPUs on an SMP
    machine.
 
-4. Making the engine use many machines loosely connected on the
+ * Making the engine use many machines loosely connected on the
    internet or in a cluster.
 
-5. Think on the opponents time.
+ * Think on the opponents time.
 
-6. A global alpha-beta reader.  This would probably be very slow and
+ * A global alpha-beta reader.  This would probably be very slow and
    could only read 2 or 3 moves ahead.  Still it could find fatal
    errors and improve the moves that GNU Go makes.
 
-7. A pattern based tactical reader instead of the hard coded one.
+ * A pattern based tactical reader instead of the hard coded one.
    This could be made stronger than the current by taking into account
    more moves.  The challenge is to keep it on focus so that the
    reading does not take forever.
 
-8. A strategic module that identifies high-level goals and then gives
+ * A strategic module that identifies high-level goals and then gives
    these goals to the rest of the engine.  It should be able to
    identify if we are ahead in territory or thickness, if we should
    play safe or if we should play daringly (e.g. if behind).  It
@@ -228,13 +233,13 @@
    should defend.  Maybe this module doesn't have to be written in C.
    Maybe PROLOG, LISP or some other AI language would be better.
 
-9. A parameter that makes GNU Go play different styles.  Such styles
+ * A parameter that makes GNU Go play different styles.  Such styles
    could be 'play for territory', 'play aggressively', 'play tricky
    moves (hamete)', and so on.  It could be used to present human
    users with different kinds of opponents or to tell GNU Go how to
    play certain computer opponents in tournaments.
 
-10.Generalize representation and handling of threats so that we have a
+ * Generalize representation and handling of threats so that we have a
    graph representation of threats that can be searched to see how
    different threats interact.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]