=for Pod::Coverage empty

=head1 NAME

Chess::Opening::Book::Entry - An opening book entry.

=head1 SYNOPSIS

    $book = Chess::Opening::Book::Polyglot->new('opening.bin');
	$entry = $book->lookupFEN($fen) or die "position not found";

	$total = $entry->weights;
	$total = $entry->counts;
	$fen = $entry->fen;
	$moves = $entry->moves;

	$entry->addMove(move => 'g1f3', count => 2304);
    
=head1 DESCRIPTION

An opening book represented by a L<Chess::Opening::Book> consists of a list
of positions represented as B<Chess::Opening::Book::Entry>.  Each entry
is identified by the position as a FEN string (see
L<Chess::Opening/Positions>) and the sum of the weight of all moves.

=head1 METHODS

=over 4

=item B<new FILENAME>

The constructor takes one single argument, the B<FILENAME> of the opening
book on disk.  An exception is thrown if the file cannot be opened.

=item B<lookupFEN FEN>

Returns a L<Chess::Opening::Book::Entry> for B<FEN> or false.
See L<Chess::Opening::Book/lookupFEN> for more information

=item B<moves>

Returns a reference to a hash of L<Chess::Opening::Book::Move> objects for
this position.  The keys are the moves in coordinate notation
(see L<Chess::Opening/Moves>) and the values are the associated objects.

=item B<weights>

Returns the sum of all weights of all moves for this position.  This is
best explained with an example.

Say the opening book contains two continuation moves Nc3 and Bc4 for a
particular position.  The move Nc3 was played successfully 300 times, and
Bc4 was played successfully 100 times.  300 and 100 are the weights or
counts for these move and the method C<count()> for the entry, the position
would then return 400, the sum of the weights of the two moves.  The relative
weights can then be calculated as C<300 / 400 = 0.75> and C<100 / 400 = 0.25>.

=item B<counts>

An alias B<weights()>, see above.

=item B<fen>

Returns the chess position in Forsyth-Edwards Notation FEN, see
L<Chess::Opening/Positions>.

=item B<addMove move =E<gt> MOVE, weight =E<gt> WEIGHT>

Adds a B<MOVE> in coordinate notation with weight B<WEIGHT>.  You can use
the named argument B<count> as an alias for B<weight>.

=back

=head1 COPYRIGHT

Copyright (C) 2019 Guido Flohr <guido.flohr@cantanea.com>,
all rights reserved.

=head1 SEE ALSO

L<Chess::Opening::Book>, L<Chess::Opening::Book::Entry>,
L<Chess::Opening::Book::Move>, perl(1)
