| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
BishBosh.StateProperty.Mutator
Contents
Description
AUTHOR- Dr. Alistair Ward
DESCRIPTION- Permits a board to be mutated.
Synopsis
- class Mutator mutator where
- defineCoordinates :: Maybe Piece -> Coordinates -> mutator -> mutator
- movePiece :: Move -> MoveType -> Piece -> mutator -> mutator
- placePiece :: Mutator mutator => Piece -> Coordinates -> mutator -> mutator
- placeFirstPiece :: (Empty mutator, Mutator mutator) => Piece -> Coordinates -> mutator
- placeAllPieces :: (Empty mutator, Mutator mutator) => [(Piece, Coordinates)] -> mutator
- removePiece :: Mutator mutator => Coordinates -> mutator -> mutator
Type-classes
class Mutator mutator where Source #
- An interface which may be implemented by data which can mutate the board.
- CAVEAT: doesn't validate requests, so
Kings can be placed in check &Pawns can be placed behind their starting rank or unpromoted on their last rank.
Methods
Arguments
| :: Maybe Piece | The optional piece to place (or remove if |
| -> Coordinates | The coordinates to define. |
| -> mutator | |
| -> mutator |
- 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: this function isn't called during normal play.
Arguments
| :: Move | |
| -> MoveType | |
| -> Piece | The piece which moved, rather than the (ptentially promoted) one that arrived. |
| -> mutator | |
| -> mutator |
Move the specified piece, accounting for promotions & casualties.
Instances
Functions
Mutators
placePiece :: Mutator mutator => Piece -> Coordinates -> mutator -> mutator Source #
- Place a piece at the specified coordinates.
- CAVEAT: any piece previously at the specified coordinates will be obliterated.
placeFirstPiece :: (Empty mutator, Mutator mutator) => Piece -> Coordinates -> mutator Source #
Place the first piece.
placeAllPieces :: (Empty mutator, Mutator mutator) => [(Piece, Coordinates)] -> mutator Source #
Place pieces from scratch.
removePiece :: Mutator mutator => Coordinates -> mutator -> mutator Source #
Remove a piece from the board.