NAME
Game::Schnapsen::Hand - one player's cards
VERSION
Version 0.01
SYNOPSIS
my $hand = Game::Schnapsen::Hand->new(cards => [ @ids ]);
$hand->count; # 5 or 6 between tricks
$hand->has_card($id);
$hand->add($id);
$hand->remove($id);
$hand->of_suit('S');
$hand->points; # what the cards would be worth to whoever took them
DESCRIPTION
A thin wrapper over a list of card ids. Five cards in Schnapsen and six in Sixty-Six between tricks, one fewer between playing to a trick and drawing from the talon, 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.
points is the holder's business and nobody else's
What a hand is worth matters to a bot deciding whether to close the talon, and to nothing else. A consumer must not put it in an opponent's view: the card points a player has taken are public, because both players count openly, but the points still in their hand are not.
METHODS
cards
The ids, as an arrayref.
count
How many.
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.
of_suit
The cards of one suit, as an arrayref, in the hand's own order.
points
The card points the hand is holding.
sorted
The ids in id order.
SEE ALSO
Game::Schnapsen::Card, Game::Schnapsen::Deal.
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.