From c10fac8e82ca6c272b5d06916b0565366ea9da5e Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sat, 17 Oct 2026 01:16:04 +0900 Subject: [PATCH] =?UTF-8?q?3=EC=9E=A5=20=EC=84=AF=EB=8B=A4=EB=A5=BC=20?= =?UTF-8?q?=ED=95=9C=EA=B2=8C=EC=9E=84=EC=B2=98=EB=9F=BC:=201=EA=B5=AC=20?= =?UTF-8?q?=EC=84=A0=20=ED=95=98=ED=94=84=C2=B7=EB=8B=A4=EC=9D=B4(1?= =?UTF-8?q?=EA=B5=AC=20=EC=B2=B4=ED=81=AC=20=EC=97=86=EC=9D=8C),=20?= =?UTF-8?q?=EC=98=88=EC=83=81=EC=A1=B1=EB=B3=B4,=20=ED=8C=A8=EC=AA=BC?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 엔진: 한게임 흐름(공개패 켬·마지막에 고르기)의 1구 첫 베팅(선)은 하프·다이만, 1구에는 체크 없음(시간 초과는 다이) - view.myReach: 다음 패로 만들 수 있는 족보(공개 정보만: 덱 구성 − 내 패 − 공개패) - 족보판 [예상족보 켬/끔]: 못 만드는 족보는 흐리게 - 패쪼기: 새로 받은 패는 뒷면, 밀어 올리면 아래부터 보이고 누르면 바로 뒤집힘, 6초 뒤 자동. 뒤집기 전에는 족보·조합을 숨김 - 도움말·규칙 화면·문서, 엔진 테스트 4개, e2e(1구 하프→콜, 패쪼기 드래그) 맞춤 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/games/seotda/board.tsx | 100 +++++++++++++++++++++-- apps/web/src/games/seotda/help.test.ts | 10 ++- apps/web/src/games/seotda/help.ts | 13 ++- apps/web/src/games/seotda/index.tsx | 2 +- apps/web/src/games/seotda/jokbo.tsx | 18 +++- docs/games/seotda.md | 6 +- e2e/games.e2e.ts | 16 +++- packages/games/src/seotda/index.ts | 32 +++++++- packages/games/src/seotda/seotda.test.ts | 57 ++++++++++++- 9 files changed, 229 insertions(+), 25 deletions(-) diff --git a/apps/web/src/games/seotda/board.tsx b/apps/web/src/games/seotda/board.tsx index c672d25..5c09f19 100644 --- a/apps/web/src/games/seotda/board.tsx +++ b/apps/web/src/games/seotda/board.tsx @@ -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(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 ( + + ); +} + 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([]); useEffect(() => setPick([]), [v.handNo, v.rematchNo, v.handPhase]); const [hover, setHover] = useState(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 } | null>(null); + const [peeked, setPeeked] = useState>(() => 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 = {seat.handName}; else if (seat?.folded) under = 다이; - else if (playing && hints && v.myCombos && !v.myChosen) + else if (playing && hints && v.myCombos && !v.myChosen && !peeking) under = ( {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 ( <>
- + {seat && u && (
setRef(seat.id, el)} aria-label={`내 자리, 보유 ${formatWon(seat.stack)}`}> @@ -691,13 +775,15 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef,
{cards.length === 0 && {seat.inHand ? '패를 기다리는 중' : '이번 판은 쉬어요'}} {cards.map((c, i) => - isCard(c) ? ( + isCard(c) && squeezing(c.key) ? ( + setPeeked((p) => new Set(p).add(c.key))} /> + ) : isCard(c) ? ( onCard(c.id)} disabled={!opening && !choosing} selected={(opening || choosing) && pick.includes(c.id)} diff --git a/apps/web/src/games/seotda/help.test.ts b/apps/web/src/games/seotda/help.test.ts index 22ffcb8..8dce083 100644 --- a/apps/web/src/games/seotda/help.test.ts +++ b/apps/web/src/games/seotda/help.test.ts @@ -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('패를 공개해요'); diff --git a/apps/web/src/games/seotda/help.ts b/apps/web/src/games/seotda/help.ts index f71c71e..724557e 100644 --- a/apps/web/src/games/seotda/help.ts +++ b/apps/web/src/games/seotda/help.ts @@ -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('패가 약하면 [다이]로 이번 판을 포기할 수 있어요.'); diff --git a/apps/web/src/games/seotda/index.tsx b/apps/web/src/games/seotda/index.tsx index 2e63078..7bff391 100644 --- a/apps/web/src/games/seotda/index.tsx +++ b/apps/web/src/games/seotda/index.tsx @@ -343,7 +343,7 @@ function Rules({ options }: { options?: SeotdaOptions }) { 진행: 판마다 모두 기본금을 판돈에 내요. 선부터 패를 받고 차례로 베팅해요. {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장 더 받고 베팅한 뒤 남은 사람끼리 패를 공개해요.' diff --git a/apps/web/src/games/seotda/jokbo.tsx b/apps/web/src/games/seotda/jokbo.tsx index 79224c0..d0d096c 100644 --- a/apps/web/src/games/seotda/jokbo.tsx +++ b/apps/web/src/games/seotda/jokbo.tsx @@ -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(null); useEffect(() => setSel(null), [hitIdx]); @@ -124,7 +127,14 @@ export function JokboBoard({ options, mine }: { options: SeotdaOptions; mine: Se let n = 0; return (
-

족보

+

+ 족보 + {reach && ( + + )} +

    {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