새 게임 젝스님트: 숫자 카드를 동시에 몰래 내고 작은 수부터 줄 끝에 붙이기, 여섯 번째 카드면 앞의 다섯 장(소머리 = 벌점)을 가져가는 2~10명 카드 게임

- 엔진 packages/games/src/six-nimmt/(options·rules·types·index·bot): 104장 소머리(합 171), 규칙 1~4, 동시에 몰래 고르기(모두 고르기 전엔 바꾸기 가능, 마지막 사람이 고르면 공개), 작은 카드 줄 고르기·양쪽 끝 같은 차이 자리 고르기에서 멈춤, 라운드 합산·66점(또는 라운드 수) 종료·20라운드 안전장치
- 옵션 전부: 카드 구성(104장/인원×10+4 섞기/펼쳐 골라 가기 프로 2~6명), 양쪽 끝 붙이기, 작은 카드 자동, 30주년판 특별 카드 4종(짝홀·산 오르기·점프하는 소 연쇄·숫자 뒤집기), 끝 점수/라운드 수, 나온 카드 표, 제한 시간
- 시간 초과·나가기: 지금 줄 기준 가장 안전한 카드·소머리 적은 줄, 3번이면 자리 비움(5초), 나간 사람은 바로 자동, 1명 남으면 끝
- 컴퓨터: 카드마다 상대 카드를 흉내 내어 가져갈 소머리 평균(1단계 4번 → 60단계 48번), humanBest 실수, 41단계 이상 숫자 뒤집기·대기 카드 보고 줄 고르기
- 화면 apps/web/src/games/six-nimmt/: 소머리 색 카드, 줄 4개 + 빨간 6번째 칸, 공개 카드 줄과 한 장씩 놓이는 재생(줄 빛남·흔들림·"+🐮" 배너·음매 소리), 손패 미리 보기("2번 줄 3번째"/"⚠ 가져감"/"⬇ 너무 작음"), 뒤집기 토글, 줄 고르기 버튼(추천), 프로 뽑기, 라운드 결과 창, 최종 표, 점수표·나온 카드 표·기록, 휴대폰 320px, 도움말·30초 요약
- 등록: GAMES·BOT_STRATEGIES·BOT_GAMES·CATALOG·GAME_UI·GAME_ICON·카드·패 탭, docs/games/README.md, 설계 문서에 정한 것 기록
- 테스트: 규칙 46개(문서 §10 예시 전부, 무작위 대국 옵션 7종 JSON 왕복·결정성·정보 누출·카드 총수·onTimeout 합법), 컴퓨터 25개(옵션 7종 × 2·5·10명, 60단계 대 1단계), 도움말 2개, 방 통합 4개, E2E six-nimmt·six-nimmt-pro

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 19:33:32 +09:00
parent 8620c82ca8
commit 88db031d0a
23 changed files with 3467 additions and 20 deletions

View File

@@ -0,0 +1,129 @@
/**
* 젝스님트 through a real Room (docs/games/six-nimmt.md §10): practice games against computers played to the end from
* the person's own screen, with the simultaneous secret pick, the row choice, the pro draft and timeouts on the clock.
*/
import { afterEach, describe, expect, test } from 'bun:test';
import { GAMES } from '@bg/games';
import type { SixNimmtAction, SixNimmtState, SixNimmtView } from '@bg/games/six-nimmt';
import { botProfile, isBotId, type ServerMessage } from '@bg/shared';
import { openDb } from '../db';
import { RoomManager } from './manager';
import { Room, type Conn } from './room';
import { RoomStore } from './store';
const rooms: Room[] = [];
afterEach(() => {
for (const r of rooms.splice(0)) r.clearTimer();
});
function harness() {
const db = openDb(':memory:');
const store = new RoomStore(db);
let now = 1_000_000;
const clock = { now: () => now, advance: (ms: number) => (now += ms) };
const users = { publicUser: (id: string) => botProfile(id) ?? { id, nickname: id, avatar: null, kind: 'guest' as const } };
const manager = new RoomManager({ store, games: GAMES, users, now: clock.now, botDelay: () => 0 });
const conn = (userId: string) => {
const msgs: ServerMessage[] = [];
const c: Conn & { msgs: ServerMessage[] } = { userId, msgs, send: (m) => msgs.push(m), close: () => {} };
return c;
};
return { db, clock, manager, conn };
}
type StateMsg = Extract<ServerMessage, { t: 'state' }>;
const views = (c: { msgs: ServerMessage[] }) => c.msgs.filter((m): m is StateMsg => m.t === 'state').map((m) => m.view as SixNimmtView);
/** What the person presses, read only from their own screen (the safest-looking card, or the fewest-bulls row). */
function personMove(v: SixNimmtView, me: string, n: number): SixNimmtAction | null {
if (v.phase === 'draft') return v.draft!.at === me ? { type: 'DRAFT', card: v.draft!.pool[n % v.draft!.pool.length]! } : null;
if (v.phase === 'select') {
if (v.players[me]!.picked || !v.my) return null;
const hand = [...v.my.hand].sort((a, b) => (a.preview?.takes ?? 0) - (b.preview?.takes ?? 0));
return { type: 'SELECT', card: hand[n % 2 === 0 ? 0 : hand.length - 1]!.n };
}
const pd = v.pending;
if (v.phase !== 'choose' || !pd || pd.player !== me) return null;
if (pd.kind === 'place') return { type: 'PLACE', row: pd.choices[0]!.row, side: pd.choices[0]!.side };
const best = v.rows.reduce((b, r, i) => (r.bulls < v.rows[b]!.bulls ? i : b), 0);
return { type: 'TAKE_ROW', row: best };
}
describe('젝스님트 room flow', () => {
test.each([
[1, {}],
[3, { deck: 'pro', endMode: 'rounds', rounds: 2 }],
[4, { placement: 'both', lowCard: 'choose', endMode: 'rounds', rounds: 2 }],
] as const)('컴퓨터 %i명과 연습 %j: 사람은 자기 화면만 보고 끝까지, 컴퓨터가 고른 카드는 공개 전까지 안 보여요', (nBots, options) => {
const h = harness();
let room: Room;
if (nBots === 1) room = h.manager.createPractice('A', 'six-nimmt') as Room;
else {
const r = h.manager.create('A', 'six-nimmt', 'private');
if (typeof r === 'string') throw new Error(r);
room = r;
expect(room.configure('A', { options: { ...GAMES['six-nimmt']!.defaultOptions, ...options } })).toBeNull();
for (let i = 0; i < nBots; i++) expect(room.addBot('A')).toBeNull();
}
rooms.push(room);
const a = h.conn('A');
room.join(a, 'player');
expect(room.start('A')).toBeNull();
const bots = room.game!.players.filter(isBotId);
expect(bots).toHaveLength(nBots);
let cs = 0;
let seen = 0;
let mine = 0;
let chose = 0;
for (let i = 0; i < 60_000 && !room.game!.finished; i++) {
h.clock.advance(250);
if (room.bots.dueAt !== null && room.bots.dueAt <= h.clock.now()) room.bots.fire();
const d = room.effectiveDeadline();
if (d !== null && d <= h.clock.now()) room.onTimer();
const vs = views(a);
for (const v of vs.slice(seen)) {
// A computer's secret pick never reaches my screen before the reveal.
for (const b of bots) expect(JSON.stringify(v)).not.toContain(`six-sel:${b}`);
expect(v.me).toBe('A');
}
seen = vs.length;
const v = vs.at(-1);
const m = v && personMove(v, 'A', mine);
if (m) {
if (m.type === 'TAKE_ROW' || m.type === 'PLACE') chose++;
room.act('A', ++cs, m);
mine++;
}
}
expect(room.game!.finished).toBe(true);
expect(a.msgs.filter((m) => m.t === 'reject')).toEqual([]);
const s = room.game!.state as SixNimmtState;
expect(s.timeouts.A).toBe(0); // every step of the person was a real press
const last = views(a).at(-1)!;
expect(last.result!.ranking.map((r) => r.player).sort()).toEqual(['A', ...bots].sort());
expect(last.result!.ranking[0]!.total).toBe(Math.min(...s.seats.map((p) => s.totals[p]!)));
expect(mine).toBeGreaterThanOrEqual(10);
if (nBots === 1) expect(chose + mine).toBeGreaterThan(10);
const row = h.db.query<{ result_json: string }, []>('SELECT result_json FROM games').get()!;
expect(JSON.parse(row.result_json).practice).toBe(true);
});
test('시간 초과: 사람이 아무것도 안 하면 제한 시간마다 자동으로 내고 3번이면 자리 비움', () => {
const h = harness();
const room = h.manager.createPractice('A', 'six-nimmt') as Room;
rooms.push(room);
const a = h.conn('A');
room.join(a, 'player');
expect(room.start('A')).toBeNull();
for (let i = 0; i < 2000; i++) {
h.clock.advance(500);
if (room.bots.dueAt !== null && room.bots.dueAt <= h.clock.now()) room.bots.fire();
const d = room.effectiveDeadline();
if (d !== null && d <= h.clock.now()) room.onTimer();
if ((room.game!.state as SixNimmtState).timeouts.A! >= 3) break;
}
const s = room.game!.state as SixNimmtState;
expect(s.timeouts.A).toBeGreaterThanOrEqual(3);
expect(views(a).at(-1)!.players.A!.away).toBe(true);
});
});

View File

