Chess::Game::MoveListEntry - a read-only class containing move data, used by Chess::Game::MoveList to record a game.
$entry = Chess::Game::MoveListEntry->new(1, $pawn, "e2", "e4", 0); $one = $entry->get_move_num(); $pawn = $entry->get_piece(); $e2 = $entry->get_start_square(); $e4 = $entry->get_dest_square(); $false = $entry->is_capture(); $false = $entry->is_short_castle(); $false = $entry->is_long_castle(); $false = $entry->is_en_passant();
The Chess module provides a framework for writing chess programs with Perl. This class forms part of that framework, containing object data about a single move.
Constructs a new MoveListEntry with the provided parameters. Requires four scalar parameters containing move number, piece, start square and destination square. Optionally takes a fifth parameter containing flags for the entry. The following flags are recognized (but there are no exported constants for them):
MOVE_CAPTURE == 0x01 MOVE_CASTLE_SHORT == 0x02 MOVE_CASTLE_LONG == 0x04 MOVE_EN_PASSANT == 0x08 $entry = Chess::Game::MoveListEntry->new(1, $pawn, "e2", "e4", 0);
There are no class methods for this class.
Takes no parameters. Returns the move number this entry was constructed with.
Takes no parameters. Returns the piece reference this entry was constructed with.
Takes no parameters. Returns the start square this entry was constructed with.
Takes no parameters. Returns the destination square this entry was constructed with.
Takes no parameters. Returns true if the entry was recorded as a capture
Takes no parameters. Returns true if the entry was recorded as a short (kingside) castle.
Takes no parameters. Returns true if the entry was recorded as a long (queenside) castle.
Takes no parameters. Returns true if the entry was recorded as an 'en passant' capture. "is_capture()" will also return true in this case.
The program uses a reference to a MoveListEntry that was not obtained by calling "new()". Ensure that all MoveListEntries in the program were obtained either in this fashion, or through the container class, Chess::Game::MoveList, and that the reference refers to a defined value.
Please report any bugs to the author.
Brian Richardson <bjr@cpan.org>
Copyright (c) 2002, 2005 Brian Richardson. All rights reserved. This module is Free Software. It may be modified and redistributed under the same terms as Perl itself.
6 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head2'
You forgot a '=back' before '=head1'
To install Chess, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Chess
CPAN shell
perl -MCPAN -e shell install Chess
For more information on module installation, please visit the detailed CPAN module installation guide.