NAME

Game::Xiangqi::Bot - the opponent, bounded in nodes

SYNOPSIS

my $iccs = Game::Xiangqi::Bot->choose($game, 'p2');
my $help = Game::Xiangqi::Bot->hint($game, 'p1');

DESCRIPTION

A budget in NODES and never in seconds, so a loaded machine chooses the same move as an idle one and a bot game replays. The rung is drawn from the game's seed, one per game, from @LADDER, which is written weakest first.

hint always answers at the top budget whatever the game drew.

The ladder, measured

A rung is a node budget and not a 1, 2, 3, because a budget is what this engine's dial actually is, and @LADDER is written weakest first because hint reaches for the last entry.

The spacing was measured over sixty games a pair with the colours alternated, against a 60% bar written down before the run: rung 40000 beat rung 8000 by 69.2%, while rung 8000 beat rung 1500 by only 56.7%. Those two steps are one ply each, and the plies are not worth the same: depth 2 already sees a capture and its reply, so the step to depth 3 buys a quieter move where the step to depth 4 buys an exchange. The bottom rung was therefore dropped to depth 1, which is also what makes it beatable by a person.

The re-spaced ladder has not itself been played. Until it has, this section describes the measurement the current spacing was derived from and not a measurement of the current spacing.

The seat is in the tie-break

Equal-scoring root moves are separated by a seed mixed from the game's seed and the seat. Without the seat both bots in a bot-versus-bot game are the same player, and a soak of them measures nothing at all.

METHODS

choose

my $iccs = Game::Xiangqi::Bot->choose($game, 'p2');

The move this seat should play, in ICCS, or undef if the game is over or it is not that seat's turn. The rung is drawn from the game's seed, so one game plays one opponent throughout and a replay reaches the same moves.

hint

my $iccs = Game::Xiangqi::Bot->hint($game, 'p1');

The same, always at the top budget whatever rung this game drew. Somebody asking for help is not asking for a beginner's answer.

level_for

my $budget = Game::Xiangqi::Bot->level_for($seed);

The node budget this seed draws from @LADDER. Returns $LEVEL instead when that is set, which is how a test or a deployment pins every game to one rung.

tiebreak_seed

my $n = Game::Xiangqi::Bot->tiebreak_seed($seed, $seat);

The number handed to the search to separate equal-scoring moves, mixed from the game's seed and the seat. Two seats of one game get two different numbers, which is the whole point: without it both bots in a bot-versus-bot game are the same player and a soak measures nothing.