The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chess::Game::MoveListEntry - a read-only class containing move data, used by Chess::Game::MoveList to record a game.

SYNOPSIS

$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();

DESCRIPTION

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.

METHODS

Construction

new()

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);

Class methods

There are no class methods for this class.

Object methods

get_move_num()

Takes no parameters. Returns the move number this entry was constructed with.

get_piece()

Takes no parameters. Returns the piece reference this entry was constructed with.

get_start_square()

Takes no parameters. Returns the start square this entry was constructed with.

get_dest_square()

Takes no parameters. Returns the destination square this entry was constructed with.

is_capture()

Takes no parameters. Returns true if the entry was recorded as a capture

is_short_castle()

Takes no parameters. Returns true if the entry was recorded as a short (kingside) castle.

is_long_castle()

Takes no parameters. Returns true if the entry was recorded as a long (queenside) castle.

is_en_passant()

Takes no parameters. Returns true if the entry was recorded as an 'en passant' capture. "is_capture()" will also return true in this case.

DIAGNOSTICS

Invalid Chess::Game::MoveListEntry reference

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.

BUGS

Please report any bugs to the author.

AUTHOR

Brian Richardson <bjr@cpan.org>

COPYRIGHT

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:

Around line 28:

'=item' outside of any '=over'

Around line 43:

You forgot a '=back' before '=head2'

Around line 49:

'=item' outside of any '=over'

Around line 86:

You forgot a '=back' before '=head1'

Around line 88:

'=item' outside of any '=over'

Around line 95:

You forgot a '=back' before '=head1'