Package sudoku.lab

Class FewestOptionsFirstSearchOrder

java.lang.Object
sudoku.lab.FewestOptionsFirstSearchOrder
All Implemented Interfaces:
SquareSearchOrder

@Immutable public class FewestOptionsFirstSearchOrder extends Object implements SquareSearchOrder
Author:
__STUDENT_NAME__, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
  • Constructor Details

    • FewestOptionsFirstSearchOrder

      public FewestOptionsFirstSearchOrder()
  • Method Details

    • selectNextUnfilledSquare

      public Optional<Square> selectNextUnfilledSquare​(SudokuPuzzle puzzle)
      A square search algorithm that prefers squares with fewer options. In other words, this algorithm should always pick the empty square that is the most constrained by its peers. This algorithm should return a square with no options if it exists (meaning that the puzzle is impossible to solve), or it should return empty, if the puzzle is already completely solved.
      Specified by:
      selectNextUnfilledSquare in interface SquareSearchOrder
      Parameters:
      puzzle - The sudoku puzzle to examine
      Returns:
      the next unfilled square to examine in the puzzle