Recently, I have been re-learning Java.
I'm working on a program to solve the 8 Queens problem to practice my skills. When I run my program, I don't get any solutions, but I can't seem to find the bug.
The code in question:
public void solve(char [] [] board, int row){
        for (int i = 0; i < 8; i++) {
            if (board[row][i] == 'O') {             //if the position is blank
                char[][] newBoard = board.clone();  //make a duplicate
                newBoard[row][i] = 'q';             //place a queen in the valid position
                invalidate(newBoard, row, i);       //mark the places the queen can take
                //printBoard(newBoard);               //display to check
                if(row < 7){                        //if we didn't just do the final row
                    solve(newBoard, (row+1));       //do the next row
                }else {                             //if we DID just do the final row
                    printBoard(board);              //print the solution
                }
            }
        }
}
When I have my print method running to get the process, I get 5 boards. The last one is:
qXXXXXXX
XXqXXXXX
XXXXqXXX
XqXXXXXX
XXXqXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
This result seems to imply that the program runs through the first-most path without any problem, but doesn't go through the others for some reason I just can't figure out.
As I touched on at the beginning, I'm not super experienced with coding, so any help would be greatly appreciated!
