src/main/java/com/webcheckers/model/Game.java
/**
     * Checks the entire board calling all of the other check functions.
     * @return true if board is good, false otherwise
     */
Checks the entire board calling all of the other check functions.
@return true if board is good, false otherwise
Checks the entire board calling all of the other check functions . @return true if board is good false otherwise
public boolean check_board(){
        for (int i = 0; i < 8; i++){
            for (int j = 0; j < 8; j++){
                if (boardView.getSpace(i,j).getPiece() == null) {
                    continue;
                } else if (boardView.getSpace(i, j).getPiece().getType() == Piece.PieceType.KING &&
                                                this.activeColor == boardView.getSpace(i, j).getPiece().getColor()){
                    boolean temp = check_DownLeft(i,j) && check_DownRight(i,j) && check_UpLeft(i,j)
                            && check_UpRight(i,j);
                    if (!temp){
                        return false;
                    }
                } else if (boardView.getSpace(i,j).getPiece().getColor() == this.activeColor &&
                                                this.activeColor == PieceColor.WHITE){
                    boolean temp = check_UpLeft(i,j) && check_UpRight(i,j);
                    if (!temp){
                        return false;
                    }
                } else if (boardView.getSpace(i,j).getPiece().getColor() == this.activeColor &&
                                                this.activeColor == PieceColor.RED){
                    boolean temp = check_DownLeft(i,j) && check_DownRight(i,j);
                    if (!temp){
                        return false;
                    }
                }
            }
        }
        return true;
    }
public boolean check_board ( ) { for ( int i = 0 ; i < 8 ; i ++ ) { for ( int j = 0 ; j < 8 ; j ++ ) { if ( boardView . getSpace ( i , j ) . getPiece ( ) == null ) { continue ; } else if ( boardView . getSpace ( i , j ) . getPiece ( ) . getType ( ) == Piece . PieceType . KING && this . activeColor == boardView . getSpace ( i , j ) . getPiece ( ) . getColor ( ) ) { boolean temp = check_DownLeft ( i , j ) && check_DownRight ( i , j ) && check_UpLeft ( i , j ) && check_UpRight ( i , j ) ; if ( ! temp ) { return false ; } } else if ( boardView . getSpace ( i , j ) . getPiece ( ) . getColor ( ) == this . activeColor && this . activeColor == PieceColor . WHITE ) { boolean temp = check_UpLeft ( i , j ) && check_UpRight ( i , j ) ; if ( ! temp ) { return false ; } } else if ( boardView . getSpace ( i , j ) . getPiece ( ) . getColor ( ) == this . activeColor && this . activeColor == PieceColor . RED ) { boolean temp = check_DownLeft ( i , j ) && check_DownRight ( i , j ) ; if ( ! temp ) { return false ; } } } } return true ; }
Checks the entire board calling all of the other check functions.
Checks the entire board calling all of the other check functions .