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 · Rules and records

discCountfunction

Count black and white discs currently on a board.

Import it

import { discCount } from "@johnmorrisdotca/narabe";

Definition

function discCount(board: Cell[]): Record<Stone, number>

Parameters

NameTypeDescription
boardCell[]

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

Returns

Record<Stone, number>

Count black and white discs currently on a board.

Examples

import { createGame, discCount } from "@johnmorrisdotca/narabe";

const reversi = createGame({variant:"reversi"});
console.log(discCount(reversi.board));
{ black: 2, white: 2 }

What it prints (run when this page was built)

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