Package-level declarations

Types

Link copied to clipboard

Represents the different modes for mistake checking in the Sudoku game.

Link copied to clipboard

Class for advising on Sudoku moves by analyzing the grid and suggesting possible next moves.

Link copied to clipboard
class SudoklifySolverEngine<T>(gridProcessor: SudokuGridProcessor<T>, puzzle: SudokuPuzzle)

Engine for solving Sudoku puzzles using the provided puzzle configuration and grid processor.

Link copied to clipboard
data class SudokuCellState(val value: Int, val solution: Int, val isLocked: Boolean, var isError: Boolean = false)

Represents the state of a single Sudoku cell.

Link copied to clipboard

Interface for processing Sudoku grids, converting between cell types, and checking for mistakes.

Link copied to clipboard
data class SudokuMove(val row: Int, val col: Int, val value: Int)

Data class representing a suggested move in the Sudoku puzzle.

Functions

Link copied to clipboard
Link copied to clipboard
fun <T> createSudokuGridProcessor(getValue: (T) -> Int, isLocked: (T) -> Boolean, getSolution: (T) -> Int, isError: (T) -> Boolean, updateCell: (row: Int, col: Int, state: SudokuCellState, cell: T) -> T): SudokuGridProcessor<T>

Creates a default implementation of SudokuGridProcessor for a specific grid cell type.

Link copied to clipboard
Link copied to clipboard
inline fun <T> List<List<T>>.processGridMistakes(mistakesMethod: MistakeCheckingMode, dimension: Dimension, crossinline getValue: (T) -> Int, crossinline isLocked: (T) -> Boolean, crossinline getSolution: (T) -> Int, crossinline isError: (T) -> Boolean, crossinline updateCell: (row: Int, col: Int, SudokuCellState, T) -> T): List<List<T>>

Converts the grid to SudokuCellState, checks for mistakes, and converts it back to the original grid type.

Link copied to clipboard
inline fun <T> SudoklifySolverEngine(gridProcessor: SudokuGridProcessor<T>, puzzle: SudokuPuzzle, mistakeCheckingMode: MistakeCheckingMode = MistakeCheckingMode.CheckViolations): SudoklifySolverEngine<T>

DSL function for creating a SudoklifySolverEngine instance with the specified parameters.

Link copied to clipboard
inline fun <T> List<List<T>>.toSudokuCellStates(crossinline getValue: (T) -> Int, crossinline isLocked: (T) -> Boolean, crossinline getSolution: (T) -> Int, crossinline isError: (T) -> Boolean): List<List<SudokuCellState>>

Converts the grid to SudokuCellState using the provided lambdas.

Link copied to clipboard
inline fun <T> List<List<SudokuCellState>>.toUserGrid(crossinline updateCell: (row: Int, col: Int, SudokuCellState, T) -> T, originalGrid: List<List<T>>): List<List<T>>

Converts the grid of SudokuCellState back to the original grid type.