tsgammon-core
Version:
A Backgammon library for Typescript, formerly developed as a part of tsgammon-ui
68 lines • 2.1 kB
TypeScript
import { Ply } from '../Ply';
import { SGResult } from './SGResult';
import { CubeState } from '../CubeState';
import { Score } from '../Score';
import { EOGStatus } from '../EOGStatus';
/**
* プレイヤーの一回の手番、または終局の記録を表す
*/
export declare type PlyRecord = PlyRecordInPlay | PlyRecordEoG;
/**
* 手番の記録を表す
*/
export declare type PlyRecordInPlay = {
tag: 'Commit';
ply: Omit<Ply, 'isRed'>;
isRed: boolean;
} | {
tag: 'Double';
cubeValue: number;
isRed: boolean;
} | {
tag: 'Take' | 'Pass';
isRed: boolean;
};
/**
* 終局の記録を表す
*/
export declare type PlyRecordEoG = {
tag: 'EOG';
stake: Score;
sgResult: SGResult;
eogStatus: EOGStatus;
};
/**
* チェッカープレイの記録を生成する
* @param ply チェッカープレイ
* @returns 手番の記録
*/
export declare function plyRecordForCheckerPlay(ply: Ply): PlyRecordInPlay;
/**
* 終局の記録を生成する
*
* @param stake 終局による得点
* @param sgResult 勝者
* @param eogStatus 終局状態
* @returns 終局の記録
*/
export declare function plyRecordForEoG(stake: Score, sgResult: SGResult, eogStatus: EOGStatus): PlyRecordEoG;
/**
* ダブルの記録を生成する
* @param cubeState キューブの状態(ダブル前)
* @param isRed 赤からのダブルならtrue
* @returns ダブルの記録
*/
export declare function plyRecordForDouble(cubeState: CubeState, isRed: boolean): PlyRecordInPlay;
/**
* テイクの記録を生成する
* @param isRed 赤がテイクした(ダブルしたのは白)のであればtrue
* @returns テイクの記録
*/
export declare function plyRecordForTake(isRed: boolean): PlyRecordInPlay;
/**
* パスの記録を生成する
* @param sgResult 勝者(ダブルした側)
* @returns パスの記録:isRedは、赤がパスした場合にtrueが設定される。
*/
export declare function plyRecordForPass(sgResult: SGResult.REDWON | SGResult.WHITEWON): PlyRecordInPlay;
//# sourceMappingURL=PlyRecord.d.ts.map