섯다: 3장 섯다를 한게임 방식으로 — 2장 받고 공개패 1장 고르기 → 1구 베팅 → 1장 더 → 2구 베팅 → 3장 중 2장 골라 승부

- 엔진: 공개패 단계(open)·액션, 공개패는 다른 사람 화면에 앞면, 최종 선택은 마지막 베팅 뒤(threePick=end), 옵션 threeOpen/threePick으로 예전 흐름 유지, 상태 v3(진행 중인 방은 예전 흐름)
- 컴퓨터: 광·4/7/9 열끗은 숨기고 평범한 패 공개, 상대 공개패를 패 범위에 반영
- 화면: 공개패 고르기 상자, 자리 표시·도움말·규칙·옵션
- 2장 섯다 기본(2장 한 번에)은 한게임 안내 그대로, 1장씩(전통)은 옵션
- E2E seotda3, 문서 §2·§5.2·§8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 22:22:06 +09:00
parent 9564e4604c
commit 1cf556b431
10 changed files with 333 additions and 41 deletions

View File

@@ -449,9 +449,9 @@ describe('재경기', () => {
});
});
describe('3장 섯다', () => {
describe('3장 섯다 (옵션: 공개패 없이, 마지막 베팅 전에 고르기)', () => {
function three() {
let s = make({ cardMode: 'three' });
let s = make({ cardMode: 'three', threeOpen: false, threePick: 'beforeBet' });
s = rig(s, { A: [S(1), S(8)], B: [P(5), P(6)], C: [P(2), P(7)] }, [S(4), P(9), P(10)]);
s = act(s, 'A', { type: 'check' });
s = act(s, 'B', { type: 'check' });
@@ -510,6 +510,76 @@ describe('3장 섯다', () => {
});
});
describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅 → 1장 더 → 2구 베팅 → 2장 고르기)', () => {
function opened() {
let s = make({ cardMode: 'three' });
s = rig(s, { A: [S(1), S(8)], B: [P(5), P(6)], C: [P(2), P(7)] }, [S(4), P(9), P(10)]);
return s;
}
test('2장을 받으면 먼저 모두 공개할 패 1장을 고르고, 고른 패는 모두에게 앞면으로 보여요', () => {
let s = opened();
expect(s.hand!.phase).toBe('open');
expect(s.hand!.cards.A).toHaveLength(2);
expect(seotda.activePlayers(s).sort()).toEqual(['A', 'B', 'C']);
expect(reject(s, 'A', { type: 'check' })).toBe('지금은 베팅 시간이 아니에요.');
expect(reject(s, 'A', { type: 'open', cardId: P(9) })).toBe('내 패 중에서 골라 주세요.');
s = act(s, 'A', { type: 'open', cardId: S(8) });
expect(reject(s, 'A', { type: 'open', cardId: S(1) })).toBe('이미 공개패를 골랐어요.');
const b = seotda.view(s, 'B');
expect(b.seats.find((x) => x.id === 'A')!.cards).toEqual([{ hidden: true }, expect.objectContaining({ id: S(8) })]);
expect(b.seats.find((x) => x.id === 'A')!.opening).toBe(true);
expect(b.seats.find((x) => x.id === 'C')!.opening).toBe(false);
expect(JSON.stringify(b)).not.toContain(`"id":${S(1)},`);
expect(seotda.secretsOf!(s, 'A')).not.toContain(`h1r0c${S(8)}`);
s = act(s, 'B', { type: 'open', cardId: P(6) });
s = act(s, 'C', { type: 'timeout' }); // 낮은 월(2월)을 보여 줘요
expect(s.hand!.opened.C).toBe(P(2));
expect(s.hand!.phase).toBe('betting');
expect(s.hand!.street).toBe(0);
expect(seotda.activePlayers(s)).toEqual(['A']);
});
test('1구 베팅 뒤 1장 더 받고 2구 베팅, 그다음 3장 중 2장을 골라 공개해요', () => {
let s = opened();
for (const [p, c] of [['A', S(8)], ['B', P(6)], ['C', P(7)]] as const) s = act(s, p, { type: 'open', cardId: c });
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'check' });
expect(s.hand!.phase).toBe('betting');
expect(s.hand!.street).toBe(1);
expect(s.hand!.cards.A).toEqual([S(1), S(8), S(4)]);
// The third card is hidden from the others; the 공개패 stays face up.
expect(seotda.view(s, 'C').seats.find((x) => x.id === 'A')!.cards).toEqual([{ hidden: true }, expect.objectContaining({ id: S(8) }), { hidden: true }]);
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'call' });
s = act(s, 'C', { type: 'die' });
expect(s.hand!.phase).toBe('choose');
expect(seotda.activePlayers(s).sort()).toEqual(['A', 'B']);
expect(seotda.view(s, 'A').myCombos!.find((c) => c.best)!.name).toBe('18광땡');
s = act(s, 'A', { type: 'choose', cardIds: [S(1), S(4)] }); // 공개패(8광)를 버리고 독사
expect(seotda.view(s, 'B').seats.find((x) => x.id === 'A')!.cards).toEqual([{ hidden: true }, { hidden: true }]);
s = act(s, 'B', { type: 'timeout' });
expect(s.hand!.phase).toBe('handEnd');
expect(s.hand!.showdown!.hands.find((x) => x.id === 'A')!.name).toBe('독사');
});
test('2구 베팅에서 한 사람만 남으면 고르기 없이 끝나요', () => {
let s = opened();
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'timeout' });
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'check' });
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'die' });
s = act(s, 'C', { type: 'die' });
expect(s.hand!.phase).toBe('handEnd');
expect(s.hand!.foldWin!.winner).toBe('A');
});
test('시간 무제한이면 공개패 고르기에도 마감이 없어요', () => {
const s = make({ turnSeconds: null, cardMode: 'three' });
expect(s.hand!.phase).toBe('open');
expect(s.deadlineAt).toBeNull();
});
});
describe('timeouts, away, leaving', () => {
test('timeout: check when nobody bet, otherwise die; two in a row → away with a 5 s limit', () => {
let s = make();
@@ -701,7 +771,7 @@ describe('한게임 방식 (원 단위, 기본 설정)', () => {
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'check' });
expect(s.hand!.phase).toBe('handEnd');
expect(s.deadlineAt).not.toBeNull();
const three = hg({ turnSeconds: null, cardMode: 'three' });
const three = hg({ turnSeconds: null, cardMode: 'three', threeOpen: false, threePick: 'beforeBet' });
let t = three;
for (const p of ['A', 'B', 'C']) t = act(t, p, { type: 'check' });
expect(t.hand!.phase).toBe('choose');
@@ -731,7 +801,8 @@ describe('한게임 방식 (원 단위, 기본 설정)', () => {
delete h.forced;
delete h.log;
const m = seotda.migrate!(v1, 1);
expect(seotda.stateVersion).toBe(2);
expect(seotda.stateVersion).toBe(3);
expect(m.options).toMatchObject({ threeOpen: false, threePick: 'beforeBet' });
expect([m.options.startingChips, m.options.baseUnit, m.baseUnit]).toEqual([1_000_000, 10_000, 10_000]);
expect(m.options).toMatchObject({ deck: 20, betRule: 'free', quarter: true });
expect(m.seats.map((x) => x.stack)).toEqual(s.seats.map((x) => x.stack * 1000));