flipsAt関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The discs a stone of stone at point would turn. Empty means the move is
illegal. directions is the square board's eight unless a caller says
otherwise; everything that has a state to hand reads flipDirections.
インポート
import { flipsAt } from "@johnmorrisdotca/narabe";
定義
function flipsAt(board: Cell[], size: number, stone: Stone, point: Point, directions?: readonly Point[]): Point[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
size | number | The number of cells on each side of the board. |
stone | Stone | The black or white colour being examined. |
point | Point | A zero-based row and column on the board. |
directions (省略可) | readonly Point[] | The board directions in which discs can flip. |
戻り値
Point[]
The discs a stone of stone at point would turn. Empty means the move is illegal. directions is the square board's eight unless a caller says otherwise; everything that has a state to hand reads flipDirections.
例
import { createGame, flipsAt } from "@johnmorrisdotca/narabe";
const reversi = createGame({variant:"reversi"});
console.log(flipsAt(reversi.board,8,"black",{row:2,col:3}));[ { row: 3, col: 3 } ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。