本文へ移動

Narabe並べ

48種類の盤上ゲームを、新しい局面を返す手の操作、合法手の一覧、再生できる棋譜で扱えます。

「並べ」は五目並べの「並べ」。石を並べることを表す言葉です。 名前について(英語)

目次

リファレンス · 囲碁のルール

scoreArea関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { scoreArea } from "@johnmorrisdotca/narabe/rules/go";

ほかのエクスポート元: @johnmorrisdotca/narabe

定義

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

引数

名前型説明
boardCell[]

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

sizenumber

The number of cells on each side of the board.

戻り値

{ black: number; white: number; }

The raw black and white area totals, without komi.

例

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 }

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/narabe 1.3.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。