From 81b257df74d1903ea087154d70efbcae569b528d Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sat, 17 Oct 2026 00:58:50 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=AF=EB=8B=A4:=203=EC=9E=A5=20=EC=84=AF?= =?UTF-8?q?=EB=8B=A4=20=EB=B0=A9=EC=9D=98=20=EC=9E=AC=EA=B2=BD=EA=B8=B0(?= =?UTF-8?q?=EA=B5=AC=EC=82=AC=C2=B7=EB=A9=8D=ED=85=85=EA=B5=AC=EB=A6=AC?= =?UTF-8?q?=EA=B5=AC=EC=82=AC=C2=B7=EA=B0=99=EC=9D=80=20=EC=A1=B1=EB=B3=B4?= =?UTF-8?q?)=EB=8A=94=202=EC=9E=A5=20=EC=84=AF=EB=8B=A4=EB=A1=9C(2?= =?UTF-8?q?=EC=9E=A5=20=ED=95=9C=20=EB=B2=88=EC=97=90,=20=EA=B3=B5?= =?UTF-8?q?=EA=B0=9C=ED=8C=A8=20=EC=97=86=EC=9D=B4=20=EB=B2=A0=ED=8C=85=20?= =?UTF-8?q?1=EB=B2=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hand.three를 (재)경기마다 두고 view.threeCard로 알림. 값이 없는 예전 상태는 방의 cardMode를 따름. 컴퓨터 판단·도움말·규칙 화면·문서도 맞춤, 엔진 테스트 2개 추가. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/games/seotda/board.tsx | 2 +- apps/web/src/games/seotda/help.ts | 5 +-- apps/web/src/games/seotda/index.tsx | 1 + docs/games/seotda.md | 2 ++ packages/games/src/seotda/bot.ts | 4 +-- packages/games/src/seotda/index.ts | 29 +++++++++++----- packages/games/src/seotda/seotda.test.ts | 42 ++++++++++++++++++++++++ 7 files changed, 72 insertions(+), 13 deletions(-) diff --git a/apps/web/src/games/seotda/board.tsx b/apps/web/src/games/seotda/board.tsx index 520c42f..ff84233 100644 --- a/apps/web/src/games/seotda/board.tsx +++ b/apps/web/src/games/seotda/board.tsx @@ -799,7 +799,7 @@ export function SeotdaBoard({ view: v, me, players, act, pending, deadline }: Bo if (v.foldWin) winners.add(v.foldWin.winner); for (const p of v.showdown?.pots ?? []) if (p.type !== 'rematch') for (const w of p.winners) winners.add(w); } - const cardW = phone ? (v.options.cardMode === 'three' ? 24 : 28) : v.options.cardMode === 'three' ? 38 : 46; + const cardW = phone ? (v.threeCard ? 24 : 28) : v.threeCard ? 38 : 46; const cols = phone ? (others.length > 4 ? 3 : 2) : 0; const othersEls: ReactNode = others.map(({ s, rel }) => ( , id: string): string { /** Which betting round this is, in plain words. */ function roundText(v: SeotdaView): string { const o = v.options; + if (o.cardMode === 'three' && !v.threeCard) return '재경기는 2장 섯다로 해요. 2장을 한 번에 받고 한 번만 베팅한 뒤 남은 사람끼리 패를 공개해요.'; if (o.cardMode === 'three') return v.street === 0 ? '2장을 받고 하는 첫 베팅이에요. 끝나면 1장을 더 받아 3장 중 쓸 2장을 골라요.' @@ -42,7 +43,7 @@ function handLine(v: SeotdaView, seat: SeotdaSeatView): string { function rematchLine(v: SeotdaView): string { if (v.rematchNo === 0 || !v.rematchReason) return ''; - return `재경기 ${v.rematchNo}회차(${REMATCH_KO[v.rematchReason]})예요. 판돈은 그대로 두고, 기본금은 다시 내지 않아요.`; + return `재경기 ${v.rematchNo}회차(${REMATCH_KO[v.rematchReason]})예요. 판돈은 그대로 두고, 기본금은 다시 내지 않아요.${v.options.cardMode === 'three' ? ' 재경기는 2장 섯다로 해요(공개패 없음).' : ''}`; } function resultLine(v: SeotdaView, players: Record): string { @@ -65,7 +66,7 @@ function resultLine(v: SeotdaView, players: Record): string function waitingLine(v: SeotdaView, players: Record): string { if (v.handPhase === 'betting') { - const oneRound = v.options.cardMode === 'two' && v.options.dealMode === 'oneRound'; + const oneRound = !v.threeCard && (v.options.cardMode === 'three' || v.options.dealMode === 'oneRound'); const round = oneRound ? '베팅' : v.street === 0 ? '첫 베팅' : '마지막 베팅'; return v.toAct ? `${who(players, v.toAct)} 차례예요(${round}).` : '카드를 나눠 주는 중이에요.'; } diff --git a/apps/web/src/games/seotda/index.tsx b/apps/web/src/games/seotda/index.tsx index 5c1f899..2e63078 100644 --- a/apps/web/src/games/seotda/index.tsx +++ b/apps/web/src/games/seotda/index.tsx @@ -362,6 +362,7 @@ function Rules({ options }: { options?: SeotdaOptions }) {

재경기: 구사나 같은 족보{o?.tieRule === 'split' ? '(이 방은 같은 족보면 나눠 가져요)' : ''}로 재경기가 되면 판돈은 그대로 두고 남은 사람끼리 새로 패를 받아요. 기본금은 다시 내지 않아요. + {o?.cardMode === 'three' ? ' 3장 섯다 방이어도 재경기는 2장 섯다로 해요: 2장을 한 번에 받고(공개패 없음) 한 번만 베팅한 뒤 공개해요.' : ''} {o && o.rejoinCost !== 'none' ? ` 구사 재경기 때 다이한 사람은 판돈의 ${o.rejoinCost === 'half' ? '절반' : '전부'}만큼 내고 다시 들어올 수 있어요.` : ''} 한 판에서 재경기가{' '} {o?.maxRematches ?? 3}번을 넘으면 나눠 가져요.

diff --git a/docs/games/seotda.md b/docs/games/seotda.md index d8e780f..058867b 100644 --- a/docs/games/seotda.md +++ b/docs/games/seotda.md @@ -103,6 +103,8 @@ 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`를 따른다. + 옵션: `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장으로 승부. diff --git a/packages/games/src/seotda/bot.ts b/packages/games/src/seotda/bot.ts index ae2f7c6..2379c6f 100644 --- a/packages/games/src/seotda/bot.ts +++ b/packages/games/src/seotda/bot.ts @@ -35,7 +35,7 @@ const sigmoid = (x: number) => 1 / (1 + Math.exp(-x)); const myCardsOf = (v: SeotdaView, me: string): number[] => (v.seats.find((s) => s.id === me)?.cards ?? []).flatMap((c) => ('id' in c ? [c.id] : [])); -const finalSizeOf = (v: SeotdaView): 2 | 3 => (v.options.cardMode === 'three' ? 3 : 2); +const finalSizeOf = (v: SeotdaView): 2 | 3 => (v.threeCard ? 3 : 2); /** Opponents still in the hand, each with a range built from the public bets of this (re)match. */ export function rangesOf(v: SeotdaView, me: string): { id: string; weight: RangeWeight }[] { @@ -51,7 +51,7 @@ export function rangesOf(v: SeotdaView, me: string): { id: string; weight: Range return { ...e, forced: isForced }; }); // Cards held when the bet was made: 2장 섯다 1장씩 → 1 card on street 0; 3장 섯다 → 2 of 3 on street 0. - const partialStreet0 = v.options.cardMode === 'three' || v.options.dealMode === 'twoRounds'; + const partialStreet0 = finalSize === 3 || (v.options.cardMode === 'two' && v.options.dealMode === 'twoRounds'); return live.map((s) => { const mine = entries.filter((e) => e.p === s.id && !e.forced); // 3장 섯다 공개패: every hand they may hold contains the card they showed. diff --git a/packages/games/src/seotda/index.ts b/packages/games/src/seotda/index.ts index 67be301..54d6647 100644 --- a/packages/games/src/seotda/index.ts +++ b/packages/games/src/seotda/index.ts @@ -227,6 +227,11 @@ export interface SeotdaHand { /** Pots carried from earlier matches of the same hand (eligibility fixed). */ carried: PotState[]; rematchReason: 'gusa' | 'mungGusa' | 'tie' | null; + /** + * This (re)match uses the 3장 섯다 flow. A 3장 섯다 room's rematch is played as 2장 섯다 (2장 한 번에, 베팅 1번, + * 공개패 없음; 2026-10-17). Absent in hands started before that → the room's `cardMode`. + */ + three?: boolean; /** Upcoming rematch participants (handEnd → rejoin → rematch). */ rematchSet: PlayerId[]; rejoinPending: PlayerId[]; @@ -340,6 +345,8 @@ export interface SeotdaView { handsPlayed: number; rematchNo: number; rematchReason: SeotdaHand['rematchReason']; + /** This (re)match is played with 3장 섯다 rules (false for 2장 rooms and for a 3장 room's rematch). */ + threeCard: boolean; baseUnit: number; seats: SeotdaSeatView[]; dealer: PlayerId | null; @@ -522,6 +529,7 @@ function startHand(s: SeotdaState, rng: Rng, events: GameEvent[]): void { betSeq: 0, carried: [], rematchReason: null, + three: o.cardMode === 'three', rematchSet: [], rejoinPending: [], rejoinCost: 0, @@ -545,6 +553,9 @@ function startHand(s: SeotdaState, rng: Rng, events: GameEvent[]): void { /** 3장 섯다 (한게임): 2장을 받으면 먼저 1장을 골라 모두에게 보여 준 뒤 첫 베팅. */ 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'; + /** 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]!; @@ -561,6 +572,8 @@ function startRematch(s: SeotdaState, rng: Rng, events: GameEvent[]): void { h.order = order; h.phase = 'betting'; h.street = 0; + // 재경기는 2장 섯다로: 3장 섯다 방도 2장을 한 번에 받고 베팅 1번, 공개패·최종 선택 없음. + h.three = false; h.deck = rng.shuffle(deckOf(s.options)); h.cards = Object.fromEntries(order.map((id) => [id, []])); h.chosen = Object.fromEntries(order.map((id) => [id, null])); @@ -582,9 +595,8 @@ function startRematch(s: SeotdaState, rng: Rng, events: GameEvent[]): void { for (const p of b.players) if (p.stack === 0) p.status = 'allIn'; b.players.push({ id: CARRY, stack: 0, round: 0, total: carriedTotal(h), status: 'out', acted: true, raised: true, mayRaise: false }); events.push({ type: 'handStart', handNo: h.handNo, rematchNo: h.rematchNo, dealer, ante: 0, reason: h.rematchReason }); - deal(h, order, firstDealCount(s.options), events); + deal(h, order, s.options.cardMode === 'three' ? 2 : firstDealCount(s.options), events); h.betting = startRound(b, 0); - if (opensFirst(s.options)) h.phase = 'open'; } /** Pots of the current match: carried (re-filtered by who is still in) + this match's bets. */ @@ -674,7 +686,7 @@ function settleShowdown(s: SeotdaState, events: GameEvent[]): void { const evals: Record = {}; const hands: ShowdownHand[] = []; for (const id of live) { - const pair = (o.cardMode === 'three' ? h.chosen[id] : h.cards[id]) as [number, number]; + const pair = (threeHand(s, h) ? h.chosen[id] : h.cards[id]) as [number, number]; const e = evalSeotda(pair[0], pair[1], rules); evals[id] = e; hands.push({ id, cards: pair, name: e.name, baseName: e.baseName, value: e.value, special: e.special }); @@ -937,7 +949,7 @@ function progress(s: SeotdaState, rng: Rng, events: GameEvent[]): void { } // 3장 섯다(한게임): 2장 → 공개패 1장 → 1구 베팅 → 1장 더 → 2구 베팅 → 3장 중 2장 고르기 → 공개. // threePick=beforeBet: 1장 더 → 2장 고르기 → 마지막 베팅 → 공개. - if (h.street === 0 && s.options.cardMode === 'three') { + if (h.street === 0 && threeHand(s, h)) { deal(h, h.order.filter((id) => contendersOf(h).includes(id)), 1, events); if (s.options.threePick === 'beforeBet') h.phase = 'choose'; else { @@ -947,11 +959,11 @@ function progress(s: SeotdaState, rng: Rng, events: GameEvent[]): void { } continue; } - if (s.options.cardMode === 'three' && contendersOf(h).some((id) => !h.chosen[id])) { + if (threeHand(s, h) && contendersOf(h).some((id) => !h.chosen[id])) { h.phase = 'choose'; continue; } - if (h.street === 0 && s.options.dealMode === 'twoRounds') { + if (h.street === 0 && s.options.cardMode === 'two' && s.options.dealMode === 'twoRounds') { deal(h, h.order.filter((id) => contendersOf(h).includes(id)), 1, events); h.street = 1; h.lastAction = {}; @@ -1353,7 +1365,7 @@ export const seotda: GameDefinition (c === shown ? cardView(h!, c) : { hidden: true as const })); } @@ -1390,7 +1402,7 @@ export const seotda: GameDefinition { const e = evalSeotda(c[0], c[1], rules); @@ -1421,6 +1433,7 @@ export const seotda: GameDefinition 0 ? h.rematchReason : null, + threeCard: h ? threeHand(s, h) : o.cardMode === 'three', baseUnit: s.baseUnit, seats, dealer: h?.dealer ?? null, diff --git a/packages/games/src/seotda/seotda.test.ts b/packages/games/src/seotda/seotda.test.ts index 3fbee02..b0d6134 100644 --- a/packages/games/src/seotda/seotda.test.ts +++ b/packages/games/src/seotda/seotda.test.ts @@ -685,6 +685,48 @@ describe('3장 섯다 (한게임 기본: 2장 → 공개패 1장 → 1구 베팅 expect(c.handName).toBe('18광땡'); }); + test('3장 섯다 방의 재경기(구사)는 2장 섯다로: 2장 한 번에, 공개패 없이 베팅 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, 'C', { type: 'die' }); + s = act(s, 'A', { type: 'check' }); + s = act(s, 'B', { type: 'check' }); + s = act(s, 'A', { type: 'choose', cardIds: [P(4), S(9)] }); + s = act(s, 'B', { type: 'choose', cardIds: [S(1), P(2)] }); + expect(s.hand!.showdown!.pots[0]).toMatchObject({ type: 'rematch', reason: 'gusa', winners: ['A', 'B'] }); + s = readyAll(s); + const h = s.hand!; + expect([h.rematchNo, h.phase, h.street, h.three]).toEqual([1, 'betting', 0, false]); + expect([h.cards.A!.length, h.cards.B!.length]).toEqual([2, 2]); + const v = seotda.view(s, 'A'); + expect(v.threeCard).toBe(false); + expect(v.myCombos).toBeNull(); + expect(v.seats.every((x) => x.opening === null)).toBe(true); + // Nothing is face up for the others (no 공개패). + expect(seotda.view(s, 'B').seats.find((x) => x.id === 'A')!.cards).toEqual([{ hidden: true }, { hidden: true }]); + s = rig(s, { A: [S(10), P(10)], B: [P(2), P(3)] }, [S(4)]); + s = act(s, 'A', { type: 'ping' }); + s = act(s, 'B', { type: 'call' }); + // One betting round, no third card, no choosing: straight to the showdown. + expect(s.hand!.phase).toBe('handEnd'); + expect(s.hand!.cards.A).toEqual([S(10), P(10)]); + expect(s.hand!.showdown!.hands.find((x) => x.id === 'A')!.name).toBe('장땡'); + expect(s.hand!.showdown!.pots[0]).toMatchObject({ type: 'win', winners: ['A'] }); + // The next hand is 3장 섯다 again. + s = readyAll(s); + expect([s.hand!.rematchNo, s.hand!.phase, s.hand!.three]).toEqual([0, 'open', true]); + expect(seotda.view(s, 'A').threeCard).toBe(true); + }); + + test('이 변경 전에 시작한 3장 재경기(three 없음)는 예전처럼 3장 흐름을 이어 가요', () => { + let s = make({ cardMode: 'three' }); + delete s.hand!.three; + expect(seotda.view(s, 'A').threeCard).toBe(true); + }); + test('시간 무제한이면 공개패 고르기에도 마감이 없어요', () => { const s = make({ turnSeconds: null, cardMode: 'three' }); expect(s.hand!.phase).toBe('open');