com.act365.sudoku
Class MostCandidates

java.lang.Object
  extended bycom.act365.sudoku.StrategyBase
      extended bycom.act365.sudoku.MostCandidates
All Implemented Interfaces:
IStrategy

public class MostCandidates
extends StrategyBase
implements IStrategy

The MostCandidates strategy makes the move at any timestep that will eliminate the greatest number of remaining candidates. It is intended to be used in order to compose puzzles.


Constructor Summary
MostCandidates(boolean[][] mask, boolean randomize)
           
 
Method Summary
 int findCandidates()
          Finds the candidates for which nInvunerable is lowest.
 void setup(Grid grid)
          Sets the state variables.
 boolean unwind(int newNMoves, boolean reset)
          Unwinds the the thread and reinstates 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, selectCandidate, setCandidate, toString, updateState
 
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, selectCandidate, setCandidate, toString, updateState
 

Constructor Detail

MostCandidates

public MostCandidates(boolean[][] mask,
                      boolean randomize)
Parameters:
mask -
randomize -
Method Detail

setup

public void setup(Grid grid)
           throws java.lang.Exception
Sets the state variables.

Specified by:
setup in interface IStrategy
Throws:
java.lang.Exception

findCandidates

public int findCandidates()
Finds the candidates for which nInvunerable is lowest.

Specified by:
findCandidates in interface IStrategy
Returns:
number of candidates
See Also:
IStrategy.findCandidates()

unwind

public boolean unwind(int newNMoves,
                      boolean reset)
Unwinds the the thread and reinstates state variables. Note that when a puzzle is created, the first value is set without loss of generality. Therefore the thread is only ever unwound until a single move remains.

Specified by:
unwind in interface IStrategy
Overrides:
unwind in class StrategyBase
See Also:
IStrategy.unwind(int,boolean)