윷놀이 지역 룰 옵션: 말 없을 때 빽도(버림·다시 던지기·날윷), 낙이면 차례 끝, 던진 순서대로, 업기 고르기, 갈림길 고르기
- 엔진: 새 옵션 5개(기본값은 예전 동작 그대로), MOVE에 piece·alt·stack(선택), 따로 선 무더기는 Piece.group으로 구분 - 컴퓨터: 다른 길·따로 두기·날윷 빽도를 점수로 판단, 따로 선 말도 함께 잡힐 위험으로 계산 - 화면: 방 설정 "지역 룰(우리 동네 규칙)" 묶음(빽도/말 움직이기/던지기, 고른 값 설명, 기본으로 되돌리기), 로비 요약·규칙 보기·도움말에 적용 중인 룰, 게임 중 갈 길 고르기·업기/따로 두기 버튼 - 문서: docs/games/yut.md 2장 표, 7장(추가한 룰·뺀 룰과 이유), 테스트·E2E 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,7 @@ async function rummikubTurns(pages: Page[], turns: number) {
|
||||
* 윷놀이: one UI step for whoever can act on `p` — press the throw button, or pick a result chip →
|
||||
* a glowing piece (or the waiting-piece tray) → "이동하기" (the two-step move confirmation).
|
||||
*/
|
||||
const yutChoiceSeen = new Set<string>();
|
||||
async function yutStep(p: Page): Promise<boolean> {
|
||||
const throwBtn = p.getByRole('button', { name: /윷 던지기|한 번 더 던지기/ });
|
||||
if ((await throwBtn.count()) && (await throwBtn.isEnabled().catch(() => false))) {
|
||||
@@ -145,8 +146,24 @@ async function yutStep(p: Page): Promise<boolean> {
|
||||
await h!.focus();
|
||||
await p.keyboard.press('Enter');
|
||||
await p.getByRole('button', { name: /^이동하기/ }).waitFor({ timeout: 1500 });
|
||||
// 지역 룰 choices (갈 길 고르기 / 따로 두기): the first time each shows up, take the other option and save a picture.
|
||||
let apart = false;
|
||||
for (const [group, tag] of [['갈 길 고르기', 'road'], ['업을지 따로 둘지 고르기', 'apart']] as const) {
|
||||
const g = p.getByRole('group', { name: group });
|
||||
if (yutChoiceSeen.has(tag) || !(await g.count())) continue;
|
||||
yutChoiceSeen.add(tag);
|
||||
apart ||= tag === 'apart';
|
||||
await g.getByRole('button').nth(1).click();
|
||||
await p.waitForTimeout(150);
|
||||
await p.screenshot({ path: join(SHOTS, `yut-choice-${tag}-${p.viewportSize()!.width < 600 ? 'phone' : 'pc'}.png`), fullPage: p.viewportSize()!.width < 600 });
|
||||
}
|
||||
await h!.focus();
|
||||
await p.keyboard.press('Enter');
|
||||
if (apart) {
|
||||
// Two stacks of the same side standing apart on one node are drawn side by side.
|
||||
await p.waitForTimeout(1200);
|
||||
await p.locator('.yut-board').screenshot({ path: join(SHOTS, 'yut-apart-board.png') });
|
||||
}
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
@@ -1142,10 +1159,37 @@ const PLANS: Record<string, Plan> = {
|
||||
},
|
||||
},
|
||||
yut: {
|
||||
// 말 2개로 줄여서 PC 방장 + 휴대폰 친구가 실제 화면 조작으로 끝까지 둔다(중간 화면도 저장).
|
||||
// 말 2개로 줄이고 지역 룰(업기 고르기·갈림길 고르기)을 켠 뒤, PC 방장 + 휴대폰 친구가 실제 화면 조작으로 끝까지 둔다.
|
||||
// 옵션 화면(PC 방장 / 휴대폰 친구 보기 전용 320px·다크)과 중간 화면도 저장.
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('button', { name: '2개', exact: true }).click();
|
||||
await host.getByText(/말 2개/).first().waitFor();
|
||||
await host.getByRole('button', { name: /지역 룰/ }).click();
|
||||
await host.getByRole('button', { name: '업을지 고르기' }).click();
|
||||
await host.getByRole('button', { name: '갈 길 고르기' }).click();
|
||||
await host.getByText(/업기 고르기 · 갈림길 고르기/).first().waitFor();
|
||||
await host.locator('#yut-house-rules').scrollIntoViewIfNeeded();
|
||||
await host.screenshot({ path: join(SHOTS, 'yut-options-pc.png') });
|
||||
// The phone friend only sees the options (read-only), but can open the 지역 룰 box.
|
||||
const guest = host.context().browser()!.contexts()[1]!.pages()[0]!;
|
||||
await guest.getByText(/업기 고르기 · 갈림길 고르기/).first().waitFor();
|
||||
await guest.getByRole('button', { name: '설정 보기' }).click();
|
||||
const sheet = guest.getByRole('dialog', { name: '게임 설정' });
|
||||
await sheet.getByRole('button', { name: /지역 룰/ }).click();
|
||||
if (await sheet.getByRole('button', { name: '업을지 고르기' }).isEnabled()) throw new Error('guest can change options');
|
||||
await guest.screenshot({ path: join(SHOTS, 'yut-options-phone.png') });
|
||||
await guest.setViewportSize({ width: 320, height: 640 });
|
||||
await guest.emulateMedia({ colorScheme: 'dark' });
|
||||
await sheet.getByText('말 움직이기').scrollIntoViewIfNeeded();
|
||||
await guest.screenshot({ path: join(SHOTS, 'yut-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];
|
||||
@@ -1175,7 +1219,7 @@ const PLANS: Record<string, Plan> = {
|
||||
}
|
||||
if (!(await over())) throw new Error(`game did not finish (${actions} UI actions)`);
|
||||
await guest.getByText(/이겼어요|아쉽게 졌어요/).waitFor();
|
||||
console.log(` yut: finished after ${actions} UI actions`);
|
||||
console.log(` yut: finished after ${actions} UI actions (지역 룰 choices used: ${[...yutChoiceSeen].join(', ') || 'none'})`);
|
||||
},
|
||||
},
|
||||
'one-card': {
|
||||
|
||||
Reference in New Issue
Block a user