parsePosition関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The position that text of formatPosition's kind stands for, or null if it is not one. bar, reserve and off may be left out.
インポート
import { parsePosition } from "@johnmorrisdotca/sugoroku";
定義
function parsePosition(text: string): Position | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | Native move notation, position text or full record specified by the signature. |
戻り値
Position | null
The position that text of formatPosition's kind stands for, or null if it is not one. bar, reserve and off may be left out.
例
import { formatPosition, parsePosition, settingsFor, startPosition } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const position = startPosition(spec);
console.log(parsePosition(formatPosition(position))?.bar);[ 0, 0 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。