chessIO-0.3.1.1: Basic chess library

Safe HaskellNone
LanguageHaskell2010

Game.Chess.UCI

Contents

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
Eq Option Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

Show Option Source # 
Instance details

Defined in Game.Chess.UCI

IsString Option Source # 
Instance details

Defined in Game.Chess.UCI

Methods

fromString :: String -> Option #

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 Source #

Arguments

:: MonadIO m 
=> Engine 
-> Position 
-> m (Position, [Ply])

the game previously in progress

Set the starting position of the current game, also clearing any pre-existing history.

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.

The Info data type

data Info Source #

Instances
Eq Info Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

Show Info Source # 
Instance details

Defined in Game.Chess.UCI

Methods

showsPrec :: Int -> Info -> ShowS #

show :: Info -> String #

showList :: [Info] -> ShowS #

data Score Source #

Constructors

CentiPawns Int 
MateIn Int 
Instances
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 #

Show Score Source # 
Instance details

Defined in Game.Chess.UCI

Methods

showsPrec :: Int -> Score -> ShowS #

show :: Score -> String #

showList :: [Score] -> ShowS #

data Bounds Source #

Constructors

UpperBound 
LowerBound 
Instances
Eq Bounds Source # 
Instance details

Defined in Game.Chess.UCI

Methods

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

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

Show Bounds Source # 
Instance details

Defined in Game.Chess.UCI

Searching

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

Instruct the engine to begin searching.

data SearchParam Source #

Instances
Eq SearchParam Source # 
Instance details

Defined in Game.Chess.UCI

Show SearchParam Source # 
Instance details

Defined in Game.Chess.UCI

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

Stop a search in progress.

Quitting

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

Quit the engine.