|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.act365.sudoku.Solver
A Solver instance solves a grid on a thread that exits gracefully if interrupted.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Solver(Grid grid,
IStrategy strategy)
Creates a Solver instance. |
|
Solver(Grid grid,
IStrategy strategy,
IStrategy composeSolver,
int composeSolverThreshold,
int maxSolns,
java.io.PrintStream debug)
Creates a Solver instance. |
|
Solver(java.lang.String threadName,
Composer composer,
int index,
Grid grid,
IStrategy strategy,
IStrategy composeSolver,
int composeSolverThreshold,
int maxSolns,
int maxUnwinds,
int maxComplexity,
java.io.PrintStream debug,
boolean useNative)
Creates a Solver instance. |
Method Summary | |
int |
getComplexity()
Determines the complexity figure for a puzzle. |
int |
getNumberOfSolutions()
Returns the number of solutions found. |
int |
getNumberOfUnwinds()
Returns the number of times the tree had to be unwound in order to solve the grid. |
static void |
main(java.lang.String[] args)
Command-line app to solve Su Doku puzzles. |
void |
run()
Runs the solver on a thread. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Solver(java.lang.String threadName, Composer composer, int index, Grid grid, IStrategy strategy, IStrategy composeSolver, int composeSolverThreshold, int maxSolns, int maxUnwinds, int maxComplexity, java.io.PrintStream debug, boolean useNative)
threadName
- thread namecomposer
- composer object to which to reportindex
- composer-defined index number for solvergrid
- grid to be solvedstrategy
- strategy to be used to complete the gridcomposeSolver
- solver to be used at each step by the composer in order to check solution uniquenessmaxSolns
- the maximum number of solutions to find before exit (0 for unlimited solutions)maxUnwinds
- the maximum permitted number of unwinds (0 for no limit)maxComplexity
- the maximum permitted complexity (0 for no limit)debug
- (optional) destination for debug infopublic Solver(Grid grid, IStrategy strategy, IStrategy composeSolver, int composeSolverThreshold, int maxSolns, java.io.PrintStream debug)
grid
- grid to be solvedstrategy
- strategy to be used to complete the gridcomposeSolver
- solver to be used at each step by the composer in order to check solution uniquenessmaxSolns
- the maximum number of solution to find before exit (0 for no limit)debug
- (optional) destination for debug infopublic Solver(Grid grid, IStrategy strategy)
grid
- grid to be solvedstrategy
- strategy to be used to complete the gridMethod Detail |
public void run()
public int getNumberOfSolutions()
public int getNumberOfUnwinds()
public int getComplexity()
public static void main(java.lang.String[] args)
Solver [-m max solutions] [-s strategy] [-v] [-u max unwinds]
[-m max solutions]
stipulates the maximum number of solutions to be reported.
The default is for all solutions to be reported.
[-s strategy]
stipulates the strategy to be used. the default is Least Candidates Hybrid.
[-v]
stipulates whether the app should execute in verbose mode. The default is no.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |