public class NQueensSolver
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
verbose
boolean verbose - whether or not to print each solution found
|
Constructor and Description |
---|
NQueensSolver(int n)
Construct a solver for finding and counting all solutions to the n queens problem.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Obtain the problem size n from args or, if not given, from the standard input.
|
long |
solve()
Return the number of solutions to the n queens problem.
|
long |
solveNThreads()
Return the number of solutions to the n queens problem, computed with n threads.
|
public boolean verbose
public NQueensSolver(int n)
n
- the number of queens to place in a non-mutually attacking configuration on an n-by-n boardpublic long solve()
public long solveNThreads()
public static void main(java.lang.String[] args)
args
- optionally, a String array containing a String of a single positive integer n specifying the problem size.