Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Board
- emptyBoard :: Board
- allSquares :: Board -> [(Pos, Square)]
- placeTile :: Board -> Tile -> Pos -> Maybe Board
- occupiedSquareAt :: Board -> Pos -> Maybe Square
- emptySquaresFrom :: Board -> Pos -> Int -> Direction -> [Pos]
- lettersAbove :: Board -> Pos -> Seq (Pos, Square)
- lettersBelow :: Board -> Pos -> Seq (Pos, Square)
- lettersLeft :: Board -> Pos -> Seq (Pos, Square)
- lettersRight :: Board -> Pos -> Seq (Pos, Square)
- unoccupiedSquareAt :: Board -> Pos -> Maybe Square
- prettyPrint :: Board -> String
Documentation
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.