라이어 게임: 토론 채팅을 게임 내내 열기, 설명은 별도 describe 액션으로
- chat은 확인 시간·설명 중(말하는 사람 포함)·토론·투표·정답 맞히기 내내 모두 쓸 수 있다 - 설명은 새 describe 액션(차례인 사람만, 80자). 채팅에 쓴 말은 설명으로 치지 않는다 - 자기 제시어 금지·고운 말 검사는 설명과 채팅 모두 그대로 - 컴퓨터 설명도 describe로 보내고, 모델이 켜져 있으면 "입력 중…" 뒤에 보낸다 - 화면: 채팅 입력칸을 항상 보이게, 설명 차례인 사람에게는 채팅 칸 안내 문구 - 문서(docs/games/liar.md)와 테스트 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,7 +156,7 @@ describe('준비와 비밀 (§4, §8.3)', () => {
|
||||
b = f(b);
|
||||
};
|
||||
step(tick);
|
||||
step((s) => act(s, speaker(s)!, { type: 'chat', text: '여름에 생각나요' }));
|
||||
step((s) => act(s, speaker(s)!, { type: 'describe', text: '여름에 생각나요' }));
|
||||
step(tick);
|
||||
step((s) => until(s, 'discussion'));
|
||||
step((s) => act(s, 'P1', { type: 'chat', text: '다들 애매하네요' }));
|
||||
@@ -205,8 +205,8 @@ describe('차례대로 설명 (§5.2)', () => {
|
||||
while (s.phase.kind === 'describe') {
|
||||
const sp = speaker(s)!;
|
||||
spoken.push(sp);
|
||||
for (const other of ids(3).filter((x) => x !== sp)) expect(reject(s, other, { type: 'chat', text: '저도요' })).toBe('지금은 설명 차례인 사람만 말할 수 있어요.');
|
||||
s = act(s, sp, { type: 'chat', text: `설명 ${spoken.length}` });
|
||||
for (const other of ids(3).filter((x) => x !== sp)) expect(reject(s, other, { type: 'describe', text: '저도요' })).toBe('지금은 설명 차례인 사람만 설명할 수 있어요.');
|
||||
s = act(s, sp, { type: 'describe', text: `설명 ${spoken.length}` });
|
||||
}
|
||||
expect(spoken).toEqual(['P0', 'P1', 'P2', 'P2', 'P1', 'P0']);
|
||||
expect(roundOrder(s, 2)).toEqual(['P2', 'P1', 'P0']);
|
||||
@@ -223,40 +223,54 @@ describe('차례대로 설명 (§5.2)', () => {
|
||||
|
||||
test('첫 바퀴 마지막 사람은 바로 이어서 두 번째 바퀴 첫 설명을 할 수 있어요(채팅 간격 제한 없음)', () => {
|
||||
let s = tick(rig(3));
|
||||
for (const p of ['P0', 'P1', 'P2']) s = act(s, p, { type: 'chat', text: `${p} 설명` }, T0 + 20_000);
|
||||
for (const p of ['P0', 'P1', 'P2']) s = act(s, p, { type: 'describe', text: `${p} 설명` }, T0 + 20_000);
|
||||
expect(speaker(s)).toBe('P2');
|
||||
s = act(s, 'P2', { type: 'chat', text: '또 설명' }, T0 + 20_000);
|
||||
s = act(s, 'P2', { type: 'describe', text: '또 설명' }, T0 + 20_000);
|
||||
expect(speaker(s)).toBe('P1');
|
||||
});
|
||||
|
||||
test('한 바퀴 옵션, 시간 초과는 넘김, 설명은 80자까지', () => {
|
||||
let s = tick(rig(3, { rounds: 1, describeSeconds: 15 }));
|
||||
expect(s.phase.kind === 'describe' && s.phase.endsAt! - s.phase.startedAt).toBe(15_000);
|
||||
expect(reject(s, 'P0', { type: 'chat', text: '가'.repeat(81) })).toContain('80자');
|
||||
expect(reject(s, 'P0', { type: 'describe', text: '가'.repeat(81) })).toContain('80자');
|
||||
s = tick(s);
|
||||
expect(s.descriptions[0]).toMatchObject({ from: 'P0', text: null });
|
||||
s = act(s, 'P1', { type: 'chat', text: '좋아요' });
|
||||
s = act(s, 'P1', { type: 'describe', text: '좋아요' });
|
||||
s = tick(s);
|
||||
expect(s.phase.kind).toBe('discussion');
|
||||
});
|
||||
|
||||
test('제시어를 직접 말하면 안 돼요(띄어쓰기 무시). 라이어는 막지 않아요(막으면 정답이 새요)', () => {
|
||||
let s = tick(rig(3, { rounds: 1 }, { liarIdx: 1 }));
|
||||
expect(reject(s, 'P0', { type: 'chat', text: '수 박 맛있어요' })).toBe('제시어를 직접 말하면 안 돼요.');
|
||||
s = act(s, 'P0', { type: 'chat', text: '여름이면 생각나요' });
|
||||
s = act(s, 'P1', { type: 'chat', text: '수박 같아요' }); // the liar's guess-like line goes through
|
||||
expect(reject(s, 'P0', { type: 'describe', text: '수 박 맛있어요' })).toBe('제시어를 직접 말하면 안 돼요.');
|
||||
expect(reject(s, 'P2', { type: 'chat', text: '수 박 맛있어요' })).toBe('제시어를 직접 말하면 안 돼요.');
|
||||
s = act(s, 'P0', { type: 'describe', text: '여름이면 생각나요' });
|
||||
s = act(s, 'P1', { type: 'describe', text: '수박 같아요' }); // the liar's guess-like line goes through
|
||||
expect(s.descriptions.at(-1)!.text).toBe('수박 같아요');
|
||||
});
|
||||
|
||||
test('바보 모드 라이어는 자기 단어를 직접 말하면 막혀요(시민과 똑같이)', () => {
|
||||
const s = tick(rig(3, { foolMode: true, rounds: 1 }, { liarIdx: 0 }));
|
||||
expect(reject(s, 'P0', { type: 'describe', text: '참외' })).toBe('제시어를 직접 말하면 안 돼요.');
|
||||
expect(reject(s, 'P0', { type: 'chat', text: '참외' })).toBe('제시어를 직접 말하면 안 돼요.');
|
||||
});
|
||||
|
||||
test('확인 시간·정답 맞히기 중에는 채팅을 못 쓰고, 토론·투표 중에는 모두 써요', () => {
|
||||
test('토론 채팅은 게임 내내 열려 있어요: 확인 시간·설명 중(말하는 사람 포함)에도 쓰고, 설명으로 치지 않아요', () => {
|
||||
let s = rig(3);
|
||||
expect(reject(s, 'P0', { type: 'chat', text: '안녕' })).toContain('확인하는 중');
|
||||
s = act(s, 'P0', { type: 'chat', text: '안녕' });
|
||||
expect(s.phase.kind).toBe('reveal');
|
||||
s = tick(s);
|
||||
expect(speaker(s)).toBe('P0');
|
||||
s = act(s, 'P1', { type: 'chat', text: '첫 사람 누구예요' });
|
||||
s = act(s, 'P0', { type: 'chat', text: '저요 잠깐만요' });
|
||||
expect(speaker(s)).toBe('P0');
|
||||
expect(s.descriptions).toEqual([]);
|
||||
expect(liar.view(s, 'P2').my).toMatchObject({ canChat: true, chatWhy: null, canDescribe: false });
|
||||
expect(reject(s, 'P1', { type: 'describe', text: '저도요' })).toBe('지금은 설명 차례인 사람만 설명할 수 있어요.');
|
||||
expect(s.chat.map((m) => m.text)).toEqual(['안녕', '첫 사람 누구예요', '저요 잠깐만요']);
|
||||
s = until(s, 'discussion');
|
||||
expect(reject(s, 'P0', { type: 'describe', text: '늦은 설명' })).toBe('지금은 설명하는 때가 아니에요.');
|
||||
s = { ...s, chat: [] };
|
||||
const t = at(s);
|
||||
// No pace limit: any number of lines at the same moment all go through.
|
||||
for (let i = 0; i < 20; i++) s = act(s, 'P1', { type: 'chat', text: `누구지 ${i}` }, t);
|
||||
@@ -324,7 +338,8 @@ describe('토론과 투표 (§5.3~5.5)', () => {
|
||||
expect(s.phase.kind).toBe('guess');
|
||||
expect(lastEv(s, 'accused')).toMatchObject({ p: 'P3', liar: true });
|
||||
expect(reject(s, 'P0', { type: 'guess', text: '수박' })).toBe('라이어만 맞힐 수 있어요.');
|
||||
expect(reject(s, 'P0', { type: 'chat', text: '힌트' })).toContain('맞히는 중');
|
||||
s = act(s, 'P0', { type: 'chat', text: '못 맞힐걸요' }); // the chat stays open while the liar guesses
|
||||
expect(s.phase.kind).toBe('guess');
|
||||
const right = act(s, 'P3', { type: 'guess', text: ' 수 박 ' });
|
||||
expect(right.final).toMatchObject({ winner: 'liar', reason: 'guessed', guess: '수 박' });
|
||||
expect(liar.result(right)!.ranking).toEqual([['P3'], ['P0', 'P1', 'P2']]);
|
||||
@@ -391,7 +406,7 @@ describe('시간 무제한 (§8.5)', () => {
|
||||
expect(liar.deadline!(s)).toBeNull();
|
||||
expect(liar.timeoutPlayers!(s)).toEqual(['P0']);
|
||||
expect(reject(s, 'P1', { type: 'phaseTimeout' })).toBe('아직 기다리는 중이에요.');
|
||||
for (const p of ['P0', 'P1', 'P2']) s = act(s, p, { type: 'chat', text: `${p} 설명` }, T0 + 3_600_000);
|
||||
for (const p of ['P0', 'P1', 'P2']) s = act(s, p, { type: 'describe', text: `${p} 설명` }, T0 + 3_600_000);
|
||||
expect(s.phase.kind).toBe('discussion');
|
||||
expect(liar.timeoutPlayers!(s)).toEqual(['P0', 'P1', 'P2']);
|
||||
for (const p of ['P0', 'P1', 'P2']) s = act(s, p, { type: 'ready' });
|
||||
@@ -409,7 +424,7 @@ describe('시간 무제한 (§8.5)', () => {
|
||||
let s = tick(rig(4, { ...U, rounds: 1 }));
|
||||
s = act(s, 'P0', liar.onTimeout(s, 'P0'));
|
||||
expect(s.descriptions[0]).toMatchObject({ from: 'P0', text: null });
|
||||
for (const p of ['P1', 'P2', 'P3']) s = act(s, p, { type: 'chat', text: `${p} 설명` });
|
||||
for (const p of ['P1', 'P2', 'P3']) s = act(s, p, { type: 'describe', text: `${p} 설명` });
|
||||
for (const p of ['P1', 'P2', 'P3']) s = act(s, p, { type: 'ready' });
|
||||
s = act(s, 'P0', liar.onTimeout(s, 'P0'));
|
||||
expect(s.phase.kind).toBe('vote');
|
||||
|
||||
Reference in New Issue
Block a user