本文へ移動

Sugoroku双六

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

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

目次

リファレンス · SVG盤面と表記

BoardLayoutクラス

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

The layout of a board, a function of its options: where each point, the bar, each tray, the rail and the dice sit, all in landscape units.

インポート

import { BoardLayout } from "@johnmorrisdotca/sugoroku/draw";

定義

class BoardLayout
new BoardLayout(options: BoardOptions): BoardLayout

引数

名前型説明
optionsBoardOptions

Cube rail, viewing side, home direction and board orientation.

メンバー

名前型説明
widthnumber
heightnumber
fieldTopnumber
optionsBoardOptions
mx(x: number, w?: number): number

An x, for something w wide, after the board is mirrored for trays on the left.

fieldLeftnumber

The x the field of points starts at, before mirroring.

fieldHeightnumber
barLeftnumber
trayLeftnumber
slotOf(point: number): { top: boolean; col: number; }

Which slot of the drawing a point of the board is in: its row (the top row or the bottom) and its column from the left, 0 to 11. The board's points are counted the way white counts: 1 to 12 along the bottom from the right, and 13 to 24 along the top from the left. Seen from black's side the rows change places.

columnLeft(col: number): number

The x of the left edge of column col, before mirroring.

pointBox(point: number): Box & { top: boolean; }

The box of a point, as a base on its edge of the field and its length.

trayBox(side: Side): Box & { top: boolean; }

The tray of a side: the bottom one is white's when seen from white's side.

barBox(side: Side): Box & { top: boolean; }

The half of the bar a side's checkers wait in: the nearer half to the side's own tray.

cubeBox(owner: Side | null): Box

Where the cube rests: the middle of the rail, or the end of it nearer its owner.

diceCentre(side: Side): { x: number; y: number; }

The middle of the row of dice, on the half of the board a side plays from: its own home half for white, the other for black.

例

import { BoardLayout } from "@johnmorrisdotca/sugoroku/draw";

const layout = new BoardLayout({cube:true,view:"white",home:"right",orientation:"landscape"});
console.log(layout);
BoardLayout {
  width: 976,
  height: 552,
  fieldTop: 32,
  options: {
    cube: true,
    view: 'white',
    home: 'right',
    orientation: 'landscape'
  }
}

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

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

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