Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
The main move validation module. FEN parsing code is in Chess.FEN and PGN parsing is in Chess.PGN
- data MoveError
- data Color
- data PieceType
- data Piece = Piece {}
- data Board = Board {}
- strToPos :: String -> (Int, Int)
- pieceAt :: Int -> Int -> Board -> Maybe Piece
- pieceAtStr :: String -> Board -> Maybe Piece
- move :: [Char] -> Board -> Either MoveError Board
- moveSAN :: [Char] -> Board -> Either MoveError Board
- check :: Color -> Board -> Bool
- mate :: Color -> Board -> Bool
- stalemate :: Color -> Board -> Bool
Documentation
WrongTurn | It's not your turn |
NoPiece | There is no piece at the "from" position |
IsCheck | Your king is checked and this move doesn't solve that |
CausesCheck | After this move your king would be checked |
InvalidMove | This is not how that piece works |
OverPiece | You cannot move over other pieces |
CapturesOwn | This move captures one of your own pieces |
NoParse | I don't understand what you mean |
pieceAt :: Int -> Int -> Board -> Maybe Piece Source
Like pieceAtStr
, but with coordinates instead of a string
pieceAtStr :: String -> Board -> Maybe Piece Source
What piece is currently at this position on the board?
move :: [Char] -> Board -> Either MoveError Board Source
Perform a move on the board in coordinate notation like "e2e4", returning either the new board or an error