UNPKG

tsgammon-core

Version:

A Backgammon library for Typescript, formerly developed as a part of tsgammon-ui

30 lines (29 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultSGState = exports.defaultBGState = void 0; const BoardState_1 = require("../BoardState"); const CubeState_1 = require("../CubeState"); const GameConf_1 = require("../GameConf"); const CubeGameState_1 = require("./CubeGameState"); const SingleGameState_1 = require("./SingleGameState"); /** * ルール設定から、デフォルト状態=各ゲーム開始時の状態を表すBGStateオブジェクトを生成する * @param gameConf ルール設定 * @returns */ function defaultBGState(gameConf = GameConf_1.standardConf) { return { cbState: (0, CubeGameState_1.cbOpening)((0, CubeState_1.cube)(1)), sgState: defaultSGState(gameConf), }; } exports.defaultBGState = defaultBGState; /** * ルール設定から、デフォルト状態=各ゲーム開始時の状態を表すSGStateオブジェクトを生成する * @param gameConf ルール設定 * @returns */ function defaultSGState(gameConf = GameConf_1.standardConf) { return (0, SingleGameState_1.openingState)((0, BoardState_1.boardState)(gameConf.initialPos, [0, 0], gameConf.innerPos, gameConf.isEoGFunc), undefined, gameConf.movesForDoublet); } exports.defaultSGState = defaultSGState;