NAME
Board - Chess board class
SYNOPSIS
use Board;
my $board = Board->fromFen($fen);
print $board->ascii();
DESCRIPTION
Board provides Board objects.
METHODS
fromFen($fen)
Constructor. Create a Board from a FEN string (Forsyth–Edwards Notation). If the input $fen is empty, use the conventional start position.
empty()
Constructor. Create an empty Board.
fen()
Get the FEN for this board position.
errors()
Return undef if position is valid. Otherwise, a string describing the error.
ascii()
Write the board as ASCII.
legal_moves_iter()
Get an iterator over the legal moves from this position.
legal_moves()
Get legal moves from this position.
push_move($move)
Update with the given *move* and push it to the move Moves are not checked for legality. It is the caller's responsibility to ensure that the move is at least pseudo-legal or a null move. Null moves just increment the move counters, switch turns and forfeit en passant capturing.
pop_move()
Restore previous position and return last move from stack. If move stack is empty, no-op and return undef.
piece_at($square)
Get the piece at given square.
remove_piece_at($square)
Remove the piece at given square. If square is empty, does nothing.
set_piece_at($square, $piece)
Put given piece/pawn on given square. Any existing piece/pawn on that square is removed.
kingside_castling_right($side)
Is kingside castling allowed for the given side?
$side = 'w' or 'b'
queenside_castling_right($side)
Is queenside castling allowed for the given side?
$side = 'w' or 'b'
ep_square()
En passant capture square, or undef if N/A
fullmove_number()
Counts move pairs. Starts at 1, increments after every Black move.
halfmove_clock()
Number of ply since last capture or pawn move.
AUTHOR
Ejner Borgbjerg
LICENSE
Perl Artistic License, GPL