NAME
Game::Gin::Hand - one player's cards
VERSION
Version 0.01
SYNOPSIS
my $hand = Game::Gin::Hand->new(cards => [ @ids ]);
$hand->count; # 10, or 11 between a draw and a discard
$hand->full; # whether it is holding the extra card
$hand->has_card($id);
$hand->add($id);
$hand->remove($id);
$hand->deadwood; # through Game::Gin::Deadwood
$hand->best;
DESCRIPTION
A thin wrapper over a list of card ids. Ten cards between turns and eleven between a draw and the discard that follows, which is the only time the size changes.
Nothing in the engine depends on the order of a hand; sorted is for display and for a stable cache key.
METHODS
cards
The ids, as an arrayref.
count
How many.
full
Whether the hand is holding its eleventh card and therefore owes a discard.
has_card
Whether an id is in the hand.
add
Adds a card. Returns the hand.
remove
Removes one copy of a card. Returns the hand.
best
The best melding, from Game::Gin::Deadwood.
deadwood
What the hand is left with.
sorted
The ids in id order.
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.