NAME

Term::Chess::Watcher - stops a Plisco search at a node budget

VERSION

Version 0.03

SYNOPSIS

my $tree = Chess::Plisco::Engine::Tree->new(
    watcher => Term::Chess::Watcher->new(40_000), ...);

DESCRIPTION

Chess::Plisco::Engine::Tree asks its watcher to check every few thousand nodes, which in the UCI engine reads standard input for a stop. Setting max_nodes on the tree does not end a search in Plisco v1.0.3: it only recalibrates when the clock is checked and never aborts, so the deepening runs on to the ply limit. This watcher is the budget: once the tree's node count reaches it, it asks for the stop the way a UCI stop would, and the tree returns the best line it has. A search bounded this way is a property of the position and never of the clock.

METHODS

new

Term::Chess::Watcher->new($nodes);

budget

The node count it stops at.

check

$watcher->check($tree);

Requests a stop once $tree->{nodes} has reached the budget.