Files
joke-app/apps/web/src/games/magical-athlete/quick.tsx
EJClaw 71381087cc 야단법석 달리기(Magical Athlete): 규칙·컴퓨터 상대·화면·도움말·문서·E2E
- 규칙 모듈 packages/games/src/magical-athlete: 선수 24명(능력 처리 순서가 하나로 정해지는 선수만),
  뱀 순서 뽑기(2~3명은 선수 8명·경주마다 둘, 4~6명은 4명·하나), 몰래 동시에 출전 선수 고르기,
  경주 4번(순한 판·거친 판 번갈아, 거친 판은 화살표·돌·별 칸), 1등 3점·2등 1점(갈수록 커지는 점수표 옵션).
  능력 처리 순서 고정: 칸 효과 → 차례인 사람 → 시계 방향, 연쇄는 줄 끝, 선수당 한 차례 5번, 두 번째 도착 즉시 종료,
  경주 차례 상한. 시간 초과는 안전한 기본값(능력 안 씀), 나간 사람 선수는 자동으로 끝까지.
- 컴퓨터: 평가값 뽑기, 칸 수 기대 이득으로 능력 판단, 레벨별 실수.
- 화면: 뱀 모양 경주로 SVG(PC 11칸·휴대폰 8칸 줄), 말 이동 애니메이션, 능력 버튼, 경주 기록, 결과 표,
  도움말·30초 요약. 판이 화면보다 길면 위에서 시작(가운데 정렬이면 위가 잘려 고르기 카드를 못 누름).
- 등록(GAMES, CATALOG, BOT_GAMES, BOT_STRATEGIES, 화면 레지스트리, 아이콘·판 탭), 문서 docs/games/magical-athlete.md.
- 테스트: 규칙·능력·순서 42개(문서 예시 포함), 컴퓨터 10개, 도움말 2개, 방 통합 2개(컴퓨터 1·3명과 끝까지),
  E2E(PC 방장 + 휴대폰, 실제 뽑기·고르기·굴리기·능력으로 네 경주 끝까지).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 03:49:48 +09:00

115 lines
4.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 야단법석 달리기 30초 규칙 요약 (docs/07 §5). */
import type { QuickCard } from '../types';
function Card({ x, y, emoji, name, picked = false }: { x: number; y: number; emoji: string; name: string; picked?: boolean }) {
return (
<g transform={`translate(${x} ${y})`}>
<rect width={56} height={74} rx={8} fill={picked ? '#dbeafe' : '#fff'} stroke={picked ? '#2563eb' : '#6b7280'} strokeWidth={picked ? 3.5 : 2} />
<text x={28} y={36} textAnchor="middle" fontSize={26}>
{emoji}
</text>
<text x={28} y={62} textAnchor="middle" fontSize={11} fontWeight={800} fill="#111827">
{name}
</text>
</g>
);
}
function DraftPic() {
return (
<svg viewBox="0 0 260 150" width={250} height={144} aria-hidden>
<Card x={6} y={10} emoji="🐇" name="토끼" />
<Card x={68} y={10} emoji="🦵" name="롱다리" picked />
<Card x={130} y={10} emoji="🍌" name="바나나" />
<Card x={192} y={10} emoji="🐌" name="꼼지락이" />
<text x={130} y={112} textAnchor="middle" fontSize={15} fontWeight={800} fill="#111827">
1→2→3→3→2→1 뱀 순서로 뽑기
</text>
<text x={130} y={136} textAnchor="middle" fontSize={13} fill="#374151">
각자 4명, 경주마다 몰래 1명 출전
</text>
</svg>
);
}
function RacePic() {
const cells = Array.from({ length: 7 }, (_, i) => i);
return (
<svg viewBox="0 0 260 150" width={250} height={144} aria-hidden>
{cells.map((i) => (
<rect key={i} x={6 + i * 36} y={46} width={32} height={32} rx={6} fill={i === 6 ? '#fde68a' : '#f3f4f6'} stroke="#6b7280" strokeWidth={1.5} />
))}
<text x={240} y={68} textAnchor="middle" fontSize={16}>
🏁
</text>
<circle cx={22} cy={62} r={13} fill="#e5484d" stroke="#1f2937" strokeWidth={2} />
<text x={22} y={68} textAnchor="middle" fontSize={15}>
🐇
</text>
<path d="M30 40 Q 92 0 154 40" fill="none" stroke="#2563eb" strokeWidth={3} strokeDasharray="5 4" />
<circle cx={130} cy={62} r={13} fill="#2f7cf6" stroke="#1f2937" strokeWidth={2} />
<text x={130} y={68} textAnchor="middle" fontSize={15}>
🍌
</text>
<rect x={14} y={92} width={36} height={36} rx={8} fill="#fffdf8" stroke="#1f2937" strokeWidth={3} />
{[[24, 102], [40, 118], [32, 110], [24, 118], [40, 102]].map(([cx, cy], i) => (
<circle key={i} cx={cx} cy={cy} r={3.5} fill="#1f2937" />
))}
<text x={62} y={108} fontSize={13} fontWeight={800} fill="#111827">
5 굴려 앞으로!
</text>
<text x={62} y={128} fontSize={13} fontWeight={800} fill="#b45309">
✨ 바나나를 지나면 넘어져요
</text>
</svg>
);
}
function MedalPic() {
return (
<svg viewBox="0 0 260 150" width={250} height={144} aria-hidden>
<rect x={30} y={70} width={60} height={50} fill="#e5e7eb" stroke="#6b7280" />
<rect x={100} y={40} width={60} height={80} fill="#fde68a" stroke="#b45309" />
<text x={130} y={34} textAnchor="middle" fontSize={26}>
🥇
</text>
<text x={60} y={64} textAnchor="middle" fontSize={24}>
🥈
</text>
<text x={130} y={88} textAnchor="middle" fontSize={18} fontWeight={900} fill="#78350f">
3점
</text>
<text x={60} y={102} textAnchor="middle" fontSize={16} fontWeight={900} fill="#374151">
1점
</text>
<text x={210} y={92} textAnchor="middle" fontSize={15} fontWeight={800} fill="#111827">
× 경주 4번
</text>
<text x={130} y={142} textAnchor="middle" fontSize={13} fill="#374151">
2등이 들어오면 바로 경주 끝
</text>
</svg>
);
}
export const quickStart: QuickCard[] = [
{
pic: <DraftPic />,
alt: '토끼, 롱다리, 바나나, 꼼지락이 선수 카드 중 롱다리를 뽑아요',
title: '능력 선수 뽑기',
text: '펼쳐진 선수를 뱀 순서로 한 명씩 뽑아 각자 4명을 모아요. 경주마다 그중 한 명을 몰래 골라 내보내요.',
},
{
pic: <RacePic />,
alt: '주사위 5가 나와 토끼가 바나나를 지나쳐 앞으로 가요',
title: '굴리고 달리기',
text: '내 차례에 주사위를 굴려 그만큼 가요. 선수마다 능력이 있어서 밀고, 끌고, 넘어뜨리며 순위가 뒤집혀요.',
},
{
pic: <MedalPic />,
alt: '1등 금메달 3점, 2등 은메달 1점, 경주 4번',
title: '1·2등만 점수',
text: '두 번째 선수가 결승선을 넘으면 경주가 끝나요. 1등 3점, 2등 1점. 네 경주 합계가 가장 많으면 이겨요.',
},
];