'use client';
import type { JSX } from 'react';
import { defaultPieces } from 'react-chessboard';
import { BotAvatar } from './Avatars';
import { TIME_CONTROLS } from '../core/chess';
export type ColorChoice = 'w' | 'random' | 'b';
export interface EngineInfo {
sims?: number;
elo?: number;
model?: string;
}
interface Props {
engine: EngineInfo | null;
offline: boolean;
color: ColorChoice;
onColor: (c: ColorChoice) => void;
timeControl: string;
onTimeControl: (id: string) => void;
onPlay: () => void;
onWatch: () => void;
}
const WhiteKing = defaultPieces.wK;
const BlackKing = defaultPieces.bK;
function RandomKing() {
return (
{engine?.elo ? `Rated about ${engine.elo}` : offline ? 'Engine offline' : 'Connecting to the engine'}
A transformer that learned chess from human games only, then searches{' '} {engine?.sims ? `${engine.sims} positions` : 'ahead'} before each move.
The engine's clock runs while it searches, so faster time controls press it too.
Can't reach the engine. Start the backend (see the README) and this page will connect on its own.
) : null}