Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Permits a board to be mutated.
Synopsis
- class Mutator mutator x y where
- defineCoordinates :: Maybe Piece -> Coordinates x y -> mutator x y -> mutator x y
- placePiece :: Mutator mutator x y => Piece -> Coordinates x y -> mutator x y -> mutator x y
- placeFirstPiece :: (Empty (mutator x y), Mutator mutator x y) => Piece -> Coordinates x y -> mutator x y
- placeAllPieces :: (Empty (mutator x y), Mutator mutator x y) => [(Piece, Coordinates x y)] -> mutator x y
- removePiece :: Mutator mutator x y => Coordinates x y -> mutator x y -> mutator x y
Type-classes
class Mutator mutator x y where Source #
- Defines the specified coordinates, by either placing or removing a piece.
- CAVEAT: this function should only be used to construct custom scenarios, since pieces don't normally spring into existence.
- CAVEAT: doesn't validate the request, so
King
s can be placed in check &Pawn
s can be placed behind their starting rank or unpromoted on their last rank. - CAVEAT: this function isn't called during normal play.
:: Maybe Piece | The optional piece to place (or remove if |
-> Coordinates x y | The coordinates to define. |
-> mutator x y | |
-> mutator x y |
Instances
(Enum x, Enum y, Ord x, Ord y) => Mutator MaybePieceByCoordinates x y Source # | |
Defined in BishBosh.State.MaybePieceByCoordinates defineCoordinates :: Maybe Piece -> Coordinates x y -> MaybePieceByCoordinates x y -> MaybePieceByCoordinates x y Source # | |
(Enum x, Enum y, Ord x, Ord y) => Mutator Board x y Source # | |
Defined in BishBosh.State.Board defineCoordinates :: Maybe Piece -> Coordinates x y -> Board x y -> Board x y Source # |
Functions
Mutators
placePiece :: Mutator mutator x y => Piece -> Coordinates x y -> mutator x y -> mutator x y Source #
- Place a piece at the specified coordinates.
- CAVEAT: any piece previously at the specified coordinates will be obliterated.
placeFirstPiece :: (Empty (mutator x y), Mutator mutator x y) => Piece -> Coordinates x y -> mutator x y Source #
Place the first piece.
placeAllPieces :: (Empty (mutator x y), Mutator mutator x y) => [(Piece, Coordinates x y)] -> mutator x y Source #
Place pieces from scratch.
removePiece :: Mutator mutator x y => Coordinates x y -> mutator x y -> mutator x y Source #
Remove a piece from the board.