Board implements Serializable { public Legality play(short p) { if (p == PASS) { pass(); return OK; } final Legality result = legality(colorToPlay, p); if (result != OK) { return result; } finalizePlay(colorToPlay, p); colorToPlay = colorToPlay.opposite(); passes = 0; turn++; hash = proposedHash; superKoTable.add(hash); notifyObservers(colorToPlay.opposite(), p); return OK; } 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(expected = AssertionError.class) public void testOffBoard() { short p = coords.getNeighbors(at("e2"))[EAST_NEIGHBOR]; board.play(p); }
@Test public void testOccupied() { board.play("c1"); assertEquals(OCCUPIED, board.play("c1")); }
@Test public void testBug1() { assertEquals(OK, board.play("D5")); assertEquals(OK, board.play("A5")); assertEquals(OK, board.play("A2")); assertEquals(OK, board.play("E4")); assertEquals(OK, board.play("D2")); assertEquals(OK, board.play("C4")); assertEquals(OK, board.play("B2")); assertEquals(OK, board.play("B5")); assertEquals(OK, board.play("E3")); assertEquals(OK, board.play("A1")); assertEquals(OK, board.play("C2")); assertEquals(OK, board.play("B1")); assertEquals(OK, board.play("D1")); assertEquals(OK, board.play("E2")); assertEquals(OK, board.play("D4")); assertEquals(OK, board.play("A4")); assertEquals(OK, board.play("E5")); assertEquals(OK, board.play("D3")); assertEquals(OK, board.play("C3")); assertEquals(OK, board.play("B4")); assertEquals(OK, board.play("C5")); assertEquals(OK, board.play("B3")); assertEquals(OK, board.play("C1")); assertEquals(OK, board.play("B1")); assertEquals(OK, board.play("D3")); assertEquals(SUICIDE, board.play("A1")); }