섯다: 3장 섯다 방의 재경기(구사·멍텅구리구사·같은 족보)는 2장 섯다로(2장 한 번에, 공개패 없이 베팅 1번)
hand.three를 (재)경기마다 두고 view.threeCard로 알림. 값이 없는 예전 상태는 방의 cardMode를 따름. 컴퓨터 판단·도움말·규칙 화면·문서도 맞춤, 엔진 테스트 2개 추가. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 }) => (
|
||||
<Seat
|
||||
|
||||
@@ -21,6 +21,7 @@ function who(players: Record<string, PublicUser>, 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, PublicUser>): string {
|
||||
@@ -65,7 +66,7 @@ function resultLine(v: SeotdaView, players: Record<string, PublicUser>): string
|
||||
|
||||
function waitingLine(v: SeotdaView, players: Record<string, PublicUser>): 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}).` : '카드를 나눠 주는 중이에요.';
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ function Rules({ options }: { options?: SeotdaOptions }) {
|
||||
<JokboTable options={o ?? ({ gwangTtaeng: 'all', ttaengjabi: 'loose', amhaeng: true, gusa: true, mungGusa: 'upTo9', hints: false } as SeotdaOptions)} />
|
||||
<p>
|
||||
<strong>재경기</strong>: 구사나 같은 족보{o?.tieRule === 'split' ? '(이 방은 같은 족보면 나눠 가져요)' : ''}로 재경기가 되면 판돈은 그대로 두고 남은 사람끼리 새로 패를 받아요. 기본금은 다시 내지 않아요.
|
||||
{o?.cardMode === 'three' ? ' 3장 섯다 방이어도 재경기는 2장 섯다로 해요: 2장을 한 번에 받고(공개패 없음) 한 번만 베팅한 뒤 공개해요.' : ''}
|
||||
{o && o.rejoinCost !== 'none' ? ` 구사 재경기 때 다이한 사람은 판돈의 ${o.rejoinCost === 'half' ? '절반' : '전부'}만큼 내고 다시 들어올 수 있어요.` : ''} 한 판에서 재경기가{' '}
|
||||
{o?.maxRematches ?? 3}번을 넘으면 나눠 가져요.
|
||||
</p>
|
||||
|
||||
@@ -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장으로 승부.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<PlayerId, HandEval> = {};
|
||||
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<SeotdaState, SeotdaAction, SeotdaView, Seotd
|
||||
// 3장 섯다: the 공개패 is face up for everyone; after choosing, others see the two kept cards (the discard stays
|
||||
// secret, so a 공개패 that was thrown away is no longer shown).
|
||||
const shown = h?.opened[x.id] ?? null;
|
||||
const chosen = o.cardMode === 'three' ? (h?.chosen[x.id] ?? null) : null;
|
||||
const chosen = h && threeHand(s, h) ? (h.chosen[x.id] ?? null) : null;
|
||||
const kept = chosen ? [...chosen] : cards;
|
||||
slots = kept.map((c) => (c === shown ? cardView(h!, c) : { hidden: true as const }));
|
||||
}
|
||||
@@ -1390,7 +1402,7 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
|
||||
const myCards = h && me ? (h.cards[me] ?? []) : [];
|
||||
const myChosen = h && me ? (h.chosen[me] ?? null) : null;
|
||||
if (h && me && myCards.length) {
|
||||
if (o.cardMode === 'three' && myCards.length === 3) {
|
||||
if (threeHand(s, h) && myCards.length === 3) {
|
||||
const best = bestChoice(myCards, rules);
|
||||
myCombos = combos(myCards).map((c) => {
|
||||
const e = evalSeotda(c[0], c[1], rules);
|
||||
@@ -1421,6 +1433,7 @@ export const seotda: GameDefinition<SeotdaState, SeotdaAction, SeotdaView, Seotd
|
||||
handsPlayed: s.handsPlayed,
|
||||
rematchNo: h?.rematchNo ?? 0,
|
||||
rematchReason: h && h.rematchNo > 0 ? h.rematchReason : null,
|
||||
threeCard: h ? threeHand(s, h) : o.cardMode === 'three',
|
||||
baseUnit: s.baseUnit,
|
||||
seats,
|
||||
dealer: h?.dealer ?? null,
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user