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

Description

Types and functions to create, manipulate and query chess game states.

Synopsis

Representing Games

data Game Source #

Represents a chess game state.

Constructors

Game 

Fields

data Update Source #

Represents an update of a chess game state.

Constructors

Update 

Fields

  • game :: Game

    Represents the chess game state before or after executing the corresponding command, depending on the context.

  • command :: Command

    Represents the command that is involved in the game state update.

Manipulating Games

execute :: Command -> Game -> Either ChessException Game Source #

Executes a command on a game state in order to obtain a new game state.

Querying Games

history :: Game -> [Update] Source #

Gets the history of updates that led to the specified game state. The most recent update is at the head of the list.

spawnCommands :: Game -> [Command] Source #

Gets a list of Spawn commands which can be used to reconstruct the board of the specified game state.

Re-exports