56 lines
3.0 KiB
TypeScript
56 lines
3.0 KiB
TypeScript
/** 바둑 30초 규칙 요약 (docs/07 §5). */
|
|
import type { QuickCard } from '../types';
|
|
|
|
type St = [number, number, 'b' | 'w'];
|
|
|
|
function MiniBoard({ stones, terr = [], marks = [] }: { stones: St[]; terr?: [number, number, 'b' | 'w'][]; marks?: [number, number][] }) {
|
|
const n = 7;
|
|
return (
|
|
<svg viewBox="-0.7 -0.7 7.4 7.4" width={170} height={170} aria-hidden>
|
|
<rect x={-0.7} y={-0.7} width={7.4} height={7.4} rx={0.4} fill="#e9c27a" />
|
|
{Array.from({ length: n }, (_, i) => (
|
|
<g key={i} stroke="#7a5a2a" strokeWidth={0.05}>
|
|
<line x1={0} y1={i} x2={n - 1} y2={i} />
|
|
<line x1={i} y1={0} x2={i} y2={n - 1} />
|
|
</g>
|
|
))}
|
|
{terr.map(([x, y, c]) => (
|
|
<rect key={`t${x}-${y}`} x={x - 0.17} y={y - 0.17} width={0.34} height={0.34} fill={c === 'b' ? '#111' : '#fafafa'} stroke={c === 'b' ? '#000' : '#555'} strokeWidth={0.03} />
|
|
))}
|
|
{stones.map(([x, y, c]) => (
|
|
<circle key={`${x}-${y}`} cx={x} cy={y} r={0.44} fill={c === 'b' ? '#151515' : '#fbfbf8'} stroke={c === 'b' ? '#000' : '#666'} strokeWidth={0.06} />
|
|
))}
|
|
{marks.map(([x, y]) => (
|
|
<circle key={`m${x}-${y}`} cx={x} cy={y} r={0.2} fill="none" stroke="#dc2626" strokeWidth={0.08} />
|
|
))}
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
/** Left part black, right part white, each surrounding empty points (small squares = territory). */
|
|
const wallB: St[] = [0, 1, 2, 3, 4, 5, 6].map((y) => [2, y, 'b'] as St);
|
|
const wallW: St[] = [0, 1, 2, 3, 4, 5, 6].map((y) => [4, y, 'w'] as St);
|
|
const terrB: [number, number, 'b'][] = [0, 1].flatMap((x) => [0, 1, 2, 3, 4, 5, 6].map((y) => [x, y, 'b'] as [number, number, 'b']));
|
|
const terrW: [number, number, 'w'][] = [5, 6].flatMap((x) => [0, 1, 2, 3, 4, 5, 6].map((y) => [x, y, 'w'] as [number, number, 'w']));
|
|
|
|
export const quickStart: QuickCard[] = [
|
|
{
|
|
pic: <MiniBoard stones={[[2, 2, 'b'], [4, 2, 'w'], [2, 4, 'b'], [4, 4, 'w'], [3, 3, 'b']]} />,
|
|
alt: '바둑판의 선이 만나는 점 위에 검은 돌과 흰 돌이 놓여 있어요',
|
|
title: '번갈아 한 수씩 둬요',
|
|
text: '보통 흑이 먼저 시작해요. 내 차례에 선이 만나는 빈 점을 누르면 돌이 놓여요. 놓은 돌은 옮기지 않아요.',
|
|
},
|
|
{
|
|
pic: <MiniBoard stones={[[3, 2, 'b'], [2, 3, 'b'], [4, 3, 'b'], [3, 4, 'b'], [3, 3, 'w']]} marks={[[3, 3]]} />,
|
|
alt: '흰 돌 하나를 검은 돌 네 개가 위아래 양옆에서 둘러싸고 있어요',
|
|
title: '둘러싸면 따내요',
|
|
text: '상대 돌의 위·아래·양옆 빈 곳(활로)을 모두 막으면 그 돌을 판에서 들어내요. 이걸 따낸다고 해요.',
|
|
},
|
|
{
|
|
pic: <MiniBoard stones={[...wallB, ...wallW]} terr={[...terrB, ...terrW]} />,
|
|
alt: '검은 돌과 흰 돌이 각자 판의 한쪽을 울타리처럼 둘러싸고 빈 곳에 작은 네모가 있어요',
|
|
title: '집이 많으면 이겨요',
|
|
text: '둘 다 연달아 [✋ 패스]하면 끝나요. 내 돌로 둘러싼 빈 곳(집)이 더 많은 쪽이 이겨요. 처음이면 9줄 판을 추천해요.',
|
|
},
|
|
];
|