NAME

Game::Reversi::Result - who won, by what, and for how much

VERSION

Version 0.01

SYNOPSIS

my $result = $game->result;

$result->winner;    # 'b', 'w', or undef for a tie
$result->result;    # 'score' | 'draw' | 'timeout' | 'abandoned' | 'resign'
$result->counts;    # discs on the board:   { b => 20, w => 14 }
$result->score;     # the official score:   { b => 50, w => 14 }
$result->places;    # { b => 1, w => 2 }

DESCRIPTION

counts and score are not the same number

counts is what is on the board. score is the official score, which awards the empty squares to the winner and therefore always totals 64. A game ending 20-14 with thirty squares empty has counts of 20 and 14 and a score of 50 and 14. See Game::Reversi::Scoring.

An interrupted game has no official score

score is undef unless "natural" is true.

This is deliberate, and it is the one place where this distribution declines to implement a rule. The sources give three different answers for a game stopped by a clock. WOF's championship rules guarantee the non-defaulting player at least 33-31; the same document scores an abandoned game 64-0; and Wikipedia describes a common over-the-board procedure guaranteeing only a one disc margin, while conceding that "There are varying methods to determine the official score when a player defaults."

A timeout is the host talking, not the game. Whatever site or program is running the game already has a policy for what happens when somebody stops playing, and a rules engine that imposed a tournament convention on top of it would be disagreeing with its host for a reason no player would understand. So the result names the winner, counts says what was on the board, and what that is worth is the caller's decision.

This matters far more in correspondence play than over a board. Over a board a default is rare; in a game played over days it is an ordinary way for a game to end.

METHODS

winner

b, w, or undef for a tie.

result

One of score, draw, timeout, abandoned, resign.

counts

Discs on the board, by colour.

score

The official score, or undef for an interrupted game.

places

Finishing order, 1 for the winner and 2 for the loser, with both 1 on a tie.

natural

Whether the game reached its own end rather than being stopped.

results

Every result value this class accepts.

stringify

A sentence.

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.