할리갈리·도블·사과 게임: 뒤집기 시간 무제한·사과 게임 무제한(여기까지), 소리·움직임

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 04:16:54 +09:00
parent f12cf12b84
commit bafbf95d98
13 changed files with 476 additions and 94 deletions

View File

@@ -80,7 +80,7 @@ describe('판 만들기', () => {
}
const s = make(['A', 'B', 'C']);
expect(new Set(Object.values(s.boards))).toEqual(new Set([s.initial]));
expect(s.endsAt).toBe(START + 120_000);
expect(s.endsAt!).toBe(START + 120_000);
expect(make(['A'], { timeLimitSec: 60 }).endsAt).toBe(START + 60_000);
});
@@ -160,10 +160,10 @@ describe('진행', () => {
s = act(s, 'A', sel(m1!), START + 1000);
s = act(s, 'B', sel(m1!), START + 1000);
s = act(s, 'B', sel(findMoves(s.boards.B!)[0]!), START + 2000);
expect(apple.deadline!(s)).toBe(s.endsAt);
expect(apple.timeoutNotBefore!(s)).toBe(s.endsAt);
expect(reason(s, 'C', sel(m1!), s.endsAt)).toBe('시간이 다 됐어요.');
s = tick(s, s.endsAt);
expect(apple.deadline!(s)).toBe(s.endsAt!);
expect(apple.timeoutNotBefore!(s)).toBe(s.endsAt!);
expect(reason(s, 'C', sel(m1!), s.endsAt!)).toBe('시간이 다 됐어요.');
s = tick(s, s.endsAt!);
expect(s.phase).toBe('ended');
const r = apple.result(s)!;
expect(r.ranking).toEqual([['B'], ['A'], ['C']]);
@@ -178,7 +178,7 @@ describe('진행', () => {
let s = make(['A']);
s = tick(s, START);
s = act(s, 'A', sel(findMoves(s.initial)[0]!), START + 500);
s = tick(s, s.endsAt + 5);
s = tick(s, s.endsAt! + 5);
const r = apple.result(s)!;
expect(r.ranking).toEqual([['A']]);
expect(r.summary).toBe(`시간이 다 됐어요. 사과 ${s.score.A}개를 지웠어요`);
@@ -220,7 +220,8 @@ describe('진행', () => {
expect(solo.phase).toBe('ended');
});
test('클라이언트 액션 스키마에는 select만(tick/leave는 시스템 전용)', () => {
test('클라이언트 액션 스키마에는 select·stop만(tick/leave는 시스템 전용)', () => {
expect(apple.actionSchema.safeParse({ type: 'stop' }).success).toBe(true);
expect(apple.actionSchema.safeParse({ type: 'tick' }).success).toBe(false);
expect(apple.actionSchema.safeParse({ type: 'leave' }).success).toBe(false);
expect(apple.actionSchema.safeParse({ type: 'select', r0: 0, c0: 0, r1: 9, c1: 16 }).success).toBe(true);
@@ -229,6 +230,47 @@ describe('진행', () => {
});
});
describe('제한 시간 무제한', () => {
test('마감 없음: 모두 막히거나 「여기까지」하면 끝, 시간 제한 방에서는 여기까지 거절', () => {
let s = make(['A', 'B'], { timeLimitSec: null });
expect(s.endsAt).toBeNull();
expect(apple.deadline!(s)).toBe(s.countdownEndsAt);
expect(reason(s, 'A', { type: 'stop' }, T0 + 100)).toBe('곧 시작해요. 잠시만 기다려 주세요.');
s = tick(s, START);
expect(s.phase).toBe('playing');
expect(s.status.A).toBe('playing'); // the start tick is not an away tick
expect(apple.deadline!(s)).toBeNull();
expect(apple.timeoutNotBefore!(s)).toBeNull();
// Hours later the board still takes moves.
const m = findMoves(s.initial)[0]!;
s = act(s, 'A', sel(m), START + 3_600_000);
expect(s.score.A).toBeGreaterThan(0);
s = act(s, 'A', { type: 'stop' }, START + 3_600_100);
expect(s.status.A).toBe('done');
expect(reason(s, 'A', { type: 'stop' }, START + 3_600_200)).toBe('이미 끝냈어요.');
expect(apple.activePlayers(s)).toEqual(['B']);
expect(apple.timeoutPlayers!(s)).toEqual(['B']);
s = act(s, 'B', { type: 'stop' }, START + 3_600_300);
expect(s.phase).toBe('ended');
const r = apple.result(s)!;
expect(r.ranking).toEqual([['A'], ['B']]);
expect(r.summary).toContain('모두 끝냈어요');
expect(reason(tick(make(['A']), START), 'A', { type: 'stop' }, START + 10)).toBe('제한 시간이 있는 방에서는 끝날 때까지 해요.');
});
test('자리 비움: 방이 유예 뒤 tick을 보내면 그 사람은 여기까지(점수 유지), 혼자면 바로 끝', () => {
let s = tick(make(['A', 'B'], { timeLimitSec: null }), START);
s = act(s, 'B', sel(findMoves(s.initial)[0]!), START + 500);
s = apple.apply(s, 'B', { type: 'tick' }, { rng: rng(), now: START + 60_000 }).state;
expect(s.status.B).toBe('done');
expect(s.score.B).toBeGreaterThan(0);
expect(s.phase).toBe('playing');
const solo = apple.apply(tick(make(['A'], { timeLimitSec: null }), START), 'A', { type: 'tick' }, { rng: rng(), now: START + 60_000 }).state;
expect(solo.phase).toBe('ended');
expect(apple.result(solo)!.summary).toBe('여기까지 했어요. 사과 0개를 지웠어요');
});
});
describe('무작위 대국', () => {
test.each([1, 2, 5, 8])('%i명: 엔진 randomPlayout(유출·JSON·결정성) 끝까지', (n) => {
const players = Array.from({ length: n }, (_, i) => `p${i + 1}`);
@@ -244,4 +286,11 @@ describe('무작위 대국', () => {
for (const p of players) expect(s.score[p]).toBe([...s.boards[p]!].filter((c) => c === '0').length);
}
});
test.each([1, 3])('무제한 %i명: 끝까지(여기까지·자리 비움 tick 포함)', (n) => {
const players = Array.from({ length: n }, (_, i) => `p${i + 1}`);
for (let i = 0; i < playoutSeeds(10); i++) {
const a = randomPlayout(apple, { players, options: apple.optionsSchema.parse({ timeLimitSec: null }), seed: seedN(900 + n * 10 + i), maxSteps: 1000, maxApplyMs: 20 });
expect(a.finished).toBe(true);
}
});
});

View File

@@ -133,7 +133,7 @@ interface Ctx {
events: GameEvent[];
}
const inGame = (s: S, p: PlayerId) => s.status[p] === 'playing' || s.status[p] === 'stuck';
const inGame = (s: S, p: PlayerId) => s.status[p] !== 'left';
/** The countdown is over (the room timer may not have ticked yet). */
const started = (s: S, now: number | undefined) => s.phase === 'playing' || (s.phase === 'countdown' && now !== undefined && now >= s.countdownEndsAt);
@@ -148,7 +148,15 @@ function catchUp(s: S, ctx: Ctx): void {
s.phase = 'playing';
ctx.events.push({ type: 'start' });
}
if (s.phase === 'playing' && ctx.now >= s.endsAt) finish(s, 'time', ctx);
if (s.phase === 'playing' && s.endsAt !== null && ctx.now >= s.endsAt) finish(s, 'time', ctx);
}
/** 무제한: a player stops (「여기까지」, or the room timed them out while away); the game ends when nobody is still playing. */
function stop(s: S, p: PlayerId, ctx: Ctx): void {
if (s.status[p] !== 'playing') return;
s.status[p] = 'done';
ctx.events.push({ type: 'done', player: p });
if (s.order.every((q) => s.status[q] !== 'playing')) finish(s, 'cleared', ctx);
}
function select(s: S, p: PlayerId, a: SelectAction, ctx: Ctx): void {
@@ -209,10 +217,15 @@ function finish(s: S, reason: EndReason, ctx: Ctx): void {
let summary: string;
if (s.order.length === 1) {
const n = ranking[0]!.score;
summary = reason === 'cleared' ? `더 지울 사과가 없어요. 사과 ${n}개를 지웠어요` : `시간이 다 됐어요. 사과 ${n}개를 지웠어요`;
const why = s.status[s.order[0]!] === 'done' ? '여기까지 했어요.' : '더 지울 사과가 없어요.';
summary = reason === 'cleared' ? `${why} 사과 ${n}개를 지웠어요` : `시간이 다 됐어요. 사과 ${n}개를 지웠어요`;
} else if (reason === 'left') summary = '다른 사람이 모두 나가서 남은 사람이 이겼어요';
else {
summary = reason === 'cleared' ? '모두 더 지울 사과가 없어요. 가장 많이 지운 사람이 이겼어요' : '시간이 다 됐어요. 사과를 가장 많이 지운 사람이 이겼어요';
const anyDone = s.order.some((p) => s.status[p] === 'done');
summary =
reason === 'cleared'
? `${anyDone ? '모두 끝냈어요' : '모두 더 지울 사과가 없어요'}. 가장 많이 지운 사람이 이겼어요`
: '시간이 다 됐어요. 사과를 가장 많이 지운 사람이 이겼어요';
if (top.length > 1) summary += ` (공동 1등 ${top.length}명)`;
}
s.final = { endReason: reason, ranking, summary } satisfies AppleFinal;
@@ -250,7 +263,7 @@ export const apple: Def = {
recent: per0<number[]>(() => []),
phase: 'countdown',
countdownEndsAt,
endsAt: countdownEndsAt + options.timeLimitSec * 1000,
endsAt: options.timeLimitSec === null ? null : countdownEndsAt + options.timeLimitSec * 1000,
final: null,
};
},
@@ -264,10 +277,14 @@ export const apple: Def = {
return ok;
case 'leave':
return inGame(s, actor) ? ok : fail('이미 게임에서 빠졌어요.');
case 'stop':
if (s.endsAt !== null) return fail('제한 시간이 있는 방에서는 끝날 때까지 해요.');
if (!started(s, now)) return fail('곧 시작해요. 잠시만 기다려 주세요.');
return s.status[actor] === 'playing' ? ok : fail('이미 끝냈어요.');
case 'select': {
if (s.status[actor] === 'left') return fail('게임에서 빠졌어요.');
if (!started(s, now)) return fail('곧 시작해요. 잠시만 기다려 주세요.');
if (now !== undefined && now >= s.endsAt) return fail('시간이 다 됐어요.');
if (now !== undefined && s.endsAt !== null && now >= s.endsAt) return fail('시간이 다 됐어요.');
if (s.status[actor] === 'stuck') return fail('더 지울 수 있는 사과가 없어요.');
if (!rateOk(s.recent[actor], now)) return fail('조금 천천히 해 주세요.');
const { sum, count } = rectSum(s.boards[actor]!, a);
@@ -281,10 +298,14 @@ export const apple: Def = {
apply(prev, actor, a, { now }) {
const s = clone(prev);
const ctx: Ctx = { now, events: [] };
const wasPlaying = prev.phase === 'playing';
catchUp(s, ctx);
if (s.phase !== 'ended') {
if (a.type === 'leave') leave(s, actor, ctx);
else if (a.type === 'select' && s.phase === 'playing') select(s, actor, a, ctx);
else if (a.type === 'stop' && s.phase === 'playing') stop(s, actor, ctx);
// 무제한: nothing is due during play, so a tick there means the room timed this player out while away.
else if (a.type === 'tick' && wasPlaying && s.endsAt === null) stop(s, actor, ctx);
}
return { state: s, events: ctx.events };
},
@@ -316,9 +337,13 @@ export const apple: Def = {
return s.phase === 'countdown' ? s.countdownEndsAt : s.endsAt;
},
/** Everyone still in drives the clock (a stuck player too: they wait for the end like everybody else). */
/**
* Everyone still in drives the clock (a stuck player too: they wait for the end like everybody else).
* 무제한 after the start: only those still playing (an away one is stopped after the room's grace period).
*/
timeoutPlayers(s) {
if (s.phase === 'ended') return [];
if (s.phase === 'playing' && s.endsAt === null) return s.order.filter((p) => s.status[p] === 'playing');
return s.order.filter((p) => inGame(s, p));
},
@@ -351,12 +376,13 @@ export const apple: Def = {
};
},
/** Test helper: the clock tick and the first few rectangles that add up to 10. */
/** Test helper: the clock tick, the first few rectangles that add up to 10 and (무제한) 「여기까지」. */
legalActions(s, p) {
if (s.phase === 'ended' || !s.order.includes(p)) return [];
const out: A[] = [{ type: 'tick' }];
if (s.phase === 'playing' && s.status[p] === 'playing') {
for (const m of findMoves(s.boards[p]!, 8)) out.push({ type: 'select', ...m });
if (s.endsAt === null) out.push({ type: 'stop' });
}
return out.filter((x) => apple.validate(s, p, x).ok);
},

View File

@@ -8,29 +8,33 @@ export const COLS = 17;
export const CELLS = ROWS * COLS;
export const TARGET = 10;
const lit = <T extends number>(...vals: T[]) =>
const lit = <T extends number | null>(...vals: T[]) =>
z.union(vals.map((v) => z.literal(v)) as unknown as [z.ZodLiteral<T>, z.ZodLiteral<T>, ...z.ZodLiteral<T>[]]);
export const appleOptionsSchema = z.object({
timeLimitSec: lit<60 | 120 | 180>(60, 120, 180)
/** null = 무제한: everyone plays until they run out of moves or press 「여기까지」 (`stop`). */
timeLimitSec: lit<60 | 120 | 180 | null>(60, 120, 180, null)
.default(120)
.meta({ title: '제한 시간', labels: { 60: '1분', 120: '2분', 180: '3분' } }),
.meta({ title: '제한 시간', labels: { 60: '1분', 120: '2분', 180: '3분', null: '무제한(모두 끝낼 때까지)' } }),
});
export type AppleOptions = z.infer<typeof appleOptionsSchema>;
/** A rectangle by two opposite corners (any order), rows 0..9, columns 0..16. */
export const appleActionSchema = z.object({
const selectSchema = z.object({
type: z.literal('select'),
r0: z.number().int().min(0).max(ROWS - 1),
c0: z.number().int().min(0).max(COLS - 1),
r1: z.number().int().min(0).max(ROWS - 1),
c1: z.number().int().min(0).max(COLS - 1),
});
export type SelectAction = z.infer<typeof appleActionSchema>;
/** Client action plus system-only ones (server timer, leaving) that are not in the schema. */
export type AppleAction = SelectAction | { type: 'tick' } | { type: 'leave' };
/** `stop` = 「여기까지」: only with no time limit, ends my game with the score I have. */
export const appleActionSchema = z.discriminatedUnion('type', [selectSchema, z.object({ type: z.literal('stop') })]);
export type SelectAction = z.infer<typeof selectSchema>;
/** Client actions plus system-only ones (server timer, leaving) that are not in the schema. */
export type AppleAction = z.infer<typeof appleActionSchema> | { type: 'tick' } | { type: 'leave' };
export type SeatStatus = 'playing' | 'stuck' | 'left';
/** `done` = stopped by choice (무제한 「여기까지」) or away past the grace period in a game without a time limit. */
export type SeatStatus = 'playing' | 'stuck' | 'done' | 'left';
export type EndReason = 'time' | 'cleared' | 'left';
export interface RankRow {
@@ -61,7 +65,8 @@ export interface AppleState {
recent: Record<PlayerId, number[]>;
phase: 'countdown' | 'playing' | 'ended';
countdownEndsAt: number;
endsAt: number;
/** null = 무제한. */
endsAt: number | null;
final: AppleFinal | null;
}
@@ -81,7 +86,7 @@ export interface AppleView {
/** My board (CELLS digits, '0' = cleared); null for spectators and during the countdown. */
cells: string | null;
countdownEndsAt: number;
endsAt: number;
endsAt: number | null;
seats: SeatView[];
result: AppleFinal | null;
}

View File

@@ -10,6 +10,7 @@ import {
allCardIds,
cardOf,
fiveFruit,
flipMs,
halliGalli as hg,
type Fruit,
type HalliGalliAction,
@@ -94,7 +95,8 @@ function rig(
s.phase = 'playing';
s.turn = r.turn ?? players[0]!;
s.turnStartedAt = now;
s.turnDeadline = now + s.options.flipSeconds * 1000 * (s.options.kidMode ? 8 / s.options.flipSeconds : 1);
const ms = flipMs(s.options);
s.turnDeadline = ms === null ? null : now + ms;
s.flipAllowedAt = now;
s.pendingFlip = null;
s.tableVersion = 5;
@@ -388,11 +390,35 @@ describe('뒤집기와 시간 (§5.1, §8.5)', () => {
expect(n.turnDeadline).toBe(START + 4000);
});
test('뒤집기 시간 무제한: 기다리다가 직접 뒤집기, 끊기면 방의 유예 뒤 자동, 자동 뒤집기는 3초 간격', () => {
const s = rig(['A', 'B'], { decks: { A: [3, 3], B: [3, 3] }, turn: 'A' }, { flipSeconds: null, timeLimitMin: null });
expect(s.turnDeadline).toBeNull();
expect(hg.deadline!(s)).toBeNull();
expect(hg.view(s, 'A').flipTotalMs).toBeNull();
// A non-turn tick (someone else's clock) does nothing however late it is.
const idle = act(s, 'B', { type: 'tick' }, START + 600_000);
expect(idle.faceUp.A).toHaveLength(0);
// A flips when ready; B's turn also has no deadline.
const n = act(s, 'A', { type: 'flip' }, START + 60_000);
expect(n.faceUp.A).toHaveLength(1);
expect(n.turn).toBe('B');
expect(n.turnDeadline).toBeNull();
expect(hg.deadline!(n)).toBeNull();
// The room times out an away turn player (its own grace period): that still flips.
const away = act(n, 'B', { type: 'tick' }, START + 120_000);
expect(away.faceUp.B).toHaveLength(1);
// 무제한 + 자동 뒤집기 keeps a 3-second pace (어린이 모드 8초).
const auto = rig(['A', 'B'], { decks: { A: [3], B: [3] }, turn: 'A' }, { flipSeconds: null, autoFlip: true });
expect(auto.turnDeadline).toBe(START + 3000);
expect(flipMs({ ...auto.options, kidMode: true })).toBe(8000);
expect(flipMs({ ...s.options, kidMode: true })).toBeNull();
});
test('시간 제한 만료: 보유 카드(덱 + 자기 공개 더미) 순, 동점은 정답 횟수, 그래도 같으면 공동', () => {
const s = rig(['A', 'B', 'C', 'D'], { decks: { A: [3], B: [5], C: [4], D: [4] }, faceUp: { A: ['S1', 'S1'], C: ['P1'], D: ['P1'] }, turn: 'A' }, { timeLimitMin: 5 });
s.correctCount = { A: 0, B: 0, C: 2, D: 2 };
// A 5 (3 + 2), B 5, C 5, D 5 → A,B (0 correct) below C,D (2 correct)
expect(hg.deadline!(s)).toBe(Math.min(s.endsAt!, s.turnDeadline));
expect(hg.deadline!(s)).toBe(Math.min(s.endsAt!, s.turnDeadline!));
const n = act(s, 'B', ringA(s), s.endsAt!); // any action at/after the end time ends the game first
expect(n.phase).toBe('ended');
expect(n.final!.endReason).toBe('timeLimit');
@@ -657,6 +683,8 @@ const PRESETS: Partial<HalliGalliOptions>[] = [
{ penaltyEscalation: true, strikeOut: true, timeLimitMin: 5 },
{ wrongToPot: true, autoFlip: true, flipGuardMs: 400, wrongRingLockoutMs: 0 },
{ duelWrongLoses: true, kidMode: true, timeLimitMin: 15 },
{ flipSeconds: null, kidMode: true },
{ flipSeconds: null, autoFlip: true, timeLimitMin: null },
];
describe('random playouts (§10, docs/09 §7)', () => {

View File

@@ -34,7 +34,15 @@ export const AWAY_FLIP_MS = 1000;
const LOG_KEEP = 30;
const POINTS = [3, 2, 1];
export const flipMs = (o: HalliGalliOptions): number => (o.kidMode ? 8 : o.flipSeconds) * 1000;
/** Flip time limit in ms; null = 무제한 (자동 뒤집기 still needs a pace: 3 s, 어린이 모드 8 s). */
export function flipMs(o: HalliGalliOptions): number | null {
if (o.flipSeconds === null) return o.autoFlip ? (o.kidMode ? 8 : 3) * 1000 : null;
return (o.kidMode ? 8 : o.flipSeconds) * 1000;
}
const deadlineFrom = (o: HalliGalliOptions, from: number): number | null => {
const ms = flipMs(o);
return ms === null ? null : from + ms;
};
/** Public key of a visible card; secretsOf uses the same form so leak checks are meaningful. */
export const cardKey = (id: number): string => `hg${id}`;
@@ -116,7 +124,7 @@ function othersClockwise(s: S, p: PlayerId): PlayerId[] {
function startTurn(s: S, p: PlayerId, now: number): void {
s.turn = p;
s.turnStartedAt = now;
s.turnDeadline = now + flipMs(s.options);
s.turnDeadline = deadlineFrom(s.options, now);
s.pendingFlip = null;
}
@@ -327,7 +335,7 @@ function tick(s: S, actor: PlayerId, ctx: Ctx): void {
if (ctx.now >= s.ringWindow.openedAt + RING_WINDOW_MS) resolveWindow(s, ctx);
return;
}
const due = (s.pendingFlip !== null && ctx.now >= s.flipAllowedAt) || ctx.now >= Math.max(s.turnDeadline, s.flipAllowedAt);
const due = (s.pendingFlip !== null && ctx.now >= s.flipAllowedAt) || (s.turnDeadline !== null && ctx.now >= Math.max(s.turnDeadline, s.flipAllowedAt));
if (actor === s.turn || due) flipOrQueue(s, s.turn, ctx);
}
@@ -413,7 +421,7 @@ export const halliGalli: GameDefinition<S, A, HalliGalliView, HalliGalliOptions>
officialDuel: false,
turn: first,
turnStartedAt: now,
turnDeadline: countdownEndsAt + flipMs(options),
turnDeadline: deadlineFrom(options, countdownEndsAt),
flipAllowedAt: countdownEndsAt,
pendingFlip: null,
tableVersion: 0,
@@ -544,9 +552,9 @@ export const halliGalli: GameDefinition<S, A, HalliGalliView, HalliGalliOptions>
if (s.ringWindow) c.push(s.ringWindow.openedAt + RING_WINDOW_MS);
else {
if (s.pendingFlip) c.push(s.flipAllowedAt);
c.push(Math.max(s.turnDeadline, s.flipAllowedAt));
if (s.turnDeadline !== null) c.push(Math.max(s.turnDeadline, s.flipAllowedAt));
}
return Math.min(...c);
return c.length ? Math.min(...c) : null;
},
/** Only the turn player's clock drives the server tick (flips, guard, bell window, time limit). */

View File

@@ -35,9 +35,10 @@ export const halliGalliOptionsSchema = z.object({
timeLimitMin: lit<5 | 10 | 15 | null>(5, 10, 15, null)
.default(10)
.meta({ title: '전체 제한 시간', labels: { 5: '5분', 10: '10분', 15: '15분', null: '없음' } }),
flipSeconds: lit<2 | 3 | 5 | 8>(2, 3, 5, 8)
/** null = 무제한: the turn player flips whenever they like (자동 뒤집기 then keeps a 3-second pace, 어린이 모드 8). */
flipSeconds: lit<2 | 3 | 5 | 8 | null>(2, 3, 5, 8, null)
.default(3)
.meta({ title: '뒤집기 제한 시간', labels: { 2: '2초', 3: '3초', 5: '5초', 8: '8초' } }),
.meta({ title: '뒤집기 제한 시간', labels: { 2: '2초', 3: '3초', 5: '5초', 8: '8초', null: '무제한' } }),
autoFlip: z.boolean().default(false).meta({ title: '카드를 자동으로 뒤집기(뒤집기 버튼 없음)' }),
flipGuardMs: lit<400 | 600 | 1000>(400, 600, 1000)
.default(600)
@@ -135,7 +136,8 @@ export interface HalliGalliState {
officialDuel: boolean;
turn: PlayerId;
turnStartedAt: number;
turnDeadline: number;
/** null = 무제한 뒤집기 시간 (nobody flips for the turn player unless they are away). */
turnDeadline: number | null;
flipAllowedAt: number;
pendingFlip: PlayerId | null;
tableVersion: number;
@@ -188,8 +190,8 @@ export interface HalliGalliView {
removed: number;
countdownEndsAt: number;
turnStartedAt: number;
turnDeadline: number;
flipTotalMs: number;
turnDeadline: number | null;
flipTotalMs: number | null;
flipAllowedAt: number;
/** The turn player's flip is queued behind the flip guard / bell window. */
pendingFlip: boolean;