chessica-0.1.0.0: A Library for Chess Game Logic
Copyright(c) Michael Szvetits 2023
LicenseBSD-3-Clause (see the file LICENSE)
Maintainertypedbyte@qualified.name
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageGHC2021

Chess.Game.Command

Description

Types and functions for commands that can change chess game states.

Synopsis

Documentation

data Command Source #

A command can be applied to a chess game state in order to obtain a new game state.

Constructors

EndTurn

Ends the turn of the active player.

Move Position (Some PlacedPiece)

Moves a placed piece to the specified position.

Destroy (Some PlacedPiece)

Removes a placed piece.

Spawn Position (Some Piece)

Creates a chess piece on the specified position.

Promote (Some PlacedPiece) (Some Piece)

Converts a chess piece into another piece.

Sequence Command Command

Represents the consecutive execution of two commands.

Atomic Command

Denotes that a command and its sub-commands belong together and should be treated as single command (e.g., when recording the history of a chess game).

Instances

Instances details
IsList Command Source # 
Instance details

Defined in Chess.Game.Command

Associated Types

type Item Command #

Show Command Source # 
Instance details

Defined in Chess.Game.Command

Eq Command Source # 
Instance details

Defined in Chess.Game.Command

Methods

(==) :: Command -> Command -> Bool #

(/=) :: Command -> Command -> Bool #

Ord Command Source # 
Instance details

Defined in Chess.Game.Command

type Item Command Source # 
Instance details

Defined in Chess.Game.Command

endTurn :: Command Source #

Smart constructor for EndTurn.

move :: Position -> PlacedPiece t -> Command Source #

Smart constructor for Move.

destroy :: PlacedPiece t -> Command Source #

Smart constructor for Destroy.

spawn :: Position -> Piece t -> Command Source #

Smart constructor for Spawn.

promote :: PlacedPiece a -> Piece b -> Command Source #

Smart constructor for Promote.

sequence :: Command -> Command -> Command Source #

Smart constructor for Sequence.

atomic :: Command -> Command Source #

Smart constructor for Atomic.

undo :: Command -> Command Source #

Produces a command that has the opposite effect of the specified command.