Java/nQueens.java
public static boolean isValid_Diagonal(char[][] board, int row, int column) {
        for (int x = 0; x < Sizes.grid_Size; x++) {
            for (int y = 0; y < Sizes.grid_Size; y++) {
                /*actually, I was doing a lot of wrong stuff here, basically my backtrack was alright,
                  but I was messing things up when checking the diagonals, it took me so long to realize that
                  I was checking them the wrong way.
                * the funny part, is that I came up with this idea down below when I thought about a problem
                * I had solved long before. The problem was about finding the minimum amount of steps a man
                * would need to take if he wanted to move from a coordinate A to a coordinate B, and it resulted
                * in a similar formula.
                * you can validate this formula in a board I wrote as comment at the end of the code.
                */
                int diffRow = Math.abs(row - x);
                int diffColumn = Math.abs(column - y);
                if (board[x][y] == 'Q' && diffRow == diffColumn) {
                    return false;
                }
            }
        }
        return true;
    }
/*
    checks diagonals in both sides, left and right.
     */
checks diagonals in both sides, left and right.
checks diagonals in both sides left and right .
public static boolean isValid_Diagonal(char[][] board, int row, int column) {
        for (int x = 0; x < Sizes.grid_Size; x++) {
            for (int y = 0; y < Sizes.grid_Size; y++) {
                /*actually, I was doing a lot of wrong stuff here, basically my backtrack was alright,
                  but I was messing things up when checking the diagonals, it took me so long to realize that
                  I was checking them the wrong way.
                * the funny part, is that I came up with this idea down below when I thought about a problem
                * I had solved long before. The problem was about finding the minimum amount of steps a man
                * would need to take if he wanted to move from a coordinate A to a coordinate B, and it resulted
                * in a similar formula.
                * you can validate this formula in a board I wrote as comment at the end of the code.
                */
                int diffRow = Math.abs(row - x);
                int diffColumn = Math.abs(column - y);
                if (board[x][y] == 'Q' && diffRow == diffColumn) {
                    return false;
                }
            }
        }
        return true;
    }
public static boolean isValid_Diagonal ( char [ ] [ ] board , int row , int column ) { for ( int x = 0 ; x < Sizes . grid_Size ; x ++ ) { for ( int y = 0 ; y < Sizes . grid_Size ; y ++ ) { /*actually, I was doing a lot of wrong stuff here, basically my backtrack was alright,
                  but I was messing things up when checking the diagonals, it took me so long to realize that
                  I was checking them the wrong way.
                * the funny part, is that I came up with this idea down below when I thought about a problem
                * I had solved long before. The problem was about finding the minimum amount of steps a man
                * would need to take if he wanted to move from a coordinate A to a coordinate B, and it resulted
                * in a similar formula.
                * you can validate this formula in a board I wrote as comment at the end of the code.
                */ int diffRow = Math . abs ( row - x ) ; int diffColumn = Math . abs ( column - y ) ; if ( board [ x ] [ y ] == 'Q' && diffRow == diffColumn ) { return false ; } } } return true ; }
checks diagonals in both sides, left and right.
checks diagonals in both sides left and right .