import { BackgammonColor } from './game'; /** * Request to offer a double to the opponent. * Sent by the active player before rolling dice. */ export interface OfferDoubleRequest { gameId: string; playerId: string; } /** * Response after successfully offering a double. * Contains the updated game state with cube in 'offered' state. */ export interface OfferDoubleResponse { gameId: string; offeredCubeValue: number; currentCubeValue: number | undefined; offeringPlayerId: string; offeringPlayerColor: BackgammonColor; targetPlayerId: string; targetPlayerColor: BackgammonColor; } /** * Request to accept an offered double. * Sent by the player who received the double offer. */ export interface AcceptDoubleRequest { gameId: string; playerId: string; } /** * Response after successfully accepting a double. * Contains the updated game state with new cube value and ownership. */ export interface AcceptDoubleResponse { gameId: string; newCubeValue: number; newCubeOwnerId: string; newCubeOwnerColor: BackgammonColor; previousCubeValue: number | undefined; } /** * Request to decline an offered double. * Sent by the player who received the double offer. * Declining ends the game immediately with the offering player as winner. */ export interface DeclineDoubleRequest { gameId: string; playerId: string; } /** * Response after declining a double. * Contains the final game state with winner information. */ export interface DeclineDoubleResponse { gameId: string; winnerId: string; winnerColor: BackgammonColor; finalCubeValue: number; reason: 'double-declined'; } export interface DoubleOfferedEvent { gameId: string; offeringPlayerId: string; offeringPlayerColor: BackgammonColor; targetPlayerId: string; targetPlayerColor: BackgammonColor; currentCubeValue: number | undefined; offeredCubeValue: number; timestamp: string; } export interface DoubleAcceptedEvent { gameId: string; acceptingPlayerId: string; acceptingPlayerColor: BackgammonColor; newCubeValue: number; newCubeOwnerId: string; timestamp: string; } export interface DoubleDeclinedEvent { gameId: string; decliningPlayerId: string; decliningPlayerColor: BackgammonColor; winnerId: string; winnerColor: BackgammonColor; finalCubeValue: number; timestamp: string; } /** * Union of all doubling WebSocket events */ export type DoublingWebSocketEvent = { type: 'double-offered'; payload: DoubleOfferedEvent; } | { type: 'double-accepted'; payload: DoubleAcceptedEvent; } | { type: 'double-declined'; payload: DoubleDeclinedEvent; }; export type DoublingErrorCode = 'INVALID_PLAYER' | 'INVALID_STATE' | 'CUBE_OWNED_BY_OPPONENT' | 'CUBE_MAXED' | 'NOT_TURN_START' | 'ALREADY_OFFERED' | 'NO_DOUBLE_TO_ACCEPT' | 'NO_DOUBLE_TO_DECLINE' | 'CRAWFORD_GAME'; export declare const DoublingErrorMessages: Record; export interface DoublingError { code: DoublingErrorCode; message: string; gameId?: string; playerId?: string; } /** * Position evaluation metrics used for doubling decisions */ export interface PositionEvaluation { winProbability: number; gammonChance: number; backgammonChance: number; loseGammonChance: number; position: 'winning' | 'losing' | 'even'; volatility: 'low' | 'medium' | 'high'; equity: number; } /** * Criteria thresholds for making doubling decisions */ export interface DoublingCriteria { minimumWinProbability: number; minimumEquityGain: number; minimumTakePoint: number; gammonConsideration: number; volatilityBonus: number; matchContextMultiplier: number; } /** * Result of robot's doubling decision analysis */ export interface DoublingDecision { shouldOffer: boolean; shouldAccept: boolean; confidence: number; reasoning: string; positionEvaluation: PositionEvaluation; criteria: DoublingCriteria; } /** * Default criteria for robot doubling decisions (money game defaults) */ export declare const DefaultDoublingCriteria: DoublingCriteria; //# sourceMappingURL=doubling.d.ts.map