src/com/hamish/battleships/Player.java
private boolean checkPositionValid(int col, int row, int shipLength, String direction) {
        if (direction.equalsIgnoreCase("D")) {
            if (row + shipLength > 10) {
                System.out.println("Please enter an option that keeps the ship on the board!");
                return false;
            } else
                return true;
        } else {
            if (col + shipLength > 10) {
                System.out.println("Please enter an option that keeps the ship on the board!");
                return false;
            } else
                return true;
        }
    }
/**
     * Returns a boolean if a ship can be placed in the position provided and direction.
     *
     * @param col        column to be checked
     * @param row        row to be checked
     * @param shipLength the length of the ship
     * @param direction  the direction to be placed
     * @return a boolean if the ship can be entered in this position
     */
Returns a boolean if a ship can be placed in the position provided and direction.
Returns a boolean if a ship can be placed in the position provided and direction .
private boolean checkPositionValid(int col, int row, int shipLength, String direction) {
        if (direction.equalsIgnoreCase("D")) {
            if (row + shipLength > 10) {
                System.out.println("Please enter an option that keeps the ship on the board!");
                return false;
            } else
                return true;
        } else {
            if (col + shipLength > 10) {
                System.out.println("Please enter an option that keeps the ship on the board!");
                return false;
            } else
                return true;
        }
    }
private boolean checkPositionValid ( int col , int row , int shipLength , String direction ) { if ( direction . equalsIgnoreCase ( "D" ) ) { if ( row + shipLength > 10 ) { System . out . println ( "Please enter an option that keeps the ship on the board!" ) ; return false ; } else return true ; } else { if ( col + shipLength > 10 ) { System . out . println ( "Please enter an option that keeps the ship on the board!" ) ; return false ; } else return true ; } }
Returns a boolean if a ship can be placed in the position provided and direction.
Returns a boolean if a ship can be placed in the position provided and direction .