From ff7746f5987b28db3f963396ac8c8cb08ae06210 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Mon, 16 Jan 2012 00:23:05 +0100 Subject: [PATCH] GTP: Adjust debug levels for messages to be more user-friendly The most important feature is that you do not see board print after each play command anymore, but instead see an extra board print at the begin of genmove. This cuts down the huge amount of noise when feeding in (or resuming) a game. --- gtp.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gtp.c b/gtp.c index a281d44..fbc3fbf 100644 --- a/gtp.c +++ b/gtp.c @@ -218,7 +218,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char } else if (!strcasecmp(cmd, "clear_board")) { board_clear(board); - if (DEBUGL(1) && debug_boardprint) + if (DEBUGL(3) && debug_boardprint) board_print(board, stderr); gtp_reply(id, NULL); return P_ENGINE_RESET; @@ -242,7 +242,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char next_tok(arg); sscanf(arg, PRIfloating, &board->komi); - if (DEBUGL(1) && debug_boardprint) + if (DEBUGL(3) && debug_boardprint) board_print(board, stderr); gtp_reply(id, NULL); @@ -274,7 +274,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char m.coord = *c; coord_done(c); char *reply = NULL; - if (DEBUGL(1)) + if (DEBUGL(5)) fprintf(stderr, "got move %d,%d,%d\n", m.color, coord_x(m.coord, board), coord_y(m.coord, board)); // This is where kgs starts the timer, not at genmove! @@ -289,7 +289,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char } gtp_error(id, "illegal move", NULL); } else { - if (DEBUGL(1) && debug_boardprint) + if (DEBUGL(4) && debug_boardprint) board_print_custom(board, stderr, engine->printhook); gtp_reply(id, reply, NULL); } @@ -299,6 +299,8 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char next_tok(arg); enum stone color = str2stone(arg); coord_t *c = NULL; + if (DEBUGL(2) && debug_boardprint) + board_print_custom(board, stderr, engine->printhook); if (!ti[color].len.t.timer_start) { /* First game move. */ @@ -319,7 +321,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char abort(); } char *str = coord2str(*c, board); - if (DEBUGL(1)) + if (DEBUGL(4)) fprintf(stderr, "playing move %s\n", str); if (DEBUGL(1) && debug_boardprint) { board_print_custom(board, stderr, engine->printhook); @@ -372,7 +374,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char do { coord_t *c = str2coord(arg, board_size(board)); m.coord = *c; coord_done(c); - if (DEBUGL(1)) + if (DEBUGL(4)) fprintf(stderr, "setting handicap %d,%d\n", coord_x(m.coord, board), coord_y(m.coord, board)); if (board_play(board, &m) < 0) { @@ -480,7 +482,7 @@ next_group:; char *reply = NULL; if (engine->undo) reply = engine->undo(engine, board); - if (DEBUGL(1) && debug_boardprint) + if (DEBUGL(3) && debug_boardprint) board_print(board, stderr); gtp_reply(id, reply, NULL); -- 2.11.4.GIT