NAME

Game::Mahjong::Bot - a seat played by the machine, at a level

VERSION

Version 0.01

SYNOPSIS

my $bot = Game::Mahjong::Bot->new(level => 2, seed => $seed);
my $move = $bot->choose($rules, $seat);   # undef when the seat is not waited on
my $hint = $bot->hint($rules, $seat);     # the top rung's move

DESCRIPTION

Three levels, Game::Mahjong::Search's rungs. choose answers undef for a seat that is not waited on, so a driver that loops over the waited seats reads undef as "stop", and every move it returns is one of the seat's legal moves, so the rules never refuse it. Ties are broken from the seed with the seat mixed in, so four bots at one table sharing a game seed do not all break the same tie the same way.

ATTRIBUTES

level

1 to 3.

seed

A string; the game's seed, usually.

METHODS

choose

The move for a seat now, or undef.

hint

The top rung's move for a seat now, whatever this bot's level.

levels

1, 2, 3.

@LADDER

The bag a site draws a rung from, weakest first. A rung may appear more than once; that is the weighting.

The ladder, measured

One seat of the higher rung against three of the rung below, the measured seat rotating, a hundred games a pairing (xt/ladder.t, 24 September 2026):

rung 2 against three rung 1s    +216.0 points a game   87 games in 100
rung 3 against three rung 2s      +6.8 points a game   24 games in 100
rung 3 against three rung 1s    +202.7 points a game   86 games in 100

And the two ideas rung 3 adds, each switched off in turn against three full rung 3s:

without the defence               +7.9 points a game   24 games in 100
without the pattern target        +9.3 points a game   26 games in 100

Rung 2 carries this ladder. Rung 3's two ideas are worth nothing a hundred games can distinguish from chance, which is a quarter of the games at four seats. The bag still ends in 3, because hint reaches for the last rung and the defence costs nothing to run; a stronger third rung is work left undone rather than work done.

SEE ALSO

Game::Mahjong::Search, Game::Mahjong::Rules

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.