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

goLegalfunction

Whether stone may play point: on the board, empty, not suicide, and not the one point the simple ko rule forbids retaking this move — exactly the point a single-stone capture just vacated, so the immediate recapture cannot instantly restore the position it broke. Any other move lifts the restriction; it is not the whole of positional superko, but it is the actual rule most rule sets call "simple ko".

Import it

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

Definition

function goLegal(board: Cell[], size: number, point: Point, stone: Stone, koPoint: Point | null): boolean

Parameters

NameTypeDescription
boardCell[]

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

sizenumber

The number of cells on each side of the board.

pointPoint

A zero-based row and column on the board.

stoneStone

The black or white colour being examined.

koPointPoint | null

The forbidden immediate-recapture point, or null without a ko restriction.

Returns

boolean

Whether the point is on board, empty, not suicide and not the immediate ko point.

Examples

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

const point = {row:7,col:7};
const go = playMove(createGame({variant:"go",size:9}),{row:4,col:4});
console.log(goLegal(go.board, go.settings.size, point, "white", go.koPoint));
true

What it prints (run when this page was built)

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