tsgammon-core
Version:
A Backgammon library for Typescript, formerly developed as a part of tsgammon-ui
84 lines • 3.75 kB
TypeScript
import { AbsoluteBoardState } from '../AbsoluteBoardState';
import { BoardState } from '../BoardState';
import { BoardStateNode } from '../BoardStateNode';
import { Dice, DicePip, DiceRoll } from '../Dices';
import { EOGStatus } from '../EOGStatus';
import { Ply } from '../Ply';
import { SGResult } from '../records/SGResult';
import { Score } from '../Score';
/**
* キューブレスのバックギャモンの局面の状態を定義した型
*/
export declare type SGState = SGOpening | SGInPlay | SGToRoll | SGEoG;
export declare type SGInPlay = SGInPlayRed | SGInPlayWhite;
export declare type SGToRoll = SGToRollRed | SGToRollWhite;
export declare type SGEoG = SGEoGRedWon | SGEoGWhiteWon | SGEoGNoGame;
declare type _SGState = {
absBoard: AbsoluteBoardState;
boardState: BoardState;
};
export declare type SGOpening = Omit<_SGState, 'lastPly'> & {
tag: 'SGOpening';
dicePip?: DicePip;
doOpening: (openingRoll: DiceRoll) => SGInPlay | SGOpening;
};
declare type _SGInPlay = _SGState & {
tag: 'SGInPlay';
dices: Dice[];
curPly: Ply;
boardStateNode: BoardStateNode;
revertTo: BoardStateNode;
toPly: (boardStateNode: BoardStateNode) => Ply;
toAbsBoard: (boardState: BoardState) => AbsoluteBoardState;
toPos: (absPos: number) => number;
};
export declare type SGInPlayRed = _SGInPlay & {
isRed: true;
doCheckerPlayCommit: (boardStateNode: BoardStateNode, revertTo: BoardStateNode) => SGToRollWhite | SGEoGRedWon;
withNode: (boardStateNode: BoardStateNode) => SGInPlayRed;
};
export declare type SGInPlayWhite = _SGInPlay & {
isRed: false;
doCheckerPlayCommit: (boardStateNode: BoardStateNode, revertTo: BoardStateNode) => SGToRollRed | SGEoGWhiteWon;
withNode: (boardStateNode: BoardStateNode) => SGInPlayWhite;
};
declare type _SGToRoll = _SGState & {
tag: 'SGToRoll';
lastPly: Ply;
};
export declare type SGToRollRed = _SGToRoll & {
isRed: true;
doRoll: (dices: DiceRoll) => SGInPlayRed;
};
export declare type SGToRollWhite = _SGToRoll & {
isRed: false;
doRoll: (dices: DiceRoll) => SGInPlayWhite;
};
export declare type _SGEoG = _SGState & {
tag: 'SGEoG';
dices: Dice[];
stake: Score;
eogStatus: EOGStatus;
};
export declare type SGEoGRedWon = _SGEoG & {
result: SGResult.REDWON;
isRed: true;
};
export declare type SGEoGWhiteWon = _SGEoG & {
result: SGResult.WHITEWON;
isRed: false;
};
export declare type SGEoGNoGame = _SGEoG & {
result: SGResult.NOGAME;
};
export declare function openingState(boardState: BoardState, dicePip: DicePip | undefined, movesForDouble?: number): SGOpening;
export declare function inPlayStateRed(boardState: BoardState, dices: DiceRoll, movesForDouble?: number): SGInPlayRed;
export declare function inPlayStateRedFromNode(boardStateNode: BoardStateNode, curPly: Ply, revertTo: BoardStateNode, movesForDouble: number): SGInPlayRed;
export declare function inPlayStateWhite(boardState: BoardState, dices: DiceRoll, movesForDouble?: number): SGInPlayWhite;
export declare function toRollStateRed(boardState: BoardState, lastPly?: Ply, movesForDouble?: number): SGToRollRed;
export declare function toRollStateWhite(boardState: BoardState, lastPly?: Ply, movesForDouble?: number): SGToRollWhite;
export declare function eogStateRed(stakeValue: number, eogStatus: EOGStatus, absBoard: AbsoluteBoardState, boardState: BoardState): SGEoGRedWon;
export declare function eogStateWhite(stakeValue: number, eogStatus: EOGStatus, absBoard: AbsoluteBoardState, boardState: BoardState): SGEoGWhiteWon;
export declare function eogStateNogame(eogStatus: EOGStatus, absBoard: AbsoluteBoardState, boardState: BoardState): SGEoG;
export {};
//# sourceMappingURL=SingleGameState.d.ts.map