Chess::Game::MoveListEntry - a read-only class containing move data, used by


Chess documentation  | view source Contained in the Chess distribution.

Index


NAME

Top

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

SYNOPSIS

Top

$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

Top

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

Top

Construction

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

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.

DIAGNOSTICS

Top

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

Top

Please report any bugs to the author.

AUTHOR

Top

Brian Richardson <bjr@cpan.org>

COPYRIGHT

Top


Chess documentation  | view source Contained in the Chess distribution.