NAME

Game::Fanorona::Result - how a game of fanorona ended

VERSION

Version 0.03

SYNOPSIS

my $result = $game->result or die 'the game is not over';
if ($result->is_draw) { print 'drawn by ', $result->how, "\n" }
else                  { print $result->winner, ' won by ', $result->how, "\n" }

DESCRIPTION

A value: who won, how, the position the game ended on and how many moves it took.

The ways a game ends

Three with a winner:

stones

A side has no stones left.

no_moves

A side to move had stones and no legal move, and has lost.

resign

A side gave up.

and four without:

repetition

The same position with the same side to move, for the third time.

quiet

Too many moves running that took nothing.

ply_cap

Too many moves altogether.

agreement

A draw was offered and accepted.

"How a game ends" in Game::Fanorona::Rules says which of these are traditional and which are this distribution's.

CONSTRUCTORS

new

my $result = Game::Fanorona::Result->new(
    how => 'stones', winner => 'white', position => $string, moves => 31,
);

Croaks on a how that is not one of the seven, on a win with no winner, and on a draw with one.

METHODS

winner

white or black, or undef for a draw.

loser

The other side, or undef for a draw.

how

One of the seven words above.

is_draw

True when nobody won.

position

The position the game ended on.

moves

How many whole moves were made.

CLASS METHODS

ways

The seven words: the three wins, then the four draws.

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)