윷놀이: 증강 윷놀이 옵션 추가 (원작 증강 71개 + 추가 10개, 증강 탭·선택 창·능력·알까기·특수 승리)

- 엔진 aug.ts: 라운드·동시 비공개 증강 선택(1·6·12 등, 혼돈 모드, 후보 수, 제외 목록), 질문(거머리·접기·돌림판·투표·색 맞히기 등),
  특수 말·보호막·함께 서기·함정/선물/똥/마늘/조준/지뢰, 특수 승리·탈락·순위, 컴퓨터(aug-bot.ts), 알까기 물리(physics.ts)
- 화면: 방 설정 [게임 종류] + [증강 윷놀이] 탭(켜기/끄기·찾기), 증강 선택 창, 내 증강 쓰기, 증강 칸, 특수 승리 팝업, 안개, 알까기 조준
- 문서 docs/games/yut-augmented.md, 테스트 aug.test.ts 59개, e2e yut-aug

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-19 22:42:52 +09:00
parent d40ba1e121
commit 28ef4ed947
21 changed files with 5928 additions and 41 deletions

View File

@@ -1598,6 +1598,162 @@ const PLANS: Record<string, Plan> = {
console.log(` yut: finished after ${actions} UI actions (지역 룰 choices used: ${[...yutChoiceSeen].join(', ') || 'none'})`);
},
},
'yut-aug': {
// 증강 윷놀이: 방장이 게임 종류를 증강으로 바꾸고 [증강 윷놀이] 탭에서 설정을 확인한 뒤, PC 방장 + 휴대폰 친구 둘이
// 증강 선택 창·질문 창·증강 쓰기·말 움직이기를 실제 화면 조작으로 해 나간다(끝까지 또는 200번 조작).
game: 'yut',
players: 3,
lobby: async (host) => {
await host.getByRole('button', { name: '증강 윷놀이', exact: true }).first().click();
await host.getByRole('tab', { name: '증강 윷놀이' }).click();
await host.getByText(/켜진 증강/).first().waitFor();
await host.screenshot({ path: join(SHOTS, 'yut-aug-options-pc.png'), fullPage: true });
await host.getByRole('tab', { name: '기본 설정' }).click();
await host.getByRole('button', { name: '3개', exact: true }).click();
// 증강을 자주 고르도록 1·3·5·7·9라운드, 후보 4개
await host.getByRole('tab', { name: '증강 윷놀이' }).click();
await host.getByRole('button', { name: '1·3·5·7·9라운드' }).click();
await host.getByRole('button', { name: '4개', exact: true }).click();
await host.getByRole('tab', { name: '기본 설정' }).click();
await host.getByText(/증강 윷놀이 · 개인전 · 말 3개/).first().waitFor();
const guest = host.context().browser()!.contexts().at(-1)!.pages()[0]!;
await guest.getByRole('button', { name: '설정 보기' }).click();
const sheet = guest.getByRole('dialog', { name: '게임 설정' });
await sheet.getByRole('tab', { name: '증강 윷놀이' }).click();
await sheet.getByText(/켜진 증강/).first().waitFor();
await guest.screenshot({ path: join(SHOTS, 'yut-aug-options-phone.png') });
await guest.setViewportSize({ width: 320, height: 640 });
await guest.emulateMedia({ colorScheme: 'dark' });
await guest.screenshot({ path: join(SHOTS, 'yut-aug-options-phone-320-dark.png') });
const wide = await guest.evaluate(() => {
const sh = document.querySelector('.sheet');
return document.documentElement.scrollWidth > window.innerWidth + 1 || (!!sh && sh.scrollWidth > sh.clientWidth + 1);
});
if (wide) throw new Error('증강 options overflow at 320px');
await guest.emulateMedia({ colorScheme: 'light' });
await guest.setViewportSize({ width: 390, height: 844 });
await sheet.getByRole('button', { name: '닫기', exact: true }).click();
},
drive: async (pages) => {
const [host, guest] = pages as [Page, Page];
const tag = (p: Page) => (p.viewportSize()!.width < 600 ? 'phone' : 'pc');
const seen = new Set<string>();
const shotOnce = async (p: Page, name: string) => {
const k = `${name}-${tag(p)}`;
if (seen.has(k)) return;
seen.add(k);
await p.waitForTimeout(250);
await p.screenshot({ path: join(SHOTS, `yut-aug-${k}.png`), fullPage: tag(p) === 'phone' });
};
const stats = { picks: 0, prompts: 0, uses: 0, moves: 0, popups: 0 };
/** One augment UI step on `p`, or false. */
const augStep = async (p: Page): Promise<boolean> => {
const dialog = p.getByRole('dialog');
if (await dialog.count()) {
// special victory / out popup
const ok = dialog.getByRole('button', { name: /^(\d+위 확보|확인)$/ });
if (await ok.count()) {
await shotOnce(p, 'popup');
await ok.first().click();
stats.popups++;
return true;
}
const cards = dialog.locator('.aug-card:not([disabled])');
if (await cards.count()) {
await shotOnce(p, 'select');
await cards.nth(stats.picks % (await cards.count())).click();
const sel = dialog.locator('select');
if (await sel.count()) await sel.selectOption({ index: 1 });
await dialog.getByRole('button', { name: /고르기$/ }).click();
stats.picks++;
return true;
}
}
const open = p.getByRole('button', { name: '증강 후보 보기' });
if ((await open.count()) && !(await dialog.count())) {
await open.click();
return true;
}
const plan = p.getByRole('button', { name: '이 순서로 예언하기' });
if (await plan.count()) {
for (const b of await p.locator('.aug-plan button').all()) await b.click();
await plan.click();
stats.prompts++;
return true;
}
const prompt = p.locator('.card .aug-target-list button:not([disabled])');
if ((await prompt.count()) && !(await p.locator('.aug-uses').count())) {
await shotOnce(p, 'prompt');
await prompt.first().click();
stats.prompts++;
return true;
}
// use an augment now and then (not the whole-turn ones every time)
const useBtn = p.locator('.aug-uses .aug-use-row button:not([disabled])');
if ((await useBtn.count()) && stats.moves % 2 === 0) {
await useBtn.first().click();
const aim = p.getByRole('button', { name: /튕기기/ });
const target = p.locator('.aug-uses .aug-target-list button.btn-primary:not([disabled])');
if (await target.count()) {
await shotOnce(p, 'use');
await target.first().click();
if (await aim.count()) {
await shotOnce(p, 'aim');
await aim.click();
}
stats.uses++;
stats.moves++;
return true;
}
if (await aim.count()) {
await aim.click();
stats.uses++;
stats.moves++;
return true;
}
const cancel = p.locator('.aug-uses').getByRole('button', { name: '취소' });
if (await cancel.count()) await cancel.click();
}
const pig = p.getByRole('button', { name: /개 내기/ });
if ((await pig.count()) && (await pig.isEnabled())) {
await pig.click();
stats.moves++;
return true;
}
if (await yutStep(p)) {
stats.moves++;
return true;
}
return false;
};
const until = Date.now() + 360_000;
const over = () => host.getByText(/이겼어요|아쉽게 졌어요/).count();
let steps = 0;
while (Date.now() < until && !(await over()) && steps < 320) {
let acted = false;
for (const p of pages) {
if (await augStep(p).catch(() => false)) {
acted = true;
steps++;
break;
}
}
const objs = await host.locator('[aria-label="판 위의 증강 물건"] > g').count();
if (objs && !seen.has('objs')) {
seen.add('objs');
await host.locator('.yut-board').screenshot({ path: join(SHOTS, 'yut-aug-objs-board.png') });
}
if (steps === 30 || steps === 120 || steps === 200) {
await host.screenshot({ path: join(SHOTS, `yut-aug-mid${steps}-pc.png`) });
await guest.screenshot({ path: join(SHOTS, `yut-aug-mid${steps}-phone.png`), fullPage: true });
}
if (!acted) await host.waitForTimeout(150);
}
await host.screenshot({ path: join(SHOTS, 'yut-aug-end-pc.png') });
console.log(` yut-aug: ${steps} UI steps ${JSON.stringify(stats)} finished=${(await over()) > 0}`);
if (stats.picks < 3) throw new Error('augment selection did not work');
},
},
'one-card': {
// 3 players, default 원카드: whoever has the turn plays a highlighted card (tap to lift, tap again to play,
// pick a suit for 7) or draws; the 원카드 button is pressed whenever it lights up. 60 turns or until the game ends.