/** * Mark the current row for the player who's current turn it is. * Will perform no-op if the arguments are out of range or if that position is already played. * Will also perform a no-op if the game is already over. * * @param row 0..2 * @param col 0..2 * */ public void mark( int row, int col ) { if(isValid(row, col)) { cells[row][col].setValue(currentTurn); if(isWinningMoveByPlayer(currentTurn, row, col)) { state = GameState.FINISHED; winner = currentTurn; } else { // flip the current turn and continue flipCurrentTurn(); } } }