NAME

Game::Merrills::Result - how a game ended

VERSION

Version 0.03

SYNOPSIS

my $result = $game->result;

$result->winner;           # 'white'
$result->loser;            # 'black'
$result->reason;           # 'few'
$result->is_draw;          # 0
$result->stringify;        # 'White wins: Black has fewer than three men'

DESCRIPTION

A game that has ended has one of these, and a game still going has none.

The reasons

few

The loser was brought down to two men, counting those still in hand, and can no longer make a mill.

blocked

It was the loser's turn and no man of theirs could move.

repetition

A draw: the same men stood on the same points with the same side to move for the third time.

no_mill

A draw: too many moves in a row went by without either side closing a mill.

agreement

A draw: one side offered it and the other accepted.

resign

The loser gave up.

timeout

The loser ran out of time. The game keeps no clock; whoever does tells it.

PROPERTIES

Both are read only. A result that contradicts itself, a draw with a winner or a win without one, dies on construction.

winner

The side that won, white or black, or undef for a draw.

$result->winner;

reason

One of the reasons above.

$result->reason;

METHODS

reasons

Every reason, as a list.

my @reasons = Game::Merrills::Result->reasons;

is_draw

True when nobody won.

$result->is_draw;

loser

The side that lost, or undef for a draw.

$result->loser;

stringify

The result as a line to show a person.

$result->stringify;        # 'Draw: the same position three times'

PACKAGE VARIABLES

@REASONS

The reasons, in order.

%REASON

The same, as the keys of a hash.

AUTHOR

LNATION, <email at lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)