SudoklifyAssembler

class SudoklifyAssembler(val schemas: SudokuSchemas, val spec: SudokuSpec, sudokuLayoutManipulator: SudokuLayoutManipulator, sudokuTokenMapper: SudokuTokenMapper, random: Random)

Assembles a Sudoku puzzle based on the provided configuration and specifications.

The SudoklifyAssembler class is responsible for creating Sudoku puzzles by selecting a random schema according to the puzzle's difficulty, shuffling and rotating the layout, generating the token sequence for the puzzle and its solution, and returning a SudokuPuzzle object.

Example:

// Create a SudokuSchemas with the schemas
val schemas = SudokuSchemas(*)

// Define Sudoku specifications
val spec = SudokuSpec {
type = SudokuType.Sudoku9x9
difficulty = Difficulty.EASY
seed = 1234L
}

// Create a SudoklifyAssembler
val assembler = SudoklifyAssembler(schemas, spec)

// Assemble a Sudoku puzzle
val puzzle = assembler.assembleSudoku()
println(puzzle)

See also

Constructors

Link copied to clipboard
constructor(schemas: SudokuSchemas, spec: SudokuSpec, sudokuLayoutManipulator: SudokuLayoutManipulator, sudokuTokenMapper: SudokuTokenMapper, random: Random)

Creates a new SudoklifyAssembler instance with the provided parameters.

Types

Link copied to clipboard
class Factory(schemas: SudokuSchemas, spec: SudokuSpec)

Factory class for creating instances of SudoklifyAssembler.

Properties

Link copied to clipboard

A SudokuSchemas instance containing the Sudoku schemas.

Link copied to clipboard

A SudokuSpec instance specifying the puzzle's configuration.

Functions

Link copied to clipboard

Creates a new Sudoku puzzle based on the specified configuration.