새 게임 블랙잭: 딜러(하우스) 상대 1~7명·놀이용 칩. 공식 규칙(6벌 S17·블랙잭 3:2·A/10 peek·아무 두 장 더블·DAS·4손패 스플릿·에이스 한 장)을 기본값으로, 한국 하우스 룰(5·6카드 찰리, 7-7-7 보너스 3:1, 배당 6:5·2:1·1:1, H17, 더블 9~11·10~11, 에이스 자유 히트·다시 스플릿, 레이트 서렌더, 인슈어런스)을 방 설정으로

- 엔진 packages/games/src/blackjack/(options·types·rules·index·bot): 베팅→인슈어런스→플레이→딜러→결과 단계 상태 기계, 비공개는 딜러 홀 카드와 슈뿐(재셔플마다 카드 id 유일), 칩은 하우스 상대로 정산
- 컴퓨터: 기본 전략(S17 차트) + 레벨 1~60(쉬움은 딜러 흉내·인슈어런스 가끔, 어려움은 차트대로·인슈어런스 거절)
- 웹 apps/web/src/games/blackjack/: 초록 테이블·손패·단계별 버튼·방 설정 변형, 30초 요약·도움말, 표준 카드 아트 재사용
- 등록: GAMES·BOT_STRATEGIES·BOT_GAMES·CATALOG·GAME_UI·GAME_ICON·게임 탭, 문서(games/blackjack.md·README·로드맵·결정 사항), e2e/games.e2e.ts
- 검증: 엔진·봇 테스트, 무작위 플레이(여러 옵션) JSON 왕복·정보 누출 없음, 전체 테스트 2,611개·타입 검사·웹 빌드 통과, bun e2e/games.e2e.ts blackjack 통과

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 05:45:41 +09:00
parent 71bdfd201a
commit 13a89a645e
23 changed files with 2243 additions and 5 deletions

View File

@@ -1181,6 +1181,43 @@ async function magicalStep(p: Page, phone: boolean, st: { picks: number; selects
}
const PLANS: Record<string, Plan> = {
blackjack: {
// PC host + phone guest. Each hand: bet the minimum, stand (decline insurance), then press 다음 판, until the
// session ends (10 hands). Smoke test only — the rules are covered by the engine tests.
players: 2,
lobby: async (host) => {
await host.getByRole('group', { name: '판 수' }).getByRole('button', { name: '5판' }).click();
await host.getByText('5판').first().waitFor();
},
drive: async (pages) => {
let finished = false;
let hands = 0;
for (let t = 0; t < 2000 && !finished; t++) {
if (await pages[0]!.getByRole('dialog', { name: '게임 결과' }).count()) {
finished = true;
break;
}
let acted = false;
for (const p of pages) {
const labels: (RegExp | string)[] = [/베팅$/, '스탠드', '안 함', '다음 판'];
for (const name of labels) {
const btn = p.getByRole('button', { name }).first();
if ((await btn.count()) && (await btn.isEnabled({ timeout: 150 }).catch(() => false))) {
if (name === '다음 판') hands++;
await btn.click({ timeout: 1000 }).catch(() => {});
acted = true;
break;
}
}
if (acted) break;
}
if (!acted) await pages[0]!.waitForTimeout(120);
}
if (!finished) throw new Error(`blackjack did not finish (${hands} hands advanced)`);
await pages[0]!.screenshot({ path: join(SHOTS, 'blackjack-result-pc.png') });
console.log(` blackjack: finished after ${hands} hands`);
},
},
rummikub: {
// PC host + phone guest, first meld "없음" so hint plays happen early; 10 real turns through the UI.
lobby: async (host) => {