NAME

Game::Dominoes::Set - the 28 tiles of a double six set, and the seeded shuffle

VERSION

Version 0.01

SYNOPSIS

use Game::Dominoes::Set qw(tiles tile_of order_for PIPS);

my $all   = tiles();            # 28 Game::Dominoes::Tile, canonical order
my $tile  = tile_of(25);        # 6-4
my $order = order_for($seed, 1);  # the ids, shuffled for hand 1

PIPS;   # 168, the pips in the whole set

DESCRIPTION

The set, and where a deal comes from. Tiles are numbered 1 to 28 in the canonical order 0-0, 0-1 to 0-6, 1-1 to 1-6, and so on to 6-6. That numbering is what the event log and the notation store, so it is part of the wire format and is not to be reordered.

FUNCTIONS

tiles

my $all = tiles();

All 28 tiles in canonical order, as an arrayref. A fresh arrayref each call, so a caller may shuffle it; the tiles inside are shared and immutable.

tile_of

my $tile = tile_of(25);

The tile with that id. Dies outside 1 to 28, which is programmer error.

order_for

my $order = order_for($seed, $hand);

The 28 ids in the order this seed deals them for this hand, as an arrayref. $seed is 32 bytes and $hand counts from 1.

A pure function of its two arguments: the same pair gives the same order on every machine and every perl. That is what makes a game replayable, and what lets anybody recompute every deal and every draw once the game is over and the seed is revealed. While a game is running the seed is in no view, so knowing this algorithm tells a player nothing.

The hand number matters. All Fives runs over many hands to a target and each one deals from a full set, so a single shuffle fixed at the start of the game would deal identical tiles every hand.

PIPS

PIPS;   # 168

The pips in a complete set. Useful as a running invariant: the hands, the boneyard and the layout must always total this between them, which catches a lost tile, a duplicated draw and a mis-set hand size in one assertion.

SIZE

SIZE;   # 28

The tiles in a complete set.

SEE ALSO

Game::Dominoes::Tile, the tiles this hands out.

AUTHOR

LNATION <email@lnation.org>

BUGS

Please report any bugs or feature requests to bug-game-dominoes at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Dominoes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Game::Dominoes::Set

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)