NAME
Game::Go::Result - who won, by how much, and by what
VERSION
Version 0.01
SYNOPSIS
my $r = $game->result;
$r->winner; # BLACK, WHITE, or undef
$r->result; # score | resign | timeout | abandoned
$r->scored_by; # territory | area, when it was counted
$r->margin; # 6.5
say $r->stringify;
DESCRIPTION
There are four results and no fifth
score, resign, timeout, abandoned. The site's games.result column is CHECK-constrained to exactly those, so a game the players could not agree is a score with scored_by => 'area' beside it rather than a new kind of result. Inventing a fifth would have meant a migration touching the ratings, the leaderboards and the log page of every game on the site.
There is no draw
Komi is fractional, so the two scores can never be equal and a jigo cannot happen. Article 10.2 permits one ("If both players have the same amount the game is a draw, which is called a 'jigo'"), and the half point is the device that removes it. Set an integer komi and a draw becomes reachable again; the suite asserts it cannot happen at the shipped value, so the day somebody changes it a test says what happened rather than a game ending in a way nothing can record.
ATTRIBUTES
winner
BLACK, WHITE, or undef when the game was abandoned.
result
One of the four above.
scored_by
territory when the players agreed the dead stones, area when they could not and the disputes ran out. Undef when the game was not counted at all.
It is here, and in the site's view, because a player looking at their game history is entitled to know their game was scored by a rule nobody agreed to.
scores
The final pair, keyed by colour. This is Article 10.2's arithmetic: each player's territory less the prisoners the opponent holds, plus komi for white.
territory, prisoners, area
The workings, so a page can show them rather than printing a margin with no explanation. territory is before the prisoner fill; area is the Tromp-Taylor score of the same position, which is what the game would have been worth under the other ruleset.
komi, dame
The komi in use, and how many empty points reached both colours.
METHODS
results
The four result values, as a list.
scored
Whether this game was counted.
margin
The absolute difference between the two scores, or undef when the game was not counted.
places
The finishing order, keyed by colour, for a site that ranks players. Both first when there is no winner.
stringify
A sentence, and it says when the game was scored by area, because that is the case a player will otherwise write in about.
SEE ALSO
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)