Class NQueens

java.lang.Object
  |
  +--NQueens

public class NQueens
extends java.lang.Object

Environment-Based Applications:
The NQueens class implements the N Queens problem.


Constructor Summary
NQueens(int n, SettableEnvDisplay d)
          Constructs an object that solves the N Queens Problem.
 
Method Summary
 int numQueens()
          Returns the number of queens to be placed on the board.
 boolean solve()
          Solves (or attempts to solve) the N Queens Problem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NQueens

public NQueens(int n,
               SettableEnvDisplay d)
Constructs an object that solves the N Queens Problem.
Parameters:
n - the number of queens to be placed on an n x n board
d - an object that knows how to display an n x n board and the queens on it
Method Detail

numQueens

public int numQueens()
Returns the number of queens to be placed on the board.

solve

public boolean solve()
Solves (or attempts to solve) the N Queens Problem.