NAME

Game::Gin::Bot - an opponent that can only see what a player can see

VERSION

Version 0.01

SYNOPSIS

my $bot = Game::Gin::Bot->new(level => 2);
my $move = $bot->choose($game, 'p2');
$game->apply('p2', $move) if $move;

DESCRIPTION

Gathers what the seat can see and hands it to Game::Gin::Search, which decides. Four things cross that boundary: the seat's own hand, the upcard, the discard pile and how many cards are left. Search has nowhere to put anything else, which is what stops this reading of the deal becoming a cheat.

Levels

  1. Throws on the count alone and knocks the moment it may. A floor to measure against rather than a serious opponent.

  2. Breaks ties on what a card could still become, so it stops throwing the card that was one away from a meld, and holds a knock until the count is low enough to survive an undercut.

There is no level 3. One was written, measured against level 2 over a hundred matches a side, and removed for losing 47-53 and for failing to finish three matches in two hundred. "knock_now" in Game::Gin::Search carries the numbers.

METHODS

choose

$bot->choose($game, $seat);

A move hashref from the seat's legal moves, or undef when it is not this seat's turn.

seed_for

Game::Gin::Bot->seed_for($game_seed, $seat);

A per-seat seed derived from the game's. Derived, because a bot holding the game seed could deal out the stock it is meant to be guessing at; per seat, because two bots sharing one seed are one bot.

level, seed

What was passed in.

SEE ALSO

Game::Gin::Search, Game::Gin.

AUTHOR

LNATION, <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under the Artistic License 2.0.