module Chess (
Chess.Internal.Board.Board,
Chess.Internal.Board.Coordinates,
Chess.Internal.Board.Square(..),
Chess.Internal.Move.GameState,
Chess.Internal.Move.currentPlayer,
Chess.Internal.Piece.Color(..),
Chess.Internal.Piece.Piece(..),
Chess.Internal.Piece.PieceType(..),
board,
fullMoveNumber,
isCheckmate,
isDraw,
isLegalMove,
isStalemate,
move,
newGame,
pieceAt,
winner,
) where
import Chess.Internal.Board
import Chess.Internal.Move
import Chess.Internal.Piece
import qualified Chess.Internal.Game as G
import qualified Chess.Internal.Notation as N
isCheckmate :: GameState -> Bool
isCheckmate = G.isCheckmate
isStalemate :: GameState -> Bool
isStalemate = G.isStalemate
isDraw :: GameState -> Bool
isDraw = G.isDraw
winner :: GameState -> Maybe Color
winner = G.getWinner
isLegalMove :: GameState
-> String
-> Bool
isLegalMove game moveStr = case N.parseMove game moveStr of
Just m -> m `elem` generateAllMoves game
Nothing -> False
move :: GameState
-> String
-> Maybe GameState
move game moveStr = do m <- N.parseMove game moveStr
case G.applyMove game m of
Left _ -> Nothing
Right game' -> Just game'
board :: GameState -> Board
board = stateBoard
newGame :: GameState
newGame = initialState
pieceAt :: Board
-> String
-> Maybe Piece
pieceAt b coordinateStr = do coords <- parseCoordinate coordinateStr
getPiece b coords
fullMoveNumber :: GameState -> Integer
fullMoveNumber = moveNumber