Board implements Serializable { public void copyDataFrom(Board that) { colorToPlay = that.colorToPlay; hash = that.hash; koPoint = that.koPoint; for (int i = 0; i < observers.length; i++) { observers[i].copyDataFrom(that.observers[i]); } passes = that.passes; for (final short p : coords.getAllPointsOnBoard()) { points[p].copyDataFrom(that.points[p]); } superKoTable.copyDataFrom(that.superKoTable); turn = that.turn; vacantPoints.copyDataFrom(that.vacantPoints); } Board(int width); void addObserver(BoardObserver observer); void clear(); void clearPreservingInitialStones(); void copyDataFrom(Board that); short getChainNextPoint(short p); short getChainRoot(short p); Color getColorAt(short p); StoneColor getColorToPlay(); CoordinateSystem getCoordinateSystem(); long getFancyHash(); long getHash(); ShortSet getLiberties(short p); int getNeighborsOfColor(short p, Color color); short getPasses(); int getTurn(); ShortSet getVacantPoints(); boolean hasMaxNeighborsForColor(StoneColor color, short p); boolean isLegal(short p); void pass(); void placeInitialStone(StoneColor color, short p); Legality play(short p); Legality play(String move); Legality playFast(short p); void setColorToPlay(StoneColor stoneColor); void setPasses(short passes); void setUpHandicap(int handicapSize); void setUpProblem(String[] diagram, StoneColor colorToPlay); @Override String toString(); void removeStones(ShortSet ourDead);  }
@Test public void testCopyDataFrom() { board = new Board(19); Board copy = new Board(19); StoneCountObserver counter = new StoneCountObserver(board, new ChineseFinalScorer(board, 7.5)); StoneCountObserver copyCounter = new StoneCountObserver(copy, new ChineseFinalScorer(copy, 7.5)); Mover mover = new PredicateMover(board, new NotEyeLike(board)); MersenneTwisterFast random = new MersenneTwisterFast(); for (int i = 0; i < 50; i++) { mover.selectAndPlayOneMove(random, true); } copy.copyDataFrom(board); assertEquals(board.toString(), copy.toString()); assertEquals(counter.getCount(BLACK), copyCounter.getCount(BLACK)); assertEquals(counter.getCount(WHITE), copyCounter.getCount(WHITE)); while (board.getPasses() < 2) { short p = mover.selectAndPlayOneMove(random, true); copy.play(p); } assertEquals(board.toString(), copy.toString()); assertEquals(counter.getCount(BLACK), copyCounter.getCount(BLACK)); assertEquals(counter.getCount(WHITE), copyCounter.getCount(WHITE)); }