File size: 1,891 Bytes
3568151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { Chess, Square, Move, Color, PieceSymbol } from 'chess.js'

export type { Chess, Square, Move, Color, PieceSymbol }

export interface ChessPiece {
  type: PieceSymbol
  color: Color
}

export interface GameState {
  board: Chess
  gameActive: boolean
  playerColor: Color
  selectedSquare: Square | null
  legalMoves: Move[]
  gameHistory: GameHistoryEntry[]
  gameOver: boolean
  gameResult: GameResult | null
  promotionMove: Move | null
  promotionDialogActive: boolean
  aiThinking: boolean
  aiModelLoaded: boolean
  aiModelLoading: boolean
}

export interface GameHistoryEntry {
  move: string
  moveData: Move
  player: 'Human' | 'AI'
  timestamp: Date
  capturedPiece?: ChessPiece
}

export interface GameResult {
  isGameOver: boolean
  winner: Color | null
  message: string
  terminationReason: string
  details?: string
}

export interface DraggedPiece {
  piece: ChessPiece
  square: Square
}

export interface SquarePosition {
  x: number
  y: number
}

export interface AudioSettings {
  enabled: boolean
  volume: number
}

export enum GameTermination {
  CHECKMATE = 'checkmate',
  STALEMATE = 'stalemate',
  INSUFFICIENT_MATERIAL = 'insufficient_material',
  THREEFOLD_REPETITION = 'threefold_repetition',
  FIFTY_MOVE_RULE = 'fifty_move_rule',
  RESIGNATION = 'resignation',
  TIMEOUT = 'timeout'
}

export interface PieceFrequencies {
  [key: string]: number
}

export interface AudioEngineConfig {
  sampleRate: number
  volume: number
  enabled: boolean
}

export const CHESS_MODELS: string[] = [
  'mlabonne/chesspythia-70m',
  'EleutherAI/pythia-70m-deduped',
  'nlpguy/amdchess-v9',
  'mlabonne/grandpythia-200k-70m',
  'facebook/opt-125m',
  'bharathrajcl/chess_llama_68m',
  'Locutusque/TinyMistral-248M-v2.5',
  'Q-bert/ChessGPT',
  'nlpguy/smolchess-v2',
  'nlpguy/amdchess-v2',
  'amd/AMD-Llama-135m',
  'nlpguy/amdchess-v5',
  'distilbert/distilgpt2'
]