? config.log ? Makefile ? config.status ? config.h ? stamp-h ? doc/Makefile ? doc/gnugo.info ? doc/gnugo.info-1 ? doc/gnugo.info-2 ? doc/gnugo.info-3 ? doc/gnugo.info-4 ? doc/gnugo.info-5 ? doc/gnugo.info-6 ? doc/gnugo.info-7 ? doc/gnugo.info-8 ? doc/gnugo.info-9 ? doc/gnugo.info-10 ? doc/gnugo.info-11 ? engine/Makefile ? engine/.deps ? engine/dragon.c.save ? engine/aftermath.c.save ? interface/Makefile ? interface/.deps ? interface/gnugo ? interface/debugboard/Makefile ? interface/debugboard/.deps ? interface/debugboard/debugboard ? patterns/Makefile ? patterns/.deps ? patterns/mkpat ? patterns/mkeyes ? patterns/joseki ? patterns/conn.c ? patterns/patterns.c ? patterns/apatterns.c ? patterns/dpatterns.c ? patterns/eyes.c ? patterns/influence.c ? patterns/barriers.c ? patterns/endgame.c ? patterns/owl_attackpat.c ? patterns/owl_vital_apat.c ? patterns/owl_defendpat.c ? patterns/fuseki9.c ? patterns/fuseki19.c ? patterns/hoshi.db ? patterns/komoku.db ? patterns/sansan.db ? patterns/takamoku.db ? patterns/mokuhazushi.db ? patterns/extract_fuseki ? patterns/fusekipat.c ? patterns/fuseki13.c ? patterns/josekidb.c ? regression/Makefile ? sgf/Makefile ? sgf/.deps ? sgf/sgfgen ? utils/Makefile ? utils/.deps Index: engine/dragon.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v retrieving revision 1.15 diff -u -r1.15 dragon.c --- engine/dragon.c 2001/10/02 06:36:02 1.15 +++ engine/dragon.c 2001/10/04 17:56:12 @@ -35,7 +35,7 @@ static void add_adjacent_dragon(int a, int b); static int dragon_invincible(int m, int n); static int compute_dragon_status(int i, int j); -static void dragon_eye(int m, int n, struct eye_data[MAX_BOARD][MAX_BOARD]); +static void dragon_eye(int m, int n, struct eye_data[BOARDMAX]); static int compute_escape(int m, int n, int dragon_status_known); static int dragon2_initialized; @@ -111,37 +111,37 @@ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (black_eye[m][n].color == BLACK_BORDER - && black_eye[m][n].origin == POS(m, n)) { + if (black_eye[POS(m, n)].color == BLACK_BORDER + && black_eye[POS(m, n)].origin == POS(m, n)) { if (!is_ko_point2(m, n) - || black_eye[m][n].esize > 1) /* Only exclude living kos. */ + || black_eye[POS(m, n)].esize > 1) /* Only exclude living kos. */ dragon_eye(m, n, black_eye); else { if (m > 0 && !is_ko_point2(m-1, n)) - black_eye[m][n].dragon = dragon[POS(m-1, n)].origin; + black_eye[POS(m, n)].dragon = dragon[POS(m-1, n)].origin; else if (m < board_size-1 && !is_ko_point2(m+1, n)) - black_eye[m][n].dragon = dragon[POS(m+1, n)].origin; + black_eye[POS(m, n)].dragon = dragon[POS(m+1, n)].origin; else if (n > 0 && !is_ko_point2(m, n-1)) - black_eye[m][n].dragon = dragon[POS(m, n-1)].origin; + black_eye[POS(m, n)].dragon = dragon[POS(m, n-1)].origin; else if (n < board_size-1 && !is_ko_point2(m, n+1)) - black_eye[m][n].dragon = dragon[POS(m, n+1)].origin; + black_eye[POS(m, n)].dragon = dragon[POS(m, n+1)].origin; } } - if (white_eye[m][n].color == WHITE_BORDER - && white_eye[m][n].origin == POS(m, n)) { + if (white_eye[POS(m, n)].color == WHITE_BORDER + && white_eye[POS(m, n)].origin == POS(m, n)) { if (!is_ko_point2(m, n) - || white_eye[m][n].esize > 1) /* Only exclude living kos. */ + || white_eye[POS(m, n)].esize > 1) /* Only exclude living kos. */ dragon_eye(m, n, white_eye); else { if (m > 0 && !is_ko_point2(m-1, n)) - white_eye[m][n].dragon = dragon[POS(m-1, n)].origin; + white_eye[POS(m, n)].dragon = dragon[POS(m-1, n)].origin; else if (m < board_size-1 && !is_ko_point2(m+1, n)) - white_eye[m][n].dragon = dragon[POS(m+1, n)].origin; + white_eye[POS(m, n)].dragon = dragon[POS(m+1, n)].origin; else if (n > 0 && !is_ko_point2(m, n-1)) - white_eye[m][n].dragon = dragon[POS(m, n-1)].origin; + white_eye[POS(m, n)].dragon = dragon[POS(m, n-1)].origin; else if (n < board_size-1 && !is_ko_point2(m, n+1)) - white_eye[m][n].dragon = dragon[POS(m, n+1)].origin; + white_eye[POS(m, n)].dragon = dragon[POS(m, n+1)].origin; } } } @@ -200,14 +200,14 @@ /* In case origins of dragons got moved, put the dragons of eyes aright. */ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { - if (black_eye[i][j].dragon != NO_MOVE) { - int dr=dragon[black_eye[i][j].dragon].origin; - black_eye[i][j].dragon = dr; + if (black_eye[POS(i, j)].dragon != NO_MOVE) { + int dr=dragon[black_eye[POS(i, j)].dragon].origin; + black_eye[POS(i, j)].dragon = dr; } - if (white_eye[i][j].dragon != NO_MOVE) { - int dr=dragon[white_eye[i][j].dragon].origin; - white_eye[i][j].dragon = dr; + if (white_eye[POS(i, j)].dragon != NO_MOVE) { + int dr=dragon[white_eye[POS(i, j)].dragon].origin; + white_eye[POS(i, j)].dragon = dr; } } time_report(2, " time to fix origins", -1, -1); @@ -225,15 +225,15 @@ int di = -1; int dj = -1; - if (black_eye[m][n].color == BLACK_BORDER - && (!black_eye[m][n].marginal || life) - && (black_eye[m][n].neighbors <= 1) - && (black_eye[m][n].dragon != NO_MOVE)) { + if (black_eye[POS(m, n)].color == BLACK_BORDER + && (!black_eye[POS(m, n)].marginal || life) + && (black_eye[POS(m, n)].neighbors <= 1) + && (black_eye[POS(m, n)].dragon != NO_MOVE)) { sum = topological_eye(m, n, BLACK, &ai, &aj, &di, &dj, black_eye, white_eye, half_eye); if (sum >= 4) { half_eye[POS(m, n)].type = FALSE_EYE; - if ((black_eye[m][n].esize == 1) + if ((black_eye[POS(m, n)].esize == 1) || is_legal2(m, n, WHITE) || BOARD(m, n) == WHITE) add_half_eye(m, n, black_eye, half_eye); @@ -242,15 +242,15 @@ half_eye[POS(m, n)].type = HALF_EYE; } - if (white_eye[m][n].color == WHITE_BORDER - && (!white_eye[m][n].marginal || life) - && (white_eye[m][n].neighbors <= 1) - && (white_eye[m][n].dragon != NO_MOVE)) { + if (white_eye[POS(m, n)].color == WHITE_BORDER + && (!white_eye[POS(m, n)].marginal || life) + && (white_eye[POS(m, n)].neighbors <= 1) + && (white_eye[POS(m, n)].dragon != NO_MOVE)) { sum = topological_eye(m, n, WHITE, &ai, &aj, &di, &dj, black_eye, white_eye, half_eye); if (sum >= 4) { half_eye[POS(m, n)].type = FALSE_EYE; - if ((white_eye[m][n].esize == 1) + if ((white_eye[POS(m, n)].esize == 1) || is_legal2(m, n, BLACK) || BOARD(m, n) == BLACK) add_half_eye(m, n, white_eye, half_eye); @@ -268,8 +268,8 @@ /* Compute the number of eyes, half eyes, etc. in an eye space. */ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { - if ((black_eye[i][j].color == BLACK_BORDER) - && (black_eye[i][j].origin == POS(i, j))) + if ((black_eye[POS(i, j)].color == BLACK_BORDER) + && (black_eye[POS(i, j)].origin == POS(i, j))) { int max, min, attacki, attackj, defendi, defendj; @@ -277,15 +277,15 @@ &defendi, &defendj, black_eye, half_eye, 1, color); DEBUG(DEBUG_EYES, "Black eyespace at %m: min=%d, max=%d\n", i, j, min, max); - black_eye[i][j].maxeye = max; - black_eye[i][j].mineye = min; - black_eye[i][j].attack_point = POS(attacki, attackj); - black_eye[i][j].defense_point = POS(defendi, defendj); - propagate_eye(i, j, black_eye); + black_eye[POS(i, j)].maxeye = max; + black_eye[POS(i, j)].mineye = min; + black_eye[POS(i, j)].attack_point = POS(attacki, attackj); + black_eye[POS(i, j)].defense_point = POS(defendi, defendj); + propagate_eye(POS(i, j), black_eye); } - if ((white_eye[i][j].color == WHITE_BORDER) - && (white_eye[i][j].origin == POS(i, j))) + if ((white_eye[POS(i, j)].color == WHITE_BORDER) + && (white_eye[POS(i, j)].origin == POS(i, j))) { int max, min, attacki, attackj, defendi, defendj; @@ -293,11 +293,11 @@ &defendi, &defendj, white_eye, half_eye, 1, color); DEBUG(DEBUG_EYES, "White eyespace at %m: min=%d, max=%d\n", i, j, min, max); - white_eye[i][j].maxeye = max; - white_eye[i][j].mineye = min; - white_eye[i][j].attack_point = POS(attacki, attackj); - white_eye[i][j].defense_point = POS(defendi, defendj); - propagate_eye(i, j, white_eye); + white_eye[POS(i, j)].maxeye = max; + white_eye[POS(i, j)].mineye = min; + white_eye[POS(i, j)].attack_point = POS(attacki, attackj); + white_eye[POS(i, j)].defense_point = POS(defendi, defendj); + propagate_eye(POS(i, j), white_eye); } } time_report(2, " time to find eyes", -1, -1); @@ -305,35 +305,35 @@ /* Now we compute the genus. */ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { - if (black_eye[i][j].color == BLACK_BORDER - && black_eye[i][j].dragon != NO_MOVE - && black_eye[i][j].origin == POS(i, j)) + if (black_eye[POS(i, j)].color == BLACK_BORDER + && black_eye[POS(i, j)].dragon != NO_MOVE + && black_eye[POS(i, j)].origin == POS(i, j)) { - m = I(black_eye[i][j].dragon); - n = J(black_eye[i][j].dragon); + m = I(black_eye[POS(i, j)].dragon); + n = J(black_eye[POS(i, j)].dragon); gg_assert (BOARD(m, n) == BLACK); TRACE("eye at %m found for dragon at %m--augmenting genus\n", i, j, m, n); - DRAGON2(m, n).genus += (black_eye[i][j].mineye); - DRAGON2(m, n).heyes += (black_eye[i][j].maxeye - - black_eye[i][j].mineye); - if (black_eye[i][j].maxeye - black_eye[i][j].mineye > 0) - DRAGON2(m, n).heye = black_eye[i][j].attack_point; - } - if ((white_eye[i][j].color == WHITE_BORDER) - && (white_eye[i][j].dragon != NO_MOVE) - && (white_eye[i][j].origin == POS(i, j))) + DRAGON2(m, n).genus += (black_eye[POS(i, j)].mineye); + DRAGON2(m, n).heyes += (black_eye[POS(i, j)].maxeye + - black_eye[POS(i, j)].mineye); + if (black_eye[POS(i, j)].maxeye - black_eye[POS(i, j)].mineye > 0) + DRAGON2(m, n).heye = black_eye[POS(i, j)].attack_point; + } + if ((white_eye[POS(i, j)].color == WHITE_BORDER) + && (white_eye[POS(i, j)].dragon != NO_MOVE) + && (white_eye[POS(i, j)].origin == POS(i, j))) { - m = I(white_eye[i][j].dragon); - n = J(white_eye[i][j].dragon); + m = I(white_eye[POS(i, j)].dragon); + n = J(white_eye[POS(i, j)].dragon); gg_assert (BOARD(m, n) == WHITE); TRACE("eye at %m found for dragon at %m--augmenting genus\n", i, j, m, n); - DRAGON2(m, n).genus += (white_eye[i][j].mineye); - DRAGON2(m, n).heyes += (white_eye[i][j].maxeye - - white_eye[i][j].mineye); - if (white_eye[i][j].maxeye - white_eye[i][j].mineye > 0) { - DRAGON2(m, n).heye = white_eye[i][j].attack_point; + DRAGON2(m, n).genus += (white_eye[POS(i, j)].mineye); + DRAGON2(m, n).heyes += (white_eye[POS(i, j)].maxeye + - white_eye[POS(i, j)].mineye); + if (white_eye[POS(i, j)].maxeye - white_eye[POS(i, j)].mineye > 0) { + DRAGON2(m, n).heye = white_eye[POS(i, j)].attack_point; } } } @@ -880,8 +880,7 @@ dragon_invincible(int m, int n) { - typedef struct eye_data row_of_eye_data[MAX_BOARD]; - row_of_eye_data *eye; + struct eye_data *eye; int i, j; @@ -905,9 +904,9 @@ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) - if (eye[i][j].origin == POS(i, j) - && same_dragon(I(eye[i][j].dragon), J(eye[i][j].dragon), m, n)) { - if (eye[i][j].msize == 0 && eye[i][j].mineye > 0) + if (eye[POS(i, j)].origin == POS(i, j) + && same_dragon(I(eye[POS(i, j)].dragon), J(eye[POS(i, j)].dragon), m, n)) { + if (eye[POS(i, j)].msize == 0 && eye[POS(i, j)].mineye > 0) strong_eyes++; } @@ -1035,7 +1034,7 @@ */ static void -dragon_eye(int m, int n, struct eye_data eye[MAX_BOARD][MAX_BOARD]) +dragon_eye(int m, int n, struct eye_data eye[BOARDMAX]) { int i, j; int dragoni = -1, dragonj = -1; @@ -1043,22 +1042,22 @@ int k; /* don't amalgamate across ikken tobi */ - if (eye[m][n].esize == 3 && eye[m][n].msize > 1) + if (eye[POS(m, n)].esize == 3 && eye[POS(m, n)].msize > 1) return; DEBUG(DEBUG_DRAGONS, "amalgamate dragons around %m\n", m, n); - if (eye[m][n].color == BLACK_BORDER) + if (eye[POS(m, n)].color == BLACK_BORDER) color = BLACK; else { - gg_assert(eye[m][n].color == WHITE_BORDER); + gg_assert(eye[POS(m, n)].color == WHITE_BORDER); color = WHITE; } for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { - if (eye[i][j].origin == POS(m, n) - && !eye[i][j].marginal - && !(eye[i][j].type & INHIBIT_CONNECTION)) { + if (eye[POS(i, j)].origin == POS(m, n) + && !eye[POS(i, j)].marginal + && !(eye[POS(i, j)].type & INHIBIT_CONNECTION)) { for (k = 0; k < 4; k++) { int di = deltai[k]; int dj = deltaj[k]; @@ -1079,11 +1078,11 @@ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { - if ((eye[i][j].color == BLACK_BORDER - || eye[i][j].color == WHITE_BORDER) - && eye[i][j].origin == POS(m, n)) + if ((eye[POS(i, j)].color == BLACK_BORDER + || eye[POS(i, j)].color == WHITE_BORDER) + && eye[POS(i, j)].origin == POS(m, n)) { - eye[i][j].dragon = POS(dragoni, dragonj); + eye[POS(i, j)].dragon = POS(dragoni, dragonj); } } } @@ -1291,11 +1290,11 @@ /* Do not pass connection inhibited intersections. */ if ((color == WHITE - && ((white_eye[i][j].type & INHIBIT_CONNECTION) - || white_eye[i][j].cut == 1)) + && ((white_eye[POS(i, j)].type & INHIBIT_CONNECTION) + || white_eye[POS(i, j)].cut == 1)) || (color == BLACK - && ((black_eye[i][j].type & INHIBIT_CONNECTION) - || black_eye[i][j].cut == 1))) + && ((black_eye[POS(i, j)].type & INHIBIT_CONNECTION) + || black_eye[POS(i, j)].cut == 1))) continue; if (distance == 4) Index: engine/globals.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/globals.c,v retrieving revision 1.9 diff -u -r1.9 globals.c --- engine/globals.c 2001/10/01 17:04:58 1.9 +++ engine/globals.c 2001/10/04 17:56:12 @@ -128,8 +128,8 @@ int number_of_dragons; struct dragon_data2 *dragon2 = NULL; struct half_eye_data half_eye[BOARDMAX]; -struct half_eye_data owl_half_eye[MAX_BOARD][MAX_BOARD]; -struct eye_data black_eye[MAX_BOARD][MAX_BOARD]; -struct eye_data white_eye[MAX_BOARD][MAX_BOARD]; -struct eye_data owl_black_eye[MAX_BOARD][MAX_BOARD]; -struct eye_data owl_white_eye[MAX_BOARD][MAX_BOARD]; +struct half_eye_data owl_half_eye[BOARDMAX]; +struct eye_data black_eye[BOARDMAX]; +struct eye_data white_eye[BOARDMAX]; +struct eye_data owl_black_eye[BOARDMAX]; +struct eye_data owl_white_eye[BOARDMAX]; Index: engine/influence.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v retrieving revision 1.8 diff -u -r1.8 influence.c --- engine/influence.c 2001/10/01 17:04:58 1.8 +++ engine/influence.c 2001/10/04 17:56:13 @@ -836,10 +836,10 @@ else color = EMPTY; - if (color == WHITE && (white_eye[m][n].type & INHIBIT_CONNECTION)) + if (color == WHITE && (white_eye[POS(m, n)].type & INHIBIT_CONNECTION)) return EMPTY; - if (color == BLACK && (black_eye[m][n].type & INHIBIT_CONNECTION)) + if (color == BLACK && (black_eye[POS(m, n)].type & INHIBIT_CONNECTION)) return EMPTY; return color; Index: engine/liberty.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v retrieving revision 1.22 diff -u -r1.22 liberty.h --- engine/liberty.h 2001/10/02 20:15:38 1.22 +++ engine/liberty.h 2001/10/04 17:56:13 @@ -469,12 +469,12 @@ int dragons_known); /* Eye space functions. */ -int eye_space(int i, int j); -int proper_eye_space(int i, int j); -int max_eye_value(int i, int j); -int marginal_eye_space(int i, int j); -void make_proper_eye_space(int i, int j, int color); -void remove_eyepoint(int i, int j, int color); +int is_eye_space(int pos); +int is_proper_eye_space(int pos); +int is_marginal_eye_space(int pos); +int max_eye_value(int pos); +void make_proper_eye_space(int pos, int color); +void remove_eyepoint(int pos, int color); /* debugging support */ @@ -684,10 +684,10 @@ int cut; /* Opponent can cut at vertex. */ }; -typedef struct eye_data row_of_eye_data[MAX_BOARD]; +typedef struct eye_data row_of_eye_data[BOARDMAX]; -extern struct eye_data white_eye[MAX_BOARD][MAX_BOARD]; -extern struct eye_data black_eye[MAX_BOARD][MAX_BOARD]; +extern struct eye_data white_eye[BOARDMAX]; +extern struct eye_data black_eye[BOARDMAX]; /* The following declarations have to be postponed until after the * definition of struct eye_data or struct half_eye_data. @@ -695,33 +695,33 @@ void compute_eyes(int i, int j, int *max, int *min, int *attacki, int *attackj, int *defendi, int *defendj, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX], int add_moves, int color); void compute_eyes_pessimistic(int i, int j, int *max, int *min, int *pessimistic_min, int *attacki, int *attackj, int *defendi, int *defendj, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]); int recognize_eye2(int m, int n, int *attacki, int *attackj, int *defendi, int *defendj, int *max, int *min, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX], int add_moves, int color); -void propagate_eye (int, int, struct eye_data eye[MAX_BOARD][MAX_BOARD]); +void propagate_eye (int pos, struct eye_data eye[BOARDMAX]); void originate_eye(int i, int j, int m, int n, - int *esize, int *msize, - struct eye_data eye[MAX_BOARD][MAX_BOARD]); + int *esize, int *msize, + struct eye_data eye[BOARDMAX]); int topological_eye(int m, int n, int color, int *ai, int *aj, int *di, int *dj, - struct eye_data b_eye[MAX_BOARD][MAX_BOARD], - struct eye_data w_eye[MAX_BOARD][MAX_BOARD], + struct eye_data b_eye[BOARDMAX], + struct eye_data w_eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]); -void add_half_eye(int m, int n, struct eye_data eye[MAX_BOARD][MAX_BOARD], +void add_half_eye(int m, int n, struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]); -void make_domains(struct eye_data b_eye[MAX_BOARD][MAX_BOARD], - struct eye_data w_eye[MAX_BOARD][MAX_BOARD], +void make_domains(struct eye_data b_eye[BOARDMAX], + struct eye_data w_eye[BOARDMAX], int owl_call); int is_halfeye(struct half_eye_data heye[BOARDMAX], int pos); Index: engine/life.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/life.c,v retrieving revision 1.6 diff -u -r1.6 life.c --- engine/life.c 2001/09/24 14:05:44 1.6 +++ engine/life.c 2001/10/04 17:56:13 @@ -106,11 +106,11 @@ static int boundary_size; -static int minimize_eyes(struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +static int minimize_eyes(struct eye_data eyedata[BOARDMAX], struct half_eye_data heye[BOARDMAX], int *min, int *ko_out, int ko_in, int ko_master, int *attack_point, int cutoff_eyes, int cutoff_ko); -static int maximize_eyes(struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +static int maximize_eyes(struct eye_data eyedata[BOARDMAX], struct half_eye_data heye[BOARDMAX], int *max, int *ko_out, int ko_in, int ko_master, int *defense_point, int cutoff_eyes, int cutoff_ko); @@ -384,7 +384,7 @@ static void -print_eyespace(struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +print_eyespace(struct eye_data eyedata[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { int m, n; @@ -417,7 +417,7 @@ for (n = minj; n <= maxj; n++) { if (eyeindex[m][n] >= 0) { if (BOARD(m, n) == EMPTY) { - if (eyedata[m][n].marginal) + if (eyedata[POS(m, n)].marginal) gprintf("%o!"); else if (is_halfeye(heye, POS(m, n))) gprintf("%oh"); @@ -438,14 +438,14 @@ static int -prepare_eyespace(int m, int n, struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +prepare_eyespace(int m, int n, struct eye_data eyedata[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { int i, j; int k; /* Set `eye_color' to the owner of the eye. */ - eye_color = eyedata[m][n].color; + eye_color = eyedata[POS(m, n)].color; if (eye_color == BLACK_BORDER) eye_color = BLACK; if (eye_color == WHITE_BORDER) @@ -459,8 +459,8 @@ */ for (i = 0; i < board_size; ++i) for (j = 0; j < board_size; ++j) { - if (eyedata[i][j].origin == POS(m, n)) { - include_eyepoint(i, j, eyedata[i][j].marginal == 0, 0); + if (eyedata[POS(i, j)].origin == POS(m, n)) { + include_eyepoint(i, j, eyedata[POS(i, j)].marginal == 0, 0); if (is_halfeye(heye, POS(i, j))) { for (k=0; k 3) { + if (eye[POS(i, j)].esize-2*eye[POS(i, j)].msize > 3) { *min = 2; *max = 2; } - else if (eye[i][j].esize-2*eye[i][j].msize > 0) { + else if (eye[POS(i, j)].esize-2*eye[POS(i, j)].msize > 0) { *min = 1; *max = 1; } @@ -942,7 +941,7 @@ int *pessimistic_min, int *attacki, int *attackj, int *defendi, int *defendj, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { int m, n; @@ -953,11 +952,11 @@ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin == POS(i, j) - && (eye[m][n].marginal + if (eye[POS(m, n)].origin == POS(i, j) + && (eye[POS(m, n)].marginal || is_halfeye(heye, POS(m, n)))) { margins++; - if (eye[m][n].marginal && eye[m][n].marginal_neighbors > 0) + if (eye[POS(m, n)].marginal && eye[POS(m, n)].marginal_neighbors > 0) margins_adjacent_to_margin++; if (is_halfeye(heye, POS(m, n))) halfeyes++; @@ -968,7 +967,7 @@ * players only cares about playing the marginal eye spaces. It is * used later to guess the eye value for unidentified eye shapes. */ - effective_eyesize = (eye[i][j].esize + halfeyes - 2*margins + effective_eyesize = (eye[POS(i, j)].esize + halfeyes - 2*margins - margins_adjacent_to_margin); if (attacki) *attacki = -1; @@ -978,18 +977,19 @@ if (debug & DEBUG_EYES) { DEBUG(DEBUG_EYES, "Eyespace at %m: color=%C, esize=%d, msize=%d\n", - i, j, eye[i][j].color, eye[i][j].esize, eye[i][j].msize); + i, j, eye[POS(i, j)].color, eye[POS(i, j)].esize, + eye[POS(i, j)].msize); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin != POS(i, j)) + if (eye[POS(m, n)].origin != POS(i, j)) continue; - if (eye[m][n].marginal && BOARD(m, n) != EMPTY) + if (eye[POS(m, n)].marginal && BOARD(m, n) != EMPTY) DEBUG(DEBUG_EYES, "%m (X!)\n", m, n); - else if (eye[m][n].marginal && BOARD(m, n) == EMPTY) + else if (eye[POS(m, n)].marginal && BOARD(m, n) == EMPTY) DEBUG(DEBUG_EYES, "%m (!)\n", m, n); - else if (!eye[m][n].marginal && BOARD(m, n) != EMPTY) + else if (!eye[POS(m, n)].marginal && BOARD(m, n) != EMPTY) DEBUG(DEBUG_EYES, "%m (X)\n", m, n); else if (is_halfeye(heye, POS(m, n)) && BOARD(m, n) == EMPTY) DEBUG(DEBUG_EYES, "%m (H)\n", m, n); @@ -1005,7 +1005,7 @@ /* First we try to let the life code evaluate the eye space. */ if (life - && eye[i][j].esize <= life_eyesize + && eye[POS(i, j)].esize <= life_eyesize && recognize_eye2(i, j, attacki, attackj, defendi, defendj, max, min, eye, heye, 0, EMPTY)) { *pessimistic_min = *min - margins; @@ -1018,9 +1018,9 @@ *pessimistic_min = *min - margins; /* A single point eye which is part of a ko can't be trusted. */ - if (eye[i][j].esize == 1 + if (eye[POS(i, j)].esize == 1 && is_ko(POS(i, j), - eye[i][j].color == WHITE_BORDER ? BLACK : WHITE, NULL)) + eye[POS(i, j)].color == WHITE_BORDER ? BLACK : WHITE, NULL)) *pessimistic_min = 0; } @@ -1059,7 +1059,7 @@ } else { *min = 0; - if (eye[i][j].esize - margins > 2) + if (eye[POS(i, j)].esize - margins > 2) *max = 1; else *max = 0; @@ -1073,8 +1073,8 @@ /* Find one marginal vertex and set as attack and defense point. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin == POS(i, j)) { - if (eye[m][n].marginal + if (eye[POS(m, n)].origin == POS(i, j)) { + if (eye[POS(m, n)].marginal && BOARD(m, n) == EMPTY) { if (defendi) *defendi = m; if (defendj) *defendj = n; @@ -1111,22 +1111,22 @@ */ void -propagate_eye (int i, int j, struct eye_data eye[MAX_BOARD][MAX_BOARD]) +propagate_eye (int pos, struct eye_data eye[BOARDMAX]) { int m, n; for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin == POS(i, j)) { - eye[m][n].color = eye[i][j].color; - eye[m][n].esize = eye[i][j].esize; - eye[m][n].msize = eye[i][j].msize; - eye[m][n].origin = eye[i][j].origin; - eye[m][n].maxeye = eye[i][j].maxeye; - eye[m][n].mineye = eye[i][j].mineye; - eye[m][n].attack_point = eye[i][j].attack_point; - eye[m][n].defense_point = eye[i][j].defense_point; - eye[m][n].dragon = eye[i][j].dragon; + if (eye[POS(m, n)].origin == pos) { + eye[POS(m, n)].color = eye[pos].color; + eye[POS(m, n)].esize = eye[pos].esize; + eye[POS(m, n)].msize = eye[pos].msize; + eye[POS(m, n)].origin = eye[pos].origin; + eye[POS(m, n)].maxeye = eye[pos].maxeye; + eye[POS(m, n)].mineye = eye[pos].mineye; + eye[POS(m, n)].attack_point = eye[pos].attack_point; + eye[POS(m, n)].defense_point = eye[pos].defense_point; + eye[POS(m, n)].dragon = eye[pos].dragon; } } } @@ -1145,7 +1145,7 @@ */ static int linear_eye_space (int i, int j, int *attacki, int *attackj, int *max, int *min, - struct eye_data eye[MAX_BOARD][MAX_BOARD]) + struct eye_data eye[BOARDMAX]) { int m, n; int end1i = -1, end1j = -1; @@ -1154,13 +1154,13 @@ int centeri = -1, centerj = -1; int middlei = -1, middlej = -1; int is_line = 1; - int msize = eye[i][j].msize; - int esize = eye[i][j].esize; + int msize = eye[POS(i, j)].msize; + int esize = eye[POS(i, j)].esize; for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin == POS(i, j)) { - if (eye[m][n].neighbors > 2) { + if (eye[POS(m, n)].origin == POS(i, j)) { + if (eye[POS(m, n)].neighbors > 2) { if (centeri == -1) { centeri = m; centerj = n; @@ -1168,13 +1168,13 @@ centers++; is_line = 0; } - if (eye[m][n].neighbors == 2) { + if (eye[POS(m, n)].neighbors == 2) { middlei = m; middlej = n; - if (eye[m][n].marginal) + if (eye[POS(m, n)].marginal) is_line = 0; } - if (eye[m][n].neighbors == 1) { + if (eye[POS(m, n)].neighbors == 1) { if (end1i == -1) { end1i = m; end1j = n; @@ -1220,29 +1220,29 @@ int farmiddlei; int farmiddlej; if (middlei > 0 - && eye[middlei-1][middlej].origin == POS(i, j) - && eye[middlei-1][middlej].neighbors == 2) + && eye[POS(middlei-1, middlej)].origin == POS(i, j) + && eye[POS(middlei-1, middlej)].neighbors == 2) { farmiddlei = middlei-1; farmiddlej = middlej; } else if (middlei < board_size-1 - && eye[middlei+1][middlej].origin == POS(i, j) - && eye[middlei+1][middlej].neighbors == 2) + && eye[POS(middlei+1, middlej)].origin == POS(i, j) + && eye[POS(middlei+1, middlej)].neighbors == 2) { farmiddlei = middlei+1; farmiddlej = middlej; } else if (middlej > 0 - && eye[middlei][middlej-1].origin == POS(i, j) - && eye[middlei][middlej-1].neighbors == 2) + && eye[POS(middlei, middlej-1)].origin == POS(i, j) + && eye[POS(middlei, middlej-1)].neighbors == 2) { farmiddlei = middlei; farmiddlej = middlej-1; } else if (middlej < board_size-1 - && eye[middlei][middlej+1].origin == POS(i, j) - && eye[middlei][middlej+1].neighbors == 2) + && eye[POS(middlei, middlej+1)].origin == POS(i, j) + && eye[POS(middlei, middlej+1)].neighbors == 2) { farmiddlei = middlei; farmiddlej = middlej+1; @@ -1297,7 +1297,7 @@ if (esize == 2) { *max = 1; *min = 0; - if (eye[end1i][end1j].marginal) { + if (eye[POS(end1i, end1j)].marginal) { *attacki = end1i; *attackj = end1j; } @@ -1325,10 +1325,10 @@ *min = 1; /* Exceptional cases. (eyes.tst:312) */ - if ((eye[end1i][end1j].marginal + if ((eye[POS(end1i, end1j)].marginal && BOARD(end1i, end1j) != EMPTY && BOARD(end2i, end2j) == EMPTY) - || (eye[end2i][end2j].marginal + || (eye[POS(end2i, end2j)].marginal && BOARD(end2i, end2j) != EMPTY && BOARD(end1i, end1j) == EMPTY)) { *min = 0; @@ -1340,7 +1340,7 @@ else { *max = 1; *min = 0; - if (eye[end1i][end1j].marginal) { + if (eye[POS(end1i, end1j)].marginal) { if (BOARD(end1i, end1j) == EMPTY) { *attacki = end1i; *attackj = end1j; @@ -1378,29 +1378,29 @@ int farmiddlei; int farmiddlej; if (middlei > 0 - && eye[middlei-1][middlej].origin == POS(i, j) - && eye[middlei-1][middlej].neighbors == 2) + && eye[POS(middlei-1, middlej)].origin == POS(i, j) + && eye[POS(middlei-1, middlej)].neighbors == 2) { farmiddlei = middlei-1; farmiddlej = middlej; } else if (middlei < board_size-1 - && eye[middlei+1][middlej].origin == POS(i, j) - && eye[middlei+1][middlej].neighbors == 2) + && eye[POS(middlei+1, middlej)].origin == POS(i, j) + && eye[POS(middlei+1, middlej)].neighbors == 2) { farmiddlei = middlei+1; farmiddlej = middlej; } else if (middlej > 0 - && eye[middlei][middlej-1].origin == POS(i, j) - && eye[middlei][middlej-1].neighbors == 2) + && eye[POS(middlei, middlej-1)].origin == POS(i, j) + && eye[POS(middlei, middlej-1)].neighbors == 2) { farmiddlei = middlei; farmiddlej = middlej-1; } else if (middlej < board_size-1 - && eye[middlei][middlej+1].origin == POS(i, j) - && eye[middlei][middlej+1].neighbors == 2) + && eye[POS(middlei, middlej+1)].origin == POS(i, j) + && eye[POS(middlei, middlej+1)].neighbors == 2) { farmiddlei = middlei; farmiddlej = middlej+1; @@ -1419,7 +1419,7 @@ else { *max = 1; *min = 0; - if (eye[end1i][end1j].marginal) { + if (eye[POS(end1i, end1j)].marginal) { *attacki = end1i; *attackj = end1j; } @@ -1435,7 +1435,7 @@ if (esize == 5) { *max=2; *min=1; - if (eye[end1i][end1j].marginal) { + if (eye[POS(end1i, end1j)].marginal) { *attacki = end1i; *attackj = end1j; } @@ -1505,7 +1505,7 @@ static int recognize_eye(int i, int j, int *ai, int *aj, int *di, int *dj, int *max, int *min, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX], int add_moves, int color) { @@ -1523,28 +1523,28 @@ int num_marginals = 0; /* Set `eye_color' to the owner of the eye. */ - eye_color = eye[i][j].color; + eye_color = eye[POS(i, j)].color; if (eye_color == BLACK_BORDER) eye_color = BLACK; if (eye_color == WHITE_BORDER) eye_color = WHITE; - if (eye[i][j].esize-eye[i][j].msize > 7) + if (eye[POS(i, j)].esize-eye[POS(i, j)].msize > 7) return 0; - if (eye[i][j].msize > MAXEYE) + if (eye[POS(i, j)].msize > MAXEYE) return 0; /* Create list of eye vertices */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { - if (eye[m][n].origin == POS(i, j)) { + if (eye[POS(m, n)].origin == POS(i, j)) { vpos[eye_size] = POS(m, n); - marginal[eye_size] = eye[m][n].marginal; + marginal[eye_size] = eye[POS(m, n)].marginal; if (marginal[eye_size]) num_marginals++; - neighbors[eye_size] = eye[m][n].neighbors; + neighbors[eye_size] = eye[POS(m, n)].neighbors; if (0) { if (marginal[eye_size]) TRACE("(%1m)", vpos[eye_size]); @@ -1832,7 +1832,7 @@ /* add_half_eye adds a half eye or false eye to an eye shape. */ void -add_half_eye(int m, int n, struct eye_data eye[MAX_BOARD][MAX_BOARD], +add_half_eye(int m, int n, struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { if (heye[POS(m, n)].type) @@ -1840,24 +1840,24 @@ if (heye[POS(m, n)].type == FALSE_EYE) { DEBUG(DEBUG_EYES, "false eye at %m for dragon at %1m\n", - m, n, eye[m][n].dragon); - if (eye[m][n].color != GRAY) { - if (eye[m][n].marginal == 0) { - eye[m][n].marginal=1; - (eye[I(eye[m][n].origin)][J(eye[m][n].origin)].msize)++; + m, n, eye[POS(m, n)].dragon); + if (eye[POS(m, n)].color != GRAY) { + if (eye[POS(m, n)].marginal == 0) { + eye[POS(m, n)].marginal=1; + (eye[eye[POS(m, n)].origin].msize)++; if ((m > 0) - && (eye[m-1][n].origin == eye[m][n].origin)) - eye[m-1][n].marginal_neighbors++; + && (eye[POS(m-1, n)].origin == eye[POS(m, n)].origin)) + eye[POS(m-1, n)].marginal_neighbors++; if ((m < board_size-1) - && (eye[m+1][n].origin == eye[m][n].origin)) - eye[m+1][n].marginal_neighbors++; + && (eye[POS(m+1, n)].origin == eye[POS(m, n)].origin)) + eye[POS(m+1, n)].marginal_neighbors++; if ((n > 0) - && (eye[m][n-1].origin == eye[m][n].origin)) - eye[m][n-1].marginal_neighbors++; + && (eye[POS(m, n-1)].origin == eye[POS(m, n)].origin)) + eye[POS(m, n-1)].marginal_neighbors++; if ((n < board_size-1) - && (eye[m][n+1].origin == eye[m][n].origin)) - eye[m][n+1].marginal_neighbors++; - propagate_eye(I(eye[m][n].origin), J(eye[m][n].origin), eye); + && (eye[POS(m, n+1)].origin == eye[POS(m, n)].origin)) + eye[POS(m, n+1)].marginal_neighbors++; + propagate_eye(eye[POS(m, n)].origin, eye); } } } @@ -1868,19 +1868,19 @@ * primarily for late endgame moves. */ int -eye_space(int i, int j) +is_eye_space(int pos) { - return ((white_eye[i][j].color == WHITE_BORDER) - || (black_eye[i][j].color == BLACK_BORDER)); + return ((white_eye[pos].color == WHITE_BORDER) + || (black_eye[pos].color == BLACK_BORDER)); } int -proper_eye_space(int i, int j) +is_proper_eye_space(int pos) { - return (( (white_eye[i][j].color == WHITE_BORDER) - && !white_eye[i][j].marginal) - || ((black_eye[i][j].color == BLACK_BORDER) - && !black_eye[i][j].marginal)); + return (( (white_eye[pos].color == WHITE_BORDER) + && !white_eye[pos].marginal) + || ((black_eye[pos].color == BLACK_BORDER) + && !black_eye[pos].marginal)); } /* Return the maximum number of eyes that can be obtained from the @@ -1889,24 +1889,24 @@ * all. */ int -max_eye_value(int i, int j) +max_eye_value(int pos) { int max_white = 0; int max_black = 0; - if (white_eye[i][j].color == WHITE_BORDER) - max_white = white_eye[i][j].maxeye; + if (white_eye[pos].color == WHITE_BORDER) + max_white = white_eye[pos].maxeye; - if (black_eye[i][j].color == BLACK_BORDER) - max_black = black_eye[i][j].maxeye; + if (black_eye[pos].color == BLACK_BORDER) + max_black = black_eye[pos].maxeye; return gg_max(max_white, max_black); } int -marginal_eye_space(int i, int j) +is_marginal_eye_space(int pos) { - return (white_eye[i][j].marginal || black_eye[i][j].marginal); + return (white_eye[pos].marginal || black_eye[pos].marginal); } int @@ -1917,33 +1917,37 @@ /* Turn a marginal eye space into a proper eye space. */ void -make_proper_eye_space(int i, int j, int color) +make_proper_eye_space(int pos, int color) { - row_of_eye_data *eye; + struct eye_data *eye; + int i = I(pos); + int j = J(pos); + if (color == WHITE) eye = white_eye; else eye = black_eye; - gg_assert(eye[i][j].color != GRAY_BORDER); - gg_assert(eye[i][j].marginal == 1); + gg_assert(eye[pos].color != GRAY_BORDER); + gg_assert(eye[pos].marginal == 1); - eye[i][j].marginal = 0; + eye[pos].marginal = 0; - (eye[I(eye[i][j].origin)][J(eye[i][j].origin)].msize)--; + (eye[eye[pos].origin].msize)--; if ((i > 0) - && (eye[i-1][j].origin == eye[i][j].origin)) - eye[i-1][j].marginal_neighbors--; + && (eye[pos-NS].origin == eye[pos].origin)) + eye[pos-NS].marginal_neighbors--; if ((i < board_size-1) - && (eye[i+1][j].origin == eye[i][j].origin)) - eye[i+1][j].marginal_neighbors--; + && (eye[pos+NS].origin == eye[pos].origin)) + eye[pos+NS].marginal_neighbors--; if ((j > 0) - && (eye[i][j-1].origin == eye[i][j].origin)) - eye[i][j-1].marginal_neighbors--; + && (eye[pos-1].origin == eye[pos].origin)) + eye[pos-1].marginal_neighbors--; if ((j < board_size-1) - && (eye[i][j+1].origin == eye[i][j].origin)) - eye[i][j+1].marginal_neighbors--; - propagate_eye(I(eye[i][j].origin), J(eye[i][j].origin), eye); + && (eye[pos+1].origin == eye[pos].origin)) + eye[pos+1].marginal_neighbors--; + + propagate_eye(eye[pos].origin, eye); } /* remove a halfeye from an eye shape. */ @@ -1992,14 +1996,15 @@ } /* Remove an eye point. This function can only be used before the - * segmentation into eyespaces. */ + * segmentation into eyespaces. + */ void -remove_eyepoint(int m, int n, int color) +remove_eyepoint(int pos, int color) { if (color == WHITE) - white_eye[m][n].color = GRAY_BORDER; + white_eye[pos].color = GRAY_BORDER; else - black_eye[m][n].color = GRAY_BORDER; + black_eye[pos].color = GRAY_BORDER; } @@ -2016,8 +2021,8 @@ int topological_eye(int m, int n, int color, int *ai, int *aj, int *di, int *dj, - struct eye_data b_eye[MAX_BOARD][MAX_BOARD], - struct eye_data w_eye[MAX_BOARD][MAX_BOARD], + struct eye_data b_eye[BOARDMAX], + struct eye_data w_eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { int sum = 0; @@ -2104,8 +2109,8 @@ evaluate_diagonal_intersection(int m, int n, int color, int *attacki, int *attackj, int *defendi, int *defendj, - struct eye_data b_eye[MAX_BOARD][MAX_BOARD], - struct eye_data w_eye[MAX_BOARD][MAX_BOARD]) + struct eye_data b_eye[BOARDMAX], + struct eye_data w_eye[BOARDMAX]) { int value = 0; int other = OTHER_COLOR(color); @@ -2142,13 +2147,13 @@ * whole group as dead (instead of living in seki). */ if (color == BLACK - && b_eye[m][n].color == BLACK_BORDER - && !b_eye[m][n].marginal + && b_eye[POS(m, n)].color == BLACK_BORDER + && !b_eye[POS(m, n)].marginal && !(BOARD(m, n) == EMPTY && does_capture_something2(m, n, WHITE))) return 0; if (color == WHITE - && w_eye[m][n].color == WHITE_BORDER - && !w_eye[m][n].marginal + && w_eye[POS(m, n)].color == WHITE_BORDER + && !w_eye[POS(m, n)].marginal && !(BOARD(m, n) == EMPTY && does_capture_something2(m, n, BLACK))) return 0; Index: engine/owl.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v retrieving revision 1.14 diff -u -r1.14 owl.c --- engine/owl.c 2001/10/01 17:04:58 1.14 +++ engine/owl.c 2001/10/04 17:56:14 @@ -67,8 +67,8 @@ int escape_values[MAX_BOARD][MAX_BOARD]; int color; - struct eye_data black_eye[MAX_BOARD][MAX_BOARD]; - struct eye_data white_eye[MAX_BOARD][MAX_BOARD]; + struct eye_data black_eye[BOARDMAX]; + struct eye_data white_eye[BOARDMAX]; /* array of half-eye data for use during owl reading */ struct half_eye_data half_eye[BOARDMAX]; @@ -165,7 +165,7 @@ static void owl_add_move(struct owl_move_data *moves, int move, int value, const char *reason, int same_dragon); static int owl_determine_life(struct local_owl_data *owl, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], int color, int komaster, int does_attack, struct owl_move_data *moves, int *probable_min, int *probable_max); @@ -1819,7 +1819,7 @@ static int owl_determine_life(struct local_owl_data *owl, - struct eye_data eye[MAX_BOARD][MAX_BOARD], + struct eye_data eye[BOARDMAX], int color, int komaster, int does_attack, struct owl_move_data *moves, int *probable_min, int *probable_max) @@ -1883,25 +1883,25 @@ for (n = 0; n < board_size; n++) if (BOARD(m, n) && owl->goal[m][n]) { if (m > 0 - && eye[m-1][n].color == eye_color - && eye[m-1][n].origin != NO_MOVE - && !eye[m-1][n].marginal) - mw[I(eye[m-1][n].origin)][J(eye[m-1][n].origin)] = 1; + && eye[POS(m-1, n)].color == eye_color + && eye[POS(m-1, n)].origin != NO_MOVE + && !eye[POS(m-1, n)].marginal) + mw[I(eye[POS(m-1, n)].origin)][J(eye[POS(m-1, n)].origin)] = 1; if (m < board_size-1 - && eye[m+1][n].color == eye_color - && eye[m+1][n].origin != NO_MOVE - && !eye[m+1][n].marginal) - mw[I(eye[m+1][n].origin)][J(eye[m+1][n].origin)] = 1; + && eye[POS(m+1, n)].color == eye_color + && eye[POS(m+1, n)].origin != NO_MOVE + && !eye[POS(m+1, n)].marginal) + mw[I(eye[POS(m+1, n)].origin)][J(eye[POS(m+1, n)].origin)] = 1; if (n > 0 - && eye[m][n-1].color == eye_color - && eye[m][n-1].origin != NO_MOVE - && !eye[m][n-1].marginal) - mw[I(eye[m][n-1].origin)][J(eye[m][n-1].origin)] = 1; + && eye[POS(m, n-1)].color == eye_color + && eye[POS(m, n-1)].origin != NO_MOVE + && !eye[POS(m, n-1)].marginal) + mw[I(eye[POS(m, n-1)].origin)][J(eye[POS(m, n-1)].origin)] = 1; if (n < board_size-1 - && eye[m][n+1].color == eye_color - && eye[m][n+1].origin != NO_MOVE - && !eye[m][n+1].marginal) - mw[I(eye[m][n+1].origin)][J(eye[m][n+1].origin)] = 1; + && eye[POS(m, n+1)].color == eye_color + && eye[POS(m, n+1)].origin != NO_MOVE + && !eye[POS(m, n+1)].marginal) + mw[I(eye[POS(m, n+1)].origin)][J(eye[POS(m, n+1)].origin)] = 1; } for (m = 0; m < board_size; m++) @@ -1917,11 +1917,11 @@ topological_intersections = 0; for (m = 0; mhalf_eye); if (sum >= 4) { - int previously_marginal = eye[m][n].marginal; + int previously_marginal = eye[POS(m, n)].marginal; owl->half_eye[POS(m, n)].type = FALSE_EYE; - if (eye[m][n].esize == 1 + if (eye[POS(m, n)].esize == 1 || is_legal2(m, n, OTHER_COLOR(color)) || BOARD(m, n) == OTHER_COLOR(color)) { add_half_eye(m, n, eye, owl->half_eye); @@ -1995,7 +1995,7 @@ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (mw[m][n] - && (eye[m][n].origin == POS(m, n))) + && (eye[POS(m, n)].origin == POS(m, n))) { int value = 0; const char *reason = ""; @@ -2009,7 +2009,7 @@ for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) if (mw[i][j] - && eye[i][j].origin == POS(m, n) + && eye[POS(i, j)].origin == POS(m, n) && owl->inessential[i][j]) pessimistic_min = 0; @@ -2018,7 +2018,7 @@ *probable_max += max; /* Fill in the maxeye field for use by the owl_eyespace() function. */ - eye[m][n].maxeye = max; + eye[POS(m, n)].maxeye = max; /* This shortcut has been disabled for two reasons: * 1. Due to the vital attack moves being able to later reduce @@ -3579,16 +3579,16 @@ ASSERT2(BOARD(bi, bj) != EMPTY, bi, bj); if (BOARD(bi, bj) == WHITE) { - opos = current_owl_data->white_eye[ai][aj].origin; + opos = current_owl_data->white_eye[POS(ai, aj)].origin; return (!is_pass(opos) - && current_owl_data->white_eye[I(opos)][J(opos)].color == WHITE_BORDER - && current_owl_data->white_eye[I(opos)][J(opos)].maxeye > 0); + && current_owl_data->white_eye[opos].color == WHITE_BORDER + && current_owl_data->white_eye[opos].maxeye > 0); } else { - opos = current_owl_data->black_eye[ai][aj].origin; + opos = current_owl_data->black_eye[POS(ai, aj)].origin; return (!is_pass(opos) - && current_owl_data->black_eye[I(opos)][J(opos)].color == BLACK_BORDER - && current_owl_data->black_eye[I(opos)][J(opos)].maxeye > 0); + && current_owl_data->black_eye[opos].color == BLACK_BORDER + && current_owl_data->black_eye[opos].maxeye > 0); } } @@ -3606,16 +3606,16 @@ ASSERT_ON_BOARD2(ai, aj); if (BOARD(bi, bj) == WHITE) { - opos = current_owl_data->white_eye[ai][aj].origin; + opos = current_owl_data->white_eye[POS(ai, aj)].origin; return (ON_BOARD(opos) - && current_owl_data->white_eye[I(opos)][J(opos)].color == WHITE_BORDER - && current_owl_data->white_eye[I(opos)][J(opos)].maxeye == 2); + && current_owl_data->white_eye[opos].color == WHITE_BORDER + && current_owl_data->white_eye[opos].maxeye == 2); } else { - opos = current_owl_data->black_eye[ai][aj].origin; + opos = current_owl_data->black_eye[POS(ai, aj)].origin; return (ON_BOARD(opos) - && current_owl_data->black_eye[I(opos)][J(opos)].color == BLACK_BORDER - && current_owl_data->black_eye[I(opos)][J(opos)].maxeye == 2); + && current_owl_data->black_eye[opos].color == BLACK_BORDER + && current_owl_data->black_eye[opos].maxeye == 2); } } Index: engine/sgfdecide.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/sgfdecide.c,v retrieving revision 1.11 diff -u -r1.11 sgfdecide.c --- engine/sgfdecide.c 2001/10/02 06:36:02 1.11 +++ engine/sgfdecide.c 2001/10/04 17:56:14 @@ -361,9 +361,9 @@ verbose = save_verbose; debug = save_debug; - if (black_eye[m][n].color == BLACK_BORDER) + if (black_eye[POS(m, n)].color == BLACK_BORDER) color = BLACK; - else if (white_eye[m][n].color == WHITE_BORDER) + else if (white_eye[POS(m, n)].color == WHITE_BORDER) color = WHITE; else { gprintf("The eye at %m is not of a single color.\n", m, n); @@ -381,9 +381,9 @@ begin_sgftreedump(&tree); count_variations = 1; - if (black_eye[m][n].color == BLACK_BORDER) { - i = I(black_eye[m][n].origin); - j = J(black_eye[m][n].origin); + if (black_eye[POS(m, n)].color == BLACK_BORDER) { + i = I(black_eye[POS(m, n)].origin); + j = J(black_eye[POS(m, n)].origin); compute_eyes(i, j, &max, &min, &attacki, &attackj, &defendi, &defendj, black_eye, half_eye, 0, EMPTY); gprintf("Black eyespace at %m: min=%d, max=%d\n", i, j, min, max); @@ -392,9 +392,9 @@ defendi, defendj); } } - if (white_eye[m][n].color == WHITE_BORDER) { - i = I(white_eye[m][n].origin); - j = J(white_eye[m][n].origin); + if (white_eye[POS(m, n)].color == WHITE_BORDER) { + i = I(white_eye[POS(m, n)].origin); + j = J(white_eye[POS(m, n)].origin); compute_eyes(i, j, &max, &min, &attacki, &attackj, &defendi, &defendj, white_eye, half_eye, 0, EMPTY); gprintf("White eyespace at %m: min=%d, max=%d\n", i, j, min, max); Index: engine/showbord.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/showbord.c,v retrieving revision 1.7 diff -u -r1.7 showbord.c --- engine/showbord.c 2001/10/01 17:04:58 1.7 +++ engine/showbord.c 2001/10/04 17:56:14 @@ -265,20 +265,20 @@ int empty_color; char empty_char; - if (black_eye[i][j].color == BLACK_BORDER) { - if (white_eye[i][j].color == WHITE_BORDER) + if (black_eye[POS(i, j)].color == BLACK_BORDER) { + if (white_eye[POS(i, j)].color == WHITE_BORDER) empty_color = domain_colors[3]; else empty_color = domain_colors[1]; - if (black_eye[i][j].marginal) + if (black_eye[POS(i, j)].marginal) empty_char = '!'; else empty_char = 'x'; } - else if (white_eye[i][j].color == WHITE_BORDER) { + else if (white_eye[POS(i, j)].color == WHITE_BORDER) { empty_color = domain_colors[2]; - if (white_eye[i][j].marginal) + if (white_eye[POS(i, j)].marginal) empty_char = '!'; else empty_char = 'o'; Index: engine/utils.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v retrieving revision 1.15 diff -u -r1.15 utils.c --- engine/utils.c 2001/10/02 20:15:38 1.15 +++ engine/utils.c 2001/10/04 17:56:15 @@ -161,9 +161,11 @@ cut_possible(int i, int j, int color) { if (color == WHITE) - return (black_eye[i][j].cut || (black_eye[i][j].type & INHIBIT_CONNECTION)); + return (black_eye[POS(i, j)].cut + || (black_eye[POS(i, j)].type & INHIBIT_CONNECTION)); else - return (white_eye[i][j].cut || (white_eye[i][j].type & INHIBIT_CONNECTION)); + return (white_eye[POS(i, j)].cut + || (white_eye[POS(i, j)].type & INHIBIT_CONNECTION)); } Index: interface/play_gtp.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v retrieving revision 1.18 diff -u -r1.18 play_gtp.c --- interface/play_gtp.c 2001/10/02 03:04:19 1.18 +++ interface/play_gtp.c 2001/10/04 17:56:15 @@ -870,15 +870,15 @@ examine_position(BLACK, EXAMINE_DRAGONS_WITHOUT_OWL); verbose = save_verbose; - if (black_eye[m][n].color == BLACK_BORDER) { - i = I(black_eye[m][n].origin); - j = J(black_eye[m][n].origin); + if (black_eye[POS(m, n)].color == BLACK_BORDER) { + i = I(black_eye[POS(m, n)].origin); + j = J(black_eye[POS(m, n)].origin); compute_eyes(i, j, &max, &min, &attacki, &attackj, &defendi, &defendj, black_eye, half_eye, 0, EMPTY); } - else if (white_eye[m][n].color == WHITE_BORDER) { - i = I(white_eye[m][n].origin); - j = J(white_eye[m][n].origin); + else if (white_eye[POS(m, n)].color == WHITE_BORDER) { + i = I(white_eye[POS(m, n)].origin); + j = J(white_eye[POS(m, n)].origin); compute_eyes(i, j, &max, &min, &attacki, &attackj, &defendi, &defendj, white_eye, half_eye, 0, EMPTY); } Index: interface/debugboard/gui.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/debugboard/gui.c,v retrieving revision 1.10 diff -u -r1.10 gui.c --- interface/debugboard/gui.c 2001/10/01 17:04:58 1.10 +++ interface/debugboard/gui.c 2001/10/04 17:56:15 @@ -307,7 +307,7 @@ void -display_eye(int color, struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +display_eye(int color, struct eye_data eyedata[BOARDMAX], int i, int j) { wmove(info_window, 1, 24); @@ -316,55 +316,55 @@ gg_wprintw(info_window, "%s ", location_to_string2(i, j)); wmove(info_window, 2, 24); - if (eyedata[i][j].origin == NO_MOVE) + if (eyedata[POS(i, j)].origin == NO_MOVE) gg_wprintw(info_window, "---"); else gg_wprintw(info_window, "%s ", - location_to_string(eyedata[i][j].origin)); + location_to_string(eyedata[POS(i, j)].origin)); wmove(info_window, 4, 18); - gg_wprintw(info_window, "%-12s", color_to_string(eyedata[i][j].color)); + gg_wprintw(info_window, "%-12s", color_to_string(eyedata[POS(i, j)].color)); wmove(info_window, 5, 18); - gg_wprintw(info_window, "%d ", eyedata[i][j].esize); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].esize); wmove(info_window, 6, 18); - gg_wprintw(info_window, "%d ", eyedata[i][j].msize); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].msize); wmove(info_window, 7, 18); - if (eyedata[i][j].dragon == NO_MOVE) + if (eyedata[POS(i, j)].dragon == NO_MOVE) gg_wprintw(info_window, "---"); else gg_wprintw(info_window, "%s ", - location_to_string(eyedata[i][j].dragon)); + location_to_string(eyedata[POS(i, j)].dragon)); wmove(info_window, 11, 18); - gg_wprintw(info_window, "%d ", eyedata[i][j].type); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].type); wmove(info_window, 12, 18); - gg_wprintw(info_window, "%d ", eyedata[i][j].marginal); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].marginal); wmove(info_window, 4, 55); - gg_wprintw(info_window, "%d ", eyedata[i][j].maxeye); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].maxeye); wmove(info_window, 5, 55); - gg_wprintw(info_window, "%d ", eyedata[i][j].mineye); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].mineye); wmove(info_window, 6, 55); - if (eyedata[i][j].attack_point == NO_MOVE) + if (eyedata[POS(i, j)].attack_point == NO_MOVE) gg_wprintw(info_window, "--- "); else gg_wprintw(info_window, "%3s", - location_to_string(eyedata[i][j].attack_point)); + location_to_string(eyedata[POS(i, j)].attack_point)); wmove(info_window, 7, 55); - if (eyedata[i][j].defense_point == NO_MOVE) + if (eyedata[POS(i, j)].defense_point == NO_MOVE) gg_wprintw(info_window, "--- "); else gg_wprintw(info_window, "%3s", - location_to_string(eyedata[i][j].defense_point)); + location_to_string(eyedata[POS(i, j)].defense_point)); wmove(info_window, 11, 55); - gg_wprintw(info_window, "%d ", eyedata[i][j].neighbors); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].neighbors); wmove(info_window, 12, 55); - gg_wprintw(info_window, "%d ", eyedata[i][j].marginal_neighbors); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].marginal_neighbors); wmove(info_window, 13, 55); - gg_wprintw(info_window, "%d ", eyedata[i][j].cut); + gg_wprintw(info_window, "%d ", eyedata[POS(i, j)].cut); wrefresh(info_window); } Index: interface/debugboard/gui.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/debugboard/gui.h,v retrieving revision 1.3 diff -u -r1.3 gui.h --- interface/debugboard/gui.h 2001/09/06 21:34:20 1.3 +++ interface/debugboard/gui.h 2001/10/04 17:56:15 @@ -39,7 +39,7 @@ void prepare_dragons_tab(void); void display_dragon(int i, int j); void prepare_eyes_tab(void); -void display_eye(int color, struct eye_data eyedata[MAX_BOARD][MAX_BOARD], +void display_eye(int color, struct eye_data eyedata[BOARDMAX], int i, int j); void prepare_help_tab(void); Index: patterns/connections.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/connections.c,v retrieving revision 1.10 diff -u -r1.10 connections.c --- patterns/connections.c 2001/10/02 06:36:02 1.10 +++ patterns/connections.c 2001/10/04 17:56:15 @@ -145,13 +145,13 @@ if (pattern->class & CLASS_B) { if (color == WHITE) - white_eye[stari][starj].cut = 1; + white_eye[POS(stari, starj)].cut = 1; else - black_eye[stari][starj].cut = 1; - if (color == WHITE && white_eye[stari][starj].color == WHITE_BORDER) - white_eye[stari][starj].marginal = 1; - else if (color == BLACK && black_eye[stari][starj].color == BLACK_BORDER) - black_eye[stari][starj].marginal = 1; + black_eye[POS(stari, starj)].cut = 1; + if (color == WHITE && white_eye[POS(stari, starj)].color == WHITE_BORDER) + white_eye[POS(stari, starj)].marginal = 1; + else if (color == BLACK && black_eye[POS(stari, starj)].color == BLACK_BORDER) + black_eye[POS(stari, starj)].marginal = 1; } else if (!(pattern->class & CLASS_C)) return; /* Nothing more to do, up to the helper or autohelper @@ -197,10 +197,10 @@ if (pattern->class & CLASS_B) { if (pattern->patn[k].att != ATT_not) break; /* The inhibition points are guaranteed to come first. */ - if (color == WHITE && white_eye[x][y].color == WHITE_BORDER) - white_eye[x][y].type |= INHIBIT_CONNECTION; - else if (color == BLACK && black_eye[x][y].color == BLACK_BORDER) - black_eye[x][y].type |= INHIBIT_CONNECTION; + if (color == WHITE && white_eye[POS(x, y)].color == WHITE_BORDER) + white_eye[POS(x, y)].type |= INHIBIT_CONNECTION; + else if (color == BLACK && black_eye[POS(x, y)].color == BLACK_BORDER) + black_eye[POS(x, y)].type |= INHIBIT_CONNECTION; } } /* loop over elements */ } Index: patterns/helpers.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v retrieving revision 1.12 diff -u -r1.12 helpers.c --- patterns/helpers.c 2001/10/02 06:36:02 1.12 +++ patterns/helpers.c 2001/10/04 17:56:15 @@ -115,9 +115,9 @@ UNUSED(transformation); UNUSED(pattern); if (color==WHITE) - own_eyespace = (white_eye[ti][tj].color == WHITE_BORDER); + own_eyespace = (white_eye[POS(ti, tj)].color == WHITE_BORDER); else - own_eyespace = (black_eye[ti][tj].color == BLACK_BORDER); + own_eyespace = (black_eye[POS(ti, tj)].color == BLACK_BORDER); if (influence_area_color(ti, tj) != color && !own_eyespace) return 1; Index: patterns/mkpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v retrieving revision 1.16 diff -u -r1.16 mkpat.c --- patterns/mkpat.c 2001/10/03 21:07:43 1.16 +++ patterns/mkpat.c 2001/10/04 17:56:15 @@ -210,11 +210,11 @@ {"not_lunch", 2, "not_lunch_helper(%ci,%cj,%ci,%cj)"}, {"area_stone", 1, "area_stone(%ci,%cj)"}, {"area_space", 1, "area_space(%ci,%cj)"}, - {"eye", 1, "eye_space(%ci,%cj)"}, - {"proper_eye", 1, "proper_eye_space(%ci,%cj)"}, - {"marginal_eye", 1, "marginal_eye_space(%ci,%cj)"}, + {"eye", 1, "is_eye_space(POS(%ci,%cj))"}, + {"proper_eye", 1, "is_proper_eye_space(POS(%ci,%cj))"}, + {"marginal_eye", 1, "is_marginal_eye_space(POS(%ci,%cj))"}, {"halfeye", 1, "is_halfeye(half_eye,POS(%ci,%cj))"}, - {"max_eye_value", 1, "max_eye_value(%ci,%cj)"}, + {"max_eye_value", 1, "max_eye_value(POS(%ci,%cj))"}, {"owl_topological_eye", 2, "owl_topological_eye(%ci,%cj,BOARD(%ci,%cj))"}, {"obvious_false_oeye", 1, "obvious_false_eye(%ci,%cj,color)"}, {"obvious_false_xeye", 1, "obvious_false_eye(%ci,%cj,OTHER_COLOR(color))"},