-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Basic chess move generation and UCI client library
--
-- A simple library for generating legal chess moves. Also includes a
-- module for communication with external processes that speak the UCI
-- (Universal Chess Interface) protocol. On top of that, provides a
-- console frontend program (cboard) that can be used to interactively
-- play against UCI engines.
@package chessIO
@version 0.2.0.0
-- | A small collection of data types and functions to represent Chess
-- positions and moves including move generation and parsing from
-- external sources.
--
-- This module does deliberately not implement any search or evaluation
-- functionality. It is intended to be used to lay the ground for
-- communicating with other programs or players, hence the package name
-- chessIO.
module Game.Chess
data Color
White :: Color
Black :: Color
opponent :: Color -> Color
data Sq
A1 :: Sq
B1 :: Sq
C1 :: Sq
D1 :: Sq
E1 :: Sq
F1 :: Sq
G1 :: Sq
H1 :: Sq
A2 :: Sq
B2 :: Sq
C2 :: Sq
D2 :: Sq
E2 :: Sq
F2 :: Sq
G2 :: Sq
H2 :: Sq
A3 :: Sq
B3 :: Sq
C3 :: Sq
D3 :: Sq
E3 :: Sq
F3 :: Sq
G3 :: Sq
H3 :: Sq
A4 :: Sq
B4 :: Sq
C4 :: Sq
D4 :: Sq
E4 :: Sq
F4 :: Sq
G4 :: Sq
H4 :: Sq
A5 :: Sq
B5 :: Sq
C5 :: Sq
D5 :: Sq
E5 :: Sq
F5 :: Sq
G5 :: Sq
H5 :: Sq
A6 :: Sq
B6 :: Sq
C6 :: Sq
D6 :: Sq
E6 :: Sq
F6 :: Sq
G6 :: Sq
H6 :: Sq
A7 :: Sq
B7 :: Sq
C7 :: Sq
D7 :: Sq
E7 :: Sq
F7 :: Sq
G7 :: Sq
H7 :: Sq
A8 :: Sq
B8 :: Sq
C8 :: Sq
D8 :: Sq
E8 :: Sq
F8 :: Sq
G8 :: Sq
H8 :: Sq
isLight :: Sq -> Bool
isDark :: Sq -> Bool
data PieceType
Pawn :: PieceType
Knight :: PieceType
Bishop :: PieceType
Rook :: PieceType
Queen :: PieceType
King :: PieceType
data Position
-- | The starting position as given by the FEN string
-- "rnbqkbnrpppppppp8888PPPPPPPP/RNBQKBNR w KQkq - 0
-- 1".
startpos :: Position
color :: Position -> Color
pieceAt :: Position -> Sq -> Maybe (Color, PieceType)
-- | Returns True if Color is in check in the given position.
inCheck :: Color -> Position -> Bool
-- | Construct a position from Forsyth-Edwards-Notation.
fromFEN :: String -> Maybe Position
-- | Convert a position to Forsyth-Edwards-Notation.
toFEN :: Position -> String
data Move
fromSAN :: Position -> String -> Either String Move
toSAN :: Position -> Move -> String
unsafeToSAN :: Position -> Move -> String
-- | Parse a move in the format used by the Universal Chess Interface
-- protocol.
fromUCI :: Position -> String -> Maybe Move
-- | Convert a move to the format used by the Universal Chess Interface
-- protocol.
toUCI :: Move -> String
-- | Generate a list of possible moves for the given position.
moves :: Position -> [Move]
-- | Apply a move to the given position.
--
-- This function checks if the move is actually legal and throws and
-- error if it isn't. See unsafeApplyMove for a version that omits
-- the legality check.
applyMove :: Position -> Move -> Position
-- | An unsafe version of applyMove. Only use this if you are sure
-- the given move can be applied to the position. This is useful if the
-- move has been generated by the moves function.
unsafeApplyMove :: Position -> Move -> Position
instance GHC.Show.Show Game.Chess.Direction
instance GHC.Classes.Eq Game.Chess.Direction
instance GHC.Classes.Eq Game.Chess.Move
instance GHC.Classes.Eq Game.Chess.Position
instance GHC.Show.Show Game.Chess.BB
instance GHC.Classes.Eq Game.Chess.BB
instance GHC.Show.Show Game.Chess.Castling
instance GHC.Classes.Ord Game.Chess.Castling
instance GHC.Classes.Eq Game.Chess.Castling
instance GHC.Show.Show Game.Chess.Sq
instance GHC.Classes.Eq Game.Chess.Sq
instance GHC.Enum.Enum Game.Chess.Sq
instance GHC.Enum.Bounded Game.Chess.Sq
instance GHC.Show.Show Game.Chess.Piece
instance GHC.Classes.Eq Game.Chess.Piece
instance GHC.Show.Show Game.Chess.Color
instance GHC.Classes.Eq Game.Chess.Color
instance GHC.Show.Show Game.Chess.PieceType
instance GHC.Classes.Eq Game.Chess.PieceType
instance GHC.Show.Show Game.Chess.From
instance GHC.Show.Show Game.Chess.Move
module Game.Chess.UCI
data UCIException
SANError :: String -> UCIException
IllegalMove :: Move -> UCIException
data Engine
name :: Engine -> Maybe ByteString
author :: Engine -> Maybe ByteString
-- | Start a UCI engine with the given executable name and command line
-- arguments.
start :: String -> [String] -> IO (Maybe Engine)
-- | 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.
start' :: Int -> (String -> IO ()) -> String -> [String] -> IO (Maybe Engine)
-- | Send a command to the engine.
--
-- This function is likely going to be removed and replaced by more
-- specific functions in the future.
send :: ByteString -> Engine -> IO ()
-- | Quit the engine.
quit :: Engine -> IO (Maybe ExitCode)
quit' :: Int -> Engine -> IO (Maybe ExitCode)
data Option
CheckBox :: Bool -> Option
ComboBox :: ByteString -> [ByteString] -> Option
[comboBoxValue] :: Option -> ByteString
[comboBoxValues] :: Option -> [ByteString]
SpinButton :: Int -> Option
[spinButtonValue, spinButtonMinBound, spinButtonMaxBound] :: Option -> Int
String :: ByteString -> Option
Button :: Option
options :: Engine -> HashMap ByteString Option
getOption :: ByteString -> Engine -> Maybe Option
-- | Set a spin option to a particular value.
--
-- Bounds are validated. Make sure you don't set a value which is out of
-- range.
setOptionSpinButton :: ByteString -> Int -> Engine -> IO Engine
-- | Return the final position of the currently active game.
currentPosition :: Engine -> IO Position
-- | Set the starting position of the current game, also clearing any
-- pre-existing history.
setPosition :: Engine -> Position -> IO ()
-- | Add a Move to the game history.
--
-- This function checks if the move is actually legal, and throws a
-- UCIException if it isn't.
addMove :: Engine -> Move -> IO ()
-- | Add the given move (in algebraic notation) to the current game.
move :: Engine -> String -> IO ()
data Info
PV :: [Move] -> Info
Depth :: Int -> Info
SelDepth :: Int -> Info
Time :: Int -> Info
MultiPV :: Int -> Info
Score :: Int -> Info
UpperBound :: Info
LowerBound :: Info
Nodes :: Int -> Info
NPS :: Int -> Info
TBHits :: Int -> Info
HashFull :: Int -> Info
CurrMove :: ByteString -> Info
CurrMoveNumber :: Int -> Info
readInfo :: Engine -> STM [Info]
tryReadInfo :: Engine -> STM (Maybe [Info])
readBestMove :: Engine -> STM (Move, Maybe Move)
tryReadBestMove :: Engine -> STM (Maybe (Move, Maybe Move))
instance GHC.Show.Show Game.Chess.UCI.Command
instance GHC.Show.Show Game.Chess.UCI.Option
instance GHC.Classes.Eq Game.Chess.UCI.Option
instance GHC.Show.Show Game.Chess.UCI.Info
instance GHC.Show.Show Game.Chess.UCI.UCIException
instance Data.String.IsString Game.Chess.UCI.Option
instance GHC.Exception.Type.Exception Game.Chess.UCI.UCIException