[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] experimental_reading_1_33.1
From: |
bump |
Subject: |
[gnugo-devel] experimental_reading_1_33.1 |
Date: |
Thu, 18 Apr 2002 15:40:55 -0700 |
This patch makes sure the experimental reading code is not
compiled if EXPERIMENTAL_READING is 0. The files
patterns/read_attack.c and patterns/read_defend.c are
still built, and there is no difference in the engine
you get if you configure with experimental reading enabled.
The motivation for this is Gunnar's discovery that you get serious
warnings on Alpha. The code is actually not valid on this platform
since it has 64 bit pointers but 32 bit integers.
matchpat.c: In function `tree_initialize_pointers':
matchpat.c:790: warning: cast from pointer to integer of different size
matchpat.c:792: warning: cast from pointer to integer of different size
matchpat.c:794: warning: cast from pointer to integer of different size
matchpat.c:800: warning: cast from pointer to integer of different size
mkpat.c: In function `dump_tree_node':
mkpat.c:1815: warning: cast to pointer from integer of different size
mkpat.c:1818: warning: cast to pointer from integer of different size
mkpat.c:1830: warning: cast to pointer from integer of different size
mkpat.c:1855: warning: cast to pointer from integer of different size
mkpat.c:1868: warning: cast to pointer from integer of different size
mkpat.c: In function `tree_write_patterns':
mkpat.c:1916: warning: cast to pointer from integer of different size
mkpat.c:1928: warning: cast from pointer to integer of different size
mkpat.c:1932: warning: cast from pointer to integer of different size
mkpat.c:1933: warning: cast from pointer to integer of different size
mkpat.c:1943: warning: cast from pointer to integer of different size
- tree based reading not compiled by default
Dan
Index: engine/gnugo.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/gnugo.h,v
retrieving revision 1.51
diff -u -r1.51 gnugo.h
--- engine/gnugo.h 11 Apr 2002 19:52:05 -0000 1.51
+++ engine/gnugo.h 18 Apr 2002 22:14:00 -0000
@@ -270,10 +270,11 @@
extern int allow_suicide; /* allow opponent to make suicide moves */
extern int capture_all_dead; /* capture all dead opponent stones */
extern int play_out_aftermath; /* make everything unconditionally settled */
+
+#if EXPERIMENTAL_READING
extern int defend_by_pattern; /* use patterns for tactical reading defense */
extern int attack_by_pattern; /* use patterns for tactical reading attack */
-
-
+#endif
/* Mandatory values of reading parameters. Normally -1, if set at
* these override the values derived from the level. */
Index: engine/interface.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/interface.c,v
retrieving revision 1.17
diff -u -r1.17 interface.c
--- engine/interface.c 31 Mar 2002 18:48:08 -0000 1.17
+++ engine/interface.c 18 Apr 2002 22:14:00 -0000
@@ -42,7 +42,9 @@
clear_board();
dfa_match_init();
+#if EXPERIMENTAL_READING
tree_match_init();
+#endif
}
Index: engine/matchpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/matchpat.c,v
retrieving revision 1.30
diff -u -r1.30 matchpat.c
--- engine/matchpat.c 31 Mar 2002 20:46:47 -0000 1.30
+++ engine/matchpat.c 18 Apr 2002 22:14:00 -0000
@@ -619,6 +619,8 @@
pdb->patterns, callback_data, goal);
}
+#if EXPERIMENTAL_READING
+
/**************************************************************************/
/* Tree matcher: */
/**************************************************************************/
@@ -801,7 +803,9 @@
} while (++matches_walk < matches + matches_size);
}
+#endif
+#
/**************************************************************************/
/* DFA matcher: */
@@ -1211,10 +1215,12 @@
prepare = dfa_prepare_for_match;
}
+#if EXPERIMENTAL_READING
if (pdb->tnl) {
loop = tree_matchpat_loop;
prepare = tree_prepare_for_match;
}
+#endif
/* select strategy */
switch (color) {
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.58
diff -u -r1.58 reading.c
--- engine/reading.c 18 Apr 2002 19:10:37 -0000 1.58
+++ engine/reading.c 18 Apr 2002 22:14:01 -0000
@@ -31,10 +31,18 @@
#include "patterns.h"
#include "gg_utils.h"
+#if EXPERIMENTAL_READING
+
/* When to use pattern-base reading */
int defend_by_pattern = 0;
int attack_by_pattern = 1;
+static int do_tactical_pat(int is_attack, int str, int *move,
+ int komaster, int kom_pos);
+static int do_defend_pat(int str, int *move, int komaster, int kom_pos);
+static int do_attack_pat(int str, int *move, int komaster, int kom_pos);
+
+#endif
/* Size of array where candidate moves are stored. */
#define MAX_MOVES 50
Index: interface/main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.36
diff -u -r1.36 main.c
--- interface/main.c 31 Mar 2002 18:48:08 -0000 1.36
+++ interface/main.c 18 Apr 2002 22:14:01 -0000
@@ -763,6 +763,8 @@
return EXIT_SUCCESS;
break;
+#if EXPERIMENTAL_READING
+
case OPT_ATTACK_BY_PATTERN:
attack_by_pattern = 1;
break;
@@ -771,6 +773,7 @@
defend_by_pattern = 1;
break;
+#endif
case 'v':
show_version();
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.67
diff -u -r1.67 mkpat.c
--- patterns/mkpat.c 18 Apr 2002 20:42:15 -0000 1.67
+++ patterns/mkpat.c 18 Apr 2002 22:14:01 -0000
@@ -353,8 +353,9 @@
int dfa_generate = 0; /* if 1 a dfa is created. */
int dfa_c_output = 0; /* if 1 the dfa is saved as a c file */
dfa_t dfa;
+#if EXPERIMENTAL_READING
int tree_output = 0; /* if 1, the tree data structure is output */
-
+#endif
/**************************
*
@@ -1416,7 +1417,7 @@
/* stuff to write the elements of a pattern */
/* ================================================================ */
-
+#ifdef EXPERIMENTAL_READING
/* callback function used to sort the elements in a pattern.
* We want to sort the patterns by attribute.
@@ -1469,6 +1470,7 @@
struct element_node *next;
};
+#endif
/* flush out the pattern stored in elements[]. Don't forget
* that elements[].{x,y} and min/max{i,j} are still relative
@@ -1508,11 +1510,15 @@
node < el-1 ? ",\n" : "};\n\n");
}
+#if EXPERIMENTAL_READING
if (tree_output)
tree_push_pattern();
+#endif
}
+#if EXPERIMENTAL_READING
+
struct tree_node graph[2];
int tree_next = 0;
@@ -1962,6 +1968,7 @@
fprintf(outfile, "}\n\n");
}
+#endif
/* sort and write out the patterns */
static void
@@ -1969,13 +1976,14 @@
{
int j;
+#if EXPERIMENTAL_READING
if (tree_output)
tree_write_patterns(outfile, name);
else
+#endif
fprintf(outfile, "\nvoid\ninit_tree_%s(void)\n{\n"
" /* nothing to do - tree option not compiled */\n"
"}\n\n", name);
-
/* Write out the patterns. */
if (fullboard)
@@ -2086,10 +2094,12 @@
fprintf(outfile, " ,& dfa_%s\n", name); /* pointer to the wired dfa */
else
fprintf(outfile, " , NULL\n"); /* pointer to a possible dfa */
+#if EXPERIMENTAL_READING
if (tree_output)
fprintf(outfile, " , tnl_%s", name);
else
fprintf(outfile, " , NULL\n");
+#endif
fprintf(outfile, "};\n");
}
@@ -2135,8 +2145,9 @@
dfa_generate = 1; dfa_c_output = 1;
break;
case 'V': dfa_verbose = strtol(gg_optarg, NULL, 10); break;
+#if EXPERIMENTAL_READING
case 'T': tree_output = 1; break;
-
+#endif
default:
fprintf(stderr, "Invalid argument ignored\n");
}
Index: patterns/patterns.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v
retrieving revision 1.31
diff -u -r1.31 patterns.h
--- patterns/patterns.h 31 Mar 2002 20:46:47 -0000 1.31
+++ patterns/patterns.h 18 Apr 2002 22:14:01 -0000
@@ -25,6 +25,10 @@
* describing the patterns.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#ifndef __PATTERN_H__
#define __PATTERN_H__
@@ -259,13 +263,17 @@
};
+#if EXPERIMENTAL_READING
struct tree_node_list;
+#endif
struct pattern_db {
int fixed_for_size;
struct pattern *patterns;
struct dfa *pdfa;
+#if EXPERIMENTAL_READING
struct tree_node_list *tnl; /* For tree-based pattern matching */
+#endif
};
@@ -351,11 +359,13 @@
extern struct fullboard_pattern fuseki13[];
extern struct fullboard_pattern fuseki9[];
+#if EXPERIMENTAL_READING
+
/* Experimental reading */
extern struct pattern_db read_attack_db;
extern struct pattern_db read_defend_db;
-
+#endif
/* Tree-based pattern matching structures*/
- [gnugo-devel] experimental_reading_1_33.1,
bump <=
- Re: [gnugo-devel] experimental_reading_1_33.1, Gunnar Farneback, 2002/04/19
- Re: [gnugo-devel] experimental_reading_1_33.1, Daniel Bump, 2002/04/19
- Re: [gnugo-devel] experimental_reading_1_33.1, Gunnar Farneback, 2002/04/19
- Re: [gnugo-devel] experimental_reading_1_33.1, bump, 2002/04/19
- Re: [gnugo-devel] experimental_reading_1_33.1, Trevor Morris, 2002/04/19
- Re: [gnugo-devel] experimental_reading_1_33.1, bump, 2002/04/19
- [gnugo-devel] 3.1.33 VC inconsistencies, Trevor Morris, 2002/04/20
- arend_1_34.1: Re: [gnugo-devel] 3.1.33 VC inconsistencies, Arend Bayer, 2002/04/20
- Re: arend_1_34.1: Re: [gnugo-devel] 3.1.33 VC inconsistencies, Trevor Morris, 2002/04/20
- Re: arend_1_34.1: Re: [gnugo-devel] 3.1.33 VC inconsistencies, bump, 2002/04/20