public class SudokuGenerator extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
GENERATOR_GEN_FAILED
Generation process failed.
|
static int |
GENERATOR_GEN_FINISHED
Generation process finished.
|
static int |
GENERATOR_GEN_NOT_STARTED
Generation process not started.
|
static int |
GENERATOR_GEN_STARTED
Generation process started.
|
static int |
GENERATOR_INIT_FAILED
Generator init failed.
|
static int |
GENERATOR_INIT_FINISHED
Generator init finished.
|
static int |
GENERATOR_INIT_STARTED
Generator init started
|
static char |
PARAM_DO_NOT_SOLVE
Indicator showing that initial board should be solved
before generation process will be started.
|
static char |
PARAM_DO_NOT_TRANSFORM
Indicator showing that initial board should not be
randomly transformed before generation process will be started.
|
static char |
PARAM_GEN_RND_BOARD
Indicator if generation should
start from randomly generated board.
|
| Constructor and Description |
|---|
SudokuGenerator(ArrayList<String> boardDefinition,
char... parameters)
Constructor based on the sudoku board
provided list of strings.
|
SudokuGenerator(char... parameters)
Default constructor based on random Sudoku puzzle example.
|
SudokuGenerator(int[][] initialBoard,
char... parameters)
Default constructor based on provided initial board.
|
SudokuGenerator(int example,
char... parameters)
Default constructor based on puzzle example.
|
SudokuGenerator(String[] boardDefinition,
char... parameters)
Constructor based on the sudoku board
provided array of strings.
|
SudokuGenerator(String boardFilePath,
char... parameters)
Constructor based on the sudoku board
provided in text file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearMessages()
Clears list of recorded messages.
|
void |
disableRndSeedOnFilledCells()
By default random seed on filled cells is enabled.
|
void |
enableRndSeedOnFilledCells()
By default random seed on filled cells is enabled.
|
int[][] |
generate()
Sudoku puzzle generator.
|
double |
getComputingTime()
Return solving time in seconds..
|
int |
getGeneratorState()
Return current state of the generator
|
String |
getLastErrorMessage()
Gets last recorded error message.
|
String |
getLastMessage()
Gets last recorded message.
|
String |
getMessages()
Returns list of recorded messages.
|
boolean |
saveBoard(String filePath)
Saves board to the text file.
|
boolean |
saveBoard(String filePath,
String headComment)
Saves board to the text file.
|
boolean |
saveBoard(String filePath,
String headComment,
String tailComment)
Saves board to the text file.
|
public static final char PARAM_GEN_RND_BOARD
public static final char PARAM_DO_NOT_SOLVE
public static final char PARAM_DO_NOT_TRANSFORM
public static final int GENERATOR_INIT_STARTED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_INIT_FINISHED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_INIT_FAILED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_GEN_NOT_STARTED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_GEN_STARTED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_GEN_FINISHED
getGeneratorState(),
Constant Field Valuespublic static final int GENERATOR_GEN_FAILED
getGeneratorState(),
Constant Field Valuespublic SudokuGenerator(char... parameters)
parameters - Optional parameters.PARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic SudokuGenerator(int example,
char... parameters)
example - Example number between 0 and SudokuPuzzles.NUMBER_OF_PUZZLE_EXAMPLES.parameters - Optional parameters.PARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic SudokuGenerator(int[][] initialBoard,
char... parameters)
initialBoard - Array with the board definition.parameters - Optional parametersPARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic SudokuGenerator(String boardFilePath, char... parameters)
boardFilePath - Path to the board definition.parameters - Optional parametersPARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic SudokuGenerator(String[] boardDefinition, char... parameters)
boardDefinition - Board definition as array of strings
(each array entry as separate row).parameters - Optional parametersPARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic SudokuGenerator(ArrayList<String> boardDefinition, char... parameters)
boardDefinition - Board definition as list of strings
(each list entry as separate row).parameters - Optional parametersPARAM_DO_NOT_SOLVE,
PARAM_DO_NOT_TRANSFORM,
PARAM_GEN_RND_BOARDpublic int[][] generate()
public boolean saveBoard(String filePath)
filePath - Path to the file.SudokuStore.saveBoard(int[][], String),
SudokuStore.boardToString(int[][])public boolean saveBoard(String filePath, String headComment)
filePath - Path to the file.headComment - Comment to be added at the head.SudokuStore.saveBoard(int[][], String, String),
SudokuStore.boardToString(int[][], String)public boolean saveBoard(String filePath, String headComment, String tailComment)
filePath - Path to the file.headComment - Comment to be added at the head.tailComment - Comment to be added at the tail.SudokuStore.saveBoard(int[][], String, String, String),
SudokuStore.boardToString(int[][], String, String)public void enableRndSeedOnFilledCells()
public void disableRndSeedOnFilledCells()
public String getMessages()
public void clearMessages()
public String getLastMessage()
public String getLastErrorMessage()
public double getComputingTime()
public int getGeneratorState()
Copyright © 2017. All rights reserved.