그림 맞히기·클루: 그리기·차례 시간 무제한(출제자 정답 공개로 넘기기), 소리·움직임, 할리갈리·사과 게임 문서에 무제한

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 13:01:42 +09:00
parent bafbf95d98
commit b8966db2a6
15 changed files with 413 additions and 84 deletions

View File

@@ -202,7 +202,7 @@ describe('점수(§6)', () => {
test('multi: 아무도 못 맞히면 출제자 0점, 시간 만료로 공개', () => {
let s = drawWith(make(3), '기린');
const d = s.turn.drawer;
s = act(s, d, { type: 'tick' }, s.turn.endsAt);
s = act(s, d, { type: 'tick' }, s.turn.endsAt!);
expect(s.turn.phase).toBe('reveal');
expect(s.turn.endReason).toBe('time');
expect(s.scores[d]).toBe(0);
@@ -224,11 +224,42 @@ describe('점수(§6)', () => {
test('speedBonus: 남은 시간 비율 × 5점 추가', () => {
let s = drawWith(make(3, { speedBonus: true }), '기린', T0);
const g = guessers(s)[0]!;
const dur = s.turn.endsAt - s.turn.startedAt;
const dur = s.turn.endsAt! - s.turn.startedAt;
s = act(s, g, guess('기린'), T0 + dur / 2);
expect(s.scores[g]).toBe(10 + 3); // round(2.5)
});
test('그리기 무제한: 마감 없음(힌트는 80초 기준), 출제자 정답 공개로 넘기기, 시간 제한 방에서는 거절', () => {
let s = drawWith(make(3, { drawSeconds: null, speedBonus: true }), '아이스크림', T0);
const d = s.turn.drawer;
const [a, b] = guessers(s) as [string, string];
expect(s.turn.endsAt).toBeNull();
expect(view(s, a).phaseMs).toBeNull();
// Hints still come, at 40 s and 60 s (the 80 s reference); after them nothing is due.
expect(cm.deadline!(s)).toBe(T0 + 40_000);
s = act(s, d, { type: 'tick' }, T0 + 40_000);
expect(s.turn.hintStage).toBe(1);
s = act(s, d, { type: 'tick' }, T0 + 60_000);
expect(s.turn.hintStage).toBe(2);
expect(cm.deadline!(s)).toBeNull();
// A guess long after "80 s" is still taken (speed bonus 0 by then).
s = act(s, a, guess('아이스크림'), T0 + 600_000);
expect(s.scores[a]).toBe(10);
expect(reason(s, a, { type: 'giveUp' })).toBe('출제자만 정답을 공개할 수 있어요.');
s = act(s, d, { type: 'giveUp' }, T0 + 601_000);
expect(s.turn.phase).toBe('reveal');
expect(s.turn.endReason).toBe('giveUp');
expect(s.scores[d]).toBe(2); // one solver in multi mode
expect(view(s, b).word).toBe('아이스크림');
const timed = drawWith(make(3), '기린');
expect(reason(timed, timed.turn.drawer, { type: 'giveUp' })).toBe('제한 시간이 있는 방에서는 시간이 끝날 때까지 그려요.');
// An away drawer is still timed out by the room (nothing else due → drawerAway).
let w = drawWith(make(3, { drawSeconds: null, hints: 'basic' }), '기린', T0);
expect(cm.deadline!(w)).toBeNull();
w = act(w, w.turn.drawer, { type: 'tick' }, T0 + 30_000);
expect(w.turn.endReason).toBe('drawerAway');
});
test('신고 과반 → 즉시 종료, 출제자 0점(맞힌 사람 점수 유지)', () => {
let s = drawWith(make(5), '기린');
const d = s.turn.drawer;
@@ -367,16 +398,16 @@ describe('진행(§5.1, §5.2, §8.5)', () => {
expect(s.turn.phase).toBe('drawing');
expect(s.turn.word!.word).toBe(c0);
expect(s.away).toEqual([]);
s = act(s, first, { type: 'tick' }, s.turn.endsAt);
s = act(s, first, { type: 'tick' }, s.turn.endsAt!);
expect(s.turn.phase).toBe('reveal');
expect(cm.deadline!(s)).toBe(s.turn.startedAt + REVEAL_MS);
s = act(s, first, { type: 'tick' }, s.turn.endsAt);
s = act(s, first, { type: 'tick' }, s.turn.endsAt!);
expect(s.turn.drawer).not.toBe(first);
expect(s.turn.no).toBe(2);
const second = s.turn.drawer;
s = act(s, second, { type: 'chooseWord', index: 2 }, s.turn.startedAt + 1000);
s = act(s, second, { type: 'tick' }, s.turn.endsAt);
s = act(s, second, { type: 'tick' }, s.turn.endsAt);
s = act(s, second, { type: 'tick' }, s.turn.endsAt!);
s = act(s, second, { type: 'tick' }, s.turn.endsAt!);
expect(s.finished).toBe(true);
const r = cm.result(s)!;
expect(r.ranking.flat().sort()).toEqual(['p1', 'p2']);
@@ -410,15 +441,15 @@ describe('진행(§5.1, §5.2, §8.5)', () => {
// Skipped while away: the next drawers are the others.
const seen: string[] = [];
for (let i = 0; i < 2; i++) {
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt!);
seen.push(s.turn.drawer);
s = act(s, s.turn.drawer, { type: 'chooseWord', index: 0 }, s.turn.startedAt + 100);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt!);
}
expect(seen).not.toContain(d);
// "돌아왔어요" clears the mark.
expect(reason(s, d, { type: 'back' })).toBeNull();
s = act(s, d, { type: 'back' }, s.turn.endsAt - 1);
s = act(s, d, { type: 'back' }, s.turn.endsAt! - 1);
expect(s.away).toEqual([]);
expect(reason(s, d, { type: 'back' })).not.toBeNull();
});
@@ -431,7 +462,7 @@ describe('진행(§5.1, §5.2, §8.5)', () => {
expect(s.turn.phase).toBe('reveal');
expect(s.turn.endReason).toBe('drawerLeft');
expect(cm.onLeave!(s, d)).toBeNull();
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt!);
expect(s.turn.drawer).not.toBe(d);
const other = s.order.find((p) => p !== d && p !== s.turn.drawer)!;
s = act(s, other, { type: 'leave' }, s.turn.startedAt + 100);
@@ -454,7 +485,7 @@ describe('진행(§5.1, §5.2, §8.5)', () => {
let s = drawWith(make(4, { guessMode: 'firstOnly', answererDraws: true }), '기린');
const g = guessers(s)[2]!;
s = act(s, g, guess('기린'), T0 + 2000);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt);
s = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt!);
expect(s.turn.drawer).toBe(g);
});
@@ -466,7 +497,7 @@ describe('진행(§5.1, §5.2, §8.5)', () => {
s.turnsPlayed = s.totalTurns - 1;
s.round = s.options.rounds;
s.turn.drawer = s.order.at(-1)!;
const r = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt);
const r = act(s, s.turn.drawer, { type: 'tick' }, s.turn.endsAt!);
expect(r.finished).toBe(true);
expect(cm.result(r)!.ranking.map((g) => [...g].sort())).toEqual([['p2'], ['p1', 'p3'], ['p4']]);
expect(r.final!.ranking.map((x) => x.rank)).toEqual([1, 2, 2, 4]);
@@ -540,7 +571,8 @@ function fastPlayout(players: PlayerId[], options: CatchmindOptions, seed: RngSt
invariants(s, poolSize);
if (cm.result(s)) return { state: s, trace, steps: step };
// Timer: the drawer's tick when due (as the room would), otherwise a random actor.
const due = cm.deadline!(s)!;
// 무제한 drawing without hints has no deadline: only the random "away drawer" ticks below.
const due = cm.deadline!(s) ?? Infinity;
let p: PlayerId;
let a: CatchmindAction;
if (now >= due || pick.int(12) === 0) {
@@ -603,7 +635,7 @@ describe('무작위 대국(§10, docs/09 §7)', () => {
const options = opts({
guessMode: pk.int(3) === 0 ? 'firstOnly' : 'multi',
rounds: (1 + pk.int(3)) as 1 | 2 | 3,
drawSeconds: ([60, 80, 100, 120] as const)[pk.int(4)]!,
drawSeconds: ([60, 80, 100, 120, null] as const)[pk.int(5)]!,
wordChoice: pk.int(4) !== 0,
hints: (['none', 'basic', 'full'] as const)[pk.int(3)]!,
letterReport: pk.int(3) !== 0,