Merge branch 'm4/davinci-code' into codex/owner/grp_discord_joke-app

# Conflicts:
#	apps/web/src/games/registry.ts
#	apps/web/src/lib/catalog-ui.ts
#	e2e/games.e2e.ts
#	packages/games/src/index.ts
#	packages/shared/src/catalog.ts
This commit is contained in:
EJClaw
2026-10-05 04:40:49 +09:00
8 changed files with 2434 additions and 0 deletions

View File

@@ -319,6 +319,40 @@ const PLANS: Record<string, Plan> = {
if (!finished && turns < 30) throw new Error(`only ${turns} turns were played`);
if (finished) await pages[0]!.screenshot({ path: join(SHOTS, 'one-card-3-result-pc.png') });
console.log(` one-card: ${turns} turns (${plays} plays, ${draws} draws)${finished ? ', game finished' : ''}`);
'davinci-code': {
// 2 players, default options (choose colours): both pick 2+2 start tiles, then several real turns:
// draw from a pile, tap an opponent's hidden tile, pick a number, confirm; after a hit press "여기서 멈추기".
drive: async (pages) => {
for (const p of pages) {
await p.getByRole('button', { name: '검정 2개 · 흰색 2개' }).click();
await p.getByRole('button', { name: '이렇게 받기' }).click();
}
const myTurn = (p: Page) => p.evaluate(() => !!document.querySelector('.turn-status')?.textContent?.includes('내 차례예요'));
for (let turn = 0; turn < 5; turn++) {
let mover: Page | null = null;
for (let t = 0; t < 100 && !mover; t++) {
for (const p of pages) if (!mover && (await myTurn(p))) mover = p;
if (!mover) await pages[0]!.waitForTimeout(100);
}
if (!mover) throw new Error(`turn ${turn + 1}: nobody has the turn`);
const pile = mover.getByRole('button', { name: turn % 2 ? /^흰색 타일 가져오기/ : /^검은색 타일 가져오기/ });
await pile.click();
await mover.getByText('맞힐 상대 타일을 눌러 주세요.').waitFor();
await mover.locator('.dv-opps .dv-pick.can').nth(turn % 3).click();
await mover.getByRole('button', { name: String((turn * 5) % 12), exact: true }).click();
if (turn < 2) await mover.screenshot({ path: join(SHOTS, `davinci-code-3-pad-${mover === pages[0] ? 'pc' : 'phone'}.png`), fullPage: true });
await mover.getByRole('button', { name: /이 숫자!$/ }).click();
// A hit → stop (the drawn tile goes in hidden); a miss ends the turn by itself.
for (let t = 0; t < 60; t++) {
const stop = mover.getByRole('button', { name: '여기서 멈추기' });
if (await stop.isVisible().catch(() => false)) await stop.click().catch(() => {});
if (!(await myTurn(mover))) break;
await mover.waitForTimeout(100);
}
if (await myTurn(mover)) throw new Error(`turn ${turn + 1}: turn did not pass`);
}
// Both screens show the guess log with every guess.
for (const p of pages) await p.getByText('추리 기록 (5)').waitFor();
},
},
othello: {