Skip to content

Game Interface

Every Ludus game implements the Game<TState, TAction> generic interface. This enables the protocol to run any game through the same engine, record deterministic replays, and generate commentary — without knowing anything about the game’s specific rules.

interface Game<TState, TAction> {
id: string;
name: string;
minPlayers: number;
maxPlayers: number;
initialize(config: GameConfig): TState;
getValidActions(state: TState, playerId: string): TAction[];
applyAction(state: TState, action: TAction): TState;
isTerminal(state: TState): boolean;
getWinner(state: TState): string | null;
getScore(state: TState, playerId: string): number;
}

See Game Engine SDK for the full API reference.