| Copyright | (c) Michael Szvetits 2023 |
|---|---|
| License | BSD-3-Clause (see the file LICENSE) |
| Maintainer | typedbyte@qualified.name |
| Stability | stable |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Chess.Game
Description
Types and functions to create, manipulate and query chess game states.
Synopsis
- data Game = Game {
- board :: Board
- activePlayer :: Player
- passivePlayer :: Player
- lastUpdate :: Maybe Update
- data Update = Update {}
- execute :: Command -> Game -> Either ChessException Game
- history :: Game -> [Update]
- spawnCommands :: Game -> [Command]
- module Chess.Game.Command
- module Chess.Game.Status
Representing Games
Represents a chess game state.
Constructors
| Game | |
Fields
| |
Represents an update of a chess game state.
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
module Chess.Game.Command
module Chess.Game.Status