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.NQueens

Description

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

Synopsis

Documentation

type Coord = (Int, Int) Source #

A board coordinate

constrainQueens :: Int -> Prop [PVar Set Coord] Source #

Given a number of queens, constrain them to not overlap

overlapping :: Coord -> Coord -> Bool Source #

Check whether two queens overlap with each other (i.e. could kill each other)

showSolution :: Int -> [Coord] -> String Source #

Print an nQueens puzzle to a string.

nQueens :: Int -> IO () Source #

Solve and print an N-Queens puzzle

nQueensAll :: Int -> IO () Source #

Solve and print all possible solutions of an N-Queens puzzle This will include duplicates.