@@ -9,7 +9,7 @@ import { assertCleanText, eachView, seatIds, usersOf } from './help-kit.test-uti
const IDS = Object.keys(GAME_UI);
test('모든 게임에 도움말이 있어요', () => {
expect(IDS).toHaveLength(34);
expect(IDS).toHaveLength(35);
for (const id of IDS) {
const src = readFileSync(join(import.meta.dir, id, 'index.tsx'), 'utf8');
expect(src, id).toMatch(/\bquickStart,/);

View File

@@ -36,6 +36,7 @@ export const GAME_UI: Record<string, () => Promise<{ default: GameUI }>> = {
liar: () => import('./liar'),
'magical-athlete': () => import('./magical-athlete'),
blackjack: () => import('./blackjack'),
'six-nimmt': () => import('./six-nimmt'),
};
const cache = new Map<string, GameUI>();

View File

@@ -0,0 +1,29 @@
import { expect, test } from 'bun:test';
import { applyAction, setupGame, usersOf } from '../help-kit.test-util';
import { GAMES } from '@bg/games';
import { helpNow } from './help';
const ID = 'six-nimmt';
const users = usersOf(['A', 'B', 'C']);
const view = (s: unknown, who: string | null) => GAMES[ID]!.view(s, who) as any;
test('젝스님트: 고르기 / 낸 뒤 기다리기 / 관전', () => {
let { state } = setupGame(ID, 3);
expect(helpNow(view(state, 'A'), 'A', users)).toContain('[이 카드 내기]');
state = applyAction(ID, state, 'A', { type: 'SELECT', card: state.hands.A[0] });
expect(helpNow(view(state, 'A'), 'A', users)).toContain('바꿀 수 있어요');
expect(helpNow(view(state, null), null, users)).toContain('몰래 골라요');
});
test('젝스님트: 너무 작은 카드면 줄 고르기 안내', () => {
let { state } = setupGame(ID, 3);
state.rows = [[90], [91], [92], [93]];
state.hands.A = [1, ...state.hands.A.filter((c: number) => c !== 1 && c < 90).slice(0, 9)];
for (const p of ['B', 'C']) state.hands[p] = state.hands[p].filter((c: number) => c > 1 && c < 90);
state = applyAction(ID, state, 'A', { type: 'SELECT', card: 1 });
state = applyAction(ID, state, 'B', { type: 'SELECT', card: state.hands.B[0] });
state = applyAction(ID, state, 'C', { type: 'SELECT', card: state.hands.C[0] });
expect(state.phase).toBe('choose');
expect(helpNow(view(state, 'A'), 'A', users)).toContain('통째로 가져가야 해요');
expect(helpNow(view(state, 'B'), 'B', users)).toContain('고르는 중이에요');
});

View File

@@ -0,0 +1,46 @@
/** 젝스님트 [?] "지금 할 수 있는 것" (docs/07 §5). Pure: only reads the client view. */
import type { SixNimmtView } from '@bg/games/six-nimmt';
import type { PublicUser } from '@bg/shared/lite';
export function helpNow(v: SixNimmtView, me: string | null, players: Record<string, PublicUser>): string {
const name = (p: string) => `${players[p]?.nickname ?? '다른 사람'}님`;
const seated = !!me && v.seats.includes(me);
const goal =
v.options.endMode === 'score'
? `누군가 벌점 ${v.options.endScore}점 이상이 되면 그 라운드 끝에 게임이 끝나요. 벌점이 가장 적은 사람이 이겨요.`
: `${v.options.rounds}라운드를 하고 벌점이 가장 적은 사람이 이겨요.`;
const score = seated ? `지금 내 벌점은 ${v.players[me!]!.total}점${v.players[me!]!.roundBulls ? `, 이번 라운드에 가져간 소머리 ${v.players[me!]!.roundBulls}개` : ''}예요.` : '';
if (v.phase === 'finished') return `게임이 끝났어요. ${v.result?.summary ?? ''}`.trim() + '\n결과 창에서 [한 판 더]를 누르면 다시 할 수 있어요.';
if (seated && v.players[me!]!.left) return '나는 그만해서 구경만 할 수 있어요. 남은 카드는 자동으로 나가요.';
if (v.phase === 'draft') {
const d = v.draft!;
const head = `${v.round}라운드 카드 골라 가기예요. 펼쳐진 카드에서 차례로 한 장씩 가져가 각자 10장을 만들어요. 남은 4장이 줄의 첫 카드가 돼요.`;
if (seated && d.at === me) return `${head}\n지금 내가 가져갈 차례예요. 카드를 누르면 바로 내 카드가 돼요. 소머리가 적은 카드, 숫자가 고르게 퍼진 카드가 무난해요.\n${score}`;
return `${head}\n지금은 ${name(d.at)}이 고르는 중이에요.\n${goal}`;
}
const lines: string[] = [];
if (v.phase === 'select') {
lines.push(`${v.round}라운드 ${v.turn}번째 카드예요. 모두 손패에서 한 장을 몰래 골라요. 모두 고르면 한꺼번에 공개되고, 작은 수부터 끝 카드가 가장 가까운 줄에 붙어요.`);
if (!seated) lines.push(goal);
else if (v.my?.selected) lines.push(`나는 ${v.my.selected.card}${v.my.selected.flip ? '(숫자 뒤집기)' : ''}을(를) 냈어요. 다른 사람이 모두 고를 때까지 다른 카드를 눌러 바꿀 수 있어요.`);
else {
lines.push('카드를 누르면 올라와요. 한 번 더 누르거나 [이 카드 내기]를 누르면 내요.');
lines.push('카드 아래 표시는 지금 줄 모양 그대로일 때 어디에 붙는지예요. "⚠ 가져감"은 여섯 번째가 되어 벌점을 받는 카드, "⬇ 너무 작음"은 줄 하나를 가져와야 하는 카드예요.');
if (v.options.fanCard === 'flipDigits' && v.players[me!]!.flipLeft) lines.push('[🔄 뒤집기]를 켜고 내면 이번 라운드에 한 번 카드 숫자를 뒤집어 낼 수 있어요(31 → 13).');
}
} else {
const pd = v.pending!;
if (pd.player === me) {
lines.push(
pd.kind === 'takeRow'
? `내 카드 ${pd.play.card}이(가) 모든 줄의 끝 카드보다 작아요. 줄 하나를 골라 통째로 가져가야 해요. 소머리가 가장 적은 줄에 "추천"이 붙어 있어요. 내 카드가 그 줄의 새 첫 카드가 돼요.`
: `내 카드 ${pd.play.card}을(를) 놓을 수 있는 자리가 두 곳이에요(차이가 같아요). 반짝이는 자리 중 하나를 눌러요.`,
);
} else lines.push(`${name(pd.player)}이 ${pd.kind === 'takeRow' ? '가져갈 줄을' : '카드를 놓을 자리를'} 고르는 중이에요. 남은 공개 카드는 그다음에 놓여요.`);
}
if (score) lines.push(score);
return lines.join('\n');
}

View File

@@ -0,0 +1,987 @@
/** 젝스님트 화면 (docs/games/six-nimmt.md §9). Penalty points (소머리) are play points of this room only. */
import { useEffect, useRef, useState, type ReactNode } from 'react';
import type { LogEntry, Marker, Pending, SixHandCard, SixNimmtOptions, SixNimmtView } from '@bg/games/six-nimmt';
import { bulls as bullsOfCard, type Card, type Preview, type Step } from '@bg/games/six-nimmt/rules';
import type { PublicUser } from '@bg/shared/lite';
import { Avatar, ConfirmSheet } from '../../components/ui';
import { TurnTimer } from '../../components/TurnTimer';
import { haptic, noise, sfx, sounds, tone } from '../../lib/feedback';
import { fxMs } from '../../lib/motion';
import type { BoardProps, GameUI, OptionsProps } from '../types';
import { helpNow } from './help';
import { quickStart } from './quick';
const nick = (players: Record<string, PublicUser>, id: string) => players[id]?.nickname ?? '알 수 없음';
const userOf = (players: Record<string, PublicUser>, id: string): PublicUser => players[id] ?? { id, nickname: '알 수 없음', avatar: null, kind: 'guest' };
const who = (players: Record<string, PublicUser>, me: string | null, p: string) => (p === me ? '나' : nick(players, p));
const reducedMotion = () => typeof matchMedia !== 'undefined' && matchMedia('(prefers-reduced-motion: reduce)').matches;
const ROW_NAMES = ['1번 줄', '2번 줄', '3번 줄', '4번 줄'];
/** Sounds on top of the shared palette (site volume applies). */
const sxSound = {
/** A card put on a row. */
place: () => {
noise(60, 0.14, 0, 'bandpass', 1400, 0.9);
tone(260, 50, 'triangle', 0.08);
},
/** "음매": lower and longer the more cows were taken. */
moo: (n: number) => {
const ms = Math.min(900, 380 + n * 40);
const f = Math.max(110, 230 - n * 8);
tone(f, ms, 'sawtooth', 0.06, 0, { slideTo: f * 0.72 });
tone(f * 1.5, ms * 0.8, 'sine', 0.05, 30, { slideTo: f * 1.05 });
},
/** The fan card / cow moving. */
hop: () => tone(520, 160, 'sine', 0.08, 0, { slideTo: 980 }),
};
// ---------------------------------------------------------------- cards
const toneOf = (b: number) => (b >= 7 ? 'b7' : b >= 5 ? 'b5' : b >= 3 ? 'b3' : b >= 2 ? 'b2' : 'b1');
const bullText = (b: number) => (b > 1 ? `🐮${b}` : '🐮');
function NumCard({ n, size = 'row', flipped, cls = '', label }: { n: Card; size?: 'row' | 'hand' | 'mini'; flipped?: number; cls?: string; label?: string }) {
const b = bullsOfCard(n);
return (
<span className={`sx-card ${size} ${toneOf(b)} ${cls}`} aria-label={label ?? `${n}, 소머리 ${b}개`} role="img">
<span className="sx-bulls" aria-hidden>
{bullText(b)}
</span>
<span className="sx-n" aria-hidden>
{flipped ?? n}
</span>
{flipped !== undefined && (
<span className="sx-orig" aria-hidden>
원래 {n}
</span>
)}
</span>
);
}
function markerLabel(m: Marker | null, row: number): string | null {
if (!m || m.row !== row) return null;
if (m.kind === 'evenOdd') return m.parity === 'even' ? '짝수만' : '홀수만';
if (m.kind === 'mountain') return `산 오르기(작은 수)${m.dir === 'up' ? ' ▲' : ' ▼'}`;
return null;
}
function MarkerIcon({ m, row }: { m: Marker | null; row: number }) {
if (!m || m.row !== row || m.kind === 'cow') return null;
const text = m.kind === 'evenOdd' ? (m.parity === 'even' ? '짝' : '홀') : m.dir === 'up' ? '⛰▲' : '⛰▼';
return (
<span className={`sx-mark ${m.kind}`} title={markerLabel(m, row) ?? ''}>
{text}
</span>
);
}
// ---------------------------------------------------------------- reveal playback
interface Playback {
/** Rows to draw (the live rows when nothing is being replayed). */
rows: Card[][];
marker: Marker | null;
/** Step being shown (its row glows, takes show a banner). */
step: Step | null;
/** Cards of the revealed turn still waiting, in order (shown above the rows). */
waiting: { player: string; card: Card; value: number; flip: boolean }[];
/** True while the drawing is behind the view. */
busy: boolean;
}
/**
* The view already has the whole turn placed; the board replays it one card at a time (0.45 s each, hurried when far
* behind). A board that opens mid-game shows the current rows without replaying.
*/
function usePlayback(v: SixNimmtView): Playback {
const rv = v.reveal;
const [pos, setPos] = useState(() => ({ id: rv?.id ?? 0, shown: rv?.steps.length ?? 0 }));
const live = (): Playback => ({ rows: v.rows.map((r) => r.cards.map((c) => c.n)), marker: v.marker, step: null, waiting: v.queue.map((q) => ({ ...q })), busy: false });
useEffect(() => {
if (!rv) return;
if (reducedMotion()) {
if (pos.id !== rv.id || pos.shown !== rv.steps.length) setPos({ id: rv.id, shown: rv.steps.length });
return;
}
if (pos.id !== rv.id) {
setPos({ id: rv.id, shown: -1 });
sfx.cardFlip();
return;
}
if (pos.shown >= rv.steps.length) return;
const behind = rv.steps.length - pos.shown;
const t = setTimeout(() => setPos((p) => ({ ...p, shown: p.shown + 1 })), fxMs(pos.shown < 0 ? 650 : behind > 4 ? 220 : 450));
return () => clearTimeout(t);
}, [rv?.id, rv?.steps.length, pos.id, pos.shown]); // eslint-disable-line react-hooks/exhaustive-deps
// Sound of the step just shown.
useEffect(() => {
if (!rv || pos.id !== rv.id || pos.shown < 0) return;
const st = rv.steps[pos.shown];
if (!st) return;
if (st.t === 'place') {
if (st.took.length) {
sxSound.moo(st.bulls);
haptic(40);
} else sxSound.place();
} else if (st.t === 'cow' && st.took.length) sxSound.moo(st.bulls);
else sxSound.hop();
}, [pos.id, pos.shown]); // eslint-disable-line react-hooks/exhaustive-deps
// A new reveal is drawn from its start even before the effect above has caught up.
const cur = !rv ? pos : pos.id === rv.id ? pos : { id: rv.id, shown: reducedMotion() ? rv.steps.length : -1 };
if (!rv || cur.shown >= rv.steps.length) return live();
const placed = new Set(rv.steps.slice(0, Math.max(0, cur.shown + 1)).filter((s) => s.t === 'place').map((s) => (s as { card: Card }).card));
const waiting = rv.plays.filter((p) => !placed.has(p.card));
if (cur.shown < 0) return { rows: rv.before.rows, marker: rv.before.marker, step: null, waiting, busy: true };
const st = rv.steps[cur.shown]!;
return { rows: st.rows, marker: st.marker, step: st, waiting, busy: true };
}
// ---------------------------------------------------------------- rows
function Rows({ v, pb, me, players, act, pending, overlay }: { v: SixNimmtView; pb: Playback; me: string | null; players: Record<string, PublicUser>; act: (a: unknown) => void; pending: boolean; overlay?: ReactNode }) {
const pd = v.pending;
const mine = !pb.busy && v.phase === 'choose' && pd && pd.player === me;
const fewest = mine && pd!.kind === 'takeRow' ? recommendRow(v) : -1;
const st = pb.step;
const glowRow = st ? (st.t === 'place' ? st.row : st.t === 'cow' ? st.to : st.to) : -1;
return (
<section className="sx-rows" aria-label="줄 4개">
{pb.rows.map((r, i) => {
const cow = pb.marker?.kind === 'cow' && pb.marker.row === i;
const slots = r.length + (cow ? 1 : 0);
const rb = r.reduce((t, c) => t + bullsOfCard(c), 0);
const ml = markerLabel(pb.marker, i);
const taking = st && st.t === 'place' && st.row === i && st.took.length > 0;
const choicesHere = mine && pd!.kind === 'place' ? pd!.choices.filter((c) => c.row === i) : [];
const placeL = choicesHere.find((c) => c.side === 'L');
const placeR = choicesHere.find((c) => c.side === 'R');
return (
<div key={i} className={`sx-row${glowRow === i ? ' glow' : ''}${taking ? ' take' : ''}${slots >= 5 ? ' full' : ''}`} aria-label={`${ROW_NAMES[i]}: ${r.join(', ')}${cow ? ', 소' : ''} · 소머리 ${rb}개${ml ? ` · ${ml}` : ''}${slots >= 5 ? ' · 다음 카드가 가져가요' : ''}`}>
<div className="sx-rowhead">
<b>{i + 1}</b>
<span className="sx-rowbulls">🐮{rb}</span>
<MarkerIcon m={pb.marker} row={i} />
</div>
<div className="sx-slots">
{placeL && (
<button type="button" className="sx-spot" disabled={pending} onClick={() => act({ type: 'PLACE', row: i, side: 'L' })} aria-label={`${ROW_NAMES[i]} 왼쪽에 놓기`}>
← 여기
</button>
)}
{r.map((c, k) => (
<NumCard key={`${c}-${k}`} n={c} cls={st && st.t === 'place' && st.card === c ? 'new' : ''} />
))}
{cow && (
<span className="sx-card row cow" role="img" aria-label="점프하는 소">
<span className="sx-n" aria-hidden>
🐄
</span>
</span>
)}
{placeR && (
<button type="button" className="sx-spot" disabled={pending} onClick={() => act({ type: 'PLACE', row: i, side: 'R' })} aria-label={`${ROW_NAMES[i]} 오른쪽에 놓기`}>
여기 →
</button>
)}
{Array.from({ length: Math.max(0, 6 - slots - (placeL ? 1 : 0) - (placeR ? 1 : 0)) }, (_, k) => (
<span key={`e${k}`} className={`sx-empty${slots + k === 5 ? ' sixth' : ''}`} aria-hidden>
{slots + k === 5 ? '6' : ''}
</span>
))}
</div>
{mine && pd!.kind === 'takeRow' && (
<button type="button" className={`btn btn-sm ${i === fewest ? 'btn-primary' : 'btn-secondary'} sx-takebtn`} disabled={pending} onClick={() => act({ type: 'TAKE_ROW', row: i })}>
이 줄 가져가기 · 🐮{rb}
{i === fewest ? ' (추천)' : ''}
</button>
)}
</div>
);
})}
{st && ((st.t === 'place' && st.took.length > 0) || (st.t === 'cow' && st.took.length > 0)) && (
<div className="sx-banner take" role="status">
{who(players, me, st.player)} +🐮{st.bulls} {st.t === 'cow' ? '(소가 뛰어서 한 줄 더!)' : st.why === 'low' ? '(너무 작은 카드)' : '(6번째 카드)'}
</div>
)}
{overlay && <div className="sx-overlay">{overlay}</div>}
</section>
);
}
/** Fewest bulls, then the largest end card (the same row the timeout takes). */
function recommendRow(v: SixNimmtView): number {
let best = 0;
v.rows.forEach((r, i) => {
const b = v.rows[best]!;
if (r.bulls < b.bulls || (r.bulls === b.bulls && r.cards.at(-1)!.n > b.cards.at(-1)!.n)) best = i;
});
return best;
}
// ---------------------------------------------------------------- players strip / revealed cards
function Strip({ v, me, players, active, deadline }: { v: SixNimmtView; me: string | null; players: Record<string, PublicUser>; active: string[]; deadline: number | null }) {
const playing = v.phase !== 'finished';
return (
<section className="sx-strip" aria-label="참가자">
{v.seats.map((p) => {
const pv = v.players[p]!;
const on = playing && active.includes(p);
const state = pv.left ? '나감' : pv.away ? '자리 비움' : v.phase === 'select' ? (pv.picked ? '골랐어요' : '고르는 중') : v.phase === 'choose' && v.pending?.player === p ? '줄 고르는 중' : v.phase === 'draft' && v.draft?.at === p ? '카드 가져가는 중' : '';
return (
<div key={p} className={`sx-player${on ? ' on' : ''}${p === me ? ' me' : ''}${pv.left ? ' gone' : ''}${on && p === me && deadline ? ' timed' : ''}`} aria-label={`${nick(players, p)}: 벌점 ${pv.total}점, 이번 라운드 소머리 ${pv.roundBulls}개${state ? `, ${state}` : ''}`}>
<div className="sx-pl-top">
<Avatar user={userOf(players, p)} size={24} />
<span className="sx-pl-name">{who(players, me, p)}</span>
{v.phase === 'select' && pv.picked && (
<span className="sx-back" aria-hidden title="골랐어요">
✔
</span>
)}
</div>
<div className="sx-pl-score">
<b>{pv.total}</b>
<span className="muted">점</span>
{pv.roundBulls > 0 && <span className="sx-plus">+🐮{pv.roundBulls}</span>}
{v.options.fanCard === 'flipDigits' && pv.flipLeft && <span title="숫자 뒤집기 남음">🔄</span>}
</div>
{state && <div className="sx-pl-state">{state}</div>}
{on && p === me && deadline && (
<span className="sx-pl-timer">
<TurnTimer deadline={deadline} totalMs={v.clockMs ?? 30_000} mine size={30} />
</span>
)}
</div>
);
})}
</section>
);
}
function Revealed({ v, pb, me, players }: { v: SixNimmtView; pb: Playback; me: string | null; players: Record<string, PublicUser> }) {
if (!pb.waiting.length) return null;
const pd = !pb.busy ? v.pending : null;
return (
<section className="sx-reveal" aria-label="공개된 카드(작은 수부터 놓여요)">
<span className="small muted sx-reveal-label">공개된 카드</span>
<div className="sx-reveal-cards">
{pb.waiting.map((p) => (
<div key={p.card} className={`sx-rv${pd && pd.play.card === p.card ? ' pend' : ''}`}>
<NumCard n={p.card} size="mini" flipped={p.flip ? p.value : undefined} label={`${who(players, me, p.player)}: ${p.card}${p.flip ? `(뒤집어서 ${p.value})` : ''}`} />
<span className="sx-rv-name">{who(players, me, p.player)}</span>
</div>
))}
</div>
</section>
);
}
// ---------------------------------------------------------------- hand / draft
function previewText(p: Preview | undefined): string {
if (!p) return '';
if ('low' in p) return `⬇ 너무 작음`;
if (p.takes > 0) return `⚠ 가져감 🐮${p.takes}`;
return `${p.row + 1}번 줄 ${p.side === 'L' ? '왼쪽' : `${p.pos}번째`}${'tie' in p && p.tie ? '(고름)' : ''}`;
}
function Hand({ v, act, pending }: { v: SixNimmtView; act: (a: unknown) => void; pending: boolean }) {
const my = v.my!;
const [pick, setPick] = useState<Card | null>(null);
const [flip, setFlip] = useState(false);
const sel = my.selected;
useEffect(() => {
setPick(null);
setFlip(false);
}, [v.round, v.turn]);
const open = v.phase === 'select';
const canFlipNow = v.options.fanCard === 'flipDigits' && v.players[v.me!]!.flipLeft;
const chosen = pick ?? sel?.card ?? null;
const chosenCard = my.hand.find((h) => h.n === chosen);
const useFlip = flip && !!chosenCard?.flipped;
const send = (n: Card, f: boolean) => {
sfx.cardPlay();
act({ type: 'SELECT', card: n, ...(f ? { flip: true } : {}) });
setPick(null);
};
const same = sel && chosen === sel.card && sel.flip === useFlip;
const tap = (h: SixHandCard) => {
if (!open || pending) return;
if (pick === h.n) send(h.n, flip && !!h.flipped);
else {
sfx.select();
setPick(h.n);
}
};
return (
<section className="sx-hand-wrap" aria-label="내 손패">
{open && (
<p className="small muted sx-hint">
{sel ? `낸 카드: ${sel.card}${sel.flip ? '(뒤집기)' : ''} · 모두 내기 전에는 다른 카드를 눌러 바꿀 수 있어요.` : '카드를 누르면 올라와요. 한 번 더 누르거나 [이 카드 내기]로 내요.'} 카드 아래 표시는 지금 줄 기준이에요. 다른 사람 카드에 따라 달라져요.
</p>
)}
<div className="sx-hand" role="group" aria-label="손패">
{my.hand.map((h) => {
const up = chosen === h.n;
const pv = flip && h.flipped ? h.flipped.preview : h.preview;
return (
<button
key={h.n}
type="button"
className={`sx-hcard${up ? ' up' : ''}${sel?.card === h.n ? ' sent' : ''}`}
disabled={!open || pending}
aria-pressed={up}
aria-label={`${h.n}, 소머리 ${h.bulls}개${pv ? `, ${previewText(pv)}` : ''}${sel?.card === h.n ? ', 낸 카드' : ''}`}
onClick={() => tap(h)}
>
<NumCard n={h.n} size="hand" flipped={flip && h.flipped ? h.flipped.value : undefined} label="" />
{open && <span className={`sx-pv${pv && ('low' in pv || pv.takes > 0) ? ' warn' : ''}`}>{previewText(pv)}</span>}
</button>
);
})}
</div>
{open && (
<div className="sx-hand-actions">
{canFlipNow && (
<button type="button" className="btn btn-secondary sx-flip" aria-pressed={flip} onClick={() => setFlip((f) => !f)}>
🔄 뒤집기 {flip ? '켬' : '끔'}
</button>
)}
<button type="button" className="btn btn-primary sx-send" disabled={pending || chosen === null || !!same} onClick={() => chosen !== null && send(chosen, useFlip)}>
{chosen === null ? '낼 카드를 눌러 주세요' : same ? '이 카드를 냈어요' : sel ? `${chosen}${useFlip ? '(뒤집기)' : ''}(으)로 바꾸기` : `${chosen}${useFlip ? '(뒤집기)' : ''} 이 카드 내기`}
</button>
</div>
)}
</section>
);
}
function Draft({ v, me, players, act, pending }: { v: SixNimmtView; me: string | null; players: Record<string, PublicUser>; act: (a: unknown) => void; pending: boolean }) {
const d = v.draft!;
const mine = d.at === me;
const myCount = me && v.my ? v.my.hand.length : 0;
return (
<section className="card sx-draft" aria-label="카드 골라 가기">
<h3>{mine ? '내 차례예요. 펼쳐진 카드에서 한 장을 가져가세요' : `${nick(players, d.at)}님이 카드를 고르는 중이에요`}</h3>
<p className="small muted" style={{ margin: 0 }}>
각자 10장이 될 때까지 차례로 한 장씩 가져가요. 남은 4장이 줄의 첫 카드가 돼요.{me && v.seats.includes(me) ? ` 내 카드 ${myCount}/10장.` : ''}
</p>
<div className="sx-pool" role="group" aria-label="펼쳐진 카드">
{d.pool.map((n) => (
<button key={n} type="button" className="sx-poolbtn" disabled={!mine || pending} onClick={() => act({ type: 'DRAFT', card: n })} aria-label={`${n} 가져가기, 소머리 ${bullsOfCard(n)}개`}>
<NumCard n={n} size="mini" label="" />
</button>
))}
</div>
{v.my && v.my.hand.length > 0 && (
<div className="sx-mine">
<span className="small muted">내 카드</span>
<div className="sx-reveal-cards">
{v.my.hand.map((h) => (
<NumCard key={h.n} n={h.n} size="mini" />
))}
</div>
</div>
)}
</section>
);
}
// ---------------------------------------------------------------- round result / final
function RoundResult({ v, me, players, onClose }: { v: SixNimmtView; me: string | null; players: Record<string, PublicUser>; onClose: () => void }) {
const lr = v.lastRound!;
const end = v.options.endMode === 'score' ? v.options.endScore : null;
const max = Math.max(end ?? 0, ...v.seats.map((p) => v.players[p]!.total), 1);
return (
<section className="card sx-round" aria-label={`${lr.round}라운드 결과`} role="status">
<div className="sx-round-head">
<strong>{lr.round}라운드 결과</strong>
<button type="button" className="btn btn-sm btn-secondary" onClick={onClose}>
닫기
</button>
</div>
<ul className="sx-bars">
{v.seats.map((p) => {
const total = v.phase === 'finished' ? v.players[p]!.total : v.players[p]!.total;
return (
<li key={p}>
<span className="sx-bar-name">{who(players, me, p)}</span>
<span className="sx-bar">
<span style={{ width: `${(total / max) * 100}%` }} />
{end && <i style={{ left: `${(end / max) * 100}%` }} title={`${end}점`} />}
</span>
<span className="sx-bar-num">
+{lr.gained[p] ?? 0} → <b>{total}</b>
</span>
</li>
);
})}
</ul>
{end && <p className="small muted" style={{ margin: 0 }}>누군가 {end}점 이상이 되면 그 라운드 끝에 게임이 끝나요.</p>}
</section>
);
}
function FinalTable({ v, me, players }: { v: SixNimmtView; me: string | null; players: Record<string, PublicUser> }) {
const r = v.result!;
const rounds = Math.max(...v.seats.map((p) => v.roundScores[p]!.length));
return (
<section className="card sx-final" aria-label="최종 결과">
<h3>최종 결과</h3>
<p style={{ margin: 0 }}>{r.summary}</p>
<div className="sx-table-wrap">
<table className="sx-table">
<thead>
<tr>
<th>순위</th>
<th>이름</th>
{Array.from({ length: rounds }, (_, i) => (
<th key={i}>{i + 1}R</th>
))}
<th>벌점</th>
</tr>
</thead>
<tbody>
{r.ranking.map((row) => (
<tr key={row.player} className={row.rank === 1 ? 'win' : ''}>
<td>{row.left ? '-' : `${row.rank}등`}</td>
<td>{who(players, me, row.player)}</td>
{Array.from({ length: rounds }, (_, i) => (
<td key={i}>{v.roundScores[row.player]![i] ?? ''}</td>
))}
<td>
<b>{row.total}</b>
</td>
</tr>
))}
</tbody>
</table>
</div>
{v.bestTake && v.bestTake.bulls > 0 && (
<p className="small" style={{ margin: 0 }}>
가장 크게 가져간 한 번: {who(players, me, v.bestTake.player)} · {v.bestTake.round}라운드에 한 번에 소머리 {v.bestTake.bulls}개!
</p>
)}
</section>
);
}
// ---------------------------------------------------------------- board
function Board({ view: v, me, players, act, pending, active, deadline }: BoardProps<SixNimmtView>) {
const pb = usePlayback(v);
const [roundShown, setRoundShown] = useState<number>(v.lastRound?.round ?? 0);
const [roundOpen, setRoundOpen] = useState(false);
const prevTurn = useRef(v.turnSeq);
const prevPicked = useRef(0);
const [announce, setAnnounce] = useState('');
// Round result window: once the replay of the last turn is done, for 5 seconds (closable).
useEffect(() => {
if (!v.lastRound || v.lastRound.round === roundShown || pb.busy) return;
setRoundShown(v.lastRound.round);
setRoundOpen(true);
const t = setTimeout(() => setRoundOpen(false), 5000);
return () => clearTimeout(t);
}, [v.lastRound?.round, pb.busy]); // eslint-disable-line react-hooks/exhaustive-deps
// Someone picked a card: a soft tap.
const pickedN = v.seats.filter((p) => v.players[p]!.picked).length;
useEffect(() => {
if (pickedN > prevPicked.current) sfx.chip();
prevPicked.current = pickedN;
}, [pickedN]);
useEffect(() => {
if (v.turnSeq === prevTurn.current) return;
prevTurn.current = v.turnSeq;
if (isMyTurn(v, me)) {
haptic(40);
if (document.visibilityState === 'hidden') sounds.myTurn();
else tone(880, 70, 'triangle', 0.06);
}
}, [v.turnSeq]); // eslint-disable-line react-hooks/exhaustive-deps
// Screen readers: the latest takes.
const lastLog = v.log.at(-1)?.n ?? 0;
const prevLog = useRef(lastLog);
useEffect(() => {
if (lastLog <= prevLog.current) return;
const added = v.log.filter((e) => e.n > prevLog.current);
prevLog.current = lastLog;
const text = added.map((e) => logText(e, me, players)).filter(Boolean).slice(-3).join(' ');
if (text) setAnnounce(text);
}, [lastLog]); // eslint-disable-line react-hooks/exhaustive-deps
const seated = !!me && v.seats.includes(me) && !v.players[me]!.left;
const pd = v.pending;
return (
<div className="sx-wrap">
<style>{CSS}</style>
<div className="card sx-head">
<strong>{v.phase === 'finished' ? '게임 끝' : v.phase === 'draft' ? `${v.round}라운드 · 카드 골라 가기` : `${v.round}라운드 · ${v.turn}/10번째 카드`}</strong>
<span className="small muted">
{v.options.endMode === 'score' ? `${v.options.endScore}점이 넘으면 끝` : `${v.options.rounds}라운드까지`}
{v.options.fanCard !== 'none' ? ` · ${FAN_KO[v.options.fanCard]}` : ''}
{v.options.placement === 'both' ? ' · 양쪽 끝' : ''}
</span>
</div>
<Strip v={v} me={me} players={players} active={active} deadline={deadline} />
{v.result && <FinalTable v={v} me={me} players={players} />}
{v.phase === 'draft' && v.draft ? (
<Draft v={v} me={me} players={players} act={act} pending={pending} />
) : (
<>
<Revealed v={v} pb={pb} me={me} players={players} />
{!pb.busy && v.phase === 'choose' && pd && (
<div className={`sx-banner${pd.player === me ? ' mine' : ''}`} role="status">
{pd.player === me
? pd.kind === 'takeRow'
? `너무 작은 카드예요(${pd.play.value})! 가져갈 줄을 고르세요`
: `${pd.play.value}을(를) 놓을 자리가 두 곳이에요. 반짝이는 자리를 골라 주세요`
: `${nick(players, pd.player)}님이 ${pd.kind === 'takeRow' ? '가져갈 줄을' : '놓을 자리를'} 고르는 중…`}
</div>
)}
<Rows v={v} pb={pb} me={me} players={players} act={act} pending={pending} overlay={roundOpen && v.lastRound && !(v.phase === 'choose' && pd?.player === me) ? <RoundResult v={v} me={me} players={players} onClose={() => setRoundOpen(false)} /> : null} />
{seated && v.my && v.phase !== 'finished' && <Hand v={v} act={act} pending={pending} />}
</>
)}
<p className="sr-only" aria-live="polite">
{announce}
</p>
</div>
);
}
const FAN_KO: Record<SixNimmtOptions['fanCard'], string> = { none: '특별 카드 없음', evenOdd: '짝홀', mountain: '산 오르기', jumpingCow: '점프하는 소', flipDigits: '숫자 뒤집기' };
function logText(e: LogEntry, me: string | null, players: Record<string, PublicUser>): string {
switch (e.t) {
case 'take':
return `${who(players, me, e.player)} ${ROW_NAMES[e.row]} ${e.cards.length}장 가져감 +🐮${e.bulls}${e.why === 'low' ? '(너무 작은 카드)' : e.why === 'cow' ? '(점프하는 소)' : ''}`;
case 'round':
return `${e.round}라운드 끝`;
case 'flip':
return `${who(players, me, e.player)} 숫자 뒤집기: ${e.card} → ${e.value}`;
case 'timeout':
return `${who(players, me, e.player)} 시간 초과(자동)`;
case 'left':
return `${who(players, me, e.player)} 나감`;
}
}
// ---------------------------------------------------------------- side panel
function Tracker({ v, me, players }: { v: SixNimmtView; me: string | null; players: Record<string, PublicUser> }) {
if (!v.seen) return null;
const seen = new Set(v.seen);
const mine = new Set(v.my?.hand.map((h) => h.n) ?? []);
return (
<details className="card sx-tracker">
<summary>나온 카드 표 ({v.seen.length}/{v.deckMax})</summary>
<div className="sx-grid" role="list" aria-label="1부터 카드 번호, 흐린 것은 이번 라운드에 나온 카드">
{Array.from({ length: v.deckMax }, (_, i) => i + 1).map((n) => (
<span key={n} role="listitem" className={`sx-cell ${toneOf(bullsOfCard(n))}${seen.has(n) ? ' seen' : ''}${mine.has(n) ? ' mine' : ''}`} aria-label={`${n}${seen.has(n) ? ' 나옴' : mine.has(n) ? ' 내 카드' : ''}`}>
{n}
</span>
))}
</div>
{v.options.deck === 'all' && <p className="small muted" style={{ margin: 0 }}>104장 중 이번 라운드에 안 쓰는 카드가 섞여 있어요.</p>}
{v.known && (
<div className="stack" style={{ gap: 4 }}>
{v.seats
.filter((p) => p !== me)
.map((p) => (
<div key={p} className="small">
<b>{nick(players, p)}</b>의 남은 카드: {v.known![p]!.join(', ') || '없음'}
</div>
))}
</div>
)}
</details>
);
}
function Side({ view: v, me, players, act }: BoardProps<SixNimmtView>) {
const [ask, setAsk] = useState(false);
const rounds = Math.max(0, ...v.seats.map((p) => v.roundScores[p]!.length));
const playing = v.phase !== 'finished';
return (
<>
<section className="card sx-scores" aria-label="점수표">
<h3>점수표(벌점)</h3>
<div className="sx-table-wrap">
<table className="sx-table">
<thead>
<tr>
<th>이름</th>
{Array.from({ length: rounds }, (_, i) => (
<th key={i}>{i + 1}R</th>
))}
{playing && <th>지금</th>}
<th>합</th>
</tr>
</thead>
<tbody>
{v.seats.map((p) => (
<tr key={p}>
<td className="sx-td-name">{who(players, me, p)}</td>
{Array.from({ length: rounds }, (_, i) => (
<td key={i}>{v.roundScores[p]![i] ?? ''}</td>
))}
{playing && <td>{v.players[p]!.roundBulls ? `+${v.players[p]!.roundBulls}` : ''}</td>}
<td>
<b>{v.players[p]!.total}</b>
</td>
</tr>
))}
</tbody>
</table>
</div>
</section>
<Tracker v={v} me={me} players={players} />
{v.log.length > 0 && (
<section className="card sx-logbox" aria-label="기록">
<h3>기록</h3>
<ul className="sx-log" tabIndex={0} aria-label="기록 (최신이 위)">
{[...v.log]
.reverse()
.slice(0, 30)
.map((e) => (
<li key={e.n} className={e.t}>
{logText(e, me, players)}
</li>
))}
</ul>
</section>
)}
{playing && me && v.seats.includes(me) && !v.players[me]!.left && (
<button className="btn btn-danger btn-sm" onClick={() => setAsk(true)}>
🏳 그만하고 나가기
</button>
)}
{ask && (
<ConfirmSheet
title="그만할까요?"
body="남은 카드는 자동으로 나가고, 나는 맨 뒤 순위가 돼요."
confirm="그만하기"
danger
onConfirm={() => act({ type: 'LEAVE' })}
onClose={() => setAsk(false)}
/>
)}
</>
);
}
// ---------------------------------------------------------------- status
function isMyTurn(v: SixNimmtView, me: string | null): boolean {
if (!me || v.phase === 'finished' || !v.players[me] || v.players[me]!.left) return false;
if (v.phase === 'draft') return v.draft?.at === me;
if (v.phase === 'select') return !v.players[me]!.picked;
return v.pending?.player === me;
}
function pendingText(pd: Pending): string {
return pd.kind === 'takeRow' ? '가져갈 줄을' : '카드를 놓을 자리를';
}
function statusText(v: SixNimmtView, me: string | null, players: Record<string, PublicUser>): string {
if (v.phase === 'finished') return v.result?.summary ?? '게임이 끝났어요';
if (me && v.players[me]?.left) return '나갔어요. 구경하는 중이에요';
const seated = !!me && v.seats.includes(me);
if (v.phase === 'draft') return isMyTurn(v, me) ? '내 차례예요. 펼쳐진 카드에서 한 장을 가져가세요' : `${nick(players, v.draft!.at)}님이 카드를 고르는 중이에요`;
if (v.phase === 'select') {
if (!seated) return '모두 낼 카드를 몰래 고르는 중이에요';
return isMyTurn(v, me) ? '내 차례예요. 낼 카드를 한 장 골라 주세요' : '다른 사람이 고르기를 기다려요';
}
const pd = v.pending!;
return pd.player === me ? `내 차례예요. ${pendingText(pd)} 골라 주세요` : `${nick(players, pd.player)}님이 ${pendingText(pd)} 고르는 중이에요`;
}
// ---------------------------------------------------------------- options
function Seg<T extends string | number | boolean | null>({ value, options, onChange, label, disabled }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string; disabled?: boolean }) {
return (
<div className="segmented" role="group" aria-label={label}>
{options.map(([k, l]) => (
<button key={String(k)} type="button" aria-pressed={value === k} disabled={disabled} onClick={() => onChange(k)}>
{l}
</button>
))}
</div>
);
}
function Field({ label, children, help }: { label: string; children: ReactNode; help?: string }) {
return (
<div className="stack" style={{ gap: 6 }}>
<strong>{label}</strong>
{children}
{help && <span className="small muted">{help}</span>}
</div>
);
}
function Options({ value: o, onChange }: OptionsProps<SixNimmtOptions>) {
const set = (patch: Partial<SixNimmtOptions>) => onChange({ ...o, ...patch });
return (
<div className="stack" style={{ gap: 16 }}>
<Field label="카드 구성" help={o.deck === 'all' ? '1~104를 섞어 10장씩 나눠요(원작 기본).' : o.deck === 'tactics' ? '인원×10+4장만 써서 섞어 나눠요. 적은 인원에서 운이 줄어요.' : '인원×10+4장을 펼쳐 놓고 차례로 골라 가요(2~6명).'}>
<Seg label="카드 구성" value={o.deck} options={[['all', '104장 모두'], ['tactics', '인원×10+4장'], ['pro', '펼쳐 골라 가기']]} onChange={(deck) => set({ deck })} />
</Field>
<Field label="줄에 붙이는 곳" help={o.placement === 'both' ? '왼쪽 끝에는 첫 카드보다 작은 수를 붙일 수 있어요. 특별 카드는 쓸 수 없어요.' : undefined}>
<Seg label="줄에 붙이는 곳" value={o.placement} options={[['right', '오른쪽 끝에만'], ['both', '양쪽 끝']]} onChange={(placement) => set({ placement, ...(placement === 'both' ? { fanCard: 'none' as const } : {}) })} />
</Field>
<Field label="너무 작은 카드를 냈을 때">
<Seg label="너무 작은 카드를 냈을 때" value={o.lowCard} options={[['choose', '줄을 직접 골라요'], ['fewest', '소머리 적은 줄 자동']]} onChange={(lowCard) => set({ lowCard })} />
</Field>
<Field label="특별 카드(30주년판)" help={o.placement === 'both' ? '"오른쪽 끝에만"일 때 쓸 수 있어요.' : o.fanCard === 'none' ? undefined : FAN_HELP[o.fanCard]}>
<Seg label="특별 카드(30주년판)" value={o.fanCard} disabled={o.placement === 'both'} options={[['none', '안 써요'], ['evenOdd', '짝홀'], ['mountain', '산 오르기'], ['jumpingCow', '점프하는 소'], ['flipDigits', '숫자 뒤집기']]} onChange={(fanCard) => set({ fanCard })} />
</Field>
<Field label="끝나는 조건">
<Seg label="끝나는 조건" value={o.endMode} options={[['score', '벌점 점수'], ['rounds', '라운드 수']]} onChange={(endMode) => set({ endMode })} />
</Field>
{o.endMode === 'score' ? (
<Field label="끝나는 벌점">
<Seg label="끝나는 벌점" value={o.endScore} options={([33, 44, 55, 66, 77, 88, 99] as const).map((n) => [n, `${n}점`] as [typeof n, string])} onChange={(endScore) => set({ endScore })} />
</Field>
) : (
<Field label="라운드 수">
<Seg label="라운드 수" value={o.rounds} options={([1, 2, 3, 4, 5, 6] as const).map((n) => [n, `${n}라운드`] as [typeof n, string])} onChange={(rounds) => set({ rounds })} />
</Field>
)}
<Field label="나온 카드 표">
<Seg label="나온 카드 표" value={o.cardTracker} options={[[true, '보여요'], [false, '기억으로 해요']]} onChange={(cardTracker) => set({ cardTracker })} />
</Field>
<Field label="제한 시간">
<Seg label="제한 시간" value={o.turnSeconds} options={[[15, '15초'], [20, '20초'], [30, '30초'], [45, '45초'], [60, '60초'], [null, '무제한']]} onChange={(turnSeconds) => set({ turnSeconds })} />
</Field>
</div>
);
}
const FAN_HELP: Record<Exclude<SixNimmtOptions['fanCard'], 'none'>, string> = {
evenOdd: '짝홀 카드가 있는 줄에는 그 면(짝/홀)과 같은 카드만 놓여요. 누가 줄을 가져가면 옮겨 가요.',
mountain: '산 오르기 줄은 끝 카드보다 작은 수를 붙여요(내림차순). 누가 줄을 가져가면 한 줄씩 움직여요.',
jumpingCow: '소가 있는 줄에 카드가 놓이면 소는 끝 카드가 가장 작은 다른 줄로 뛰어가요. 소도 한 칸을 차지해요.',
flipDigits: '라운드에 한 번, 카드 숫자를 뒤집어 낼 수 있어요(31 → 13). 놓인 뒤에는 원래 숫자예요.',
};
function optionsSummary(o: SixNimmtOptions): string {
return [
o.deck === 'all' ? '104장' : o.deck === 'tactics' ? '인원×10+4장' : '펼쳐 골라 가기',
o.placement === 'both' ? '양쪽 끝' : null,
o.lowCard === 'fewest' ? '작은 카드 자동' : null,
o.fanCard !== 'none' ? FAN_KO[o.fanCard] : null,
o.endMode === 'score' ? `${o.endScore}점에 끝` : `${o.rounds}라운드`,
o.cardTracker ? null : '카드 표 없음',
o.turnSeconds === null ? '시간 제한 없음' : `${o.turnSeconds}초`,
]
.filter(Boolean)
.join(' · ');
}
// ---------------------------------------------------------------- rules
function Rules({ options }: { options?: SixNimmtOptions }) {
const o: SixNimmtOptions = { deck: 'all', placement: 'right', lowCard: 'choose', fanCard: 'none', endMode: 'score', endScore: 66, rounds: 3, cardTracker: true, turnSeconds: 30, ...(options ?? {}) };
return (
<div className="stack">
<p>
1부터 104까지 숫자 카드로 해요. 카드마다 <strong>소머리</strong>가 그려져 있고 이것이 벌점이에요(보통 1개, 5로 끝나면 2개, 10의 배수 3개, 11의 배수 5개, 55는 7개). 벌점이 <strong>적은</strong> 사람이 이겨요.
</p>
<p>
각자 10장을 받고, 판에는 줄 4개가 한 장씩으로 시작해요. 매번 모두 손패에서 한 장을 <strong>몰래 동시에</strong> 고르고, 모두 고르면 한꺼번에 공개해요.
</p>
<p>
공개된 카드는 <strong>작은 수부터</strong> 한 장씩 줄에 붙어요. 내 카드보다 끝 카드가 작은 줄 중 <strong>차이가 가장 작은 줄</strong> 끝에 붙어요. 예를 들어 끝 카드가 41, 42일 때 45는 42 다음이에요.
</p>
<p>
내 카드가 그 줄의 <strong>여섯 번째</strong> 카드가 되면 앞의 다섯 장을 가져가고(소머리만큼 벌점), 내 카드가 그 줄의 새 첫 카드가 돼요.
</p>
<p>
내 카드가 모든 줄의 끝 카드보다 작으면 {o.lowCard === 'choose' ? '원하는 줄 하나를 골라 통째로 가져가고' : '소머리가 가장 적은 줄을 자동으로 가져가고'}, 내 카드가 그 줄의 새 첫 카드가 돼요.
</p>
<p>
10장을 다 내면 라운드가 끝나고 가져간 소머리를 더해요.{' '}
{o.endMode === 'score' ? `누군가 ${o.endScore}점 이상이 되면 그 라운드 끝에 게임이 끝나요(20라운드가 지나도 끝).` : `${o.rounds}라운드를 하고 끝나요.`} 벌점이 같으면 함께 이겨요.
</p>
{o.deck !== 'all' && (
<p>
<strong>{o.deck === 'pro' ? '프로 변형' : '전술 변형'}</strong>: 인원×10+4장(1부터)만 써요.
{o.deck === 'pro' ? ' 모든 카드를 펼쳐 놓고 시작하는 사람부터 차례로 한 장씩 가져가 10장을 만들어요. 남은 4장이 작은 수부터 줄의 첫 카드예요.' : ' 섞어서 나눠요.'}
</p>
)}
{o.placement === 'both' && (
<p>
<strong>양쪽 끝</strong>: 줄 왼쪽에는 첫 카드보다 작은 카드를 붙일 수 있어요. 오른쪽·왼쪽 중 차이가 가장 작은 자리에 놓이고, 차이가 같은 자리가 둘이면 직접 골라요.
</p>
)}
{o.fanCard !== 'none' && (
<p>
<strong>{FAN_KO[o.fanCard]}</strong>: {FAN_HELP[o.fanCard]}
{o.fanCard === 'jumpingCow' && ' 소가 뛰어간 줄이 여섯 칸이 되면 소를 뛰게 한 사람이 가장 큰 카드만 남기고 그 줄도 가져가요.'}
{o.fanCard === 'flipDigits' && ' 한 자리 수는 0을 붙여 뒤집어요(7 → 70). 100 이상은 뒤집을 수 없어요.'}
</p>
)}
<p>
{o.cardTracker ? '오른쪽 [나온 카드 표]에서 이번 라운드에 나온 카드를 볼 수 있어요. ' : '나온 카드 표는 꺼져 있어요(원작처럼 기억으로). '}
{o.turnSeconds === null ? '이 방은 시간 제한이 없어요.' : `${o.turnSeconds}초 안에 고르지 않으면 지금 줄 기준으로 가장 안전한 카드가 자동으로 나가요.`}
</p>
<p className="small muted">원작: 볼프강 크라머 「6 nimmt!」(AMIGO). 30주년판 특별 카드 아이디어: Guillaume Lefebvre, Daniela Bustos, Frank Heeren, Martin Profanter. 카드 그림과 규칙 문장은 이 사이트에서 새로 만들었어요.</p>
</div>
);
}
// ---------------------------------------------------------------- styles
const CSS = `
.sx-wrap { width: 100%; max-width: 980px; display: flex; flex-direction: column; gap: 10px; }
.game-main:has(> .sx-wrap) { justify-content: flex-start; }
.sx-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding: 8px 14px; }
.sx-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
@media (min-width: 720px) { .sx-strip { flex-wrap: wrap; overflow: visible; } }
.sx-player { position: relative; flex: 0 0 auto; min-width: 96px; max-width: 150px; background: var(--surface); border: 2px solid var(--border); border-radius: 12px; padding: 4px 8px; }
.sx-player.on { border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 35%, transparent); }
.sx-player.me { background: var(--primary-soft); }
.sx-player.gone { opacity: .55; }
.sx-pl-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sx-pl-name { font-weight: 700; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.sx-back { display: inline-flex; width: 18px; height: 24px; border-radius: 4px; background: #2f4f86; color: #fff; font-size: .7rem; align-items: center; justify-content: center; border: 1px solid #1d3461; }
.sx-pl-score { display: flex; align-items: baseline; gap: 3px; font-size: .85rem; }
.sx-pl-score b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sx-plus { color: var(--danger); font-weight: 700; }
.sx-pl-state { font-size: .75rem; color: var(--text-sub); white-space: nowrap; }
.sx-pl-timer { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.sx-player.timed { padding-right: 40px; }
.sx-rows { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--felt); border-radius: 16px; padding: 8px; }
.sx-row { width: 100%; max-width: 480px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px; align-items: center; border-radius: 10px; padding: 2px; transition: background .2s; }
.sx-row.glow { background: rgba(255, 255, 255, .16); }
.sx-row.take { animation: sx-shake .45s ease both; background: rgba(239, 68, 68, .35); }
@keyframes sx-shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sx-rowhead { display: flex; flex-direction: column; align-items: center; gap: 1px; color: #fff; font-size: .72rem; line-height: 1.1; }
.sx-rowhead b { font-size: 1rem; }
.sx-rowbulls { white-space: nowrap; }
.sx-mark { border-radius: 6px; padding: 1px 3px; font-weight: 900; font-size: .72rem; background: #fff; color: #1c1e21; white-space: nowrap; }
.sx-mark.mountain { background: #d9f99d; }
.sx-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 64px)); gap: 4px; }
.sx-takebtn { grid-column: 2; justify-self: start; min-height: 40px; }
@media (min-width: 720px) {
.sx-row:has(.sx-takebtn) { max-width: 680px; grid-template-columns: 30px minmax(0, 1fr) auto; }
.sx-row .sx-takebtn { grid-column: 3; }
}
.sx-card { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; border: 2px solid #3b3f46; color: #1c1e21; background: #fff; font-weight: 900; user-select: none; box-sizing: border-box; }
.sx-card.row { width: 100%; aspect-ratio: 5 / 7; }
.sx-card.hand { width: 100%; aspect-ratio: 5 / 7; }
.sx-card.mini { width: 40px; height: 54px; }
.sx-card.b2 { background: #cfe6ff; }
.sx-card.b3 { background: #fff0a3; }
.sx-card.b5 { background: #ffc98f; }
.sx-card.b7 { background: #ff9d9d; border-color: #9b1c1c; }
.sx-card.cow { background: #f1f5f9; border-style: dashed; }
.sx-card.new { animation: sx-in .35s ease-out both; box-shadow: 0 0 0 3px var(--focus); }
@keyframes sx-in { from { transform: translateY(-14px) scale(1.15); opacity: .3; } }
.sx-bulls { position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-size: .62rem; font-weight: 700; line-height: 1; }
.sx-n { font-size: clamp(.95rem, 4.2vw, 1.5rem); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sx-card.mini .sx-n { font-size: 1.05rem; }
.sx-card.mini .sx-bulls { font-size: .55rem; }
.sx-orig { position: absolute; bottom: 2px; font-size: .55rem; font-weight: 700; color: #334155; }
.sx-empty { aspect-ratio: 5 / 7; border-radius: 8px; border: 2px dashed rgba(255, 255, 255, .28); display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, .5); font-weight: 900; }
.sx-empty.sixth { border-color: rgba(248, 113, 113, .7); background: rgba(248, 113, 113, .16); color: #fecaca; }
.sx-spot { aspect-ratio: 5 / 7; border-radius: 8px; border: 3px solid var(--focus); background: rgba(245, 158, 11, .25); color: #fff; font-weight: 900; font-size: .75rem; cursor: pointer; animation: sx-pulse 1s ease-in-out infinite; padding: 0; }
@keyframes sx-pulse { 50% { background: rgba(245, 158, 11, .55); } }
.sx-banner { border-radius: 12px; padding: 8px 12px; font-weight: 800; text-align: center; background: var(--warning-soft); color: var(--text); }
.sx-banner.mine { background: var(--danger-soft); border: 2px solid var(--danger); }
.sx-banner.take { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--danger); color: #fff; font-size: 1.05rem; box-shadow: var(--shadow); white-space: nowrap; animation: sx-pop .3s ease-out both; pointer-events: none; z-index: 2; }
@keyframes sx-pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.sx-reveal { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 6px 10px; border: 1px solid var(--border); overflow-x: auto; }
.sx-reveal-label { white-space: nowrap; }
.sx-reveal-cards { display: flex; gap: 6px; flex-wrap: nowrap; }
.sx-rv { display: flex; flex-direction: column; align-items: center; gap: 1px; animation: sx-flip .4s ease-out both; }
.sx-rv.pend .sx-card { box-shadow: 0 0 0 3px var(--danger); }
@keyframes sx-flip { from { transform: rotateY(90deg); } }
.sx-rv-name { font-size: .7rem; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-hand-wrap { display: flex; flex-direction: column; gap: 6px; }
.sx-hint { margin: 0; }
.sx-hand { display: grid; grid-template-columns: repeat(10, minmax(0, 72px)); gap: 6px; justify-content: center; padding-top: 12px; }
@media (max-width: 720px) { .sx-hand { grid-template-columns: repeat(5, minmax(0, 64px)); } }
.sx-hcard { all: unset; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border-radius: 10px; transition: transform .15s; min-width: 0; }
.sx-hcard:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sx-hcard:disabled { cursor: default; }
.sx-hcard.up { transform: translateY(-10px); }
.sx-hcard.up .sx-card { box-shadow: 0 0 0 3px var(--primary); }
.sx-hcard.sent .sx-card { outline: 3px dashed var(--success); outline-offset: 1px; }
.sx-pv { font-size: .68rem; line-height: 1.15; text-align: center; color: var(--text-sub); min-height: 2.3em; word-break: keep-all; }
.sx-pv.warn { color: var(--danger); font-weight: 800; }
.sx-hand-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sx-send { min-width: 220px; flex: 1 1 220px; max-width: 420px; }
.sx-flip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); }
.sx-draft { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.sx-draft h3 { margin: 0; font-size: 1.05rem; }
.sx-pool { display: flex; flex-wrap: wrap; gap: 5px; }
.sx-poolbtn { all: unset; cursor: pointer; border-radius: 8px; }
.sx-poolbtn:focus-visible { outline: 3px solid var(--focus); }
.sx-poolbtn:disabled { cursor: default; opacity: .85; }
.sx-poolbtn:not(:disabled):hover .sx-card { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--primary); }
.sx-mine { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.sx-overlay { position: absolute; inset: 8px; display: flex; align-items: flex-start; justify-content: center; z-index: 3; pointer-events: none; }
.sx-overlay > * { pointer-events: auto; width: min(100%, 520px); box-shadow: var(--shadow); }
.sx-round { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; border: 2px solid var(--primary); }
.sx-round-head { display: flex; justify-content: space-between; align-items: center; }
.sx-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sx-bars li { display: grid; grid-template-columns: minmax(0, 90px) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; }
.sx-bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-bar { position: relative; height: 12px; border-radius: 6px; background: var(--border); }
.sx-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--warning); }
.sx-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--danger); }
.sx-bar-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sx-final { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sx-final h3, .sx-scores h3, .sx-logbox h3 { margin: 0; font-size: 1rem; }
.sx-table-wrap { overflow-x: auto; }
.sx-table { border-collapse: collapse; width: 100%; font-size: .85rem; font-variant-numeric: tabular-nums; }
.sx-table th, .sx-table td { padding: 3px 6px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.sx-table tr.win td { background: var(--success-soft); }
.sx-td-name { text-align: left !important; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.sx-scores, .sx-logbox { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.sx-log { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }
.sx-log li.take { color: var(--danger); }
.sx-log li.round { font-weight: 800; }
.sx-tracker { padding: 10px 12px; }
.sx-tracker summary { cursor: pointer; font-weight: 700; }
.sx-grid { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; margin: 8px 0; }
.sx-cell { font-size: .68rem; text-align: center; border-radius: 4px; padding: 2px 0; color: #1c1e21; background: #fff; border: 1px solid #c8c8c8; font-variant-numeric: tabular-nums; }
.sx-cell.b2 { background: #cfe6ff; } .sx-cell.b3 { background: #fff0a3; } .sx-cell.b5 { background: #ffc98f; } .sx-cell.b7 { background: #ff9d9d; }
.sx-cell.seen { opacity: .25; text-decoration: line-through; }
.sx-cell.mine { outline: 2px solid var(--primary); font-weight: 900; }
@media (max-width: 400px) {
.sx-rows { padding: 5px; gap: 4px; }
.sx-row { grid-template-columns: 24px minmax(0, 1fr); gap: 2px; }
.sx-slots { gap: 3px; }
.sx-rowhead { font-size: .62rem; }
.sx-card { border-width: 1.5px; border-radius: 6px; }
}
`;
const ui: GameUI<SixNimmtView, SixNimmtOptions> = {
Board,
Side,
statusText,
isMyTurn,
Options,
optionsSummary,
Rules,
quickStart,
helpNow,
};
export default ui;

View File

@@ -0,0 +1,86 @@
/** 젝스님트 30초 규칙 요약 (docs/07 §5). */
import type { QuickCard } from '../types';
const FILL: Record<number, string> = { 1: '#ffffff', 2: '#cfe6ff', 3: '#fff0a3', 5: '#ffc98f', 7: '#ff9d9d' };
const bulls = (n: number) => (n === 55 ? 7 : n % 11 === 0 ? 5 : n % 10 === 0 ? 3 : n % 5 === 0 ? 2 : 1);
function C({ n, x, y, back, hl }: { n?: number; x: number; y: number; back?: boolean; hl?: string }) {
const b = n ? bulls(n) : 1;
return (
<g transform={`translate(${x} ${y})`}>
<rect width={34} height={46} rx={5} fill={back ? '#2f4f86' : FILL[b]} stroke={hl ?? '#3b3f46'} strokeWidth={hl ? 3 : 1.5} />
{!back && n !== undefined && (
<>
<text x={17} y={12} textAnchor="middle" fontSize={8}>
{b > 1 ? `🐮${b}` : '🐮'}
</text>
<text x={17} y={34} textAnchor="middle" fontSize={16} fontWeight={900} fill="#1c1e21">
{n}
</text>
</>
)}
{back && (
<text x={17} y={29} textAnchor="middle" fontSize={14} fill="#fff">
?
</text>
)}
</g>
);
}
export const quickStart: QuickCard[] = [
{
pic: (
<svg viewBox="0 0 250 130" width={250} height={130} aria-hidden>
{['나', '민수', '지호', '서연'].map((t, i) => (
<g key={t}>
<C x={14 + i * 60} y={14} back />
<text x={31 + i * 60} y={76} textAnchor="middle" fontSize={11} fill="#374151">
{t}
</text>
</g>
))}
<text x={125} y={108} textAnchor="middle" fontSize={14} fontWeight={800} fill="#1d4ed8">
동시에 1장씩 몰래 → 한꺼번에 공개!
</text>
</svg>
),
alt: '네 사람이 뒷면 카드를 한 장씩 내고 한꺼번에 공개',
title: '동시에 1장 내기',
text: '모두 손패에서 한 장을 몰래 골라요. 모두 고르면 한꺼번에 공개돼요.',
},
{
pic: (
<svg viewBox="0 0 250 130" width={250} height={130} aria-hidden>
<text x={6} y={28} fontSize={11} fill="#374151">1줄</text>
<C n={23} x={30} y={8} />
<C n={41} x={68} y={8} />
<text x={6} y={84} fontSize={11} fill="#374151">2줄</text>
<C n={42} x={30} y={64} />
<C n={45} x={68} y={64} hl="#f59e0b" />
<text x={116} y={36} fontSize={12} fill="#b91c1c">41 다음? ✗</text>
<text x={116} y={92} fontSize={12} fontWeight={800} fill="#15803d">42 다음 ✓ (차이 3)</text>
<text x={125} y={124} textAnchor="middle" fontSize={11} fill="#374151">작은 수부터, 끝 카드가 가장 가까운 줄에</text>
</svg>
),
alt: '45는 끝 카드 41이 아니라 더 가까운 42 다음에 붙음',
title: '가장 가까운 줄 끝에',
text: '공개된 카드는 작은 수부터, 끝 카드가 내 카드보다 작고 가장 가까운 줄에 붙어요. 45는 41이 아니라 42 다음!',
},
{
pic: (
<svg viewBox="0 0 250 130" width={250} height={130} aria-hidden>
{[12, 14, 15, 21, 26].map((n, i) => (
<C key={n} n={n} x={6 + i * 38} y={14} />
))}
<C n={30} x={198} y={14} hl="#dc2626" />
<text x={215} y={76} textAnchor="middle" fontSize={11} fontWeight={800} fill="#dc2626">6번째!</text>
<text x={100} y={92} textAnchor="middle" fontSize={14} fontWeight={900} fill="#b91c1c">앞의 5장을 가져가요 +🐮6</text>
<text x={125} y={118} textAnchor="middle" fontSize={11} fill="#374151">소머리 = 벌점, 적은 사람이 이겨요</text>
</svg>
),
alt: '여섯 번째 카드 30을 낸 사람이 앞의 다섯 장(소머리 6개)을 가져감',
title: '6번째면 다섯 장을 가져가요',
text: '내 카드가 줄의 6번째가 되면 앞의 5장을 가져가요(소머리 = 벌점). 모든 줄보다 작으면 줄 하나를 골라 가져가요.',
},
];

View File

@@ -33,6 +33,7 @@ export const GAME_ICON: Record<string, string> = {
liar: '🤥',
'magical-athlete': '🏃',
blackjack: '🂡',
'six-nimmt': '🐮',
};
/** Shown on the home screen so users know what's coming (docs/12-roadmap.md). */
@@ -41,6 +42,6 @@ export const UPCOMING: string[] = [];
/** Tabs on the game picker (docs/07 §3.3). Games not listed here only show under 전체. */
export const GAME_GROUPS: { key: string; label: string; ids: string[] }[] = [
{ key: 'board', label: '판·주사위', ids: ['omok', 'connect-four', 'othello', 'chess', 'janggi', 'baduk', 'quoridor', 'yut', 'marble', 'yacht', 'las-vegas', 'magical-athlete', 'clue'] },
{ key: 'cards', label: '카드·패', ids: ['seotda', 'poker', 'blackjack', 'one-card', 'uno', 'gostop', 'dalmuti', 'splendor', 'cockroach-poker', 'ninety-nine', 'old-maid', 'mahjong', 'rummikub', 'davinci-code'] },
{ key: 'cards', label: '카드·패', ids: ['seotda', 'poker', 'blackjack', 'one-card', 'uno', 'gostop', 'dalmuti', 'splendor', 'cockroach-poker', 'ninety-nine', 'old-maid', 'mahjong', 'rummikub', 'davinci-code', 'six-nimmt'] },
{ key: 'party', label: '여럿이 파티', ids: ['bang', 'halli-galli', 'dobble', 'catchmind', 'mafia', 'liar', 'apple'] },
];