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; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
size | number | 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 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。