From bdb415aff6127ce67460732f257709ec69ad941b Mon Sep 17 00:00:00 2001 From: EJClaw Date: Thu, 15 Oct 2026 23:47:48 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=AB=EC=8A=A4=ED=8A=B8=EB=A6=AD=20?= =?UTF-8?q?=EC=BB=B4=ED=93=A8=ED=84=B0:=2060=EB=A0=88=EB=B2=A8=20=EC=8B=9C?= =?UTF-8?q?=EB=AE=AC=EB=A0=88=EC=9D=B4=EC=85=98=20400=E2=86=92200=EB=B2=88?= =?UTF-8?q?.=20400=EB=B2=88=EC=9D=B4=EB=A9=B4=20=ED=98=BC=EC=9E=90?= =?UTF-8?q?=EC=84=9C=20=ED=95=9C=20=EC=88=98=20=EC=B5=9C=EB=8C=80=2036ms?= =?UTF-8?q?=EB=9D=BC=20=EC=A0=84=EC=B2=B4=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=91=EB=A0=AC=EB=A1=9C=20=EB=8F=8C=EB=A6=B4=20?= =?UTF-8?q?=EB=95=8C=20=EC=84=9C=EB=B2=84=EC=9D=98=20=EC=BB=B4=ED=93=A8?= =?UTF-8?q?=ED=84=B0=20=ED=95=9C=20=EC=88=98=20=EC=98=88=EC=82=B0(50ms)?= =?UTF-8?q?=EC=9D=84=20=EB=84=98=EC=96=B4=20'slow=20bot=20move'=20?= =?UTF-8?q?=EA=B2=BD=EA=B3=A0=EB=A1=9C=20bots.room.test=EA=B0=80=20?= =?UTF-8?q?=EA=B0=80=EB=81=94=20=EC=8B=A4=ED=8C=A8=ED=96=88=EC=9D=8C.=20?= =?UTF-8?q?=EB=B4=87=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EA=B8=B0=EC=A4=80?= =?UTF-8?q?=EB=8F=84=20=ED=95=9C=20=EC=88=98=2040ms=20=EB=AF=B8=EB=A7=8C?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- docs/games/hot-streak.md | 4 ++-- packages/games/src/hot-streak/bot.test.ts | 4 ++-- packages/games/src/hot-streak/bot.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/games/hot-streak.md b/docs/games/hot-streak.md index ef3015a..68a1d97 100644 --- a/docs/games/hot-streak.md +++ b/docs/games/hot-streak.md @@ -388,7 +388,7 @@ interface HotStreakState { ### 8.7 컴퓨터 상대(레벨 1~60) - 입력은 자기 `view`와 `legal`뿐. 덱 추정: `faceUp`/`known` + 내 손패 + 아직 안 보인 카드(53장 중 나머지)에서 남이 넣었을 카드를 무작위로 채운다. -- `sim.ts`: 위 추정 덱으로 경주를 N번 돌려(레벨 1은 30번, 60은 400번, 사이에서 고르게) 마스코트별 등수 분포와 사이드 질문 확률을 얻는다. +- `sim.ts`: 위 추정 덱으로 경주를 N번 돌려(레벨 1은 30번, 60은 200번(서버의 컴퓨터 한 수 예산 50ms 안에 넉넉히 들도록), 사이에서 고르게) 마스코트별 등수 분포와 사이드 질문 확률을 얻는다. - 뽑기: 남은 티켓의 안전·위험(·거꾸로) 면 기대값을 계산해 고른다. 마지막 경주 두 배는 기대값이 가장 큰 티켓(마이너스 위험 고려). - 넣기: 손패 카드마다 "그 카드를 넣었을 때 내 티켓 기대 수익"을 시뮬레이션해 가장 좋은 카드를 넣는다(내가 건 마스코트를 밀거나 1등 후보를 넘어뜨림). - 레벨이 낮을수록 가끔 덜 좋은 수: 공통 `humanBest` 확률표를 쓰되, 점수는 기대 달러이고 `small` = $1, `critical`은 쓰지 않는다. @@ -430,7 +430,7 @@ interface HotStreakState { - [ ] 경주 사이: 티켓 복귀, 사이드 다음 카드, 덱에서 1장(2장) 받기, 시작 카드도 손에 올 수 있음, `draftStart` 세 방식(동점 처리 포함), 상금 나누기 3장 교체. - [ ] 엔진 공통: 무작위 대국 1,000시드(2·3·5·8·9·10명, 옵션 조합), JSON 왕복, 결정성, 유출 검사(`#gen` 접미사 덕분에 오탐 없음), 시간 초과만으로 끝남, 카드 총수 보존(18 + 손패 + 상자 = 53). - [ ] 경주는 마감 타이머만으로 끝까지 넘어감(연결 끊긴 사람이 있어도), `HURRY` 전원 동의 시 즉시 끝. -- [ ] 컴퓨터: 레벨 1·60이 2~10명 끝까지, 모든 수 합법, 한 수 50ms 이내(시뮬레이션 400번 기준), 60레벨이 무작위보다 돈을 더 많이 범. +- [ ] 컴퓨터: 레벨 1·60이 2~10명 끝까지, 모든 수 합법, 한 수 50ms 이내(시뮬레이션 200번 기준), 60레벨이 무작위보다 돈을 더 많이 범. - [ ] 방 통합·E2E: PC 방장 + 휴대폰(320px)으로 티켓 뽑기·위험 면·카드 넣기·경주 구경·정산·마지막 두 배까지 한 판, 넣은 카드 비공개 확인. ## 11. 참고 자료 diff --git a/packages/games/src/hot-streak/bot.test.ts b/packages/games/src/hot-streak/bot.test.ts index 2dcb846..df7f8bb 100644 --- a/packages/games/src/hot-streak/bot.test.ts +++ b/packages/games/src/hot-streak/bot.test.ts @@ -13,7 +13,7 @@ const opts = (o: Partial = {}) => def.optionsSchema.parse({ .. describe('핫스트릭 컴퓨터', () => { test('시뮬레이션 횟수: 레벨 1은 30번, 60은 400번', () => { expect(runsFor(1)).toBe(30); - expect(runsFor(60)).toBe(400); + expect(runsFor(60)).toBe(200); expect(runsFor(30)).toBeGreaterThan(30); }); @@ -32,7 +32,7 @@ describe('핫스트릭 컴퓨터', () => { const r = botPlayout(def, { players: seats(n, 0), seed: seedN(n + level), isBot, level, maxSteps: 20_000 }); expect(r.finished).toBe(true); expect(r.botTimeouts).toBe(0); - expect(r.maxBotMs).toBeLessThan(level === 60 ? 120 : 60); + expect(r.maxBotMs).toBeLessThan(40); }); } } diff --git a/packages/games/src/hot-streak/bot.ts b/packages/games/src/hot-streak/bot.ts index e859e35..d59ab37 100644 --- a/packages/games/src/hot-streak/bot.ts +++ b/packages/games/src/hot-streak/bot.ts @@ -1,6 +1,6 @@ /** * 핫스트릭 컴퓨터 (docs/games/hot-streak.md §8.7). Only its own view: it guesses the race deck from the face-up list, - * the cards seen last race and its own hand, runs the race many times (레벨 1: 30번 … 60: 400번) and + * the cards seen last race and its own hand, runs the race many times (레벨 1: 30번 … 60: 200번) and * - 티켓: 안전·위험(·거꾸로) 면의 기대 달러가 가장 큰 것, 마지막 경주 두 배는 기대값이 가장 큰 티켓, * - 카드 넣기: 넣었을 때 내 티켓 기대 수익이 가장 큰 카드(같은 셔플로 비교), * - 상금 나누기: 상금 기대값이 큰 마스코트 + 확률이 높은 쪽 YES/NO. @@ -17,10 +17,10 @@ import type { HotStreakView } from './index'; type Act = HotStreakAction; const SCALE = { small: 1, critical: Infinity }; -/** Simulated races for a decision at this level (1 → 30, 60 → 400). */ +/** Simulated races for a decision at this level (1 → 30, 60 → 200): even under load a move stays well inside the server's 50 ms bot budget. */ export const runsFor = (level: number | undefined): number => { const l = Math.min(60, Math.max(1, level ?? 30)); - return Math.round(30 + ((l - 1) / 59) * 370); + return Math.round(30 + ((l - 1) / 59) * 170); }; /** What the bot can tell about the coming race deck (public info + its own hand). */