puzzle-draw-0.1.0.0: Creating graphics for pencil puzzles.

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Puzzles.Grid

Description

Puzzle grids.

Synopsis

Documentation

data Grid s a where Source

A generic grid, with the given shape and contents.

Constructors

Grid :: s -> Map (Cell s) a -> Grid s a 

Fields

shape :: s
 
contents :: Map (Cell s) a
 

Instances

Functor (Grid s) 
Foldable (Grid s) 
Traversable (Grid s) 
(Show a, Show s, GridShape s) => Show (Grid s a) 

type SGrid = Grid Square Source

Standard square grid.

(!) :: (GridShape s, Ord (Cell s)) => Grid s a -> Cell s -> a Source

Lookup a grid value at a given cell. Unsafe.

fromListList :: [[a]] -> Grid Square a Source

Initialize a square grid from a list of lists. The grid might be incomplete if some rows are shorter.

size :: GridShape s => Grid s a -> GridSize s Source

cells :: GridShape s => Grid s a -> [Cell s] Source

inBounds :: (GridShape s, Eq (Cell s)) => Grid s a -> Cell s -> Bool Source

clues :: GridShape s => Grid s (Maybe a) -> [(Cell s, a)] Source

For a grid with value type Maybe a, return an association list of cells and Just values.

values :: GridShape s => Grid s a -> [(Cell s, a)] Source

Association list of cells and values.

borders :: Eq a => Grid Square a -> [Edge] Source

The inner edges of a grid that separate unequal cells.

data OutsideClues a Source

Clues along the outside of a square grid.

Constructors

OC 

Fields

left :: [a]
 
right :: [a]
 
bottom :: [a]
 
top :: [a]
 

Instances

outsideclues :: OutsideClues (Maybe a) -> [((Int, Int), a)] Source

Convert outside clues to association list mapping coordinate to value.