本文へ移動

Sugoroku双六

標準の規則、キューブ、試合の得点、シード付きのサイコロ、再生できる記録で、バックギャモンと仲間のゲームを遊べます。

「双六」は、盤と駒で遊ぶゲームの名前です。 名前について(英語)

目次

リファレンス · 規則・ゲーム・記録

ReplayOk型

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

A successfully validated record, its settings, completed games and optional current game.

インポート

import type { ReplayOk } from "@johnmorrisdotca/sugoroku";

定義

type ReplayOk = {
    readonly ok: true;
    readonly settings: Settings;
    readonly seed: RecordSeed | null;
    readonly match: Match;
    readonly games: readonly ReplayedGame[];
    readonly current: GameState | null;
};

メンバー

名前型説明
oktrue
settingsSettings
seedRecordSeed | null
matchMatch

The match as it stands after every finished game.

gamesreadonly ReplayedGame[]

Every finished game, in order.

currentGameState | null

The game still in play when the record ends, or null if the last was finished.

例

import { GameRecorder, legalPlaysOf, newGame, replayRecord, rollOpening, settingsFor, startGame } from "@johnmorrisdotca/sugoroku";
import type { ReplayOk } from "@johnmorrisdotca/sugoroku";

const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const play = legalPlaysOf(game)[0];
const record = new GameRecorder(settings);
record.startGame();
record.opening([3,1]);
record.turn("white",[3,1],play.moves);
const replay = replayRecord(record.text());
if(!replay.ok) throw new Error(replay.reason);
const value: ReplayOk = replay;
console.log(value);
{
  ok: true,
  settings: {
    variant: {
      checkers: 15,
      dice: 2,
      doubles: 'four',
      direction: 'opposed',
      opening: 'roll-off',
      goal: 'first-off',
      holdBelow: 0,
      drawAfter: 0,
      key: 'backgammon',
      layout: [Array]
    },
    rules: {
      points: 5,
      cube: true,
      crawford: true,
      jacoby: false,
      beaver: false,
      gammons: false
    }
  },
  seed: null,
  match: {
    settings: { variant: [Object], rules: [Object] },
    score: [ 0, 0 ],
    results: [],
    crawfordNext: false,
    crawfordPlayed: false,
    over: false,
    winner: null
  },
  games: [],
  current: {
    settings: { variant: [Object], rules: [Object] },
    crawford: false,
    score: [ 0, 0 ],
    position: { points: [Array], bar: [Array], reserve: [Array], off: [Array] },
    turn: 'black',
    phase: 'before-roll',
    dice: null,
    need: [],
    plan: [],
    moves: [],
    turnStart: { points: [Array], bar: [Array], reserve: [Array], off: [Array] },
    cube: { value: 1, owner: null },
    offeredBy: null,
    turns: [ 1, 0 ],
    opening: [ 3, 1 ],
    result: null
  }
}

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

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

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