[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] get_level()
From: |
Gunnar Farnebäck |
Subject: |
[gnugo-devel] get_level() |
Date: |
Fri, 07 Oct 2005 00:27:44 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
In genmove.c there's a function get_level() which implements an
undocumented feature to read in the level setting from file at each
move.
This has always been a somewhat questionable feature (can it be
considered cheating to help the engine to modify it's level during the
game?) and I strongly doubt it's being used by anyone.
I propose to remove it as per the appended patch.
- remove get_level() from genmove.c
/Gunnar
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.105
diff -u -r1.105 genmove.c
--- engine/genmove.c 12 Jun 2005 09:34:14 -0000 1.105
+++ engine/genmove.c 6 Oct 2005 21:14:58 -0000
@@ -36,7 +36,6 @@
*/
#define NEEDS_UPDATE(x) (x != position_number ? (x = position_number, 1) : 0)
-static int get_level(int *level);
static int do_genmove(int color, float pure_threat_value,
int allowed_moves[BOARDMAX], float *value, int *resign);
@@ -318,8 +317,6 @@
/* no move is found yet. */
move = PASS_MOVE;
*value = 0.0;
- if (get_level(&level))
- fprintf(stderr, "level = %d\n", level);
/* experimental level adapter */
clock_adapt_level(&level, color);
@@ -558,32 +555,6 @@
potential_moves[move] = value;
}
-
-/* If there is a file with the name "level", reads it
- * each move and corrects the value of level.
- */
-
-static int
-get_level(int *level)
-{
- char buffer[128];
- FILE *fp;
-
- const char filename[] = "level";
-
- if ((fp = fopen(filename, "r")) == NULL)
- return 0;
-
- if (fgets(buffer, 128, fp)) {
- if (sscanf(buffer, "%d", level))
- return 1;
- else
- return 0;
- }
- else
- return 0;
-}
-
/* revise_semeai(color) changes the status of any DEAD dragon of
* OPPOSITE_COLOR(color) which occurs in a semeai to UNKNOWN.
- [gnugo-devel] get_level(),
Gunnar Farnebäck <=