| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Game.Chess.UCI
Contents
Synopsis
- data UCIException
- data Engine
- name :: Engine -> Maybe ByteString
- author :: Engine -> Maybe ByteString
- start :: String -> [String] -> IO (Maybe Engine)
- start' :: Int -> (String -> IO ()) -> String -> [String] -> IO (Maybe Engine)
- send :: ByteString -> Engine -> IO ()
- quit :: Engine -> IO (Maybe ExitCode)
- quit' :: Int -> Engine -> IO (Maybe ExitCode)
- data Option
- = CheckBox Bool
- | ComboBox { }
- | SpinButton { }
- | String ByteString
- | Button
- options :: Engine -> HashMap ByteString Option
- getOption :: ByteString -> Engine -> Maybe Option
- setOptionSpinButton :: ByteString -> Int -> Engine -> IO Engine
- currentPosition :: Engine -> IO Position
- setPosition :: Engine -> Position -> IO ()
- addMove :: Engine -> Move -> IO ()
- move :: Engine -> String -> IO ()
- data Info
- readInfo :: Engine -> STM [Info]
- tryReadInfo :: Engine -> STM (Maybe [Info])
- readBestMove :: Engine -> STM (Move, Maybe Move)
- tryReadBestMove :: Engine -> STM (Maybe (Move, Maybe Move))
Exceptions
data UCIException Source #
Constructors
| SANError String | |
| IllegalMove Move |
Instances
| Show UCIException Source # | |
Defined in Game.Chess.UCI Methods showsPrec :: Int -> UCIException -> ShowS # show :: UCIException -> String # showList :: [UCIException] -> ShowS # | |
| Exception UCIException Source # | |
Defined in Game.Chess.UCI Methods toException :: UCIException -> SomeException # fromException :: SomeException -> Maybe UCIException # displayException :: UCIException -> String # | |
The Engine data type
Starting and quitting a UCI engine
start :: String -> [String] -> IO (Maybe Engine) Source #
Start a UCI engine with the given executable name and command line arguments.
start' :: Int -> (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.
send :: ByteString -> Engine -> IO () Source #
Send a command to the engine.
This function is likely going to be removed and replaced by more specific functions in the future.
Engine options
Constructors
| CheckBox Bool | |
| ComboBox | |
Fields | |
| SpinButton | |
Fields | |
| String ByteString | |
| Button | |
setOptionSpinButton :: ByteString -> Int -> Engine -> IO 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
currentPosition :: Engine -> IO Position Source #
Return the final position of the currently active game.
setPosition :: Engine -> Position -> IO () Source #
Set the starting position of the current game, also clearing any pre-existing history.
addMove :: Engine -> Move -> IO () 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.
move :: Engine -> String -> IO () Source #
Add the given move (in algebraic notation) to the current game.