NAME

Game::Go::Rules - the constants, the codes and the pinned values

VERSION

Version 0.01

SYNOPSIS

use Game::Go::Rules;

Game::Go::Rules::BLACK;          # 1
Game::Go::Rules::other(BLACK);   # WHITE
Game::Go::Rules::refusal(3);     # the sentence for a ko refusal

DESCRIPTION

A leaf module that depends on nothing, so that Game::Go and Game::Go::Engine can both use it without loading each other.

Everything here is either a value pinned from a source, with the source named, or a house choice labelled as one.

CONSTANTS

EMPTY, BLACK, WHITE, BORDER

The four values a point can hold. EMPTY is 0, so a fresh board is a zeroed board. BORDER is the engine's sentinel ring and is never a point a caller can name.

MIN_SIZE, MAX_SIZE

2 and 19.

OK, ILL_OFF, ILL_TAKEN, ILL_KO, ILL_SUICIDE, ILL_REPEAT, ILL_COLOUR

Why a move was refused. OK is 0 and every other value names one rule. ILL_COLOUR is programmer error rather than a refused move.

DEFAULT_KOMI

6.5, on every size, and a house choice rather than a pinned rule. Komi is not in the Japanese rules of 1989 at all. The fractional part is the device that makes a draw impossible, which Article 10.2 would otherwise permit; the particular value is conventional for 19x19 and has no standard at all for 9x9.

HANDICAP_KOMI

0.5 in a handicap game, on Sensei's Library: "there is no komi (or it is just 0.5, to prevent a draw)".

MAX_HANDICAP

9. Beyond nine stones the difference in strength is usually taken to make the game a lesson rather than a contest.

FUNCTIONS

sizes

The three sizes the distribution offers: 9, 13 and 19.

refusal, refusals

The sentence for a refusal code, and the whole table as a hashref. The table is copied, so a caller cannot edit it by editing what it got back.

other

The other colour.

is_colour

Whether a value is BLACK or WHITE. EMPTY and BORDER are not colours a player can be.

colour_name

black, white, or nobody.

star_points

Game::Go::Rules::star_points(19)     # nine [col, row] pairs

The star points of a board, as [$col, $row] pairs.

Cited for 19x19, Sensei's Library: "Star points (J. hoshi) are the nine points on a 19x19 go board marked by small dots, where handicap stones are placed ... there are 3 named star points: the 4-4 point (corner star), the 10-4 point (side star) and the 10-10 point (tengen)."

For the small boards the same source says only how many: "A 13x13 board has only five star points", and "A 9x9 board also has only five star points. However, some leave out that in the center, some those in the corners." So their coordinates here are ours, on the obvious reading, and the 9x9 set is one the source says is not settled.

max_handicap

How many stones a board can take: nine on 19x19, five on the others. It is a property of the board rather than one number, because only 19x19 has nine star points to put them on.

handicap_points

Game::Go::Rules::handicap_points(19, 4)

The points a handicap places, as [$col, $row] pairs, in the traditional order. Empty for a handicap of 0 or 1, which place none.

Cited for 19x19 from Wikipedia's "Handicapping in Go", whose table references Iwamoto Kaoru, Go for Beginners, Pantheon, 1977 (originally 1972), pages 109-114. Two rows of it are what a reader is most likely to get wrong: at three stones it is the upper left that is left out, and six and seven use the left and right side stars rather than the top and bottom.

For 9x9 and 13x13 there is no cited convention and there cannot be a nine-stone one. Those follow the same order as far as their five points go, which is ours.

letter, from_letter

A colour as b or w, and back again. Undef for anything that is not a colour.

The log writes colours as letters because a log is read by people and transported as JSON, and a bare 1 or 2 in an event payload is a number nobody can check by eye. The engine keeps them numeric, because the C does.

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)