블랙잭: 카드 연출이 끝나기 전 [다음 판] 막기, 자리 폭 나누기와 카드 크기 맞추기로 겹침·잘림 없애기

- [다음 판]은 딜러 카드가 다 놓여 결과가 보인 뒤에만 눌림(혼자 하는 판도 결과를 건너뛰지 않음)
- 자리마다 테이블 폭을 무게(내 자리·스플릿 자리 더 넓게)로 나누고, 그 폭과 딜러 아래 높이에 맞춰 카드 크기 계산(최소 26px), 손패 3개 이상이면 두 줄
- 좁은 자리는 아바타 없이 이름만, 손패 정보 줄바꿈
- 엔진 테스트: 처음 나눠 주기·딜러 차례 연출 시간이 제한 시간에 더해지는지(1인 판)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-17 01:43:31 +09:00
parent 02c2a8508c
commit 0335a09eef
3 changed files with 116 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, test } from 'bun:test';
import { SeededRng, playoutSeeds, randomPlayout, seedN, type CardId, type RngState } from '@bg/engine';
import {
BJ_DEAL_STEP_MS,
blackjack,
buildShoe,
chipsNonNegative,
@@ -113,6 +114,23 @@ describe('flow', () => {
expect(s.rounds['A']!.hands[0]!.status).toBe('bust'); // +QD = 30
});
test('카드 연출 시간: 처음 나눠 주기와 딜러 차례만큼 다음 제한 시간이 늘어요(혼자 하는 판도 결과를 건너뛰지 않음)', () => {
// A: KS, 7D (17). Dealer: 5H + 6C, then draws 2S, 3D, 4C → 20.
const shoe: CardId[] = ['KS', '5H', '7D', '6C', '2S', '3D', '4C'];
let s = make({ insurance: false }, ['A'], shoe);
s = blackjack.apply(s, 'A', { type: 'bet', amount: 100 }, { rng: rng(), now: 1000 }).state;
expect(s.phase).toBe('playing');
// 4 cards dealt × 450 ms on top of the 20 s turn.
expect(s.deadlineMs).toBe(20_000 + 4 * BJ_DEAL_STEP_MS);
expect(s.deadlineAt).toBe(1000 + 20_000 + 4 * BJ_DEAL_STEP_MS);
s = blackjack.apply(s, 'A', { type: 'stand' }, { rng: rng(), now: 2000 }).state;
expect(s.phase).toBe('handEnd');
expect(s.dealer).toHaveLength(5);
// Hole card turn + 3 drawn cards, then the usual result time.
expect(s.deadlineMs).toBe(s.options.handEndSeconds * 1000 + 4 * BJ_DEAL_STEP_MS);
expect(s.animLagMs).toBe(0);
});
test('전체 흐름: 한 판을 끝까지', () => {
let s = make({ insurance: false, handLimit: 5 });
let now = 1;