새 게임 젝스님트: 숫자 카드를 동시에 몰래 내고 작은 수부터 줄 끝에 붙이기, 여섯 번째 카드면 앞의 다섯 장(소머리 = 벌점)을 가져가는 2~10명 카드 게임
- 엔진 packages/games/src/six-nimmt/(options·rules·types·index·bot): 104장 소머리(합 171), 규칙 1~4, 동시에 몰래 고르기(모두 고르기 전엔 바꾸기 가능, 마지막 사람이 고르면 공개), 작은 카드 줄 고르기·양쪽 끝 같은 차이 자리 고르기에서 멈춤, 라운드 합산·66점(또는 라운드 수) 종료·20라운드 안전장치 - 옵션 전부: 카드 구성(104장/인원×10+4 섞기/펼쳐 골라 가기 프로 2~6명), 양쪽 끝 붙이기, 작은 카드 자동, 30주년판 특별 카드 4종(짝홀·산 오르기·점프하는 소 연쇄·숫자 뒤집기), 끝 점수/라운드 수, 나온 카드 표, 제한 시간 - 시간 초과·나가기: 지금 줄 기준 가장 안전한 카드·소머리 적은 줄, 3번이면 자리 비움(5초), 나간 사람은 바로 자동, 1명 남으면 끝 - 컴퓨터: 카드마다 상대 카드를 흉내 내어 가져갈 소머리 평균(1단계 4번 → 60단계 48번), humanBest 실수, 41단계 이상 숫자 뒤집기·대기 카드 보고 줄 고르기 - 화면 apps/web/src/games/six-nimmt/: 소머리 색 카드, 줄 4개 + 빨간 6번째 칸, 공개 카드 줄과 한 장씩 놓이는 재생(줄 빛남·흔들림·"+🐮" 배너·음매 소리), 손패 미리 보기("2번 줄 3번째"/"⚠ 가져감"/"⬇ 너무 작음"), 뒤집기 토글, 줄 고르기 버튼(추천), 프로 뽑기, 라운드 결과 창, 최종 표, 점수표·나온 카드 표·기록, 휴대폰 320px, 도움말·30초 요약 - 등록: GAMES·BOT_STRATEGIES·BOT_GAMES·CATALOG·GAME_UI·GAME_ICON·카드·패 탭, docs/games/README.md, 설계 문서에 정한 것 기록 - 테스트: 규칙 46개(문서 §10 예시 전부, 무작위 대국 옵션 7종 JSON 왕복·결정성·정보 누출·카드 총수·onTimeout 합법), 컴퓨터 25개(옵션 7종 × 2·5·10명, 60단계 대 1단계), 도움말 2개, 방 통합 4개, E2E six-nimmt·six-nimmt-pro Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
157
e2e/games.e2e.ts
157
e2e/games.e2e.ts
@@ -1191,6 +1191,51 @@ async function magicalStep(p: Page, phone: boolean, st: { picks: number; selects
|
||||
return false;
|
||||
}
|
||||
|
||||
async function sixStep(p: Page, phone: boolean, st: { selects: number; taps: number; rows: number; spots: number; drafts: number }): Promise<boolean> {
|
||||
const press = (l: Locator) => (phone ? l.tap({ timeout: 1500 }) : l.click({ timeout: 1500 }));
|
||||
try {
|
||||
const take = p.locator('.sx-takebtn:not([disabled])');
|
||||
if (await take.count()) {
|
||||
await press(take.first());
|
||||
st.rows++;
|
||||
await p.waitForTimeout(200);
|
||||
return true;
|
||||
}
|
||||
const spot = p.locator('.sx-spot:not([disabled])');
|
||||
if (await spot.count()) {
|
||||
await press(spot.first());
|
||||
st.spots++;
|
||||
return true;
|
||||
}
|
||||
const pool = p.locator('.sx-poolbtn:not([disabled])');
|
||||
if (await pool.count()) {
|
||||
await press(pool.nth(st.drafts % (await pool.count())));
|
||||
st.drafts++;
|
||||
return true;
|
||||
}
|
||||
const cards = p.locator('.sx-hcard:not([disabled])');
|
||||
const n = await cards.count();
|
||||
if (n && !(await p.locator('.sx-hcard.sent').count())) {
|
||||
const card = cards.nth((st.selects * 3) % n);
|
||||
if (phone && Math.floor(st.selects / 2) % 2 === 0) {
|
||||
// Phone: tap the same card twice to play it.
|
||||
await card.tap({ timeout: 1500 });
|
||||
await card.tap({ timeout: 1500 });
|
||||
st.taps++;
|
||||
} else {
|
||||
await press(card);
|
||||
await press(p.locator('.sx-send'));
|
||||
}
|
||||
st.selects++;
|
||||
await p.locator('.sx-hcard.sent').or(p.locator('.sx-reveal')).first().waitFor({ timeout: 4000 }).catch(() => {});
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const PLANS: Record<string, Plan> = {
|
||||
blackjack: {
|
||||
// PC host + phone guest. Each hand: bet the minimum, stand (decline insurance), then press 다음 판, until the
|
||||
@@ -3190,6 +3235,118 @@ const PLANS: Record<string, Plan> = {
|
||||
console.log(` magical-athlete: ${st.picks} picks, ${st.selects} race picks, ${st.acts} turn choices (${st.second} second options), powers + wild track seen`);
|
||||
},
|
||||
},
|
||||
'six-nimmt': {
|
||||
// PC host + phone guest, two rounds by round count. Real secret picks (PC: card + [이 카드 내기]; phone: also a double
|
||||
// tap), too-low cards take a row through the row buttons, until the game ends. Rules are covered by the engine tests.
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('group', { name: '끝나는 조건' }).getByRole('button', { name: '라운드 수' }).click();
|
||||
await host.getByRole('group', { name: '라운드 수' }).getByRole('button', { name: '2라운드' }).click();
|
||||
await host.getByText('2라운드').first().waitFor();
|
||||
},
|
||||
drive: async (pages) => {
|
||||
const [host, guest] = pages as [Page, Page];
|
||||
const st = { selects: 0, taps: 0, rows: 0, spots: 0, drafts: 0 };
|
||||
const shots = new Set<string>();
|
||||
let roundBox = false;
|
||||
let revealSeen = false;
|
||||
const over = () => host.getByRole('dialog', { name: '게임 결과' }).count();
|
||||
const until = Date.now() + 300_000;
|
||||
while (Date.now() < until && !(await over())) {
|
||||
for (const [i, p] of pages.entries()) {
|
||||
if (!shots.has(`choose${i}`) && (await p.locator('.sx-takebtn:not([disabled])').count())) {
|
||||
shots.add(`choose${i}`);
|
||||
await p.screenshot({ path: join(SHOTS, `six-nimmt-choose-${i ? 'phone' : 'pc'}.png`), fullPage: i > 0 });
|
||||
}
|
||||
}
|
||||
let acted = false;
|
||||
for (const [i, p] of pages.entries()) {
|
||||
if (await sixStep(p, i > 0, st)) {
|
||||
acted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!revealSeen && (await host.locator('.sx-reveal').count())) revealSeen = true;
|
||||
if (!roundBox && (await host.locator('.sx-round').count())) {
|
||||
roundBox = true;
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-round-pc.png') });
|
||||
}
|
||||
if (!shots.has('mid') && st.selects >= 7) {
|
||||
shots.add('mid');
|
||||
await host.waitForTimeout(300);
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-mid-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-mid-phone.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-mid-phone-full.png'), fullPage: true });
|
||||
await host.emulateMedia({ colorScheme: 'dark' });
|
||||
await guest.emulateMedia({ colorScheme: 'dark' });
|
||||
await host.waitForTimeout(300);
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-mid-pc-dark.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-mid-phone-dark.png'), fullPage: true });
|
||||
await host.emulateMedia({ colorScheme: 'light' });
|
||||
await guest.emulateMedia({ colorScheme: 'light' });
|
||||
}
|
||||
if (!shots.has('narrow') && st.selects >= 12) {
|
||||
shots.add('narrow');
|
||||
await guest.setViewportSize({ width: 320, height: 700 });
|
||||
await guest.waitForTimeout(300);
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-320-phone.png'), fullPage: true });
|
||||
const wide = await guest.evaluate(() => document.documentElement.scrollWidth);
|
||||
if (wide > 322) throw new Error(`page is ${wide}px wide at 320px`);
|
||||
await guest.setViewportSize({ width: 390, height: 844 });
|
||||
}
|
||||
if (!acted) await host.waitForTimeout(150);
|
||||
}
|
||||
if (!(await over())) throw new Error(`game did not finish (${JSON.stringify(st)})`);
|
||||
await guest.getByRole('dialog', { name: '게임 결과' }).waitFor();
|
||||
await host.waitForTimeout(600);
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-result-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-result-phone.png') });
|
||||
await host.keyboard.press('Escape');
|
||||
await host.locator('section[aria-label="최종 결과"]').waitFor();
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-final-pc.png'), fullPage: true });
|
||||
const cols = await host.locator('section[aria-label="최종 결과"] thead th').count();
|
||||
if (cols !== 5) throw new Error(`expected 2 round columns in the final table, saw ${cols - 3}`);
|
||||
if (st.selects < 38 || !st.taps || !revealSeen) throw new Error(`too few real steps: ${JSON.stringify(st)} reveal=${revealSeen}`);
|
||||
console.log(` six-nimmt: ${st.selects} picks (${st.taps} double taps), ${st.rows} row choices, round box ${roundBox ? 'seen' : 'missed'}`);
|
||||
},
|
||||
},
|
||||
'six-nimmt-pro': {
|
||||
// Variant smoke test: the pro draft (2 players → 1~24 face up, ten picks each) and both-ends placement, one round.
|
||||
game: 'six-nimmt',
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('group', { name: '카드 구성' }).getByRole('button', { name: '펼쳐 골라 가기' }).click();
|
||||
await host.getByRole('group', { name: '줄에 붙이는 곳' }).getByRole('button', { name: '양쪽 끝' }).click();
|
||||
await host.getByRole('group', { name: '끝나는 조건' }).getByRole('button', { name: '라운드 수' }).click();
|
||||
await host.getByRole('group', { name: '라운드 수' }).getByRole('button', { name: '1라운드' }).click();
|
||||
await host.getByText('펼쳐 골라 가기').first().waitFor();
|
||||
},
|
||||
drive: async (pages) => {
|
||||
const [host, guest] = pages as [Page, Page];
|
||||
const st = { selects: 0, taps: 0, rows: 0, spots: 0, drafts: 0 };
|
||||
let draftShot = false;
|
||||
const over = () => host.getByRole('dialog', { name: '게임 결과' }).count();
|
||||
const until = Date.now() + 240_000;
|
||||
while (Date.now() < until && !(await over())) {
|
||||
let acted = false;
|
||||
for (const [i, p] of pages.entries()) {
|
||||
if (await sixStep(p, i > 0, st)) {
|
||||
acted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!draftShot && st.drafts >= 5) {
|
||||
draftShot = true;
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-pro-draft-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'six-nimmt-pro-draft-phone.png'), fullPage: true });
|
||||
}
|
||||
if (!acted) await host.waitForTimeout(150);
|
||||
}
|
||||
if (!(await over())) throw new Error(`game did not finish (${JSON.stringify(st)})`);
|
||||
await host.waitForTimeout(600);
|
||||
await host.screenshot({ path: join(SHOTS, 'six-nimmt-pro-result-pc.png') });
|
||||
if (st.drafts !== 20 || st.selects < 19) throw new Error(`too few real steps: ${JSON.stringify(st)}`);
|
||||
console.log(` six-nimmt-pro: ${st.drafts} draft picks, ${st.selects} card picks, ${st.rows} row choices, ${st.spots} spot choices`);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const games = process.argv.slice(2).length ? process.argv.slice(2) : Object.keys(PLANS);
|
||||
|
||||
Reference in New Issue
Block a user