fix(SCOPONE-0008): complete iteration 1 remove ai lag
This commit is contained in:
43
src/game/ai-worker-protocol.ts
Normal file
43
src/game/ai-worker-protocol.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user