Module

Data.NQueens.Internal

Package
purescript-nqueens
Repository
jrrom/purescript-nqueens

#Position Source

type Position = { col :: Int, row :: Int }

type Position { row :: Int, col :: Int }

#Board Source

newtype Board

newtype Board { size :: Int, queens :: List Position }

Constructors

Instances

  • Show Board

    Will display with leading and ending newline in the form below:

    _ Q _ _ _ _ _ Q Q _ _ _ _ _ Q _

#isQueen Source

isQueen :: Int -> Int -> List Position -> Boolean

Check if the Position has a queen.

#canAttack Source

canAttack :: Position -> Position -> Boolean

Check if the Position can be attacked.

#valid Source

valid :: Board -> Position -> Boolean

Check if the Position is valid by comparing against qs :: List Position.