3장 섯다를 한게임처럼: 1구 선 하프·다이(1구 체크 없음), 예상족보, 패쪼기

- 엔진: 한게임 흐름(공개패 켬·마지막에 고르기)의 1구 첫 베팅(선)은 하프·다이만, 1구에는 체크 없음(시간 초과는 다이)
- view.myReach: 다음 패로 만들 수 있는 족보(공개 정보만: 덱 구성 − 내 패 − 공개패)
- 족보판 [예상족보 켬/끔]: 못 만드는 족보는 흐리게
- 패쪼기: 새로 받은 패는 뒷면, 밀어 올리면 아래부터 보이고 누르면 바로 뒤집힘, 6초 뒤 자동. 뒤집기 전에는 족보·조합을 숨김
- 도움말·규칙 화면·문서, 엔진 테스트 4개, e2e(1구 하프→콜, 패쪼기 드래그) 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-17 01:16:04 +09:00
parent 9ec756bf38
commit c10fac8e82
9 changed files with 229 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ import { formatWon, formatWonDelta, formatWonShort } from '@bg/games/seotda/mone
import type { PublicUser } from '@bg/shared/lite';
import { Avatar } from '../../components/ui';
import { TurnTimer } from '../../components/TurnTimer';
import { HwatuCard } from '../../components/cards/HwatuCard';
import { HWATU_RATIO, HwatuBack, HwatuCard } from '../../components/cards/HwatuCard';
import { haptic, sfx, sounds } from '../../lib/feedback';
import { usePhone } from '../../lib/media';
import type { BoardProps } from '../types';
@@ -146,6 +146,9 @@ const CSS = `
font-family: inherit; font-weight: 700; font-size: .78rem; line-height: 1.6; letter-spacing: -.01em; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.sd-jokbo li button:hover { border-color: var(--text-sub); }
.sd-jokbo li button.sel { border-color: var(--text-sub); box-shadow: inset 0 0 0 1px var(--text-sub); }
.sd-jokbo li button.no { opacity: .38; }
.sd-outlook { margin-left: auto; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-sub); font-family: inherit; font-size: .72rem; font-weight: 800; padding: 0 8px; line-height: 1.6; cursor: pointer; }
.sd-outlook.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.sd-jokbo li button.hit { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 900; }
.sd-jokbo-desc { display: flex; gap: 6px; align-items: center; font-size: .78rem; line-height: 1.35; margin-top: auto; padding: 6px 8px; border-radius: 10px; background: var(--surface); }
.sd-jokbo-desc .pics { display: flex; gap: 2px; flex: none; }
@@ -162,6 +165,14 @@ const CSS = `
.sd-handarea .under { display: flex; justify-content: center; }
.sd-handarea .hint { font-size: .8rem; text-align: center; opacity: .92; }
.sd-handarea .sd-seal { font-size: 1.25rem; padding: 2px 16px; }
.sd-squeeze { position: relative; flex: none; padding: 0; border: 0; background: none; border-radius: 7px; overflow: hidden; cursor: grab; touch-action: none;
box-shadow: 0 0 0 3px #fde047, 0 4px 12px rgba(0,0,0,.35); }
.sd-squeeze:active { cursor: grabbing; }
.sd-squeeze .face, .sd-squeeze .cover { position: absolute; inset: 0; display: block; }
.sd-squeeze .cover { transition: transform .06s linear; }
.sd-squeeze .tip { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); white-space: nowrap; font-size: .74rem; font-weight: 900; color: #fff;
background: rgba(0,0,0,.55); border-radius: 999px; padding: 1px 8px; pointer-events: none; animation: sd-nudge 1.1s ease-in-out infinite; }
@keyframes sd-nudge { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
.sd-combos { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sd-combo { border: 0; border-radius: 7px; padding: 2px 10px; font-family: inherit; font-weight: 800; font-size: .88rem; line-height: 1.4; background: rgba(255,255,255,.92); color: #1c1e21; }
.sd-combo.best { background: linear-gradient(160deg, #fde047, #f59e0b); color: #5a2a00; box-shadow: 0 0 0 2px #b45309; }
@@ -537,6 +548,68 @@ function BetGrid({ view: v, me, act, pending, setHover }: { view: SeotdaView; me
);
}
/**
* 패쪼기 (한게임처럼): the extra card comes face down; push the back up (drag) to peek from the bottom-left number, or
* tap / Enter to turn it at once. Turns by itself after a few seconds so nobody gets stuck.
*/
function Squeeze({ card, width, onDone }: { card: SeotdaCardView; width: number; onDone: () => void }) {
const h = Math.round(width * HWATU_RATIO);
const [dy, setDy] = useState(0);
const start = useRef<number | null>(null);
const done = useRef(false);
const finish = () => {
if (done.current) return;
done.current = true;
sfx.cardFlip();
onDone();
};
const finishRef = useRef(finish);
finishRef.current = finish;
useEffect(() => {
const t = setTimeout(() => finishRef.current(), fxMs(6000) || 6000);
return () => clearTimeout(t);
}, []);
return (
<button
type="button"
className="sd-squeeze anim-deal"
style={{ width, height: h, ['--from-y' as string]: '-180px' }}
aria-label="새로 받은 패 확인하기(밀어 올리거나 누르기)"
onPointerDown={(e) => {
start.current = e.clientY;
e.currentTarget.setPointerCapture?.(e.pointerId);
}}
onPointerMove={(e) => {
if (start.current !== null) setDy(Math.min(h, Math.max(0, start.current - e.clientY)));
}}
onPointerUp={() => {
if (start.current === null) return;
start.current = null;
if (dy > h * 0.4 || dy < 6) finish();
else setDy(0);
}}
onPointerCancel={() => {
start.current = null;
setDy(0);
}}
onClick={(e) => {
if (e.detail === 0) finish(); // keyboard (Enter / Space)
}}
>
<span className="face" aria-hidden>
<HwatuCard card={card} width={width} monthStyle="corner" />
</span>
<span className="cover" aria-hidden style={{ transform: `translateY(${-dy}px)` }}>
<HwatuBack w={width} h={h} />
</span>
<span className="tip" aria-hidden>
↑ 밀어서 확인
</span>
</button>
);
}
interface DockProps {
view: SeotdaView;
seat: SeotdaSeatView | null;
@@ -558,6 +631,14 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
const [pick, setPick] = useState<number[]>([]);
useEffect(() => setPick([]), [v.handNo, v.rematchNo, v.handPhase]);
const [hover, setHover] = useState<BetType | null>(null);
// 패쪼기: cards that arrive after the first deal of a (re)match come face down until I peek.
const matchTag = `${v.handNo}-${v.rematchNo}`;
const first = useRef<{ tag: string; keys: Set<string> } | null>(null);
const [peeked, setPeeked] = useState<Set<string>>(() => new Set());
const myKeys = (seat?.cards ?? []).filter(isCard).map((c) => c.key);
if (myKeys.length && first.current?.tag !== matchTag) first.current = { tag: matchTag, keys: new Set(myKeys) };
const squeezing = (key: string) => !!first.current && first.current.tag === matchTag && !first.current.keys.has(key) && !peeked.has(key) && !seat?.handName;
const peeking = myKeys.some(squeezing);
const u = seat ? userOf(players, seat.id) : null;
const cards = seat?.cards ?? [];
const opening = !!seat && v.handPhase === 'open' && seat.opening === false;
@@ -566,7 +647,8 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
const playing = !!seat && seat.inHand && !seat.folded;
const w = phone ? (cards.length > 2 ? 62 : 74) : cards.length > 2 ? 76 : 88;
const tag = `${v.handNo}-${v.rematchNo}`;
const h = v.myHand;
// While a card is still face down, don't give away the new 족보.
const h = peeking ? null : v.myHand;
const hints = v.options.hints;
const onCard = (id: number) =>
opening ? setPick([id]) : choosing ? setPick((p) => (p.includes(id) ? p.filter((x) => x !== id) : p.length >= 2 ? [p[1]!, id] : [...p, id])) : undefined;
@@ -581,7 +663,7 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
let under: ReactNode = null;
if (seat?.handName) under = <span className={`sd-seal anim-pop${isBig(seat.handName) ? ' big' : ''}`}>{seat.handName}</span>;
else if (seat?.folded) under = <span className="sd-seal die">다이</span>;
else if (playing && hints && v.myCombos && !v.myChosen)
else if (playing && hints && v.myCombos && !v.myChosen && !peeking)
under = (
<span className="sd-combos">
{v.myCombos.map((c) =>
@@ -658,7 +740,9 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
? hoverBet
? `${BET_KO[hover!]}: ${BET_HELP[hover!]}. 걸고 나면 내 돈 ${formatWon(seat!.stack - hoverBet.amount)}, 판돈 ${formatWon(v.pot + hoverBet.amount)}`
: v.forcedHalf
? `베팅 규칙 ${v.options.betRule}: 첫 베팅은 하프 또는 다이만 할 수 있어요.`
? v.options.betRule === 'free'
? '3장 섯다 1구: 선은 하프 또는 다이만 할 수 있어요.'
: `베팅 규칙 ${v.options.betRule}: 첫 베팅은 하프 또는 다이만 할 수 있어요.`
: '내 차례예요. 버튼이나 숫자 키로 걸어요.'
: v.handPhase === 'betting' && v.toAct
? `${nick(players, v.toAct)}님 차례예요.`
@@ -667,7 +751,7 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
return (
<>
<div className={`sd-dock${seat?.isTurn ? ' turn' : ''}${winner ? ' win' : ''}`}>
<JokboBoard options={v.options} mine={playing ? h : null} />
<JokboBoard options={v.options} mine={playing ? h : null} reach={playing && !peeking ? v.myReach : null} />
{seat && u && (
<div className="sd-prof" ref={(el) => setRef(seat.id, el)} aria-label={`내 자리, 보유 ${formatWon(seat.stack)}`}>
<ActBubble seat={seat} />
@@ -691,13 +775,15 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
<div className="mine" aria-label="내 패">
{cards.length === 0 && <span className="small">{seat.inHand ? '패를 기다리는 중' : '이번 판은 쉬어요'}</span>}
{cards.map((c, i) =>
isCard(c) ? (
isCard(c) && squeezing(c.key) ? (
<Squeeze key={c.key} card={c} width={w} onDone={() => setPeeked((p) => new Set(p).add(c.key))} />
) : isCard(c) ? (
<HwatuCard
key={c.key}
card={c}
width={w}
monthStyle="corner"
className="anim-deal"
className={peeked.has(c.key) ? undefined : 'anim-deal'}
onClick={() => onCard(c.id)}
disabled={!opening && !choosing}
selected={(opening || choosing) && pick.includes(c.id)}

View File

@@ -75,7 +75,15 @@ test('섯다: 3장 섯다 공개패 → 베팅 2번 → 고르기 단계(한게
expect(helpNow(view(state, null), null, users)).toContain('공개패');
for (const p of ['A', 'B', 'C']) state = applyAction('seotda', state, p, { type: 'open', cardId: view(state, p).seats.find((x) => x.id === p).cards[0].id });
expect(helpNow(view(state, null), null, users)).not.toContain('공개패를 고르는 중');
while (view(state, null).handPhase === 'betting') state = applyAction('seotda', state, view(state, null).toAct, { type: 'check' });
// 1구 (한게임): 선은 하프·다이만, 그다음은 체크 없이 콜. 2구는 체크.
const dealer = view(state, null).toAct as string;
expect(helpNow(view(state, dealer), dealer, users)).toContain('선이 [하프]나 [다이]만');
while (view(state, null).handPhase === 'betting') {
const who = view(state, null).toAct as string;
const legal = view(state, who).legal.map((l: { type: string }) => l.type);
const t = ['check', 'call', 'half'].find((x) => legal.includes(x))!;
state = applyAction('seotda', state, who, { type: t });
}
expect(view(state, null).handPhase).toBe('choose');
expect(view(state, null).street).toBe(1);
expect(helpNow(view(state, null), null, users)).toContain('패를 공개해요');

View File

@@ -94,12 +94,19 @@ function myBetting(v: SeotdaView, seat: SeotdaSeatView): string {
const lines = [`내 차례예요. ${roundText(v)}`];
const hand = handLine(v, seat);
if (hand) lines.push(hand);
lines.push(`누를 수 있는 버튼: ${buttons.map((t) => `[${BET_KO[t]}]`).join(' ')}. 버튼 아래 적힌 금액이 바로 판돈에 들어가요. PC에서는 버튼 왼쪽 위 숫자 키(${buttons.map((t) => `${BET_KO[t]} ${BET_KEY[t]}`).join(', ')})로도 걸 수 있어요.`);
lines.push(`누를 수 있는 버튼: ${buttons.map((t) => `[${BET_KO[t]}]`).join(' ')}. 버튼 아래 적힌 금액이 바로 판돈에 들어가요. PC에서는 버튼 왼쪽에 적힌 숫자 키(${buttons.map((t) => `${BET_KO[t]} ${BET_KEY[t]}`).join(', ')})로도 걸 수 있어요.`);
const tips: string[] = [];
if (v.forcedHalf) tips.push(`이 방은 베팅 규칙 ${v.options.betRule}이라 첫 베팅에서 앞쪽 사람은 [하프]나 [다이]만 할 수 있어요.`);
if (v.forcedHalf)
tips.push(
v.options.betRule === 'free'
? '3장 섯다 1구에서는 선이 [하프]나 [다이]만 할 수 있어요(한게임 방식).'
: `이 방은 베팅 규칙 ${v.options.betRule}이라 첫 베팅에서 앞쪽 사람은 [하프]나 [다이]만 할 수 있어요.`,
);
if (v.threeCard && v.street === 0 && v.options.threeOpen && v.options.threePick === 'end' && !v.forcedHalf)
tips.push('3장 섯다 1구에서는 [체크]를 할 수 없어요. 걸거나 다이해요.');
const call = legal.get('call');
if (call) tips.push(`앞사람이 걸었어요. [콜]은 그만큼(${won(call.amount)}) 맞추는 거예요.`);
else if (legal.has('ping')) tips.push(`[체크]는 걸지 않고 넘기고, [삥]은 기본금만큼 ${won(v.baseUnit)}을 걸어요.`);
else if (legal.has('ping')) tips.push(legal.has('check') ? `[체크]는 걸지 않고 넘기고, [삥]은 기본금만큼 ${won(v.baseUnit)}을 걸어요.` : `[삥]은 기본금만큼 ${won(v.baseUnit)}을 걸어요.`);
if (!buttons.some((t) => RAISES.includes(t)) && seat.lastAction) tips.push('이번 라운드에 이미 한 번 해서 더 올릴 수는 없어요(올리기는 한 라운드에 한 번).');
if (v.legal.some((l) => l.allIn)) tips.push('가진 금액이 모자라면 가진 만큼 다 내는 올인이 돼요.');
tips.push('패가 약하면 [다이]로 이번 판을 포기할 수 있어요.');

View File

@@ -343,7 +343,7 @@ function Rules({ options }: { options?: SeotdaOptions }) {
<strong>진행</strong>: 판마다 모두 <strong>기본금</strong>을 판돈에 내요. 선부터 패를 받고 차례로 베팅해요.
{o?.cardMode === 'three'
? o.threeOpen && o.threePick === 'end'
? ' 3장 섯다(한게임)는 2장을 받아 그중 1장을 골라 모두에게 보여 주고(공개패) → 첫 베팅 → 1장을 더 받아 → 마지막 베팅 → 3장 중 쓸 2장을 골라 공개해요. 버린 1장은 공개패가 아니면 끝까지 아무도 못 봐요.'
? ' 3장 섯다(한게임)는 2장을 받아 그중 1장을 골라 모두에게 보여 주고(공개패) → 1구 베팅 → 1장을 더 받아(밀어 올려 확인하는 패쪼기) → 2구 베팅 → 3장 중 쓸 2장을 골라 공개해요. 1구에서는 선이 하프나 다이만 할 수 있고, 체크는 없어요. 버린 1장은 공개패가 아니면 끝까지 아무도 못 봐요. 족보판의 [예상족보]를 켜면 다음 패로 만들 수 있는 족보만 밝게 보여요.'
: ` 3장 섯다는 2장을 받고${o.threeOpen ? ' 1장을 골라 모두에게 보여 준 뒤' : ''} 베팅 → 1장을 더 받아 ${o.threePick === 'end' ? '마지막 베팅 → 3장 중 쓸 2장을 골라 공개해요' : '3장 중 쓸 2장을 몰래 고르고 → 마지막 베팅 후 공개해요'}. 버린 1장은 끝까지 아무도 못 봐요.`
: o?.dealMode === 'twoRounds'
? ' 1장 받고 베팅, 1장 더 받고 베팅한 뒤 남은 사람끼리 패를 공개해요.'

View File

@@ -115,8 +115,11 @@ export function JokboTable({ options, mine }: { options: SeotdaOptions; mine?: S
* Compact 족보판 (bottom-left of the table, like 한게임 섯다): every hand in 3 columns, my current hand lit up (when
* hints are on); the line below explains the selected hand (my hand by default, or the one clicked).
*/
export function JokboBoard({ options, mine }: { options: SeotdaOptions; mine: SeotdaView['myHand'] }) {
export function JokboBoard({ options, mine, reach }: { options: SeotdaOptions; mine: SeotdaView['myHand']; reach?: SeotdaView['myReach'] }) {
const rows = jokboRows(options);
// 예상족보 (한게임처럼 켜고 끌 수 있음): rows my next card can still make stay bright, the rest fade.
const [outlook, setOutlook] = useState(true);
const can = reach && outlook ? (r: JokboRow) => reach.some((x) => r.match(x.value, x.special)) : null;
const hitIdx = mine && options.hints ? rows.findIndex((r) => r.match(mine.value, mine.special)) : -1;
const [sel, setSel] = useState<number | null>(null);
useEffect(() => setSel(null), [hitIdx]);
@@ -124,7 +127,14 @@ export function JokboBoard({ options, mine }: { options: SeotdaOptions; mine: Se
let n = 0;
return (
<section className="sd-jokbo" aria-label="족보">
<h3>족보</h3>
<h3>
족보
{reach && (
<button type="button" className={`sd-outlook${outlook ? ' on' : ''}`} aria-pressed={outlook} onClick={() => setOutlook(!outlook)} title="다음 패로 만들 수 있는 족보만 밝게 보여요">
예상족보 {outlook ? '켬' : '끔'}
</button>
)}
</h3>
<ol style={{ gridTemplateRows: `repeat(${Math.ceil(rows.length / 3)}, auto)` }}>
{rows.map((r, i) => {
const label = r.special ? `*${r.short}` : `${++n}.${r.short}`;
@@ -132,10 +142,10 @@ export function JokboBoard({ options, mine }: { options: SeotdaOptions; mine: Se
<li key={r.name}>
<button
type="button"
className={`${i === hitIdx ? 'hit' : ''}${shown === r ? ' sel' : ''}`}
className={`${i === hitIdx ? 'hit' : ''}${shown === r ? ' sel' : ''}${can && !can(r) ? ' no' : ''}`}
aria-pressed={shown === r}
aria-current={i === hitIdx ? 'true' : undefined}
title={`${r.name}${r.note ? `: ${r.note}` : ''}`}
title={`${r.name}${r.note ? `: ${r.note}` : ''}${can ? (can(r) ? ' (다음 패로 만들 수 있어요)' : ' (다음 패로는 못 만들어요)') : ''}`}
onClick={() => setSel(sel === i ? null : i)}
>
{label}

View File

@@ -97,14 +97,16 @@
기본(한게임 3장 섯다, 2026-10-13 인터넷 규칙 다시 확인):
1. 기본금 → 2장씩 나눠 줌(비공개).
2. 공개패 고르기(동시 진행, `threeOpen`): 각자 2장 중 1장을 골라 모두에게 앞면으로 보여 준다. 시간이 지나면(또는 나간 사람은) 낮은 월의 패가 공개된다.
3. 1구 베팅(선부터).
4. 남은 사람에게 1장 더(비공개, 손에 3장).
3. 1구 베팅(선부터). 선은 하프 또는 다이만 할 수 있고(베팅 규칙 222~444면 그 규칙대로), 1구에서는 아무도 체크를 못 한다(선이 다이하면 다음 사람은 체크만 빼고 다 된다, 시간 초과는 다이). 2구는 자유. (2026-10-17, 한게임 3장 섯다: 나무위키 "1라운드 베팅에서 선은 하프나 다이만 가능, 선이 죽으면 그다음 사람은 체크를 제외한 모든 베팅", 한게임 공식 가이드 이미지에서 1구 버튼은 다이·하프만 켜짐.) `threeOpen=끔`이나 `threePick=beforeBet` 변형에는 걸지 않는다.
4. 남은 사람에게 1장 더(비공개, 손에 3장). 화면에서는 **패쪼기**: 새 패가 뒷면으로 와서 위로 밀어 올리면 아래(왼쪽 아래 월 숫자)부터 보이고, 누르거나 Enter면 바로 뒤집힌다. 6초가 지나면 저절로 뒤집힌다. 뒤집기 전에는 내 족보 이름·조합·예상족보를 보여 주지 않는다(새로고침하면 이미 받은 패로 본다).
5. 2구 베팅.
6. 2명 이상 남으면 최종 패 고르기(동시 진행): 각자 3장 중 2장을 고른다. 시간이 지나면 가장 센 조합. 2구 베팅에서 한 사람만 남으면 고르지 않고 끝난다(카드 공개를 고르면 손패 3장을 모두 보여 준다).
7. 쇼다운(고른 2장으로 판정). 버린 1장은 공개패가 아니면 끝까지 아무에게도 보이지 않는다(공개패를 버리면 다른 사람 화면에서 그 패가 빠진다).
재경기(구사·멍텅구리구사·같은 족보)는 3장 섯다 방이어도 **2장 섯다**로 한다(2026-10-17): 2장을 한 번에 받고 공개패 없이 베팅 1번 → 쇼다운. 재경기가 끝나면 다음 판은 다시 3장 섯다. 엔진은 (재)경기마다 `hand.three`를 두고(본 판 = `cardMode=three`, 재경기 = false), 화면에는 `view.threeCard`로 알린다. 이 값이 없는 예전 상태(배포 전에 시작한 재경기)는 방의 `cardMode`를 따른다.
**예상족보**(`hints` 켬, 아직 패를 더 받을 때): 족보판에서 다음 패 1장으로 만들 수 있는 족보만 밝게, 못 만드는 족보는 흐리게 보인다. [예상족보 켬/끔]으로 끌 수 있다. 서버가 공개된 정보만으로 계산한다(덱 구성 − 내 패 − 모두에게 보인 공개패, 남은 덱 순서는 쓰지 않음, `view.myReach`).
옵션: `threeOpen=끔`이면 2단계가 없다. `threePick=beforeBet`이면 4단계 직후에 2장을 고르고(뒷면 2장만 남김) 그다음 마지막 베팅 → 쇼다운(2026-10-13 이전의 3장 섯다 흐름). 진행 중이던 방(상태 버전 2)은 버전 3으로 옮길 때 예전 흐름(공개패 없음, 베팅 전 고르기)을 그대로 쓴다.
근거: 한게임 섯다 안내 "3장 섯다: 2장을 먼저 받고 베팅 한 후 패 1장을 더 받고 베팅을 한 번 더 하는 게임방식", "2장 섯다: 전통적인 섯다 방식으로 화투패 2장을 모두 받은 다음 베팅하여 승부"(hangame-images.toastoven.net/hangame/pc/gostop/introduce/html/gssudda/guide_gssudda01_02.html). 한게임 앱 안내(블루스택 공략): "패를 2장 받고, 2장의 패 중 모두에게 공개할 패를 1장 선택 → 1구 베팅 → 추가 패 → 3장의 패 중 최종 패 선택". 나무위키 '섰다': 인터넷 3장 섯다(한게임/피망)는 2장 받고 1장 공개 → 첫 베팅 → 1장 더 → 두 번째 베팅 → 가장 좋은 2장으로 승부.

View File

@@ -1905,10 +1905,24 @@ const PLANS: Record<string, Plan> = {
// The others now see one face-up card of each player.
await pages[0]!.waitForFunction(() => document.querySelectorAll('.sd-seat .sd-cards img, .sd-seat .sd-cards svg').length > 0, null, { timeout: 5000 }).catch(() => {});
await pages[0]!.screenshot({ path: join(SHOTS, 'seotda3-open-pc.png') });
// 1구 (한게임): 선은 하프만(다이 말고), 나머지는 콜. 2구는 모두 체크.
await pressActions(pages, /^하프/, 1);
await pressActions(pages, /^콜/, 2);
for (let n = 0; n < 40 && !(await pages[0]!.getByRole('button', { name: /정하기$|두 장을 고르세요/ }).count()) && !(await pages[0]!.getByText('이번 판 결과').count()); n++) {
// Nobody raises, so every action is a 체크 (콜 stays disabled and would hide it from pressActions).
await pressActions(pages, /^체크/, 1).catch(() => {});
}
// 패쪼기: the third card comes face down; host drags it up halfway first (screenshot), then everyone turns it.
const sq = (p: Page) => p.getByRole('button', { name: /새로 받은 패 확인하기/ });
if (await sq(pages[0]!).count()) {
const box = (await sq(pages[0]!).first().boundingBox())!;
await pages[0]!.mouse.move(box.x + box.width / 2, box.y + box.height - 10);
await pages[0]!.mouse.down();
await pages[0]!.mouse.move(box.x + box.width / 2, box.y + box.height * 0.75, { steps: 4 });
await pages[0]!.screenshot({ path: join(SHOTS, 'seotda3-squeeze-pc.png') });
await pages[0]!.mouse.move(box.x + box.width / 2, box.y - 10, { steps: 4 });
await pages[0]!.mouse.up();
}
for (const p of pages) while (await sq(p).count()) await sq(p).first().click();
await pages[0]!.screenshot({ path: join(SHOTS, 'seotda3-choose-pc.png') });
if (await pages[0]!.getByText('자리 비움').count()) throw new Error('someone timed out (the plan should act for everybody)');
for (const p of pages) {

View File

@@ -362,6 +362,11 @@ export interface SeotdaView {
betLog: BetLogEntry[];
myHand: { name: string; value: number | null; special: SpecialKind | null; hint: string; strength: 'high' | 'mid' | 'low' | null } | null;
myCombos: { cardIds: [number, number]; name: string; value: number; best: boolean }[] | null;
/**
* 예상족보 (hints on, still drawing): every 족보 my final hand can still become with the next card, from public
* information only (deck composition minus my cards and the face-up 공개패). null when not drawing.
*/
myReach: { value: number; special: SpecialKind | null }[] | null;
myChosen: [number, number] | null;
/** 3장 섯다: the card I show everyone (공개패). */
myOpened: number | null;
@@ -420,6 +425,8 @@ function betsFor(s: SeotdaState, h: SeotdaHand, idx: number): { type: BetType; a
if (!h.betting) return [];
let out = legalBets(h.betting, idx).map((l) => ({ type: toType(l.kind), amount: l.amount, allIn: l.allIn }));
if (!s.options.quarter) out = out.filter((l) => l.type !== 'quarter');
// 한게임 3장 섯다 1구: 선은 하프·다이만(아래 forced), 선이 다이하면 다음 사람부터는 체크만 빼고 다 된다.
if (hangameThree(s, h) && h.street === 0 && out.some((l) => l.type !== 'check' && l.type !== 'die')) out = out.filter((l) => l.type !== 'check');
if (h.forced > 0 && h.street === 0 && out.length) {
const half = out.find((l) => l.type === 'half') ?? out.find((l) => l.type === 'full' || l.type === 'ddadang' || l.type === 'quarter');
const keep = half ?? out.find((l) => l.type === 'call' || l.type === 'check');
@@ -539,7 +546,8 @@ function startHand(s: SeotdaState, rng: Rng, events: GameEvent[]): void {
next: null,
ready: [],
lastAction: {},
forced: forcedCount(o),
// 한게임 3장 섯다: 1구 첫 베팅(선)은 하프·다이만. 베팅 규칙 222~444면 그 규칙대로.
forced: o.cardMode === 'three' && o.threeOpen && o.threePick === 'end' ? Math.max(1, forcedCount(o)) : forcedCount(o),
log: [],
};
s.hand = h;
@@ -556,6 +564,9 @@ const opensFirst = (o: SeotdaOptions) => o.cardMode === 'three' && o.threeOpen;
/** The current (re)match follows the 3장 섯다 flow (a 3장 room's rematch is 2장 섯다). */
const threeHand = (s: SeotdaState, h: SeotdaHand): boolean => h.three ?? s.options.cardMode === 'three';
/** 한게임 3장 섯다 흐름(공개패 켬, 마지막 베팅 뒤 고르기) — 1구 선 하프·다이, 1구 체크 없음. */
const hangameThree = (s: SeotdaState, h: SeotdaHand): boolean => threeHand(s, h) && s.options.threeOpen && s.options.threePick === 'end';
/** Card shown when the player does not pick one (timeout, left, computer default): the lower month — the higher one stays hidden. */
export function autoOpen(cards: number[]): number {
return [...cards].sort((a, b) => HWATU[a]!.month - HWATU[b]!.month || a - b)[0]!;
@@ -1236,7 +1247,8 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
const err = validateBet(h.betting, idx, { kind: toKind(a.type) } as BetAction);
if (!err && betsFor(s, h, idx).some((l) => l.type === a.type)) return ok;
if (!err && a.type === 'quarter' && !s.options.quarter) return fail('이 방은 쿼터 베팅을 쓰지 않아요.');
if (!err) return fail(`베팅 규칙 ${s.options.betRule}: 지금은 하프 또는 다이만 할 수 있어요.`);
if (!err && h.forced <= 0 && a.type === 'check') return fail('3장 섯다 1구에서는 체크를 할 수 없어요. 걸거나 다이해 주세요.');
if (!err) return fail(s.options.betRule === 'free' ? '3장 섯다 1구에서 선은 하프 또는 다이만 할 수 있어요.' : `베팅 규칙 ${s.options.betRule}: 지금은 하프 또는 다이만 할 수 있어요.`);
if (h.betting.turn === idx && ['ping', 'ddadang', 'quarter', 'half', 'full'].includes(a.type)) {
if (a.type === 'full' && s.options.maxRaise === 'half') return fail('이 방은 하프까지만 올릴 수 있어요.');
if (a.type === 'ping' && h.betting.opened) return fail('누가 이미 걸어서 삥을 할 수 없어요.');
@@ -1398,6 +1410,7 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
h && b && myIdx >= 0 && h.phase === 'betting' && !seatOf(s, me!)!.left ? betsFor(s, h, myIdx) : [];
let myHand: SeotdaView['myHand'] = null;
let myCombos: SeotdaView['myCombos'] = null;
let myReach: SeotdaView['myReach'] = null;
let myDiscard: SeotdaCardView | null = null;
const myCards = h && me ? (h.cards[me] ?? []) : [];
const myChosen = h && me ? (h.chosen[me] ?? null) : null;
@@ -1411,6 +1424,20 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
});
if (myChosen) myDiscard = cardView(h, myCards.find((c) => !myChosen.includes(c))!);
}
const finalSize = threeHand(s, h) ? 3 : 2;
if (o.hints && myCards.length < finalSize && !myChosen) {
const seen = new Set([...myCards, ...Object.values(h.opened).filter((c): c is number => c !== null)]);
const reach = new Map<string, { value: number; special: SpecialKind | null }>();
for (const c of deckOf(o)) {
if (seen.has(c)) continue;
const next = [...myCards, c];
for (const [a, b2] of next.length === 2 ? [next as [number, number]] : combos(next)) {
const e = evalSeotda(a, b2, rules);
reach.set(`${e.value}|${e.special}`, { value: e.value, special: e.special });
}
}
myReach = [...reach.values()];
}
if (o.hints) {
const pair = myChosen ?? (myCards.length === 2 ? (myCards as [number, number]) : myCards.length === 3 ? bestChoice(myCards, rules) : null);
if (pair) {
@@ -1447,6 +1474,7 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
betLog: h?.log ?? [],
myHand,
myCombos,
myReach,
myChosen,
myOpened: h && me ? (h.opened[me] ?? null) : null,
myDiscard,

View File

@@ -648,7 +648,11 @@ describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅
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' });
// 1구: 선(A)은 하프·다이만.
expect(seotda.view(s, 'A').legal.map((l) => l.type).sort()).toEqual(['die', 'half']);
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'call' });
s = act(s, 'C', { type: 'call' });
expect(s.hand!.phase).toBe('betting');
expect(s.hand!.street).toBe(1);
expect(s.hand!.cards.A).toEqual([S(1), S(8), S(4)]);
@@ -670,7 +674,9 @@ describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅
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: 'call' });
s = act(s, 'C', { type: 'call' });
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'die' });
s = act(s, 'C', { type: 'die' });
@@ -689,8 +695,8 @@ describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅
let s = make({ cardMode: 'three' });
s = rig(s, { A: [P(4), S(9)], B: [S(1), P(2)], C: [P(5), P(6)] }, [P(7), P(8)]);
for (const [p, c] of [['A', S(9)], ['B', P(2)], ['C', P(5)]] as const) s = act(s, p, { type: 'open', cardId: c });
s = act(s, 'A', { type: 'check' });
s = act(s, 'B', { type: 'check' });
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'call' });
s = act(s, 'C', { type: 'die' });
s = act(s, 'A', { type: 'check' });
s = act(s, 'B', { type: 'check' });
@@ -721,6 +727,49 @@ describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅
expect(seotda.view(s, 'A').threeCard).toBe(true);
});
test('1구(한게임): 선은 하프·다이만, 선이 다이하면 다음 사람부터는 체크만 빼고 다 돼요. 2구에는 제한이 없어요', () => {
let s = opened();
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'timeout' });
expect(seotda.view(s, 'A').forcedHalf).toBe(true);
expect(reject(s, 'A', { type: 'check' })).not.toBeNull();
expect(reject(s, 'A', { type: 'ping' })).not.toBeNull();
s = act(s, 'A', { type: 'die' });
const b = seotda.view(s, 'B').legal.map((l) => l.type);
expect(b).not.toContain('check');
expect(b).toEqual(expect.arrayContaining(['ping', 'half', 'die']));
expect(reject(s, 'B', { type: 'check' })).toBe('3장 섯다 1구에서는 체크를 할 수 없어요. 걸거나 다이해 주세요.');
// Time out with nothing bet: check is not allowed here, so it is a 다이.
s = act(s, 'B', { type: 'timeout' });
expect(s.hand!.lastAction.B!.type).toBe('die');
});
test('예상족보: 다음 패로 만들 수 있는 족보만, 공개된 정보로만 계산해요', () => {
let s = opened();
const values = (v: { value: number; special: unknown }[] | null) => (v ?? []).filter((x) => !x.special).map((x) => x.value);
const a = seotda.view(s, 'A');
// 1광 + 8광: 18광땡은 늘 남고, 3월 광이 오면 38광땡.
expect(values(a.myReach)).toEqual(expect.arrayContaining([990, 1000]));
// B shows the 3월 광 → A can no longer make 38광땡.
s.hand!.cards.B = [S(3), P(6)];
s = act(s, 'B', { type: 'open', cardId: S(3) });
expect(values(seotda.view(s, 'A').myReach)).not.toContain(1000);
for (const p of ['A', 'C']) s = act(s, p, { type: 'timeout' });
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'call' });
s = act(s, 'C', { type: 'call' });
expect(seotda.view(s, 'A').myReach).toBeNull();
});
test('2구는 체크부터 자유롭게', () => {
let s = opened();
for (const p of ['A', 'B', 'C']) s = act(s, p, { type: 'timeout' });
s = act(s, 'A', { type: 'half' });
s = act(s, 'B', { type: 'call' });
s = act(s, 'C', { type: 'call' });
expect(s.hand!.street).toBe(1);
expect(seotda.view(s, 'A').legal.map((l) => l.type)).toContain('check');
});
test('이 변경 전에 시작한 3장 재경기(three 없음)는 예전처럼 3장 흐름을 이어 가요', () => {
let s = make({ cardMode: 'three' });
delete s.hand!.three;