컴퓨터 생각 시간을 사람처럼: 컴퓨터마다 다른 빠르기, 고를 게 많을수록 길게, 가끔 멈칫

- defaultBotDelay: 할 게 하나면 0.7~1.3초, 고르면 1.6~3.9초(+12% 확률로 1~3초 멈칫)
- botPace: 컴퓨터 id로 고정된 0.7~1.5배 빠르기
- 같은 컴퓨터가 이어서 두는 동작은 절반, 사람과 같은 반응 창은 +1.5초(그대로)
- 차례 시간이 있으면 남은 시간의 절반을 넘기지 않음
- e2e(bots) 컴퓨터 응답 대기 8초 → 15초, docs/06 §12 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-11 01:23:38 +09:00
parent c97fb4583e
commit 4c967f4de4
6 changed files with 135 additions and 26 deletions

View File

@@ -6,7 +6,7 @@ import { ulid } from 'ulid';
import { SeededRng, createSeed, seedToHex, type AnyGameDefinition, type GameResult, type RngState } from '@bg/engine';
import { botsAllowed, isBotId, makeBotId, botNumber, maskProfanity, type PublicUser, type RoomView, type ServerMessage, type SeatView } from '@bg/shared';
import { sha256Hex } from '../auth/sessions';
import { BotDriver } from './bots';
import { BotDriver, type BotDelayInput } from './bots';
import type { LogEntry, RoomStore } from './store';
import { applyLocks, type EffectiveGame, type SiteSettings } from '../admin/settings';
@@ -82,7 +82,7 @@ export interface RoomDeps {
/** Admin settings (docs/14-admin.md). Optional so unit tests can run without them. */
settings?: { game(id: string): EffectiveGame | null; getSite(): SiteSettings };
/** Computer players' thinking time (ms) for a decision with `choices` options; tests may pin it. */
botDelay?: (choices: number, withPeople: boolean) => number;
botDelay?: (input: BotDelayInput) => number;
}
const CHAT_HISTORY = 30;
@@ -149,6 +149,7 @@ export class Room {
return room.def;
},
now: this.now,
deadline: () => this.effectiveDeadline(),
run: (bot, action) => {
const parsed = this.def.actionSchema.safeParse(action);
return parsed.success ? this.runAction(bot, parsed.data, undefined, false) : '잘못된 요청이에요.';