Esempio n. 1
0
 /**
  * Copy the state of one board to another. Initializes the target board with the size and the
  * setup stones of the source board and executes all moves of the source board on the target
  * board.
  */
 public static void copy(Board target, ConstBoard source) {
   target.init(source.getSize());
   ConstPointList setupBlack = source.getSetup(BLACK);
   ConstPointList setupWhite = source.getSetup(WHITE);
   GoColor setupPlayer = source.getSetupPlayer();
   if (setupBlack.size() > 0 || setupWhite.size() > 0) {
     if (source.isSetupHandicap()) target.setupHandicap(setupBlack);
     else target.setup(setupBlack, setupWhite, setupPlayer);
   }
   for (int i = 0; i < source.getNumberMoves(); ++i) target.play(source.getMove(i));
 }