NAME

Game::Go::Bot - Monte Carlo, because alpha-beta does not work on Go

VERSION

Version 0.01

SYNOPSIS

my $bot = Game::Go::Bot->new(level => 3, seed => $bytes);

my $move = $bot->choose($game, $colour);   # a Move, or undef
$bot->last_search;                          # what it thought

DESCRIPTION

Why this is not alpha-beta

Every other engine in this family of distributions searches with alpha-beta. Go is also perfect information and alpha-beta is useless on it, for two reasons that compound:

There is no static evaluation. A Reversi evaluation is a weight table plus mobility, and it works because a corner is worth having in every Reversi position ever. There is no equivalent here: whether a stone is strong depends on whether its group will live, which is the thing the evaluation was wanted for.

The branching factor is 361 at the root, and stays above 200 for most of a 19x19 game. Reversi's is under ten.

So the leaf value is the result of playing the position out at random and counting it, which needs no evaluation function at all.

The budget is playouts, never seconds

The bot runs inside a web move transaction, and a loaded machine must return the same move as an idle one, or the replay of a bot game stops reproducing and the seed published at the end proves nothing.

The levels are therefore playout counts, per board size, because a playout is not the same work on 81 points as on 361. Measured on the machine this was written on:

size    playouts/sec    1000 playouts
 9x9          14,000            69 ms
13x13         4,600           210 ms
19x19         1,300           723 ms

A slower machine plays the same moves more slowly rather than playing different ones.

How good is it

Weak, and weakest on the big board. It is a plain Monte Carlo player with uniform playouts and no Go knowledge beyond not filling its own eyes. On 9x9 at the top rung it plays recognisable moves; on 19x19 it is a beginner, because 361 root moves cannot be compared inside a web request.

That is the known cost of the game rather than a defect to be tuned away, and the plan this was built from deferred Go four times over it. What the distribution does about it is cap the top rung on the biggest board and say so on the page, rather than offering a strength it does not have.

ATTRIBUTES

level

1 to 5. Level 1 should be beatable by somebody who has just read the rules.

seed

The game's seed. Every stream the bot uses is derived from it by SHA-256 together with the seat and the move number: the seat so the two colours do not play one opening from one seed, and the move number so a position reached twice (which a dispute makes possible) is not searched with the same stream twice.

What the last search did: the chosen point, the playouts run, the chosen move's visits and win rate in permille, how many playouts hit the move cap, and how many root moves there were.

METHODS

levels

budget

The playout count for this bot's level on a board of a given size.

choose

$bot->choose($game, $colour)

A Game::Go::Move, or undef where the bot has nothing to say: a finished game, a colour that is not to play, or a position with no legal move. Undef rather than an error, because the site's bot driver breaks its loop on it.

During the confirmation phase this hands off to mark.

mark

The confirmation phase, which a bot has to be able to play or a bot game strands in it and the clock times the bot out of a game it may well have won.

As the proposer it marks what the playouts say is dead and then finishes. As the answerer it accepts a proposal matching its own reading, and disputes at most once in a game: a bot that disputed every round trip against a stubborn human would turn a finished game into an unbounded one, and between a bot and a person the bot is the party that should yield.

It judges dead stones by playouts and not by heuristics: from the stopped position, play it out and see whose the points end up being. And it never proposes a mark on a chain Benson's algorithm finds unconditionally alive, because the engine would refuse it and a refused bot move is a stranded game.

SEE ALSO

Game::Go, Game::Go::Marking.

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)