src/main/java/com/webcheckers/model/Game.java
/**
     * Checks if single move is valid
     * @param move, move to be made
     * @return true if valid, false otherwise
     * @throws Exception
     */
Checks if single move is valid
@param move, move to be made
@return true if valid, false otherwise
@throws Exception
Checks if single move is valid @param move move to be made @return true if valid false otherwise @throws Exception
private boolean isValidNormalMoveSingle(Move move) throws Exception {
        Position start = move.getStart();
        Position end = move.getEnd();
        Space startSpace = boardView.getSpace(start.getRow(), start.getCell());
        Piece startPiece = startSpace.getPiece();
        PieceColor pieceColor = startPiece.color;
        Space endSpace = boardView.getSpace(end.getRow(), end.getCell());
        Piece endPiece = endSpace.getPiece();
        boolean isKing = startPiece.getType() == Piece.PieceType.KING;
        if (endPiece != null) {
            throw new Exception("Piece already present at endPiece.");
        }
        boolean validRow;
        boolean validCell;
        if (isKing){
            validRow = Math.abs(start.getRow() - end.getRow()) == 1;
            validCell = Math.abs(start.getCell() - end.getCell()) ==1;
        }
        else if (pieceColor == PieceColor.RED ) {
            validRow = start.getRow() - end.getRow() == 1;
            validCell = start.getCell() - end.getCell() == -1 || start.getCell() - end.getCell() == 1;
        }
        else {
            validRow = end.getRow() - start.getRow() == 1;
            validCell = start.getCell() - end.getCell() == -1 || start.getCell() - end.getCell() == 1;
        }
        if (!validRow) {
            throw new Exception("Non-jump must be a difference of 1 row.");
        }
        else if (!validCell){
            throw new Exception("Non-jump must be a difference of 1 col.");
        }
        else {
            return true;
        }
    }
private boolean isValidNormalMoveSingle ( Move move ) throws Exception { Position start = move . getStart ( ) ; Position end = move . getEnd ( ) ; Space startSpace = boardView . getSpace ( start . getRow ( ) , start . getCell ( ) ) ; Piece startPiece = startSpace . getPiece ( ) ; PieceColor pieceColor = startPiece . color ; Space endSpace = boardView . getSpace ( end . getRow ( ) , end . getCell ( ) ) ; Piece endPiece = endSpace . getPiece ( ) ; boolean isKing = startPiece . getType ( ) == Piece . PieceType . KING ; if ( endPiece != null ) { throw new Exception ( "Piece already present at endPiece." ) ; } boolean validRow ; boolean validCell ; if ( isKing ) { validRow = Math . abs ( start . getRow ( ) - end . getRow ( ) ) == 1 ; validCell = Math . abs ( start . getCell ( ) - end . getCell ( ) ) == 1 ; } else if ( pieceColor == PieceColor . RED ) { validRow = start . getRow ( ) - end . getRow ( ) == 1 ; validCell = start . getCell ( ) - end . getCell ( ) == - 1 || start . getCell ( ) - end . getCell ( ) == 1 ; } else { validRow = end . getRow ( ) - start . getRow ( ) == 1 ; validCell = start . getCell ( ) - end . getCell ( ) == - 1 || start . getCell ( ) - end . getCell ( ) == 1 ; } if ( ! validRow ) { throw new Exception ( "Non-jump must be a difference of 1 row." ) ; } else if ( ! validCell ) { throw new Exception ( "Non-jump must be a difference of 1 col." ) ; } else { return true ; } }
Checks if single move is valid
 @param move, move to be made
 @return true if valid, false otherwise
 @throws Exception
Checks if single move is valid @param move move to be made @return true if valid false otherwise @throws Exception