[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] [PATCH 1/1] Add a '-d' debug flag for the Monte Carlo code
From: |
Chad Williamson |
Subject: |
[gnugo-devel] [PATCH 1/1] Add a '-d' debug flag for the Monte Carlo code. |
Date: |
Sat, 15 Jun 2013 15:32:38 -0500 |
Per a FIXME notice in montecarlo.c, replace the hardcoded mc_debug
variable with a DEBUG_MC flag for '-d'.
---
engine/gnugo.h | 2 ++
engine/montecarlo.c | 7 ++-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/engine/gnugo.h b/engine/gnugo.h
index b5b4d76..620b165 100644
--- a/engine/gnugo.h
+++ b/engine/gnugo.h
@@ -167,6 +167,7 @@ extern int output_flags; /* amount of output to outfile
*/
#define DEBUG_LARGE_SCALE 0x1000000
#define DEBUG_SPLIT_OWL 0x2000000
#define DEBUG_TIME 0x4000000
+#define DEBUG_MC 0x8000000
#define DEBUG_FLAGS "\
@@ -198,6 +199,7 @@ DEBUG_ORACLE_STREAM 0x1000000\n\
DEBUG_LARGE_SCALE 0x1000000\n\
DEBUG_SPLIT_OWL 0x2000000\n\
DEBUG_TIME 0x4000000\n\
+DEBUG_MC 0x8000000\n\
"
diff --git a/engine/montecarlo.c b/engine/montecarlo.c
index f13904f..bc0b429 100644
--- a/engine/montecarlo.c
+++ b/engine/montecarlo.c
@@ -34,9 +34,6 @@
#include "random.h"
#include <math.h>
-/* FIXME: Replace with a DEBUG_MC symbol for use with -d. */
-static int mc_debug = 0;
-
#define TURN_OFF_ASSERTIONS 1
@@ -1559,7 +1556,7 @@ mc_generate_random_move(struct mc_game *game)
* FIXME: Handle this in some proper way.
*/
if (depth > 600) {
- if (mc_debug) {
+ if (debug & DEBUG_MC) {
int pos;
fprintf(stderr, "Reached 600 iterations.\n");
mc_showboard(mc, stderr);
@@ -2187,7 +2184,7 @@ uct_genmove(int color, int *move, int *forbidden_moves,
int *allowed_moves,
uct_dump_tree(&tree, "/tmp/ucttree.sgf", color, 50);
/* Print information about the search tree. */
- if (mc_debug) {
+ if (debug & DEBUG_MC) {
while (1) {
float mean;
float std;
--
1.8.1.4