wordify-0.1.0.0

Safe HaskellSafe
LanguageHaskell2010

Wordify.Rules.Board

Contents

Synopsis

Documentation

data Board Source #

Instances
Eq Board Source # 
Instance details

Defined in Wordify.Rules.Board.Internal

Methods

(==) :: Board -> Board -> Bool #

(/=) :: Board -> Board -> Bool #

Show Board Source # 
Instance details

Defined in Wordify.Rules.Board

Methods

showsPrec :: Int -> Board -> ShowS #

show :: Board -> String #

showList :: [Board] -> ShowS #

emptyBoard :: Board Source #

Creates an empty board.

allSquares :: Board -> [(Pos, Square)] Source #

Returns all the squares on the board, ordered by column then row.

placeTile :: Board -> Tile -> Pos -> Maybe Board Source #

Places a tile on a square and yields the new board, if the target square is empty. Otherwise yields Nothing.

occupiedSquareAt :: Board -> Pos -> Maybe Square Source #

Returns the square at a given position if it is occupied by a tile. Otherwise returns Nothing.

emptySquaresFrom :: Board -> Pos -> Int -> Direction -> [Pos] Source #

Finds the empty square positions horizontally or vertically from a given position, skipping any squares that are occupied by a tile

lettersAbove :: Board -> Pos -> Seq (Pos, Square) Source #

All letters immediately above a given square until a non-occupied square

lettersBelow :: Board -> Pos -> Seq (Pos, Square) Source #

All letters immediately below a given square until a non-occupied square

lettersLeft :: Board -> Pos -> Seq (Pos, Square) Source #

All letters immediately left of a given square until a non-occupied square

lettersRight :: Board -> Pos -> Seq (Pos, Square) Source #

All letters immediately right of a given square until a non-occupied square

unoccupiedSquareAt :: Board -> Pos -> Maybe Square Source #

Returns the square at a given position if it is not occupied by a tile. Otherwise returns Nothing.

prettyPrint :: Board -> String Source #

Pretty prints a board to a human readable string representation. Helpful for development.

Orphan instances

Show Board Source # 
Instance details

Methods

showsPrec :: Int -> Board -> ShowS #

show :: Board -> String #

showList :: [Board] -> ShowS #