|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smithers.logicpuzzles.AbstractPuzzleSolver<Mosaic,MosaicState> smithers.logicpuzzles.MosaicSolver
public class MosaicSolver
Solves mosaic puzzles. The method employed here uses two modes: simple logic and advanced logic. Simple logic attempts to solve the puzzle only looking at one clue at a time, whereas advanced logic looks at up to two clues at once.
Field Summary |
---|
Fields inherited from class smithers.logicpuzzles.AbstractPuzzleSolver |
---|
puzzle, state |
Constructor Summary | |
---|---|
MosaicSolver(Mosaic puzzle)
Creates a new solver for the specified puzzle. |
|
MosaicSolver(Mosaic puzzle,
boolean advanced)
Creates a new solver for the specified puzzle. |
|
MosaicSolver(MosaicState state)
Creates a new solver to work from the specified state. |
|
MosaicSolver(MosaicState state,
boolean advanced)
Creates a new solver to work from the specified state. |
Method Summary | |
---|---|
int[] |
getLastChange()
Finds the last change that was made to the puzzle. |
MosaicState |
makeState(Mosaic puzzle)
Makes a new state for the specified puzzle. |
boolean |
nextStep()
Advances to the next step of solving the puzzle. |
int |
solveStep()
Solves the current clue as much as possible. |
void |
start()
Restarts the solving process. |
Methods inherited from class smithers.logicpuzzles.AbstractPuzzleSolver |
---|
getPuzzle, getState, pass, solve, step |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MosaicSolver(Mosaic puzzle)
puzzle
- the puzzle to solvepublic MosaicSolver(MosaicState state)
state
- the puzzle state to work frompublic MosaicSolver(Mosaic puzzle, boolean advanced)
puzzle
- the puzzle to solveadvanced
- whether or not to use advanced logicpublic MosaicSolver(MosaicState state, boolean advanced)
state
- the puzzle state to work fromadvanced
- whether or not to use advanced logicMethod Detail |
---|
public MosaicState makeState(Mosaic puzzle)
AbstractPuzzleSolver
puzzle
as an argument.
makeState
in class AbstractPuzzleSolver<Mosaic,MosaicState>
puzzle
- the puzzle to create a state for
public void start()
PuzzleSolver
public int[] getLastChange()
step()
or pass()
resulted in no change, this returns
null
.
public boolean nextStep()
AbstractPuzzleSolver
nextStep
in class AbstractPuzzleSolver<Mosaic,MosaicState>
true
iff the solver has started a new 'pass'public int solveStep()
solveStep
in class AbstractPuzzleSolver<Mosaic,MosaicState>
2
if a change was made, 0
otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |