Meta
view release on metacpan or search on metacpan
Meta/Chess/Move.pm view on Meta::CPAN
use Meta::Development::Assert qw();
our($VERSION,@ISA);
$VERSION="0.18";
@ISA=qw();
#sub new($);
#sub set($$$);
#sub get_from($);
#sub get_to($);
#sub set_coronation($$);
#sub get_coronation($);
#sub set_coronation_piece($$);
#sub get_coronation_piece($);
#sub set_small_castle($$);
#sub get_small_castle($);
#sub set_large_castle($$);
#sub get_large_castle($);
#sub print($$);
#sub TEST($);
#__DATA__
sub new($) {
Meta/Chess/Move.pm view on Meta::CPAN
sub get_from($) {
my($self)=@_;
return($self->{FROM});
}
sub get_to($) {
my($self)=@_;
return($self->{TO});
}
sub set_coronation($$) {
my($self,$val)=@_;
Meta::Development::Assert::assert_true($self->get_to()->get_y() eq "7" || $self->get_to()->get_y() eq "0","problem with coronation");
$self->{CORONATION}=$val;
}
sub get_coronation($) {
my($self)=@_;
return($self->{CORONATION});
}
sub set_coronation_piece($$) {
my($self,$piece)=@_;
Meta::Development::Assert::assert_true($self->get_coronation(),"cannot set coronation piece with no coronation");
$self->{CORONATION_PIECE}=$piece;
}
sub get_coronation_piece($) {
my($self)=@_;
return($self->{CORONATION_PIECE});
}
sub set_small_castle($$) {
my($self,$val)=@_;
$self->{SMALL_CASTLE}=$val;
}
sub get_small_castle($) {
Meta/Chess/Move.pm view on Meta::CPAN
my($self,$file)=@_;
if($self->get_small_castle()) {
print $file "0-0";
return;
}
if($self->get_large_castle()) {
print $file "0-0-0";
return;
}
$self->get_to()->print($file);
if($self->get_coronation()) {
print $file "=".Meta::Chess::Piece::get_shortcut($self->get_coronation_piece());
}
}
sub TEST($) {
my($context)=@_;
return(1);
}
1;
Meta/Chess/Move.pm view on Meta::CPAN
This object is a chess move. It has the piece doing the move and the parameters
of the move.
=head1 FUNCTIONS
new($)
set($$$)
get_from($)
get_to($)
set_coronation($$)
get_coronation($)
set_coronation_piece($$)
get_coronation_piece($)
set_small_castle($$)
get_small_castle($)
set_large_castle($$)
get_large_castle($)
print($$)
TEST($)
=head1 FUNCTION DOCUMENTATION
=over 4
Meta/Chess/Move.pm view on Meta::CPAN
This sets all the moves parameters.
=item B<get_from($)>
This will give you the position from which the move starts.
=item B<get_to($)>
This will give you the position at which the move ends.
=item B<set_coronation($$)>
This sets the moves coronation parameter.
=item B<get_coronation($)>
This will let you have the information if were talking about coronation.
=item B<set_coronation_piece($$)>
This will set the piece that the coronation produces.
=item B<get_coronation_piece($)>
This will give you the piece that the coronation produces.
=item B<set_small_castle($$)>
This will set the small castle parameter.
=item B<get_small_castle($)>
This will give you the small castle parameter.
=item B<set_large_castle($$)>
( run in 0.272 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )