Example #1
0
// -----------------------------------------------------------------------
// main:
//  The main program parses commandline arguments and starts a game.
//
int main (int argc, char *argv[])
{
  Gmp *gmp;
  
  Load_Arguments (argc, argv);
  
  joseki_count  = Pattern_Load_Text_File (joseki_list,  MAX_PATTERNS, joseki_file);
  pattern_count = Pattern_Load_Text_File (pattern_list, MAX_PATTERNS, pattern_file);
  
  srand(time(NULL));
  gmp = gmp_create(0, 1);

  while (1)
  {
    gmp_startGame (gmp, -1, -1, 5.5, -1, -1);  // This allows the other side to set the parameters.
    waitForNewGame(gmp);
    
    if (gmp_handicap(gmp) > 9)
    {
      fprintf(stderr, "I don't know how to play handicap games greater than 9.\n");
      exit(1);
    }
    
    playGame(gmp, gmp_size(gmp), gmp_handicap(gmp), gmp_iAmWhite(gmp));
  }
  
  fclose (debug);
  exit(0);
}   // main
Example #2
0
int main(int argc, char *argv[])  {
  Gmp  *ge;

  srand(time(NULL));
  ge = gmp_create(0, 1);

  for (;;)  {
    /*
     * I really should look at the command line and set up the handicap,
     *   board size, etc. better than this.
     */
    gmp_startGame(ge, -1, -1, 5.5, -1, -1);
    waitForNewGame(ge);
    if (gmp_handicap(ge) != 0)  {
      fprintf(stderr, "I don't know how to play handicap games.\n");
      exit(1);
    }
    playGame(ge, gmp_size(ge), gmp_iAmWhite(ge));
  }
  exit(0);
}