defineGame
defineGame<
S,O,PN,AN,A,PAN,P,V,R,ID,OI>(config):Game<S,O,PN,AN,A,PAN,P,V,R,ID,OI>
Defined in: core/define.ts:412
Defines a game. Checks the definition eagerly so mistakes surface at startup, not at the first action.
export const ticTacToe = defineGame({ id: 'tic-tac-toe', seats: { min: 2, max: 2 }, setup: () => ({ board: Array<'X' | 'O' | null>(9).fill(null) }), turns: { order: 'round-robin' }, actions: { place: { input: z.object({ cell: z.number() }), run({ state, input }) {} } },});Type Parameters
Section titled “Type Parameters”S
O = undefined
PN extends string = string
AN extends string = never
A = unknown
PAN extends string = never
P = unknown
V = S
R = Json
ID extends string = string
OI = O
Parameters
Section titled “Parameters”config
Section titled “config”GameConfig<S, O, PN, AN, A, PAN, P, V, R> & object
Returns
Section titled “Returns”Game<S, O, PN, AN, A, PAN, P, V, R, ID, OI>
