NAME
Game::Sternhalma::Bot - players for a game of sternhalma, from weakest to strongest
SYNOPSIS
use Game::Sternhalma;
use Game::Sternhalma::Bot;
my $game = Game::Sternhalma->new(seats => 3);
until ($game->over) {
my $move = Game::Sternhalma::Bot->choose($game, rung => 1, seed => 7);
$game->play($move);
last if $game->ply >= 9;
}
DESCRIPTION
Four rungs, weakest first. Rung 0 picks at random among the moves that take a piece nearer home. Rung 1 takes the move that leaves it best placed against its nearest rival, one ply ahead. Rungs 2 and 3 search ahead, for a budget of positions looked at, never of seconds, so the same rung plays the same move on any machine. The same game, rung and seed always give the same move. A searching rung never puts its pieces back into an arrangement they have already had while it has another move: without that, searching seats can shuffle pieces inside their homes for ever, each waiting for another to make a ladder.
METHODS
choose
my $move = Game::Sternhalma::Bot->choose($game, rung => 3, seed => 7);
A move for the seat to move, as "play" in Game::Sternhalma takes it: { kind => 'move', from, to } or { kind => 'pass' }. undef once the game is over. $game is a Game::Sternhalma, whose history the bot reads, or a Game::Sternhalma::Engine, with history => [ keys ], the "own_key" in Game::Sternhalma::Engines the seat to move has had, if it has one. The rung defaults to the strongest.
think
The same, with what the choice cost: from, to, pass, nodes, depth, score and rung.
rungs
The rungs there are, weakest first.
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)