NAME
Game::Senet::Bot - an opponent for Senet, in levels
VERSION
Version 0.02
SYNOPSIS
use Game::Senet;
use Game::Senet::Bot;
my $game = Game::Senet->new(seed => 'any bytes at all');
my $bot = Game::Senet::Bot->new(level => 3);
$game->play($bot->choose($game)) until $game->is_over;
my @levels = Game::Senet::Bot->levels('skyruk');
DESCRIPTION
A player that chooses a move for whichever side is to throw. Level 1 is a rule of thumb that looks no further than the throw in hand; the levels above it search through the sticks, expecting each throw at its chance, a number of throws deep. Each level is the strongest the measurements could tell apart from the one below it, under that rule set; the ladder is a rule set's, and the two named sets may have different numbers of levels.
Nothing here reads a clock: a search is bounded in nodes, so the same game and level give the same move every time.
CONSTRUCTOR
new
my $bot = Game::Senet::Bot->new(level => $n);
my $bot = Game::Senet::Bot->new(level => $n, budget => $nodes);
level is a whole number from 1; whether a game's rule set has that many levels is asked when the bot plays it. budget is a ceiling on the nodes one search may visit, far above what any level needs.
METHODS
choose
my $move = $bot->choose($game);
One of $game->legal, the Game::Senet::Move itself, or undef when the game is over. Croaks when the game's rule set has no such level.
think
my $thought = $bot->think($game);
The move with how it was found: { move, depth, value, nodes, stopped }.
level
budget
levels
my @levels = Game::Senet::Bot->levels($rules);
The levels a rule set has, from 1.
rung
my $rung = Game::Senet::Bot->rung($level, $rules);
What a level is under a rule set: name, and depth and weights for a level that searches. Croaks on a level the rule set does not have.
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)