Ejemplo n.º 1
0
/* Start playing using the Go Text Protocol. */
void
play_gtp(FILE * gtp_input, FILE * gtp_output, FILE * gtp_dump_commands,
         Game * g) {
  setbuf(gtp_output, NULL);

  game = g;

  /* Inform the GTP utility functions about the board size. */
  gtp_internal_set_boardsize(game->get_boardsize());

  gtp_main_loop(commands, gtp_input, gtp_output, gtp_dump_commands);
}
Ejemplo n.º 2
0
int
main(int argc, char **argv)
{
  unsigned int random_seed = 1;

  /* Optionally a random seed can be passed as an argument to the program. */
  if (argc > 1)
    sscanf(argv[1], "%u", &random_seed);
  srand(random_seed);
  
  /* Make sure that stdout is not block buffered. */
  setbuf(stdout, NULL);
  
  /* Inform the GTP utility functions about the initial board size. */
  gtp_internal_set_boardsize(board_size);

  /* Initialize the board. */
  init_brown();

  /* Process GTP commands. */
  gtp_main_loop(commands, stdin, NULL);

  return 0;
}