本文へ移動

Sugoroku双六

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

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

目次

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

GameState型

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

The immutable game phase, board, dice, remaining moves, cube and optional result.

インポート

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

定義

type GameState = {
    readonly settings: Settings;
    readonly crawford: boolean;
    readonly score: readonly [
        number,
        number
    ];
    readonly position: Position;
    readonly turn: Side | null;
    readonly phase: Phase;
    readonly dice: readonly number[] | null;
    readonly need: readonly number[];
    readonly plan: readonly number[];
    readonly moves: readonly Move[];
    readonly turnStart: Position;
    readonly cube: Cube;
    readonly offeredBy: Side | null;
    readonly turns: readonly [
        number,
        number
    ];
    readonly opening: readonly [
        number,
        number
    ] | null;
    readonly result: GameResult | null;
};

メンバー

名前型説明
settingsSettings
crawfordboolean

Whether this is the Crawford game of a match: no cube.

scorereadonly [number, number]

The match score as the game began, [white, black]: what the dead cube is judged by.

positionPosition
turnSide | null

The side to move; null until the opening throw has decided.

phasePhase
dicereadonly number[] | null

The roll being played, as thrown.

needreadonly number[]

The dice this turn must still play, highest first. Empty when the turn has been played, or when nothing can be.

planreadonly number[]

The dice this turn had to play to begin with, highest first.

movesreadonly Move[]

The moves made so far this turn, in order.

turnStartPosition

The position the turn began from: the moves are made from it.

cubeCube
offeredBySide | null

Who offered the double that is waiting to be answered, when phase is double-offered or beaver-offered.

turnsreadonly [number, number]

The turns each side has taken.

openingreadonly [number, number] | null

The last throw of a die each at the start: [white, black]. A tie means the sides throw again.

resultGameResult | null

例

import { newGame, rollOpening, settingsFor } from "@johnmorrisdotca/sugoroku";
import type { GameState } from "@johnmorrisdotca/sugoroku";

const settings = settingsFor("backgammon",{points:5,cube:true});
const game = rollOpening(newGame(settings),[3,1]);
const value: GameState = game;
console.log(value);
{
  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
    }
  },
  crawford: false,
  score: [ 0, 0 ],
  position: {
    points: [ [Array], [Array] ],
    bar: [ 0, 0 ],
    reserve: [ 0, 0 ],
    off: [ 0, 0 ]
  },
  turn: 'white',
  phase: 'playing',
  dice: [ 3, 1 ],
  need: [ 3, 1 ],
  plan: [ 3, 1 ],
  moves: [],
  turnStart: {
    points: [ [Array], [Array] ],
    bar: [ 0, 0 ],
    reserve: [ 0, 0 ],
    off: [ 0, 0 ]
  },
  cube: { value: 1, owner: null },
  offeredBy: null,
  turns: [ 0, 0 ],
  opening: [ 3, 1 ],
  result: null
}

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

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

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