UNPKG

tsgammon-core

Version:

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

28 lines (27 loc) 869 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asCheckerPlayState = void 0; /** * チェッカープレイ開始状態を示すSGStateオブジェクトを、CheckerPlayStateオブジェクトに変換する * @param sgInPlay * @returns */ function asCheckerPlayState(sgInPlay) { const { boardStateNode, absBoard, revertTo, toAbsBoard, toPly, toPos } = sgInPlay; const curPly = toPly(boardStateNode); const isUndoable = curPly.moves.length > 0; return { isCommitted: false, curPly, curBoardState: boardStateNode, absBoard, boardStateNodeRevertTo: revertTo, absBoardRevertTo: toAbsBoard(revertTo.board), toAbsBoard, toPly, toPos, isUndoable, revertDicesFlag: false, }; } exports.asCheckerPlayState = asCheckerPlayState;