NAME

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

VERSION

Version 0.01

SYNOPSIS

my $result = $game->result;

if ($result) {
	print $result->stringify, "\n";   # 'Black wins: White has no move'
	print $result->pdn, "\n";         # '0-1'
}

DESCRIPTION

A finished game has one of these and an unfinished game has undef, so $game->result is the whole test for "is it over".

The engine produces the reasons no_moves, resign, repetition, no_progress and agreement. It never produces timeout: that one exists so a server ending a game on its own clock can build a result of the same shape rather than inventing one.

PROPERTIES

winner

Readonly black, white, or undef for a draw.

$result->winner;

reason

Readonly string: no_moves, resign, repetition, no_progress, agreement or timeout. Anything else dies at construction.

$result->reason;

FUNCTIONS

is_draw

True when there is no winner.

$result->is_draw;

loser

The side that lost, or undef for a draw.

$result->loser;

pdn

The PDN result token. Following PDN, the first number is White's score, so 1-0 is a win for White, 0-1 a win for Black and 1/2-1/2 a draw.

$result->pdn;

stringify

One line for a person, naming the winner and why.

$result->stringify;   # 'Draw: threefold repetition'

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-game-checkers at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Checkers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

perldoc Game::Checkers

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)