NAME

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

SYNOPSIS

my $usi  = Game::Shogi::Bot->choose($game, 'w', seed => $seed);
my $help = Game::Shogi::Bot->hint($game, 'b');
$game->declare if Game::Shogi::Bot->declares($game, 'w');

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, written weakest first.

The ladder, measured

See plan_game_shogi/08-the-search-and-the-ladder.md, which records each rung against the one below, with the date and the number of games.

The seat is in the tie-break

Equal-scoring moves are separated by a seed mixed from the game's seed and the side. Without the side both bots of one game are the same player, and a game between them measures nothing.

VARIABLES

@LADDER

The node budgets, weakest first.

$LEVEL

When set, every game plays this budget.

METHODS

choose

my $usi = Game::Shogi::Bot->choose($game, 'w', seed => $seed, nodes => $n);

The move this side should play, as USI, or undef when the game is over or it is not this side's turn. The budget is nodes when given, else the rung the seed draws.

declares

True when it is this side's turn and it may declare the impasse, which wins. A bot that may declares.

hint

The same as "choose", always at the top budget. Somebody asking for help is not asking for a beginner's answer.

level_for

Game::Shogi::Bot->level_for($seed)

The node budget this seed draws from @LADDER, or $LEVEL when that is set.

tiebreak_seed

Game::Shogi::Bot->tiebreak_seed($seed, $side)

The number handed to the search to separate equal-scoring moves, mixed from the game's seed and the side.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)