feat(bot): scaffold Brain interface and types

This commit is contained in:
claude (blind_chess)
2026-04-28 13:38:16 -04:00
parent 6d457a2321
commit bc954f4748
2 changed files with 50 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import type {
Announcement,
BoardView,
Color,
PromotionType,
Square,
} from '@blind-chess/shared';
import type { ModeratorText } from '@blind-chess/shared';
export interface CandidateMove {
from: Square;
to: Square;
promotion?: PromotionType;
}
export interface AttemptHistoryEntry {
move: CandidateMove;
rejection: ModeratorText;
}
export interface BrainInput {
view: BoardView;
newAnnouncements: Announcement[];
legalCandidates: CandidateMove[];
attemptHistory: AttemptHistoryEntry[];
drawOfferFromOpponent: boolean;
ply: number;
}
export type BrainAction =
| { type: 'commit'; from: Square; to: Square; promotion?: PromotionType }
| { type: 'resign' }
| { type: 'offer-draw' }
| { type: 'respond-draw'; accept: boolean };
export interface BrainInitArgs {
color: Color;
mode: 'blind' | 'vanilla';
gameId: string;
}
export interface Brain {
init(args: BrainInitArgs): Promise<void>;
decide(input: BrainInput): Promise<BrainAction>;
dispose?(): Promise<void>;
}
+4
View File
@@ -0,0 +1,4 @@
export type {
Brain, BrainInput, BrainAction, BrainInitArgs,
CandidateMove, AttemptHistoryEntry,
} from './brain.js';