com.eriksilkensen.sudoku
Class GeneratingBoardFactory

java.lang.Object
  extended by com.eriksilkensen.sudoku.GeneratingBoardFactory
All Implemented Interfaces:
BoardFactory
Direct Known Subclasses:
TestBoardFactory

public abstract class GeneratingBoardFactory
extends java.lang.Object
implements BoardFactory

Ideally, this program would be able to generate valid Sudoku boards on the fly whenever a user asks for one.

This abstract Factory attempts to provide for some of that functionality by delegating the actual creation of the puzzles to subclasses - which each start with a fully filled and generated Board.

As of 02/13/07 this class does not function correctly and should not be used.

Since:
1.0
Version:
02/13/07
Author:
Erik Silkensen

Constructor Summary
GeneratingBoardFactory()
           
 
Method Summary
 boolean attemptToRemoveCell(Cell cell, Board board, int row, int col)
          Determines the legality of attemption to remove a given Cell on the Given Board at the given location [row][col].
 Board createBoard(BoardDifficulties difficulty)
          This method should not be overridden by subclassing Factories and so it is marked final.
 Cell[] getRandomCells(int[] rows, int[] cols, Cell[][] cells)
          Helper method that can be used to generate some random Cell values
 int[] getRandomCoords(int numOfCoords)
          Helper method that can be used to generate some random coordinate values
 Board leaveClues(int numOfClues, Board board)
          leaveClues() attempts to remove all Cells from a Board leaving the specified number of 'clues,' but isn't accurate enough to be used yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratingBoardFactory

public GeneratingBoardFactory()
Method Detail

createBoard

public final Board createBoard(BoardDifficulties difficulty)
This method should not be overridden by subclassing Factories and so it is marked final. It generates a Board, and then sends it off to the subclasses who will make a puzzle out of it.

Specified by:
createBoard in interface BoardFactory

leaveClues

public Board leaveClues(int numOfClues,
                        Board board)
leaveClues() attempts to remove all Cells from a Board leaving the specified number of 'clues,' but isn't accurate enough to be used yet. Currently it leavesClues() with an accuracy of about 60%


attemptToRemoveCell

public boolean attemptToRemoveCell(Cell cell,
                                   Board board,
                                   int row,
                                   int col)
Determines the legality of attemption to remove a given Cell on the Given Board at the given location [row][col]. If the move is determined to be legal, the Cell is removed


getRandomCells

public Cell[] getRandomCells(int[] rows,
                             int[] cols,
                             Cell[][] cells)
Helper method that can be used to generate some random Cell values


getRandomCoords

public int[] getRandomCoords(int numOfCoords)
Helper method that can be used to generate some random coordinate values