Skip to the content

Narabe並べ

Play forty-eight abstract board games through immutable moves, legal choices and replayable records.

Narabe means arranging in Japanese, as in gomoku-narabe: five in a row. About the name

Contents

Reference · Go rules

scoreAreafunction

The area score: every stone on the board, plus every empty region whose only neighbours are one colour. An empty region touching both colours, or touching neither (an empty board), counts for nobody — dame, not territory. Dead stones are not marked or removed here: a stone left on the board still counts as a stone, so a player who wants credit for territory a stray stone sits in has to capture it before passing, the same as playing it out at the real table.

Import it

import { scoreArea } from "@johnmorrisdotca/narabe/rules/go";

Also exported from: @johnmorrisdotca/narabe

Definition

function scoreArea(board: Cell[], size: number): { black: number; white: number; }

Parameters

NameTypeDescription
boardCell[]

The row-major board cells; null marks an empty point.

sizenumber

The number of cells on each side of the board.

Returns

{ black: number; white: number; }

The raw black and white area totals, without komi.

Examples

import { createGame, playMove } from "@johnmorrisdotca/narabe";
import { scoreArea } from "@johnmorrisdotca/narabe/rules/go";

const go = playMove(createGame({variant:"go",size:9}),{row:4,col:4});
console.log(scoreArea(go.board, go.settings.size));
{ black: 81, white: 0 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/narabe 1.3.0.