hw1/src/main/java/models/GameBoard.java
/**
   * Plays a turn for the given player in the (x, y) coordinate specified.
   * @param player The player to play the turn for.
   * @param x      The x-position.
   * @param y      The y-position.
   * @throws Exception A simple exception if the move cannot be made: either the
   *                   position is out of bounds, the position is already filled,
   *                   or it's not the player's turn.
   */
Plays a turn for the given player in the (x, y) coordinate specified.
@param player The player to play the turn for.
@param x      The x-position.
@param y      The y-position.
@throws Exception A simple exception if the move cannot be made: either the
position is out of bounds, the position is already filled,
or it's not the player's turn.
Plays a turn for the given player in the ( x y ) coordinate specified . @param player The player to play the turn for . @param x The x - position . @param y The y - position . @throws Exception A simple exception if the move cannot be made : either the position is out of bounds the position is already filled or it ' s not the player ' s turn .
public void playTurn(Player player, int x, int y) throws Exception {
    final char type = player.getType();
    if (x < 0 || y < 0 || x > 2 || y > 2) {
      throw new Exception("Invalid position");
    } else if (boardState[x][y] != '\0') {
      throw new Exception("Position already filled");
    } else if (player.getId() != turn) {
      throw new Exception("Not your turn");
    }
    boardState[x][y] = type;
    updateWinner();
  }
public void playTurn ( Player player , int x , int y ) throws Exception { final char type = player . getType ( ) ; if ( x < 0 || y < 0 || x > 2 || y > 2 ) { throw new Exception ( "Invalid position" ) ; } else if ( boardState [ x ] [ y ] != '\0' ) { throw new Exception ( "Position already filled" ) ; } else if ( player . getId ( ) != turn ) { throw new Exception ( "Not your turn" ) ; } boardState [ x ] [ y ] = type ; updateWinner ( ) ; }
Plays a turn for the given player in the (x, y) coordinate specified.
Plays a turn for the given player in the ( x y ) coordinate specified .