This module defines the Position
data type, which is used to model
chess positions.
Internal.Position
Type representing a chess position.
initial : Position
The standard starting position.
sideToMove : Position -> PieceColor
The current side to move.
pieceOn : Square -> Position -> Maybe Piece
The piece on the given square, or Nothing
if the square is empty.
colorOn : Square -> Position -> Maybe PieceColor
The color of the piece on the given square, or Nothing
if the square is
empty.
isEmpty : Square -> Position -> Basics.Bool
Tests whether the given square on the board is empty.
epSquare : Position -> Maybe Square
The en passant square, or Nothing
if no en passant capture is possible.
moveNumber : Position -> Basics.Int
Current move number in the game.
sideAttacksSquare : PieceColor -> Square -> Position -> Basics.Bool
Tests whether the given side attacks the given square.
isCheck : Position -> Basics.Bool
Tests whether the side to move is in check.
isCheckmate : Position -> Basics.Bool
Tests whether the side to move is checkmated.
moves : Position -> List Move
A list of all legal moves.
movesFrom : Square -> Position -> List Move
A list of all legal moves from the given square.
doMove : Move -> Position -> Position
Do a move on the board, returning the resulting position.
fromFen : String -> Maybe Position
Tries to initialize a position from a FEN string. Returns Nothing
on
failure.
toFen : Position -> String
Converts a position to a String
in FEN notation.
toUci : Position -> String
Converts a position to UCI notation, for sending it to a chess engine with
a position fen <fen> moves ...
command.