Example #1
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);
 }
Example #2
0
 /** Copies data from that (the player's real board) to the local board. */
 public void copyDataFrom(Board that) {
   board.copyDataFrom(that);
   fancyHashes[board.getTurn()] = board.getFancyHash();
 }
Example #3
0
 /** Returns the current turn number on this runnable's board. */
 public int getTurn() {
   return board.getTurn();
 }
Example #4
0
 /**
  * Accepts (plays on on this McRunnable's own board) the given move.
  *
  * @see edu.lclark.orego.core.Board#play(short)
  */
 public void acceptMove(short p) {
   final Legality legality = board.play(p);
   assert legality == OK
       : "Legality " + legality + " for move " + coords.toString(p) + "\n" + board;
   fancyHashes[board.getTurn()] = board.getFancyHash();
 }