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

areaWinnerfunction

The colour whose area plus komi wins the Go position.

Import it

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

Definition

function areaWinner(board: Cell[], size: number, komi: number): Stone

Parameters

NameTypeDescription
boardCell[]

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

sizenumber

The number of cells on each side of the board.

kominumber

The score bonus credited to white.

Returns

Stone

Black when its area is greater than white area plus komi; otherwise white.

Examples

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

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

What it prints (run when this page was built)

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