@gamepark/rules-api
Version:
API to implement the rules of a board game
15 lines (14 loc) • 1.15 kB
TypeScript
import { Rules } from './Rules';
export interface IncompleteInformation<GameView = any, Move = any, MoveView = any> {
getView(): GameView;
getMoveView(move: Move): MoveView;
}
export declare function hasIncompleteInformation<GameView = any, Move = any, MoveView = any>(rules: Object): rules is IncompleteInformation<GameView, Move, MoveView>;
export interface SecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any> extends IncompleteInformation<GameView, Move, MoveView> {
getPlayerView(playerId: PlayerId): GameView;
getPlayerMoveView?(move: Move, playerId: PlayerId): MoveView;
keepMoveSecret?(move: Move, playerId: PlayerId): boolean;
}
export declare function hasSecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any>(rules: Object): rules is SecretInformation<GameView, Move, MoveView, PlayerId>;
export declare function getGameView<Game, GameView, PlayerId>(rules: Rules<Game, any, PlayerId>, playerId?: PlayerId): GameView;
export declare function getMoveView<GameView, Move, MoveView, PlayerId>(rules: Rules<any, Move, PlayerId>, move: Move, playerId?: PlayerId): MoveView;