// Shared ATProto record shapes for boo.sky.go.* lexicons export interface GameRecord { $type: 'boo.sky.go.game'; playerOne: string; playerTwo?: string; boardSize: number; status: 'waiting' | 'active' | 'completed'; winner?: string; blackScore?: number; whiteScore?: number; blackScorer?: string; whiteScorer?: string; deadStones?: string[]; // Format: ["bA01", "wT19"] handicap?: number; handicapStones?: Array<{ x: number; y: number }>; createdAt: string; } export interface MoveRecord { $type: 'boo.sky.go.move'; uri?: string; // AT URI of this move record (populated when fetching) game: string; // AT URI of the game player: string; moveNumber: number; x: number; y: number; color: 'black' | 'white'; captureCount: number; createdAt: string; } export interface PassRecord { $type: 'boo.sky.go.pass'; game: string; // AT URI of the game player: string; moveNumber: number; color: 'black' | 'white'; createdAt: string; } export interface ResignRecord { $type: 'boo.sky.go.resign'; game: string; // AT URI of the game player: string; color: 'black' | 'white'; createdAt: string; } export interface ReactionRecord { $type: 'boo.sky.go.reaction'; game: string; // AT URI of the game move: string; // AT URI of the move being reacted to emoji?: string; text: string; stars?: number; // 1-5 createdAt: string; } export interface ProfileRecord { $type: 'boo.sky.go.profile'; wins: number; losses: number; ranking: number; status: 'playing' | 'watching' | 'offline'; createdAt: string; updatedAt?: string; } // Convert (x, y, color) to board notation with zero-padded numbers export function coordsToNotation(x: number, y: number, color: 'black' | 'white'): string { const col = String.fromCharCode(65 + x); // 0=A, 1=B, etc. const row = (y + 1).toString().padStart(2, '0'); // 0-indexed to 1-indexed, zero-padded return `${color === 'black' ? 'b' : 'w'}${col}${row}`; } // Convert board notation to (x, y, color) export function notationToCoords(notation: string): { x: number, y: number, color: 'black' | 'white' } { const color = notation[0] === 'b' ? 'black' : 'white'; const col = notation.charCodeAt(1) - 65; // A=0, B=1, etc. const row = parseInt(notation.slice(2)) - 1; // 1-indexed to 0-indexed return { x: col, y: row, color }; }