gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] clear_cache gtp command


From: Evan Berggren Daniel
Subject: [gnugo-devel] clear_cache gtp command
Date: Sat, 23 Nov 2002 12:18:11 -0500 (EST)

This patch implements a new gtp command, clear_cache, which completely
clears the persistent caches.  I have found it useful when experimenting
with depth values, and it could also be used to separate out caching
dependent tests into a separate suite.

Thanks

Evan Daniel

- new gtp command clear_cache
- new functions clear_persistent_owl_cache and
clear_persistent_reading_cache


Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.136
diff -u -r1.136 liberty.h
--- engine/liberty.h    21 Nov 2002 00:25:10 -0000      1.136
+++ engine/liberty.h    23 Nov 2002 17:05:32 -0000
@@ -294,6 +294,7 @@

 /* persistent.c */
 void purge_persistent_reading_cache(void);
+void clear_persistent_reading_cache(void);
 int search_persistent_reading_cache(int routine, int str, int *result,
                                    int *move);
 void store_persistent_reading_cache(int routine, int str, int result,
@@ -301,6 +302,7 @@
 void delete_persistent_reading_entry(int index);
 void reading_hotspots(float values[BOARDMAX]);
 void purge_persistent_owl_cache(void);
+void clear_persistent_owl_cache(void);
 int search_persistent_owl_cache(int routine, int apos, int bpos, int cpos,
                                int *result, int *move, int *move2,
                                int *certain);
Index: engine/persistent.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/persistent.c,v
retrieving revision 1.5
diff -u -r1.5 persistent.c
--- engine/persistent.c 5 Nov 2002 16:49:44 -0000       1.5
+++ engine/persistent.c 23 Nov 2002 17:05:33 -0000
@@ -264,6 +264,12 @@
   }
 }

+void
+clear_persistent_reading_cache()
+{
+  persistent_reading_cache_size = 0;
+}
+

 /* Look for a valid read result in the persistent cache.
  * Return index of the entry found if there is a match, -1 if no match.
@@ -641,6 +647,12 @@
       persistent_owl_cache_size--;
     }
   }
+}
+
+void
+clear_persistent_owl_cache()
+{
+  persistent_owl_cache_size = 0;
 }

 int
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.103
diff -u -r1.103 play_gtp.c
--- interface/play_gtp.c        16 Nov 2002 00:30:25 -0000      1.103
+++ interface/play_gtp.c        23 Nov 2002 17:05:35 -0000
@@ -58,6 +58,7 @@
 DECLARE(gtp_attack);
 DECLARE(gtp_attack_either);
 DECLARE(gtp_clear_board);
+DECLARE(gtp_clear_cache);
 DECLARE(gtp_combination_attack);
 DECLARE(gtp_connect);
 DECLARE(gtp_countlib);
@@ -175,6 +176,7 @@
   {"boardsize",                      gtp_set_boardsize},
   {"captures",               gtp_captures},
   {"clear_board",                    gtp_clear_board},
+  {"clear_cache",            gtp_clear_cache},
   {"color",                          gtp_what_color},
   {"combination_attack",      gtp_combination_attack},
   {"connect",                gtp_connect},
@@ -1097,6 +1099,24 @@
   return gtp_success("");
 }

+/*********************
+ * Caching          *
+ *********************/
+
+/* Function:  clear the caches.
+ * Arguments: none.
+ * Fails:     never.
+ * Returns:   nothing.
+ */
+
+static int
+gtp_clear_cache(char *s)
+{
+  UNUSED(s);
+  clear_persistent_reading_cache();
+  clear_persistent_owl_cache();
+  return gtp_success("");
+}

 /*********************
  * Tactical reading. *





reply via email to

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