|
From: | Andy Olsen |
Subject: | [gnugo-devel] debugboard bug fixes |
Date: | Wed, 30 Oct 2002 00:21:20 -0600 |
Hi, I was playing with the debugboard
program, but I noticed it has 2 problems:
1. It was always showing a completely
empty board. I fixed this by moving the gameinfo_play_sgftree() call to be
later in main.c. Possibly the reset_engine() call is clearing the
board? I didn't investigate further since the problem went away after my
change. Looks like no one is really using this program since this bug
means it's pretty much worthless and it's been in there at least since
3.2. :-)
2. An assertion fails when you try to show
dragon information on an empty point. I added code to handle this
case.
See below the diffs for main.c and gui.c, I
started from the 3.3.11 tar file. I'm new at this, I don't know what
procedures I should be following, let me know!
- Andy Olsen
===================================================================
--- main.c 2002-10-20
09:11:54.000000000 -0500
+++ /home/Andy/main.c 2002-10-30 00:00:28.000000000 -0600 @@ -116,10 +116,6 @@ fusekidb = 1; josekidb = 1; - gameinfo_clear(&gameinfo, 19, 5.5); - next = gameinfo_play_sgftree(&gameinfo, &sgftree, until); - - /* Check if there is enough screen space. */ if (!display_init(MINWIDTH, MINHEIGHT, board_size)) exit(1); @@ -129,6 +125,9 @@ init_gnugo(8); reset_engine(); + gameinfo_clear(&gameinfo, 19, 5.5); + next = gameinfo_play_sgftree(&gameinfo, &sgftree, until); + display_message("Hit 'h' for help!"); tab_window_draw(tabs); ===================================================================
--- gui.c 2002-09-26
15:28:09.000000000 -0500
+++ /home/Andy/gui.c 2002-10-30 00:00:31.000000000 -0600 @@ -228,88 +228,125 @@ wmove(info_window, 1, 2); gg_wprintw(info_window, "%3s: %5s dragon ", location_to_string(pos), color_to_string(d->color)); - gg_wprintw(info_window, "(origin %s) id %d ", - location_to_string(d->origin), d->id); - - wmove(info_window, 3, 16); - gg_wprintw(info_window, "%3d %5.3f ", d->size, d->effective_size); + if ( board[pos] == EMPTY ) { + gg_wprintw(info_window, " "); + wmove(info_window, 3, 16); + gg_wprintw(info_window, " "); #if 0 - wmove(info_window, 8, 18); - if (board[pos] == EMPTY) - gg_wprintw(info_window, " ", d2->heyes); - else - gg_wprintw(info_window, "%d ", d2->heyes); - wmove(info_window, 8, 21); - if (board[pos] != EMPTY && d2->heyes > 0) - gg_wprintw(info_window, "[%s] ", location_to_string(d2->heye)); - else - gg_wprintw(info_window, "[---]"); - - wmove(info_window, 9, 18); - gg_wprintw(info_window, "%d ", d2->genus); + /* heyes printing code removed */ #endif - wmove(info_window, 10, 18); - gg_wprintw(info_window, "%d ", - board[pos] == EMPTY ? 0 : d2->escape_route); - wmove(info_window, 11, 18); - if (d2->lunch == NO_MOVE) + + wmove(info_window, 10, 18); + gg_wprintw(info_window, "0 "); + wmove(info_window, 11, 18); gg_wprintw(info_window, "---"); - else - gg_wprintw(info_window, "%3s", location_to_string(d2->lunch)); - /* status */ - wmove(info_window, 3, 55); - gg_wprintw(info_window, "%s ", status_to_string(d->crude_status)); + /* status */ + wmove(info_window, 3, 55); + gg_wprintw(info_window, " "); + + /* owl status */ + wmove(info_window, 4, 55); + gg_wprintw(info_window, " [---] [---]"); + + wmove(info_window, 5, 55); + gg_wprintw(info_window, " [---] [---]"); + + wmove(info_window, 6, 55); + gg_wprintw(info_window, " "); + + wmove(info_window, 9, 55); + gg_wprintw(info_window, " "); + wmove(info_window, 10, 55); + gg_wprintw(info_window, "0 "); + + wmove(info_window, 11, 55); + gg_wprintw(info_window, "0 "); + } else { + gg_wprintw(info_window, "(origin %s) id %d ", + location_to_string(d->origin), d->id); - /* owl status */ - wmove(info_window, 4, 55); - gg_wprintw(info_window, "%-12s", status_to_string(d->owl_status)); - if (d->owl_attack_point == NO_MOVE) - gg_wprintw(info_window, "[---] "); - else - gg_wprintw(info_window, "[%3s] ", - location_to_string(d->owl_attack_point)); - if (d->owl_defense_point == NO_MOVE) - gg_wprintw(info_window, "[---] "); - else - gg_wprintw(info_window, "[%3s] ", - location_to_string(d->owl_defense_point)); + wmove(info_window, 3, 16); + gg_wprintw(info_window, "%3d %5.3f ", d->size, d->effective_size); - wmove(info_window, 5, 55); - switch (d->owl_threat_status) { - case DEAD: - case ALIVE: - gg_wprintw(info_window, "%-12s[---] [---]", - status_to_string(d->owl_threat_status)); - break; - case UNCHECKED: - gg_wprintw(info_window, "unchecked [---] [---]"); - break; - case CAN_THREATEN_ATTACK: - gg_wprintw(info_window, "att. threat [%3s] [---]", - location_to_string(d->owl_second_attack_point)); - break; - case CAN_THREATEN_DEFENSE: - gg_wprintw(info_window, "def. threat [---] [%3s]", - location_to_string(d->owl_second_defense_point)); - break; - default: - gg_wprintw(info_window, "Error: %3d [---] [---]", d->owl_threat_status); - break; - } +#if 0 + wmove(info_window, 8, 18); + if (board[pos] == EMPTY) + gg_wprintw(info_window, " ", d2->heyes); + else + gg_wprintw(info_window, "%d ", d2->heyes); + wmove(info_window, 8, 21); + if (board[pos] != EMPTY && d2->heyes > 0) + gg_wprintw(info_window, "[%s] ", location_to_string(d2->heye)); + else + gg_wprintw(info_window, "[---]"); - wmove(info_window, 6, 55); - gg_wprintw(info_window, "%s ", status_to_string(d->status)); + wmove(info_window, 9, 18); + gg_wprintw(info_window, "%d ", d2->genus); +#endif - wmove(info_window, 8, 55); - wmove(info_window, 9, 55); - gg_wprintw(info_window, "%s ", safety_to_string(d2->safety)); - wmove(info_window, 10, 55); - gg_wprintw(info_window, "%d ", d2->semeai); + wmove(info_window, 10, 18); + gg_wprintw(info_window, "%d ", + board[pos] == EMPTY ? 0 : d2->escape_route); + wmove(info_window, 11, 18); + if (d2->lunch == NO_MOVE) + gg_wprintw(info_window, "---"); + else + gg_wprintw(info_window, "%3s", location_to_string(d2->lunch)); + + /* status */ + wmove(info_window, 3, 55); + gg_wprintw(info_window, "%s ", status_to_string(d->crude_status)); + + /* owl status */ + wmove(info_window, 4, 55); + gg_wprintw(info_window, "%-12s", status_to_string(d->owl_status)); + if (d->owl_attack_point == NO_MOVE) + gg_wprintw(info_window, "[---] "); + else + gg_wprintw(info_window, "[%3s] ", + location_to_string(d->owl_attack_point)); + if (d->owl_defense_point == NO_MOVE) + gg_wprintw(info_window, "[---] "); + else + gg_wprintw(info_window, "[%3s] ", + location_to_string(d->owl_defense_point)); + + wmove(info_window, 5, 55); + switch (d->owl_threat_status) { + case DEAD: + case ALIVE: + gg_wprintw(info_window, "%-12s[---] [---]", + status_to_string(d->owl_threat_status)); + break; + case UNCHECKED: + gg_wprintw(info_window, "unchecked [---] [---]"); + break; + case CAN_THREATEN_ATTACK: + gg_wprintw(info_window, "att. threat [%3s] [---]", + location_to_string(d->owl_second_attack_point)); + break; + case CAN_THREATEN_DEFENSE: + gg_wprintw(info_window, "def. threat [---] [%3s]", + location_to_string(d->owl_second_defense_point)); + break; + default: + gg_wprintw(info_window, "Error: %3d [---] [---]", d->owl_threat_status); + break; + } + + wmove(info_window, 6, 55); + gg_wprintw(info_window, "%s ", status_to_string(d->status)); + + wmove(info_window, 9, 55); + gg_wprintw(info_window, "%s ", safety_to_string(d2->safety)); + wmove(info_window, 10, 55); + gg_wprintw(info_window, "%d ", d2->semeai); - wmove(info_window, 11, 55); - gg_wprintw(info_window, "%d ", d2->semeai_margin_of_safety); + wmove(info_window, 11, 55); + gg_wprintw(info_window, "%d ", d2->semeai_margin_of_safety); + } wrefresh(info_window); } |
[Prev in Thread] | Current Thread | [Next in Thread] |