extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
1// Shared ATProto record shapes for boo.sky.go.* lexicons
2
3export interface GameRecord {
4 $type: 'boo.sky.go.game';
5 playerOne: string;
6 playerTwo?: string;
7 boardSize: number;
8 status: 'waiting' | 'active' | 'completed';
9 winner?: string;
10 blackScore?: number;
11 whiteScore?: number;
12 blackScorer?: string;
13 whiteScorer?: string;
14 deadStones?: string[]; // Format: ["bA01", "wT19"]
15 handicap?: number;
16 handicapStones?: Array<{ x: number; y: number }>;
17 createdAt: string;
18}
19
20export interface MoveRecord {
21 $type: 'boo.sky.go.move';
22 uri?: string; // AT URI of this move record (populated when fetching)
23 game: string; // AT URI of the game
24 player: string;
25 moveNumber: number;
26 x: number;
27 y: number;
28 color: 'black' | 'white';
29 captureCount: number;
30 createdAt: string;
31}
32
33export interface PassRecord {
34 $type: 'boo.sky.go.pass';
35 game: string; // AT URI of the game
36 player: string;
37 moveNumber: number;
38 color: 'black' | 'white';
39 createdAt: string;
40}
41
42export interface ResignRecord {
43 $type: 'boo.sky.go.resign';
44 game: string; // AT URI of the game
45 player: string;
46 color: 'black' | 'white';
47 createdAt: string;
48}
49
50export interface ReactionRecord {
51 $type: 'boo.sky.go.reaction';
52 game: string; // AT URI of the game
53 move: string; // AT URI of the move being reacted to
54 emoji?: string;
55 text: string;
56 stars?: number; // 1-5
57 createdAt: string;
58}
59
60export interface ProfileRecord {
61 $type: 'boo.sky.go.profile';
62 wins: number;
63 losses: number;
64 ranking: number;
65 status: 'playing' | 'watching' | 'offline';
66 createdAt: string;
67 updatedAt?: string;
68}
69
70// Convert (x, y, color) to board notation with zero-padded numbers
71export function coordsToNotation(x: number, y: number, color: 'black' | 'white'): string {
72 const col = String.fromCharCode(65 + x); // 0=A, 1=B, etc.
73 const row = (y + 1).toString().padStart(2, '0'); // 0-indexed to 1-indexed, zero-padded
74 return `${color === 'black' ? 'b' : 'w'}${col}${row}`;
75}
76
77// Convert board notation to (x, y, color)
78export function notationToCoords(notation: string): { x: number, y: number, color: 'black' | 'white' } {
79 const color = notation[0] === 'b' ? 'black' : 'white';
80 const col = notation.charCodeAt(1) - 65; // A=0, B=1, etc.
81 const row = parseInt(notation.slice(2)) - 1; // 1-indexed to 0-indexed
82 return { x: col, y: row, color };
83}