43 lines
1008 B
TypeScript
43 lines
1008 B
TypeScript
import type { AIDecisionProgress, AIMove } from './ai';
|
|
import type { CardTrackerSnapshot } from './card-tracker';
|
|
import type { Difficulty, GameState, PlayerIndex } from './types';
|
|
|
|
export interface AIWorkerChooseMoveRequest {
|
|
type: 'choose-move';
|
|
requestId: string;
|
|
state: GameState;
|
|
playerIdx: PlayerIndex;
|
|
difficulty: Difficulty;
|
|
trackerSnapshot: CardTrackerSnapshot | null;
|
|
}
|
|
|
|
export interface AIWorkerProgressMessage {
|
|
type: 'progress';
|
|
requestId: string;
|
|
progress: AIDecisionProgress;
|
|
}
|
|
|
|
export interface AIWorkerResultMessage {
|
|
type: 'result';
|
|
requestId: string;
|
|
move: AIMove;
|
|
}
|
|
|
|
export interface AIWorkerSerializedError {
|
|
message: string;
|
|
name: string;
|
|
stack?: string;
|
|
}
|
|
|
|
export interface AIWorkerErrorMessage {
|
|
type: 'error';
|
|
requestId: string;
|
|
error: AIWorkerSerializedError;
|
|
}
|
|
|
|
export type AIWorkerRequestMessage = AIWorkerChooseMoveRequest;
|
|
|
|
export type AIWorkerResponseMessage =
|
|
| AIWorkerProgressMessage
|
|
| AIWorkerResultMessage
|
|
| AIWorkerErrorMessage; |