|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.act365.sudoku.StrategyBase
com.act365.sudoku.FirstAvailable
The 'FirstAvailable' strategy always selects the first valid choice it finds in any situation - it doesn't make any attempt to rank the various alternatives. It is the only strategy implemented in Releases 1.0 and 1.1.
Constructor Summary | |
FirstAvailable()
Creates a new FirstAvailable instance. |
Method Summary | |
int |
findCandidates()
Locates the nearest empty cell, finds its lowest valid value and stores the result. |
void |
selectCandidate()
Selects the single available candidate. |
void |
setup(Grid grid)
Prepares the strategy to solve the given grid.. |
boolean |
unwind(int newNMoves,
boolean reset)
Removes the current cell coordinates from the thread. |
void |
updateState(int x,
int y,
int value,
java.lang.String reason,
boolean writeState)
Updates state variables. |
Methods inherited from class com.act365.sudoku.StrategyBase |
explainsReasoning, getBestReason, getBestValue, getBestX, getBestY, getLastWrittenMove, getNumberOfCandidates, getReason, getReasonCandidate, getScore, getThreadLength, getThreadX, getThreadY, getValueCandidate, getXCandidate, getYCandidate, reset, reset, setCandidate, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.act365.sudoku.IStrategy |
explainsReasoning, getBestReason, getBestValue, getBestX, getBestY, getLastWrittenMove, getNumberOfCandidates, getReason, getReasonCandidate, getScore, getThreadLength, getThreadX, getThreadY, getValueCandidate, getXCandidate, getYCandidate, reset, reset, setCandidate, toString |
Constructor Detail |
public FirstAvailable()
Method Detail |
public void setup(Grid grid) throws java.lang.Exception
setup
in interface IStrategy
java.lang.Exception
public int findCandidates()
findCandidates
in interface IStrategy
IStrategy.findCandidates()
public void selectCandidate()
selectCandidate
in interface IStrategy
selectCandidate
in class StrategyBase
com.act365.sudoku
public void updateState(int x, int y, int value, java.lang.String reason, boolean writeState)
updateState
in interface IStrategy
updateState
in class StrategyBase
writeState
- is ignoredIStrategy.updateState(int,int,int,String,boolean)
public boolean unwind(int newNMoves, boolean reset)
unwind
in interface IStrategy
unwind
in class StrategyBase
IStrategy.unwind(int,boolean)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |