NAME
Game::Fanorona::Variant - the board a game is played on, where it starts, and its limits
VERSION
Version 0.03
SYNOPSIS
use Game::Fanorona::Variant;
my $game = Game::Fanorona::Variant->named('sivy');
my $small = Game::Fanorona::Variant->named('telo');
my $short = Game::Fanorona::Variant->custom(board => 'sivy', quiet_limit => 40);
my $odd = Game::Fanorona::Variant->custom(cols => 7, rows => 5);
print $short->as_string, "\n"; # sivy,quiet_limit=40
my $again = Game::Fanorona::Variant->from_string($short->as_string);
DESCRIPTION
A value: which board, the position the game begins from, and the three limits that draw a game. It is made once and does not change.
Not by new, which croaks. The three constructors check every field, and a field that is not one is refused where new would have accepted it in silence.
The boards
Fanorona has three traditional sizes, and this distribution names them as the game does: sivy, nine files by five ranks and the game most people mean; dimy, five by five; and telo, three by three. Any board of odd width 3 to 9 and height 3 or 5 can be had by its size.
The set-up of the nine by five is the traditional one. The set-ups of the others are derived from it, by carrying its pattern down: the home ranks full, the centre empty, the middle rank alternating outward from the centre with a white stone directly left of it and a black one directly right. No source this distribution read gives them.
For telo that derivation leaves nothing to choose, because the only other balanced middle rank is its mirror image and the mirror image is the same game. And it is checked: worked through with this engine, the three by three is a win for White, which is what the published solution of the game says.
For dimy the pattern gives b w . b w, and a rank that reads the same from both ends, b w . w b, is a real alternative that nothing here settles. A game can be started from it with start.
The limits
quiet_limit, the number of moves running, both sides counted, that may take nothing before the game is drawn; repeat, which occurrence of a position draws it; and ply_cap, the number of moves at which a game is drawn whatever else. They are what Game::Fanorona::Rules describes, and its defaults are this class's. A quiet_limit or a repeat of 0 turns that draw off.
CONSTRUCTORS
named
my $variant = Game::Fanorona::Variant->named('dimy');
One of the three boards from its set-up with the default limits. sivy when no name is given. Croaks on a name that is not a board.
custom
my $variant = Game::Fanorona::Variant->custom(
board => 'dimy', # or cols => 5, rows => 5
start => 'bbbbb/bbbbb/bw1wb/wwwww/wwwww w',
quiet_limit => 40,
repeat => 3,
ply_cap => 500,
);
A board by name or by size, and whatever else differs. Croaks on a field that is not one, a field with no value, a size that cannot be built, a limit that is not a whole number, a repeat of 1, a ply_cap below 1, or a start that is not a position of a board that size.
from_string
my $variant = Game::Fanorona::Variant->from_string('sivy,quiet_limit=40');
The variant as_string wrote, or undef for a string that is not one.
METHODS
name
sivy, dimy or telo for a board of one of those sizes, whatever its start and limits; otherwise the size, as 7x5.
cols
rows
The size of the board.
start
The position the game begins from, as Game::Fanorona::Engine writes it.
is_setup
True when start is the set-up of the board.
quiet_limit
repeat
ply_cap
The three limits.
limits
The three limits as a hash reference, which is what "new" in Game::Fanorona::Rules takes as its variant.
as_string
The variant as one line: its name, then each limit that is not the default, then the start if it is not the set-up. A named board with nothing changed is just its name.
CLASS METHODS
names
The three names: sivy, dimy, telo.
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)