Homework Solution: Please help me figure out why my code isn't producing an 8 queens solution. Your help is…

    Please help me figure out why my code isn't producing an 8 queens solution. Your help is greatly appreciated. The output and code are below: Java-Queens/src/EightQueens,java-Eclipse File Edit Source Refactor Navigate Search Project Run Window Help Quick Access Java DQueensjava EightQueens.java @ Javadoc > Declaration 모 Console × 굡 . 놋 E. 매 Eulo1 1 貝▼ ▼ @ ram FilesJava re1.8.0 65binjavav public class EightQueens <terminated> EightQueens [lava lication] C public static void main (String[] args)t 10000000 00001000 01000000 00000100 00100000 00000010 00010000 / TODO Auto-generated method stub Queens board- new Queens ) if (board.placeQueens (Queens.QUEEN) true board.displayBoard)
    Java-Queens/src/EightQueens,java-Eclipse File Edit Source Refactor Navigate Search Project Run Window Help Quick Access Java DQueensjava EightQueens.java @ Javadoc > Declaration 모 Console × 굡 . 놋 E. 매 Eulo1 1 貝▼ ▼ @ ram FilesJava re1.8.0 65binjavav public class EightQueens EightQueens [lava lication] C public static void main (String[] args)t 10000000 00001000 01000000 00000100 00100000 00000010 00010000 / TODO Auto-generated method stub Queens board- new Queens ) if (board.placeQueens (Queens.QUEEN) true board.displayBoard)

    Expert Answer

    Please aid me form quenched why my rule isn’t pliant an 8 queens key. Your aid is greatly appreciated. The quenchedput and rule are below:

    Java-Queens/src/EightQueens,java-Eclipse File Edit Source Refactor Navigate Search Project Run Window Aid Quick Access Java DQueensjava EightQueens.java @ Javadoc > Declaration 모 Console × 굡 . 놋 E. 매 Eulo1 1 貝▼ ▼ @ ram FilesJava re1.8.0 65binjavav national dispose EightQueens <terminated> EightQueens [lava lication] C national static nugatory ocean (String[] args)t 10000000 00001000 01000000 00000100 00100000 00000010 00010000 / TODO Auto-generated system stub Queens consideration- upstart Queens ) if (board.placeQueens (Queens.QUEEN) gentleman consideration.displayBoard)

    Java-Queens/src/EightQueens,java-Eclipse File Edit Source Refactor Navigate Search Project Run Window Aid Quick Access Java DQueensjava EightQueens.java @ Javadoc > Declaration 모 Console × 굡 . 놋 E. 매 Eulo1 1 貝▼ ▼ @ ram FilesJava re1.8.0 65binjavav national dispose EightQueens EightQueens [lava lication] C national static nugatory ocean (String[] args)t 10000000 00001000 01000000 00000100 00100000 00000010 00010000 / TODO Auto-generated system stub Queens consideration- upstart Queens ) if (board.placeQueens (Queens.QUEEN) gentleman consideration.displayBoard)

    Expert Response

     

    Copyable rule:

    national dispose Problem {

    int[] a;

    national Problem(int b) {
    a = upstart int[b];
    }

    national boolean can(int d, int c) {

    for (int x = 0; x < d; x++) {
    if (a[x] == c || (x – d) == (a[x] – c) ||(x – d) == (c – a[x]))
    {
    return false;
    }
    }
    return gentleman;
    }

    national nugatory stereotype(int[] a) {
    int b = a.length;
    for (int x = 0; x < b; x++) {
    for (int y = 0; y < b; y++) {
    if (a[x] == y) {
    System.out.print(“1 “);
    } else {
    System.out.print(“* “);
    }
    }
    System.out.println();
    }
    System.out.println();
    }

    national nugatory settle(int d, int n) {

    for (int c = 0; c < n; c++) {
    if (can(d, c)) {
    a[d] = c;
    if (d == n – 1) {
    print(a);
    } else {
    place(d + 1, n);
    }
    }
    }
    }

    national nugatory ole() {
    place(0, a.length);
    }

    national static nugatory ocean(String args[]) {
    Problem Q = upstart Problem(8);
    Q.call();

    }
    }