mad-props-0.2.1.0: Monadic DSL for building constraint solvers using basic propagators.

Copyright(c) Chris Penner 2019
LicenseBSD3
Safe HaskellNone
LanguageHaskell2010

Examples.Sudoku

Description

Click Source on a function to see how it's implemented!

Synopsis

Documentation

txtToBoard :: [String] -> [[Set Int]] Source #

Convert a textual board into a board containing sets of cells of possible numbers

boardToText :: [[Int]] -> String Source #

Convert a board to a string.

easyBoard :: [[Set Int]] Source #

An easy to solve sudoku board

rowsOf :: [[a]] -> [[a]] Source #

Get a list of all rows in a board

colsOf :: [[a]] -> [[a]] Source #

Get a list of all columns in a board

blocksOf :: [[a]] -> [[a]] Source #

Get a list of all square blocks in a board

linkBoardCells :: [[PVar Set Int]] -> Prop () Source #

Given a board of PVars, link the appropriate cells with disjoint constraints

constrainBoard :: [[Set Int]] -> Prop [[PVar Set Int]] Source #

Given a sudoku board, apply the necessary constraints and return a result board of PVars. We wrap the result in Compose because solve requires a Functor over PVars

solvePuzzle :: [[Set Int]] -> IO () Source #