NAME

Game::Dominoes::Result - how a game ended, and in what order

VERSION

Version 0.01

SYNOPSIS

my $result = $game->result;

$result->winner;      # 2, or undef if it was drawn
$result->places;      # { 1 => 2, 2 => 1, 3 => 3 }
$result->scores;      # { 1 => 204, 2 => 250, 3 => 111 }
$result->reason;      # 'target'
$result->ranking;     # [ [2], [1], [3] ]
$result->stringify;

DESCRIPTION

The whole finishing order, not just a winner.

At two seats "who won" says everything. At three and four, second is a real result: it is what game_players.place on peer2peergames.com records and what the pairwise rating there consumes, so the engine produces the ranking and lets the caller decide how much of it to use.

PROPERTIES

places

$result->places;   # { 1 => 2, 2 => 1 }

The finishing order, seat to place. Places start at 1 and may repeat: two seats tied for second means two seats at place 2 and nobody at place 3, the way a race result is written.

scores

$result->scores;

Each seat's final score.

reason

$result->reason;   # 'target'

One of target, blocked, resign or timeout.

timeout is never produced by this engine. It exists so that a server can build a result of the same shape when a seat runs out of clock, which is not something a game of dominoes knows about. Game::Checkers::Result carries the same value for the same reason.

FUNCTIONS

winner

$result->winner;   # 2, or undef

The seat on place 1, or undef when more than one seat shares it. Undef means a draw, not an error.

winners

$result->winners;   # [2]

Every seat on place 1, in seat order.

is_draw

$result->is_draw;

Whether more than one seat finished first.

seats

$result->seats;

Every seat in the game, in seat order.

ranking

$result->ranking;   # [ [2], [1, 3] ]

The seats in finishing order, one inner arrayref per place, so a tie stays visible instead of being flattened into an arbitrary order.

reasons

Game::Dominoes::Result->reasons;

Every reason this class accepts, as an arrayref.

stringify

$result->stringify;

One line for a person.

SEE ALSO

Game::Dominoes, which builds these.

AUTHOR

LNATION <email@lnation.org>

BUGS

Please report any bugs or feature requests to bug-game-dominoes at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Dominoes.

SUPPORT

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

perldoc Game::Dominoes::Result

ACKNOWLEDGEMENTS

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)