NAME
Game::Gin::Deck - the seeded deal, and the stock as the tail of it
VERSION
Version 0.01
SYNOPSIS
use Game::Gin::Deck qw(order_for deal_for);
my $order = order_for($seed, 1); # 52 ids, a permutation
my $deal = deal_for($seed, 1);
$deal->{non_dealer}; # ten ids
$deal->{dealer}; # ten ids
$deal->{upcard}; # one id
$deal->{stock}; # thirty-one ids, in draw order
DESCRIPTION
One shuffle per deal, from the seed and the deal number, with no call to rand anywhere. A game is therefore a pure function of its seed and its moves and replays on any machine, which is what lets a finished game be checked by anybody once the seed is published.
The hand number is part of the key
Gin is played over many deals to a target. A shuffle fixed once at the start of the game would deal the same cards every deal, and that failure looks like luck rather than like a bug.
The stock is the tail of the same order
So drawing from the stock is "take the next one", derivable from the seed and the number of draws already made. Nothing has to record which card was drawn, which is how the site keeps a stock draw secret without relying on a filter.
FUNCTIONS
Nothing is exported by default.
order_for
my $order = order_for($seed, $hand);
The 52 ids in shuffled order, as an arrayref. Dies unless the seed is exactly 32 bytes and the hand number is a positive integer.
deal_for
my $deal = deal_for($seed, $hand);
The same order laid out as non_dealer, dealer, upcard and stock.
HAND_SIZE, UPCARD_AT, STOCK_AT
10, 20 and 21: the hand size, and the positions in the order at which the upcard and the stock begin.
SEE ALSO
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.