Example #1
0
 public Color performMcRun(boolean mercy, Board originalBoard) {
   player.descend(this);
   Color winner;
   if (originalBoard.getPasses() == 2) {
     winner = scorer.winner();
   } else {
     winner = playout(mercy);
   }
   player.updateTree(winner, this);
   playoutsCompleted++;
   return winner;
 }
Example #2
0
 /**
  * Plays moves to the end of the game and returns the winner: BLACK, WHITE, or (in rare event of a
  * tie or a playout canceled because it hits the maximum number of moves) VACANT.
  *
  * @param mercy True if we should abandon the playout when one color has many more stones than the
  *     other.
  */
 public Color playout(boolean mercy) {
   do {
     if (board.getTurn() >= coords.getMaxMovesPerGame()) {
       // Playout ran out of moves, probably due to superko
       return VACANT;
     }
     if (board.getPasses() < 2) {
       selectAndPlayOneMove();
     }
     if (board.getPasses() >= 2) {
       // Game ended
       return scorer.winner();
     }
     final Color mercyWinner = mercyObserver.mercyWinner();
     if (mercy && mercyWinner != null) {
       // One player has far more stones on the board
       return mercyWinner;
     }
   } while (true);
 }