=for Pod::Coverage empty

=head1 NAME

Chess::Plisco::Engine::TimeControl - Time Management

=head1 SYNOPSIS

    my $tc = Chess::Plisco::Engine::TimeControl->new(
        searchmoves => ['e2e4', 'd2d4', 'f2f4'],
        ponder => 0,
        movestogo => 40,
        mwime => 5 * 60 * 1000,
        btime => 5 * 60 * 1000,
        winc => 1000,
        binc => 1000,
        depth => 5.
        nodes => 1_000_000,
        mate => 5,
        movetime => 1000,
        infinite => 0,
    );

=head1 DESCRIPTION

A B<Chess::Plisco::Engine::TimeControl> processes the parameters for a search and
sets the relevant properties of the L<Chess::Plisco::Engine::Tree>.

=head1 CONSTRUCTOR

The constructor receives the values parsed as options for the "go" command
per the UCI specification.

=over 4

=item B<position>

The current position as a L<Chess::Plisco::Engine::Position> object.

=item B<start_time>

Start time of the current search as an array of seconds and microseconds
since the epoch (as returned by  L<Time::HiRes/gettimeofday>).

=item B<allocated_time>

The maximum time in ms to think about a move.

=item B<nodes_to_tc>

When that many nodes have been searched, the time left should be checked
again.  A negative value means to search infinitely.

=item B<move_now>

If true, the engine's time is used up and it should move as soon as possible.

=back

=head1 COPYRIGHT

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

=head1 SEE ALSO

L<Chess::Plisco::Engine::Position>, perl(1)
