Пример #1
0
  public void placePiece(Player p, int square) {
    if (getActivePlayer() != p) {
      throw new RuntimeException("Not our turn");
    }

    if (grid.occupy(square, p)) {
      waiting = false;
      updateGameState();
      nextPlayer();
    } else {
      throw new RuntimeException("tried to place in an invalid location!");
    }
  }