NAME

Game::Reversi::Scoring - what a finished game is worth

VERSION

Version 0.01

SYNOPSIS

Game::Reversi::Scoring->count($board);    # { b => 20, w => 14 }
Game::Reversi::Scoring->score($board);    # { b => 50, w => 14 }
Game::Reversi::Scoring->winner($board);   # 'b'

DESCRIPTION

Two rules exist, and this implements the tournament one

WOF, World Othello Championships rules, section IV.7:

The official score of the game will be determined by counting up the discs of each colour on the board, counting empty squares for the winner. In the event of a draw, the score will always be 32-32.

Wikipedia restates it and cites that document: "If the game ended before the grid was completely filled, any empty squares are scored for the winner."

The other rule is simply the absence of that sentence. WOF's own public rules page, and the casual rules sites, stop at "the player with the majority of their colour showing is the winner". Under that reading a game ending 20-14 with thirty squares empty is recorded 20-14; under the tournament rule it is 50-14.

Who wins is the same either way. The empty squares go to the winner, so they cannot change who that is. Only the recorded margin differs.

The tie is a branch, not arithmetic

"Counting empty squares for the winner" has no answer when there is no winner, and WOF resolves it by fiat in the same sentence: a tie is recorded 32-32 whatever is on the board. A game ending 25-25 with fourteen squares empty is officially 32-32.

Wikipedia notes the preferred word for such a result is tie, and that "The term 'draw' for such may also be heard, but is somewhat frowned upon". This distribution nevertheless reports draw from Game::Reversi::Result, because that is the word the site consuming it already uses for every other game and inventing a third value for a terminology preference would break its ranking.

count and score are two names on purpose

count is what is on the board and drives the live scoreboard. score is the official result and exists only at the end. A single function with a flag would let a midgame evaluation reach for the end of game rule and conclude that every position is worth 64.

METHODS

count

Discs on the board, by colour.

score

The official score. Always totals 64.

winner

Whoever has more discs, or undef for a tie.

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.