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

groupAtfunction

The connected group of stones sharing the colour at from, and the empty points touching any of them — its liberties. A group with none is what capturing takes off the board.

Import it

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

Also exported from: @johnmorrisdotca/narabe

Definition

function groupAt(board: Cell[], size: number, from: Point): { stones: Point[]; liberties: Set<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.

fromPoint

The source point of the group or moving piece.

Returns

{ stones: Point[]; liberties: Set<number>; }

The connected same-colour stones and their empty neighbouring indices.

Examples

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

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

What it prints (run when this page was built)

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