섯다·포커: 다른 사람이 모두 죽고 혼자 남으면 카드를 공개할지 고르기(카드 공개/공개 안 함, 시간 초과·나감·기본은 공개 안 함, 공개하면 모두에게 패와 족보를 뒤집어 보여 주고 기록에 남김, 컴퓨터도 센 패면 가끔 공개)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 04:27:55 +09:00
parent 73b929739d
commit 966bc3c5ef
20 changed files with 529 additions and 48 deletions

View File

@@ -8,7 +8,8 @@ import { bestIntl, bestOmaha } from './eval/international';
import { bestKorean } from './eval/korean';
import { bestLow } from './eval/low';
import { evalBadugi } from './eval/badugi';
import { bossOf, idxOf, inPlay, rebuysLeft, seatOf, waitingFor } from './hand';
import { bossOf, contenderIds, idxOf, inPlay, rebuysLeft, seatOf, waitingFor } from './hand';
import { evaluate } from './showdown';
import { isSeven, streetName } from './modes';
import type { BetActionType, HandPlayer, LegalBetView, PokerState, PokerView, SeatView } from './types';
@@ -66,6 +67,14 @@ export function drawLimitFor(s: PokerState): { max: number; aceBonus: boolean }
return s.options.drawLimit === 'three' ? { max: 3, aceBonus: true } : { max: 5, aceBonus: false };
}
/** Fold win where the last player showed the cards: who, and their hand. */
function foldShownOf(s: PokerState): PokerView['foldShown'] {
const h = s.hand;
if (!h?.foldShown) return null;
const id = contenderIds(h)[0]!;
return { id, handName: evaluate(s.options, h.players[id]!, h.board).high.name };
}
export function buildView(s: PokerState, viewer: PlayerId | null): PokerView {
const o = s.options;
const h = s.hand;
@@ -79,7 +88,7 @@ export function buildView(s: PokerState, viewer: PlayerId | null): PokerView {
const hp = h?.players[seat.id];
const bp = h && hp ? h.bet.players[idxOf(h, seat.id)] : undefined;
const mine = viewer === seat.id;
const shown = !!h && (mine || revealedIds.has(seat.id) || (o.mode === 'indian' && h.settled));
const shown = !!h && (mine || revealedIds.has(seat.id) || (o.mode === 'indian' && h.settled) || (!!h.foldShown && inPlay(h, seat.id)));
const v: SeatView = {
id: seat.id,
seat: i,
@@ -190,6 +199,7 @@ export function buildView(s: PokerState, viewer: PlayerId | null): PokerView {
drawMax: dl.max,
drawAceBonus: dl.aceBonus,
canDeclare: contesting && h!.phase === 'declare' && h!.waiting && !hp!.declare,
canReveal: !!(h && h.phase === 'reveal' && viewer && inPlay(h, viewer) && me?.status !== 'left'),
canReady: !!(s.phase === 'playing' && h?.phase === 'handEnd' && hp && !hp.ready && me?.status !== 'left'),
canRebuy: s.phase === 'rebuy' && !!viewer && s.rebuyPending.includes(viewer),
rebuysLeft: left,
@@ -198,6 +208,7 @@ export function buildView(s: PokerState, viewer: PlayerId | null): PokerView {
awards: h?.awards ? h.awards.map((a) => ({ ...a })) : null,
winners: h ? [...h.winners] : [],
foldWin: !!h?.foldWin,
foldShown: foldShownOf(s),
indianUsed: [...s.indianUsed],
log: s.log.slice(-VIEW_LOG).map((e) => ({ ...e })),
stats: structuredClone(s.stats),