Chess
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Chess/Board.pm view on Meta::CPAN
Takes a single scalar parameter containing the square to calculate distance
from. Returns the horizontal distance in squares between the two points.
=item vert_distance()
Takes a single scalar parameter containing the square to calculate distance
from. Returns the vertical distance in squares between the two points.
=item squares_in_line()
Takes two scalar parameters containing two distinct endpoints in a line.
Returns a list of scalars in lower-case with an entry for each square in that
line, or C<undef> if the two endpoints do not define a line. In the case where
both squares are the same, will return a list containing that square.
=back
=head2 Object methods
=over 4
=item clone()
Takes no arguments. Returns a blessed Chess::Board object reference which is
identical to the caller object. However, it is a I<deep copy> which allows
the clone()'d object to be manipulated separately of the caller object.
=item line_is_open()
Takes two scalar arguments, valid squares defining the endpoints of a line
on the Chess::Board. Returns true if there are no pieces on either of the
endpoints, or on any of the intervening squares. Returns false if the line
is blocked by one or more pieces, and C<undef> if the two squares do not
define endpoints of a line. In the case where both squares are equal, will
return true if the square is empty and false otherwise.
=item get_piece_at()
Takes a single scalar argument containing the square to retrieve the piece
from. Returns a scalar representing the piece on that square, or C<undef> if
there is none. Returns C<undef> and prints a warning to STDERR (See
L</"DIAGNOSTICS">) if the provided square is not valid.
=item set_piece_at()
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.221 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )