NAME

Game::Senet::Variant - a rule set of Senet, as a value

VERSION

Version 0.02

SYNOPSIS

use Game::Senet::Variant;

my $kendall = Game::Senet::Variant->named('kendall');
my $seven   = Game::Senet::Variant->named('kendall', pieces => 7);
my $mine    = Game::Senet::Variant->custom(exits => 'skyruk', protect => 'run');

print $seven->name, "\n";            # kendall
print $seven->describe, "\n";        # kendall pieces=7
print "@{ $kendall->exit_for(26, 1) }\n";    # walk

DESCRIPTION

The rules a game of Senet is played by, as an immutable value. Two are named: kendall, after Timothy Kendall's reconstruction as modern sets print it, and skyruk, the reconstruction published with an open-source implementation of the game. Any other combination of the fields is a custom set.

FIELDS

exits

kendall or skyruk: which named set's table says what a piece on houses 26 to 30 may do with each roll. It names a table and is not a table.

pieces

5 or 7 a side.

blockade

3, 2, or 0 for none: how many of a side's pieces in a row the other side may not pass.

protect

run, ends or none: which pieces of a run of two or more may not be swapped.

backward

1 when a piece moves back, by the roll, if no piece can move forward.

reach26

exact, or any when a piece on house 25 reaches 26 on any roll.

throw_on_26

1 when a piece arriving on house 26 is thrown for again, alone.

CONSTRUCTORS

new

my $variant = Game::Senet::Variant->new(%fields);

Sugar's constructor: a field not given takes kendall's value, and a value no field may hold croaks. A key that is not a field is ignored in silence, which is why "custom" exists.

named

my $variant = Game::Senet::Variant->named($name);
my $variant = Game::Senet::Variant->named($name, pieces => 7);

A named set. pieces may be given, and nothing else. A name that is not one croaks, listing the names.

custom

my $variant = Game::Senet::Variant->custom(%fields);

kendall with the fields given changed. A key that is not a field croaks.

of

my $variant = Game::Senet::Variant->of($name_or_hash_or_variant);

A variant from whatever names one: undef for kendall, a name, a hash of fields, or a variant, which is returned as it is.

METHODS

fields

The field names, in order.

names

The named sets, in order.

name

The named set this is, pieces aside, or undef for a custom set.

describe

kendall, kendall pieces=7, or every field for a custom set.

as_hash

The fields as a hash, in the shape "rules" in Game::Senet::Engine takes.

equals

$a->equals($b)

True when every field, pieces included, is the same.

exit_for

my $chain = $variant->exit_for($house, $roll);

What a piece on house 26 to 30 tries with a roll, in order: house numbers and the words off, walk (house 15, or the first empty house below it) and stay. An empty list is no move.

AUTHOR

LNATION <email@lnation.org>

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)