새 게임 핫스트릭: 마스코트 넷의 카드 경주에 티켓으로 거는 파티 게임(2~10명, 놀이용 가상 돈)
- 엔진 packages/games/src/hot-streak/(cards·rules·race·index·sim·bot): 뱀 순서 티켓 뽑기(안전/위험 면) → 비밀 카드 넣기 → 경주 → 정산, 경주 3번 - 경주는 서버 타이머가 flipSeconds마다 카드 한 장씩(timeoutPlayers 한 자리 + timeoutNotBefore, 끊겨도 빨라지지 않음), 모두 [빨리 보기]면 끝까지 바로 - 카드 53장·충돌·기어가기·꺾기·초록 카드·허들·경주로 접기(13→10→7→3→0)·시상대 공동 실격·사이드 질문 12개 판정 - 섞을 때마다 카드 id 접미사(#gen)를 새로 붙여 유출 검사가 헷갈리지 않음 - §2 옵션 13개 모두: bettingMode(9~10명 상금 나누기 포함), races, finalBet, draftStart, reverseBets, cardsPerRace, burn, spicyDeck, hurdles, potScale, lifeStory, turnSeconds, flipSeconds - 컴퓨터: 공개 정보로 덱을 추정해 몬테카를로 경주(레벨 1: 30번 ~ 60: 400번), 티켓·두 배·카드 넣기·상금 나누기 기대값, humanBest - 화면 apps/web/src/games/hot-streak/: 직접 그린 SVG 마스코트(곰·핫도그·아귀·여왕)와 카드, PC 가로·휴대폰 세로 경주로, 경주 기록을 한 박자 늦게 다시 그리기(폴짝·쾅·실격·등수·접기), 티켓 더미·두 배·비밀 카드·상금 나누기·정산·최종 결과(인생 결과), 도움말·30초 요약 - 등록: GAMES·BOT_STRATEGIES·BOT_GAMES·CATALOG·GAME_UI·GAME_ICON·여럿이 파티 탭, docs/games/README.md, 설계 문서 §13 구현 메모(정한 세부 규칙) - 테스트: 엔진 64개(§10 체크리스트·§5.8 예시·무작위 대국·시간 초과만으로 끝·유출 없음), 컴퓨터 15개, 도움말 2개, 방 통합 3개, e2e/games.e2e.ts hot-streak(PC + 휴대폰, 320px 넘침 확인) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3190,6 +3190,105 @@ 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`);
|
||||
},
|
||||
},
|
||||
'hot-streak': {
|
||||
// PC host + phone guest, one race (so it is also the last one: 두 배 티켓), cards every 1.2 s. Real draft (one risky
|
||||
// face), secret cards (2 each with 2 players), a few cards flipped by the server clock, then both press 빨리 보기,
|
||||
// payout table, final result. The put-in cards stay private.
|
||||
players: 2,
|
||||
lobby: async (host) => {
|
||||
await host.getByRole('group', { name: '경주 수' }).getByRole('button', { name: '1번(맛보기)' }).click();
|
||||
await host.getByRole('group', { name: '카드 넘기는 간격' }).getByRole('button', { name: '1.2초' }).click();
|
||||
await host.getByText('경주 1번').first().waitFor();
|
||||
},
|
||||
drive: async (pages) => {
|
||||
const [host, guest] = pages as [Page, Page];
|
||||
const st = { drafts: 0, risky: 0, doubles: 0, puts: 0, flips: 0, hurried: false, payout: false };
|
||||
const shots = new Set<string>();
|
||||
const over = () => host.getByRole('dialog', { name: '게임 결과' }).count();
|
||||
const shot = async (name: string) => {
|
||||
if (shots.has(name)) return;
|
||||
shots.add(name);
|
||||
await host.screenshot({ path: join(SHOTS, `hot-streak-${name}-pc.png`) });
|
||||
await guest.screenshot({ path: join(SHOTS, `hot-streak-${name}-phone.png`), fullPage: true });
|
||||
await guest.setViewportSize({ width: 320, height: 720 });
|
||||
await guest.waitForTimeout(300);
|
||||
await guest.screenshot({ path: join(SHOTS, `hot-streak-${name}-phone320.png`), fullPage: true });
|
||||
const wide = await guest.evaluate(() => document.documentElement.scrollWidth);
|
||||
if (wide > 322) throw new Error(`hot-streak ${name}: page is ${wide}px wide at 320px`);
|
||||
await guest.setViewportSize({ width: 390, height: 844 });
|
||||
};
|
||||
const tryClick = (l: Locator) => l.click({ timeout: 2000 }).then(() => true, () => false);
|
||||
const until = Date.now() + 240_000;
|
||||
while (Date.now() < until && !(await over())) {
|
||||
let acted = false;
|
||||
for (const p of pages) {
|
||||
const stack = p.locator('section[aria-label="티켓 뽑기"] button.hs-stack:not([disabled])').first();
|
||||
if (await stack.count()) {
|
||||
if (st.drafts === 1) await shot('draft');
|
||||
if (!(await stack.click({ timeout: 2000 }).then(() => true, () => false))) continue;
|
||||
const risky = st.risky === 0;
|
||||
if (!(await tryClick(p.getByRole('button', { name: risky ? /위험으로/ : /안전으로/ }).first()))) continue;
|
||||
st.drafts++;
|
||||
if (risky) st.risky++;
|
||||
acted = true;
|
||||
break;
|
||||
}
|
||||
const dbl = p.locator('section[aria-label="두 배 티켓 고르기"] button.btn:not([disabled])').first();
|
||||
// The panel goes away once the server answers: a click that finds nothing is just retried next round.
|
||||
if ((await dbl.count()) && (await dbl.click({ timeout: 2000 }).then(() => true, () => false))) {
|
||||
st.doubles++;
|
||||
acted = true;
|
||||
break;
|
||||
}
|
||||
const cards = p.locator('section[aria-label="비밀 카드 넣기"] button.hs-hcard:not([disabled])');
|
||||
if ((await cards.count()) && (await p.getByRole('button', { name: /몰래 넣기/ }).count())) {
|
||||
await shot('submit');
|
||||
if (!(await tryClick(cards.nth(0))) || !(await tryClick(cards.nth(1))) || !(await tryClick(p.getByRole('button', { name: /몰래 넣기/ })))) continue;
|
||||
// The first one sees their own card while waiting; the last one starts the race at once.
|
||||
if (st.puts === 0) await p.getByText('넣은 카드:').waitFor({ timeout: 5000 });
|
||||
st.puts++;
|
||||
acted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const flips = await host.locator('.hs-flipped .hs-card').count();
|
||||
st.flips = Math.max(st.flips, flips);
|
||||
if (flips >= 3 && !shots.has('race')) {
|
||||
await shot('race');
|
||||
await host.emulateMedia({ colorScheme: 'dark' });
|
||||
await host.waitForTimeout(250);
|
||||
await host.screenshot({ path: join(SHOTS, 'hot-streak-race-pc-dark.png') });
|
||||
await host.emulateMedia({ colorScheme: 'light' });
|
||||
// Secret cards: each sees only their own.
|
||||
const mineH = await host.getByText('넣은 카드:').count();
|
||||
const mineG = await guest.getByText('넣은 카드:').count();
|
||||
if (mineH || mineG) throw new Error('put-in cards still shown during the race');
|
||||
}
|
||||
if (shots.has('race') && !st.hurried) {
|
||||
for (const p of pages) await p.getByRole('button', { name: /빨리 보기/ }).click();
|
||||
st.hurried = true;
|
||||
}
|
||||
const next = host.getByRole('button', { name: /최종 결과 보기|다음 경주로/ });
|
||||
if (await next.count()) {
|
||||
st.payout = true;
|
||||
await host.waitForTimeout(300);
|
||||
await shot('payout');
|
||||
acted = await tryClick(next);
|
||||
}
|
||||
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(500);
|
||||
await host.screenshot({ path: join(SHOTS, 'hot-streak-result-pc.png') });
|
||||
await guest.screenshot({ path: join(SHOTS, 'hot-streak-result-phone.png') });
|
||||
await host.keyboard.press('Escape');
|
||||
await host.locator('section[aria-label="최종 결과"]').waitFor();
|
||||
await host.screenshot({ path: join(SHOTS, 'hot-streak-final-pc.png'), fullPage: true });
|
||||
if (st.drafts !== 6 || st.doubles !== 2 || st.puts !== 2 || st.flips < 3 || !st.hurried || !st.payout) throw new Error(`too few real steps: ${JSON.stringify(st)}`);
|
||||
console.log(` hot-streak: ${st.drafts} tickets (${st.risky} risky), ${st.doubles} doubles, ${st.puts} secret puts, ${st.flips}+ cards flipped on the clock, 빨리 보기, payout`);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const games = process.argv.slice(2).length ? process.argv.slice(2) : Object.keys(PLANS);
|
||||
|
||||
Reference in New Issue
Block a user