Files
joke-app/apps/web/src/games/registry.ts
EJClaw 3e414e62ca M7: 바퀴벌레 포커 규칙·화면·테스트
- 규칙 모듈(packages/games/src/cockroach-poker): 64장(8종×8) 셔플·좌석순 분배, 2인 10장 비공개 제거,
  offer/call/peek/pass 흐름, seen 규칙, 2인 판정 전용(twoPlayerPass 하우스 룰은 1회 되돌려 주기),
  같은 종류 loseCount장(자동: 2인 5, 3~6인 4)·손패 0장 시작자·eightKindsRule 패배,
  시간 초과 자동 행동(§8.5)과 3연속 시간 초과 시 자리 비움(5초), 나가면 그 사람 패배,
  빠른 말(say, 라운드당 3번), view는 남의 손패·미확인자에게 건네는 카드·제거 카드를 숨김
- 테스트: §10 시나리오 전부, randomPlayout 200판 + 빠른 루프 800판(카드 보존·유출·onTimeout 합법·재생 결정성)
- 화면(apps/web/src/games/cockroach-poker): 자체 SVG 벌레 8종, 앞마당 종류별 배지(경고/위험),
  건네기 3단계(카드→사람→주장), 판정 시트(진짜!/거짓말!/몰래 보고 넘기기), 넘긴 순서·본 사람 표시
- 등록: GAMES, CATALOG, 웹 registry, GAME_ICON / E2E 플랜(PC 방장 + 휴대폰 2명, 끝까지 진행)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:46:30 +09:00

40 lines
1.3 KiB
TypeScript

import type { GameUI } from './types';
/** Game screens are code-split: each is downloaded only when that game is opened (docs/09 §6). */
export const GAME_UI: Record<string, () => Promise<{ default: GameUI }>> = {
omok: () => import('./omok'),
othello: () => import('./othello'),
chess: () => import('./chess'),
janggi: () => import('./janggi'),
baduk: () => import('./baduk'),
seotda: () => import('./seotda'),
poker: () => import('./poker'),
yacht: () => import('./yacht'),
yut: () => import('./yut'),
'one-card': () => import('./one-card'),
rummikub: () => import('./rummikub'),
'davinci-code': () => import('./davinci-code'),
mahjong: () => import('./mahjong'),
gostop: () => import('./gostop'),
bang: () => import('./bang'),
'halli-galli': () => import('./halli-galli'),
marble: () => import('./marble'),
'cockroach-poker': () => import('./cockroach-poker'),
};
const cache = new Map<string, GameUI>();
export async function loadGameUI(id: string): Promise<GameUI | null> {
const hit = cache.get(id);
if (hit) return hit;
const loader = GAME_UI[id];
if (!loader) return null;
const mod = (await loader()).default;
cache.set(id, mod);
return mod;
}
export function cachedGameUI(id: string): GameUI | null {
return cache.get(id) ?? null;
}