Types

Link copied to clipboard
object Companion
Link copied to clipboard
data object EightByEight : Dimension

Object representing a 8x8 Sudoku dimension.

Link copied to clipboard

Object representing a 81x81 Sudoku dimension.

Link copied to clipboard

Object representing a 15x15 Sudoku dimension.

Link copied to clipboard

Object representing a 49x49 Sudoku dimension.

Link copied to clipboard
data object FourByFour : Dimension

Object representing a 4x4 Sudoku dimension.

Link copied to clipboard
data class GridSize(val width: Int, val height: Int)

Data class representing the size of a Sudoku grid.

Link copied to clipboard
data object NineByNine : Dimension

Object representing a 9x9 Sudoku dimension.

Link copied to clipboard
data object SixBySix : Dimension

Object representing a 6x6 Sudoku dimension.

Link copied to clipboard

Object representing a 16x16 Sudoku dimension.

Link copied to clipboard

Object representing a 64x64 Sudoku dimension.

Link copied to clipboard
data object TenByTen : Dimension

Object representing a 10x10 Sudoku dimension.

Link copied to clipboard

Object representing a 36x36 Sudoku dimension.

Link copied to clipboard

Object representing a 12x12 Sudoku dimension.

Link copied to clipboard

Object representing a 25x25 Sudoku dimension.

Link copied to clipboard
data object Unspecified : Dimension

Companion object used to represent an unspecified Sudoku dimension.

Properties

Link copied to clipboard

The height of a single box in the grid.

Link copied to clipboard

The width of a single box in the grid.

Link copied to clipboard
val cells: Int
Link copied to clipboard
val digits: Int
Link copied to clipboard

The size of the Sudoku grid (width and height).

Link copied to clipboard
val height: Int

The height of the Sudoku grid.

Link copied to clipboard

Whether the grid size is square (width == height).

Link copied to clipboard

A human-readable name for the Sudoku dimension (e.g., "4x4").

Link copied to clipboard

The total number of cells in the Sudoku grid. This is calculated by squaring the uniqueDigitsCount. Each cell within the grid can hold one of the uniqueDigitsCount distinct digits (or symbols).

Link copied to clipboard

The number of distinct digits used in the Sudoku grid. This represents the total number of unique symbols that can be placed within a single cell of the Sudoku. It is calculated as the product of the grid width and height.

Link copied to clipboard
val width: Int

The width of the Sudoku grid.

Functions

Link copied to clipboard
fun Dimension.areCellsInSameBox(cellIndex1: Int, cellIndex2: Int): Boolean

Checks if two cells are in the same box based on their indices.

fun Dimension.areCellsInSameBox(row1: Int, col1: Int, row2: Int, col2: Int): Boolean

This alternative way to check if two cells are in the same box uses their row and column indices directly.

Link copied to clipboard
fun Dimension.areCellsInSameColumn(cellIndex1: Int, cellIndex2: Int): Boolean

Checks if two cells are in the same column based on their indices.

Link copied to clipboard
fun Dimension.areCellsInSameRow(cellIndex1: Int, cellIndex2: Int): Boolean

Checks if two cells are in the same row based on their indices.

Link copied to clipboard
fun Dimension.areCellsRelated(row1: Int, col1: Int, row2: Int, col2: Int): Boolean

Checks if two cells are related (in the same row, column, or box) based on their row and column indices.

Link copied to clipboard

Returns a list containing all valid digits (1 to Dimension.digits) for the Sudoku.

Link copied to clipboard

Returns the top-left and bottom-right coordinates of the box containing the cell at the specified row and column.

Link copied to clipboard
fun Dimension.getBoxIndex(row: Int, col: Int): Int

Returns the box index (within the range 0 to Dimension.boxes - 1) for a given cell at the specified row and column.

Link copied to clipboard

Returns the box column index (within the range 0 to (Dimension.width - 1 / Dimension.boxWidth - 1)) for a given cell index.

Link copied to clipboard

Returns the box row index (within the range 0 to (Dimension.height - 1 / Dimension.boxHeight - 1)) for a given cell index.

Link copied to clipboard

Returns the column index (within the range 0 to Dimension.width - 1) for a given cell index.

Link copied to clipboard
Link copied to clipboard
fun Dimension.getCellRowIndex(cellIndex: Int): Int

Returns the row index (within the range 0 to Dimension.height - 1) for a given cell index.

Link copied to clipboard

Checks if a given digit is valid within the range of allowed digits for this Sudoku (1 to Dimension.digits).

Link copied to clipboard
override fun toString(): String

Returns a string representation of the Sudoku dimension.