Chess-Plisco

 view release on metacpan or  search on metacpan

lib/Chess/Plisco.pod  view on Meta::CPAN

This does the same as the builtin function C<__builtin_ctzll> of the C
compilers llvm and gcc.

=item B<bitboardMoreThanOneSet(BITBOARD)>

Returns a truthy value if more than one bit in B<BITBOARD> is set, false
otherwise.

=back

=head2 Perft Methods

A "perft" (B<PERF>ormance B<T>est) is a standard test for measuring the
performance of the move generator.  Starting from the current position, it
generates all legal moves up to the specified depth.  It is also important for
testing the correct functioning of the move generator because the number of
leave nodes for certain positions are well known.

Internally, each legal move is applied to the position, then the next level
is computed from the resulting position, and finally the move is undone.

=over 4

=item B<perft(DEPTH)>

Does a performance test to depth B<DEPTH>.  Returns the number of leaf nodes
found.

=item B<perftWithOutput(DEPTH, FILEHANDLE)>

Does the the same as B<perft> but prints out all top-level moves found
with the number of subnodes for each move.  The time needed is measured
with L<Time::HiRes/gettimeofday> and reported at the end as well as the
number of nodes found.

This method can be used directly to implement the command "go perft" for a UCI
compatible chess engine.

=back

=head2 Methods for Debugging and Diagnostics

=over 4

=item B<consistent>

Does an extensive consistency check on the position and throws an exception
if any inconsistency is encountered.

=item B<dumpBitboard(BITBOARD)>

Generate a string representation of B<BITBOARD> in ASCII art.

=item B<dumpAll>

Generates a string representation of all bitboards in ASCII art plus some
additional information.

=item B<dumpInfo(INFO)>

Returns a string with the decoded position information as retured by
L</info>.

=item B<movesCoordinateNotation(MOVES)>

Takes an array of moves (as integers) and converts it into an array of moves
in coordinate notation.

=back

=head2 Other Methods

=over 4

=item B<RNG>

Returns a pseudo-random integer created by the well-known xor-shift
pseudo-random number generator.

The random-number generator is always seeded with the same seed (initial value).
This is on purpose, so that the numbers returned are deterministic.  The
method is currently only used for generating the Zobrist keys for position
signatures.

If you want a different seed, you should override the constant
L</CP_RANDOM_SEED>.

=back

=head1 PROPERTIES

You can access individual properties either by using index constants or by
using accessor macros from L<Chess::Plisco::Macro>.  All accessor macros
can be assigned to; they are L-values.  But you are strongly advised
to modify properties of a B<Chess::Plisco> instance only with the methods
documented here.

For getting or setting the bitboard of all white pieces, you have
these options:

    $whites_pieces = $pos->[CP_W_PIECES];
    $white_pieces = cp_w_pieces $pos;
    $white_pieces = cp_w_pieces($pos);
    $pos->[CP_W_PIECES] = $white_pieces;
    cp_w_pieces $pos = $white_pieces;
    cp_w_pieces($pos) = $white_pieces;

The macros (all starting with "cp_") are only available when you have loaded
L<Chess::Plisco::Macro>, see there for more information.

All elements of the position array are documented below under
L</Accessor Indices (:accessors)>.

=head1 EXPORT TAGS

The module exports only constants, all prefixed with "CP_".

Note that (lowercase) macros "cp_" are defined by using
L<Chess::Plisco::Macro>.

=head2 All Constants (:all)



( run in 3.219 seconds using v1.01-cache-2.11-cpan-600a1bdf6e4 )