goLegal関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { goLegal } from "@johnmorrisdotca/narabe/rules/go";
定義
function goLegal(board: Cell[], size: number, point: Point, stone: Stone, koPoint: Point | null): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
size | number | The number of cells on each side of the board. |
point | Point | A zero-based row and column on the board. |
stone | Stone | The black or white colour being examined. |
koPoint | Point | null | The forbidden immediate-recapture point, or null without a ko restriction. |
戻り値
boolean
Whether the point is on board, empty, not suicide and not the immediate ko point.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。