NAME

Game::Schnapsen::Declare - marriages and the trump exchange, as arithmetic

VERSION

Version 0.01

SYNOPSIS

use Game::Schnapsen::Declare qw(marriages_in exchange_card);

my $m = marriages_in($hand->cards, 'H');
$m->[0]{suit};    # 'H'
$m->[0]{value};   # 40, because hearts are trumps
$m->[0]{king};    # the id to lead or to show

exchange_card($hand->cards, 'H', 'J');   # the jack of hearts, or undef

DESCRIPTION

What a hand could declare, given the trump suit. Nothing here knows whether the declaration is allowed: that depends on whose lead it is, on whether the talon is open, on how many tricks the player has taken and on which of the two games is being played, and it therefore belongs to Game::Schnapsen::Deal.

Keeping the two apart is the point. The arithmetic is shared by both games word for word; the permission is where five of the eleven divergences live.

A marriage is twenty, or forty in trumps

The matched king and queen of a suit. Both rulesets agree on the values, on who may declare one and on what it costs to declare one you cannot use, so all of that is written once.

Three rules about them live in the deal rather than here, because each needs state this module is not given:

  • only the player whose turn it is to lead may declare;

  • the declarer must then lead one of the two cards, which is a constraint on the following lead;

  • the twenty or forty does not count until the declarer has taken a trick, so a marriage is held pending and folded in at that moment. A player who declares and never takes a trick scores nothing for it.

That third one is the rule most often got wrong, and it is worth knowing that it is not implemented here.

The exchange card is the lowest trump

The trump jack in Schnapsen and the trump nine in Sixty-Six, which is in each case the lowest trump in that pack. exchange_card is told which rank to look for rather than which game it is in.

FUNCTIONS

Nothing is exported by default.

marriages_in

marriages_in(\@cards, $trump);

Every marriage the hand holds, as an arrayref of { suit, value, king, queen }, in suit order. Empty if there are none.

marriage_value

20, or 40 for the trump suit.

exchange_card

exchange_card(\@cards, $trump, $rank);

The id of the exchange card if the hand holds it, otherwise undef.

MARRIAGE, MARRIAGE_TRUMP

20 and 40.

SEE ALSO

Game::Schnapsen::Deal, Game::Schnapsen::Variant.

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.