병합: wt2/g2-cards

This commit is contained in:
EJClaw
2026-10-13 13:37:59 +09:00
47 changed files with 2706 additions and 323 deletions

View File

@@ -28,7 +28,7 @@ function practice(options: Record<string, unknown> = {}) {
room.addBot('A');
room.configure('A', { options: { ...(room.config.options as object), ...options } });
expect(room.start('A')).toBeNull();
return { room, clock, msgs };
return { room, clock, msgs, a };
}
/** Bots move at once; when the game waits on the person, they play their first legal action (or the clock runs out). */
@@ -72,3 +72,19 @@ test('500 points with house rules: the person only times out, the computers stil
const view = JSON.stringify(GAMES.uno!.view(s, 'A'));
for (const bot of s.seats.filter(isBotId)) for (const c of s.hands[bot]!) expect(view).not.toContain(`"${c.id}"`);
});
test('무제한 time: no clock while the person is here; a dropped connection is still auto-played after the grace time', () => {
const { room, clock, a } = practice({ turnSeconds: null });
// Let the computers move until the game waits on the person.
for (let i = 0; i < 200 && room.bots.dueAt !== null; i++) room.bots.fire();
const s = () => room.game!.state as UnoState;
expect(GAMES.uno!.activePlayers(s())).toContain('A');
expect(room.effectiveDeadline()).toBeNull();
const turn = s().turnNo;
room.disconnect(a);
const d = room.effectiveDeadline();
expect(d).not.toBeNull();
clock.advance(d! - clock.advance(0) + 1);
room.onTimer();
expect(s().turnNo !== turn || s().log.some((e) => e.t === 'timeout' && e.p === 'A')).toBe(true);
});