bishbosh-0.1.0.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 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 Kings can be placed in check & Pawns can be placed behind their starting rank or unpromoted on their last rank.
  • CAVEAT: this function isn't called during normal play.

Methods

defineCoordinates Source #

Arguments

:: Maybe Piece

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

-> Coordinates x y

The coordinates to define.

-> mutator x y 
-> mutator x y 

Instances

Instances details
(Enum x, Enum y, Ord x, Ord y) => Mutator MaybePieceByCoordinates x y Source # 
Instance details

Defined in BishBosh.State.MaybePieceByCoordinates

(Enum x, Enum y, Ord x, Ord y) => Mutator Board x y Source # 
Instance details

Defined in BishBosh.State.Board

Methods

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.