uk.co.keang.sudoku.solver
Class BruteForceSolver

java.lang.Object
  extended by uk.co.keang.sudoku.solver.AbstractSolver
      extended by uk.co.keang.sudoku.solver.BruteForceSolver

public class BruteForceSolver
extends AbstractSolver

Author:
A.G.Docherty Provides resolution by simply looking along row column and block for a missing value

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.co.keang.sudoku.solver.AbstractSolver
AbstractSolver.SolverDifficulty
 
Field Summary
 
Fields inherited from class uk.co.keang.sudoku.solver.AbstractSolver
found, hGrid, puzzle
 
Constructor Summary
BruteForceSolver(Puzzle grid, java.util.Random r)
           
 
Method Summary
 int fillBlock(int blockIndex)
          Fills the block index with a random set of numbers.
 int findSolutions()
          Runs the solver once to try to resolve individual squares
 
Methods inherited from class uk.co.keang.sudoku.solver.AbstractSolver
addSolverListener, fireSolutionEvent, getDifficultyFactor, getSolverDifficulty, hasSolverListeners, removeAllFromSet, removeAllSolverListeners, removeSolverListener, retainAllInSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BruteForceSolver

public BruteForceSolver(Puzzle grid,
                        java.util.Random r)
Method Detail

findSolutions

public int findSolutions()
                  throws IllegalGridException
Description copied from class: AbstractSolver
Runs the solver once to try to resolve individual squares

Specified by:
findSolutions in class AbstractSolver
Returns:
the number of solutions found
Throws:
IllegalGridException

fillBlock

public int fillBlock(int blockIndex)
Fills the block index with a random set of numbers. These numbers are legal within this block but may not be legal when compared with other blocks

Parameters:
blockIndex - - 0n based block number where blocks are number left to right and then top to bottom
Returns:
the number of numbers added