Exemplo n.º 1
0
void
showboard(int xo)
{
  int i, j, ii;
  gg_init_color();

  /* Set all dragon numbers to 0. */
  memset(dragon_num, 0, sizeof(dragon_num));
  
  next_white = (259 - 26);
  next_black = 26;
  
  start_draw_board();
  
  for (i = 0; i < board_size; i++) {
    ii = board_size - i;
    fprintf(stderr, "\n%2d", ii);
    
    for (j = 0; j < board_size; j++)
      showchar(i, j, is_hoshi_point(i, j) ? '+' : '.', xo);
    
    fprintf(stderr, " %d", ii);
    
    if (xo == 0 && ((board_size < 10 && i == board_size-2)
		    || (board_size >= 10 && i == 8)))
      fprintf(stderr, "     WHITE (O) has captured %d stones", black_captured);
    
    if (xo == 0 && ((board_size < 10 && i == board_size-1)
		    || (board_size >= 10 && i == 9)))
      fprintf(stderr, "     BLACK (X) has captured %d stones", white_captured);
    
    if (xo == 3) {
      if (i == board_size-5)
	write_color_string(GG_COLOR_GREEN, "    green=alive");
      if (i == board_size-4)
	write_color_string(GG_COLOR_CYAN, "    cyan=dead");
      if (i == board_size-3)
	write_color_string(GG_COLOR_RED, "    red=critical");
      if (i == board_size-2)
	write_color_string(GG_COLOR_YELLOW, "    yellow=unknown");
      if (i == board_size-1)
	write_color_string(GG_COLOR_MAGENTA, "    magenta=unchecked");
    }
  }

  end_draw_board();
}
Exemplo n.º 2
0
static void
draw_active_area(char board[BOARDMAX], int apos)
{
  int i, j, ii;
  int c = ' ';
  int cw = (apos == NO_MOVE) ? 'O' : 'o';
  int cb = (apos == NO_MOVE) ? 'X' : 'x';

  start_draw_board();
  
  for (i = 0; i < board_size; i++) {
    ii = board_size - i;
    fprintf(stderr, "\n%2d", ii);
    
    for (j = 0; j < board_size; j++) {
      int pos = POS(i, j);
      if (board[pos] == EMPTY)
	c = '.';
      else if (board[pos] == WHITE)
	c = cw;
      else if ((board[pos] & 3) == WHITE)
	c = 'O';
      else if (board[pos] == BLACK)
	c = cb;
      else if ((board[pos] & 3) == BLACK)
	c = 'X';
      if (board[pos] == GRAY)
	c = '?';
      
      if (pos == apos)
	fprintf(stderr, "[%c", c);
      else if (j > 0 && POS(i, j-1) == apos)
	fprintf(stderr, "]%c", c);
      else
	fprintf(stderr, " %c", c);
    }
    
    fprintf(stderr, " %d", ii);
  }

  end_draw_board();
}
Exemplo n.º 3
0
static void
show_surround_map(signed char mf[BOARDMAX], signed char mn[BOARDMAX])
{
  int m, n;

  start_draw_board();
  for (m = 0; m < board_size; m++)
    for (n = 0; n < board_size; n++) {
      int col, c;
      
      if (mf[POS(m, n)]) {
	if (mn[POS(m, n)] == 1)
	  col = GG_COLOR_RED;
	else if (mn[POS(m, n)] == 2)
	  col = GG_COLOR_YELLOW;
	else
	  col = GG_COLOR_GREEN;
      }
      else if (mn[POS(m, n)] == 1)
	col = GG_COLOR_BLUE;
      else if (mn[POS(m, n)] == 2)
	col = GG_COLOR_CYAN;
      else
	col = GG_COLOR_BLACK;
      if (board[POS(m, n)] == BLACK)
	c = 'X';
      else if (board[POS(m, n)] == WHITE)
	c = 'O';
      else if (mn[POS(m, n)])
	c = '*';
      else
	c = '.';
      draw_color_char(m, n, c, col);
    }
  end_draw_board();
}