새 게임 라이어 게임: 규칙 엔진·말하는 컴퓨터·화면·도움말·문서·E2E

- packages/games/src/liar: 주제 10개 제시어 은행, 설명(두 번째 바퀴 거꾸로)·자유 토론·투표(동점 재투표 한 번, 또 동점이면 라이어 승리)·라이어 정답 맞히기(띄어쓰기·다른 표기 무시), 바보 모드
- 컴퓨터: 마피아처럼 live 전략, 레벨 1~60을 LiveBotInput.level 로 받음(서버 BotDriver 가 넘김), BOT_CHAT_REQUIRED 에 추가
- 웹: 꾹 누르는 제시어 카드, 설명 기록·토론 채팅·투표 화면, 30초 요약, [?] 도움말
- 문서 docs/games/liar.md, 등록(GAMES·CATALOG·BOT_GAMES·registry·아이콘), 서버 방 테스트, E2E(거절 알림이 저절로 사라지는지 확인 포함)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 03:14:39 +09:00
parent bde430f33e
commit 74a7daa4d3
25 changed files with 3569 additions and 12 deletions

View File

@@ -35,6 +35,7 @@ import { appleBot } from '../apple/bot';
import { clueBot } from '../clue/bot';
import { connectFourBot } from '../connect-four/bot';
import { unoBot } from '../uno/bot';
import { liarBot } from '../liar/bot';
export type { BotInput, BotStrategy, LiveBotDecision, LiveBotInput, LiveBotStrategy } from './types';
export { botDraw, botPace, botPersona, hash01, idLevel, type BotLevel, type BotPersona } from './persona';
@@ -106,8 +107,9 @@ export function decideBotAction(
return rest.length ? pick(playable(rest), random) : null;
}
/** Live strategies (games where everybody acts at once: 마피아 talks, 사과 게임 races on its own board); also in `BOT_GAMES`. */
/** Live strategies (games where everybody acts at once: 마피아·라이어 게임 talk, 사과 게임 races on its own board); also in `BOT_GAMES`. */
export const LIVE_BOT_STRATEGIES: Record<string, LiveBotStrategy> = {
mafia: mafiaBot,
apple: appleBot,
liar: liarBot,
};

View File

@@ -33,8 +33,8 @@ export function liveBotPlayout(
names?: Record<PlayerId, string>;
/** Override characters (tests): called once after setup with the game state. */
personaOf?: (p: PlayerId, state: unknown) => BotPersona;
/** Each computer's level (default: none, the strategy's own default). */
levelOf?: (p: PlayerId) => BotLevel;
/** Each computer's level 1~60 (default: none, the strategy's own default). */
levelOf?: (p: PlayerId, state: unknown) => BotLevel;
maxMs?: number;
},
): LivePlayoutReport {
@@ -48,6 +48,7 @@ export function liveBotPlayout(
const bots = opts.players.filter(opts.isBot);
const persona = new Map(bots.map((b) => [b, opts.personaOf?.(b, state) ?? botPersona(b)]));
const memory = new Map(bots.map((b) => [b, {} as Record<string, unknown>]));
const level = new Map(bots.map((b) => [b, opts.levelOf?.(b, state)]));
const due = new Map(bots.map((b) => [b, now + 500 + random() * 1000]));
const rep: LivePlayoutReport = { finished: false, state, actions: 0, rejected: [], chat: [], maxBotMs: 0, elapsed: 0 };
const maxMs = opts.maxMs ?? 3 * 3600_000;
@@ -74,7 +75,7 @@ export function liveBotPlayout(
if (bot === null) throw new Error(`${def.id}: stalled`);
now = Math.max(now, due.get(bot)!);
const t0 = performance.now();
const d = strategy({ me: bot, view: structuredClone(def.view(state, bot)), now, random, persona: persona.get(bot)!, level: opts.levelOf?.(bot), names, memory: memory.get(bot)! });
const d = strategy({ me: bot, view: structuredClone(def.view(state, bot)), now, random, persona: persona.get(bot)!, level: level.get(bot), names, memory: memory.get(bot)! });
rep.maxBotMs = Math.max(rep.maxBotMs, performance.now() - t0);
due.set(bot, now + Math.max(50, d.next));
if (d.action) {