bishbosh-0.1.4.0: Plays chess.
Safe HaskellNone
LanguageHaskell2010

BishBosh.StateProperty.Mutator

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Permits a board to be mutated.
Synopsis

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

defineCoordinates Source #

Arguments

:: Maybe Piece

The optional piece to place (or remove if Nothing is specified).

-> 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.

movePiece Source #

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.

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.