chessIO-0.9.3.1: Basic chess library
Copyright(c) Mario Lang 2021
LicenseBSD3
Maintainermlang@blind.guru
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Game.Chess.UCI

Description

The Universal Chess Interface (UCI) is a protocol for communicating with external Chess engines.

Synopsis

Exceptions

The Engine data type

Starting a UCI engine

start :: String -> [String] -> IO (Maybe Engine) Source #

Start a UCI engine with the given executable name and command line arguments.

start' :: KnownDivRat unit Microsecond => Time unit -> (String -> IO ()) -> String -> [String] -> IO (Maybe Engine) Source #

Start a UCI engine with the given timeout for initialisation.

If the engine takes more then the given microseconds to answer to the initialisation request, Nothing is returned and the external process will be terminated.

Engine options

data Option Source #

Instances

Instances details
IsString Option Source # 
Instance details

Defined in Game.Chess.UCI

Methods

fromString :: String -> Option #

Show Option Source # 
Instance details

Defined in Game.Chess.UCI

Eq Option Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

setOptionSpinButton :: MonadIO m => ByteString -> Int -> Engine -> m Engine Source #

Set a spin option to a particular value.

Bounds are validated. Make sure you don't set a value which is out of range.

Manipulating the current game information

isready :: Engine -> IO () Source #

Wait until the engine is ready to take more commands.

currentPosition :: MonadIO m => Engine -> m Position Source #

Return the final position of the currently active game.

setPosition :: (Foldable f, MonadIO m) => Engine -> Position -> f Ply -> m () Source #

Set the starting position and plies of the current game.

addPly :: MonadIO m => Engine -> Ply -> m () Source #

Add a Move to the game history.

This function checks if the move is actually legal, and throws a UCIException if it isn't.

replacePly :: MonadIO m => Engine -> Ply -> m () Source #

The Info data type

data Info Source #

Instances

Instances details
Show Info Source # 
Instance details

Defined in Game.Chess.UCI

Methods

showsPrec :: Int -> Info -> ShowS #

show :: Info -> String #

showList :: [Info] -> ShowS #

Eq Info Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

data Score Source #

Constructors

CentiPawns Int 
MateIn Int 

Instances

Instances details
Show Score Source # 
Instance details

Defined in Game.Chess.UCI

Methods

showsPrec :: Int -> Score -> ShowS #

show :: Score -> String #

showList :: [Score] -> ShowS #

Eq Score Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

Ord Score Source # 
Instance details

Defined in Game.Chess.UCI

Methods

compare :: Score -> Score -> Ordering #

(<) :: Score -> Score -> Bool #

(<=) :: Score -> Score -> Bool #

(>) :: Score -> Score -> Bool #

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

max :: Score -> Score -> Score #

min :: Score -> Score -> Score #

data Bounds Source #

Constructors

UpperBound 
LowerBound 

Instances

Instances details
Show Bounds Source # 
Instance details

Defined in Game.Chess.UCI

Eq Bounds Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

Searching

search :: MonadIO m => Engine -> [SearchParam] -> m (TChan BestMove, TChan [Info]) Source #

Instruct the engine to begin searching.

data SearchParam Source #

Instances

Instances details
Show SearchParam Source # 
Instance details

Defined in Game.Chess.UCI

Eq SearchParam Source # 
Instance details

Defined in Game.Chess.UCI

ponderhit :: MonadIO m => Engine -> m () Source #

Switch a ponder search to normal search when the pondered move was played.

stop :: MonadIO m => Engine -> m () Source #

Stop a search in progress.

Quitting

quit :: MonadIO m => Engine -> m (Maybe ExitCode) Source #

Quit the engine.