Class ChessQueensOne
java.lang.Object
topics.backtracking.ChessQueensOne
BACKTRACKING PROBLEM: THE PROBLEM OF THE N QUEENS
This program calculates one way of placing
n queens on a chessboard of side n
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbacktracking(int j) Performs the backtracking processbooleanReturns whether there is a solution
-
Constructor Details
-
ChessQueensOne
public ChessQueensOne(int n) Constructor for ChessQueensOne objects- Parameters:
n- Size of the board
-
-
Method Details
-
backtracking
public void backtracking(int j) Performs the backtracking process- Parameters:
j- Level in the tree of states starting at 0
-
isSolution
public boolean isSolution()Returns whether there is a solution- Returns:
- True is there is a solution. False otherwise
-