Module

Sudoku

Package
purescript-sudoku
Repository
sanrokugomaato/purescript-sudoku

This is the main module of Sudoku. It provides a set of functions to generate, manipulate or solve a Sudoku game.

#emptyBoard Source

emptyBoard :: Board (Maybe Int)

The emptyBoard function creates an empty board filled with Nothing.

#fullBoard Source

fullBoard :: forall e. Eff (random :: RANDOM | e) (Board Int)

The fullBoard function creates a random complete answer for a Sudoku game.

#rowOf Source

rowOf :: forall a. Cell a -> Row

The rowOf function calculates which row a cell belongs to.

#colOf Source

colOf :: forall a. Cell a -> Col

The colOf function calculates which column a cell belongs to.

#valueOf Source

valueOf :: forall a. Cell a -> a

The valueOf function calculates which value a cell has.

#rowCells Source

rowCells :: forall a. Row -> Board a -> Array (Cell a)

The rowCells function retrieves an array of cells which belong to a specfic row on a board.

#colCells Source

colCells :: forall a. Col -> Board a -> Array (Cell a)

The colCells function retrieves an array of cells which belong to a specfic column on a board.

#sectionAt Source

sectionAt :: Row -> Col -> Section

The sectionAt function calculates which section a row/column pair belongs to.

#sectionContains Source

sectionContains :: forall a. Section -> Cell a -> Boolean

The sectionContains function tells if a section contains a cell.

#sectionCells Source

sectionCells :: forall a. Section -> Board a -> Array (Cell a)

The sectionCells function retrieves an array of cells which belong to a specific section on a board.

#idxAt Source

idxAt :: Row -> Col -> Int

The idxAt function converts a row/column pair into a corresponding index in an internal array of Board.

#valueAt Source

valueAt :: forall a. Row -> Col -> Board a -> a

The valueAt function retrieves a value of a cell with a row and column on a board.

#availableValues Source

availableValues :: Row -> Col -> Board (Maybe Int) -> Array Int

The availableValues function calculates values available at a cell with the Sudoku rule.

#replaceValue Source

replaceValue :: forall a. Row -> Col -> a -> Board a -> Board a

The replaceValue function replaces a value at a cell at a row/column pair on a board.

#generateGame Source

generateGame :: forall e. Difficulty -> Eff (random :: RANDOM | e) Game

The generateGame function generates a random Sudoku game with a minimum difficulty.

#solve Source

solve :: Board (Maybe Int) -> Array (Board Int)

The solve function literally solves a Sudoku question board, returns an array of complete solutions.