UNPKG

tsgammon-core

Version:

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

21 lines (20 loc) 597 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatMoves = exports.formatMove = void 0; /** * ムーブ1つを文字列表現に変換する。 * * @param move 対象ムーブ * @returns 変換後の文字列 */ function formatMove(move) { const from = move.from === 0 ? 'Bar' : move.from; const to = move.isBearOff ? 'Off' : move.to; const hit = move.isHit ? '*' : ''; return `${from}/${to}${hit}`; } exports.formatMove = formatMove; function formatMoves(moves) { return moves.map(formatMove); } exports.formatMoves = formatMoves;