증강 윷놀이: 증강 아이콘 101개, 사이트 추가 증강 20개 더(모두 30개), 추가 증강 기본 꺼짐
- 증강마다 48×48 SVG 아이콘(aug-icons/): 타일 색 = 종류(규칙·즉시·사용·승리 조건), 그림 = 증강. 선택 카드·사람 카드 칩·쓰기 버튼·승리 팝업·방 설정 목록·규칙 보기에 표시. 고양이가 된 증강은 회색 고양이. 모아 보기: apps/web/scripts/aug-icon-sheet.tsx - 새 증강 20개: 다시 던지기, 곱빼기, 올인, 저주 인형, 얼음!, 자석, 뒤로 돌아, 꼴찌의 반란, 텃세, 따라쟁이, 청개구리, 사냥꾼, 줍줍, 도장 깨기, 스타트 대시, 방공호, 벼락, 블랙홀, 로켓 발사, 최후의 일격 (규칙·컴퓨터·테스트·문서) - augOff 기본값 = 이 사이트 추가 증강 30개(방에서 [추가 증강 켜기]로 켬) - 카니발리즘: 내 말 잡기를 '잡기'로 세지 않음(ownCaptures) → 개돼지와 함께일 때 컴퓨터·시간 초과가 자기 말을 잡고 다시 던지기를 끝없이 반복하던 문제 수정 - 방 설정 탭이 방 정보 갱신으로 다시 그려질 때 [윷놀이 설정]으로 되돌아가던 문제 수정 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,8 @@ const VALUE: Partial<Record<AugId, number>> = {
|
||||
domain: 4, getoff: 4, moordo: 4, leech: 4, illusion: 4, alkkagi: 4, four: 4, mine: 4, teleport: 4, cannibal: 3, alone: 3,
|
||||
nofriends: 3, plan: 3, necro: 3, cancel: 3, whoami: 3, roulette: 3, fold: 3, excess: 3, dual: 3, fog: 3, sniper: 3, ox: 3,
|
||||
detective: 3, delivery: 3, storm: 3, sacrifice: 3, moonwalk: 3, lastdance: 1, chosen: 2, objection: 2, timetravel: 2, cat: 1,
|
||||
rocket: 7, finisher: 7, hunter: 6, reroll: 6, double: 6, magnet: 5, curse: 5, freeze: 5, pushback: 5, underdog: 5, bunker: 5,
|
||||
dash: 5, pickup: 5, frog: 5, copycat: 5, homeground: 4, lightning: 4, blackhole: 4, stamp: 4, gamble: 3,
|
||||
};
|
||||
|
||||
type A = YutAction;
|
||||
@@ -62,7 +64,8 @@ export function augBotAction(view: YutView, legal: A[], random: () => number): A
|
||||
return { type: 'AUG_ANSWER', choice: order } as A;
|
||||
}
|
||||
case 'illusion':
|
||||
case 'thief': {
|
||||
case 'thief':
|
||||
case 'copycat': {
|
||||
const opts = pr.choices ?? [];
|
||||
const val = (label: string) => {
|
||||
const name = label.split(' · ')[1] ?? '';
|
||||
@@ -145,6 +148,31 @@ export function augBotAction(view: YutView, legal: A[], random: () => number): A
|
||||
case 'domain':
|
||||
consider(u, random() < 0.2 ? 3 : 0);
|
||||
break;
|
||||
case 'magnet':
|
||||
consider(u, (o?.kills ?? 0) > 0 ? 7 + (o?.kills ?? 0) : 0);
|
||||
break;
|
||||
case 'rocket':
|
||||
consider(u, (o?.label ?? '').startsWith('대기') ? 4 : 6 + (o?.kills ?? 0));
|
||||
break;
|
||||
case 'curse':
|
||||
consider(u, u.target === leaderSide ? 5 : 0);
|
||||
break;
|
||||
case 'freeze':
|
||||
case 'pushback': {
|
||||
if (u.target !== leaderSide || u.node === undefined) break;
|
||||
// the leader's stack nearest the finish
|
||||
consider(u, remainingDistance(u.node as NodeId, view.options.finishRule) <= 8 ? 5 + (o?.kills ?? 0) : 0);
|
||||
break;
|
||||
}
|
||||
case 'double':
|
||||
consider(u, u.result === 'mo' || u.result === 'yut' ? 6 : 0);
|
||||
break;
|
||||
case 'reroll':
|
||||
consider(u, u.result === 'backdo' || u.result === 'do' ? 4 : 0);
|
||||
break;
|
||||
case 'gamble':
|
||||
consider(u, random() < 0.15 ? 2 : 0);
|
||||
break;
|
||||
case 'swap': {
|
||||
if (o?.at === undefined || o.at === 'home' || u.node === undefined) break;
|
||||
const gain = remainingDistance(o.at, view.options.finishRule) - remainingDistance(u.node as NodeId, view.options.finishRule);
|
||||
|
||||
@@ -99,11 +99,11 @@ describe('증강 윷놀이: options and selection', () => {
|
||||
|
||||
test('명탐정 voids the same augment picked by someone else in that selection', () => {
|
||||
const s = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true }), rng: SeededRng.fromSeed(seedN(2)), now: 0 });
|
||||
s.aug!.select!.offers = { '0': ['detective', 'cat', 'fog'], '1': ['tiger', 'cat', 'fog'] };
|
||||
let t = act(s, 'A', { type: 'AUG_PICK', aug: 'detective', target: 'tiger' });
|
||||
s.aug!.select!.offers = { '0': ['detective', 'cat', 'fog'], '1': ['shield', 'cat', 'fog'] };
|
||||
let t = act(s, 'A', { type: 'AUG_PICK', aug: 'detective', target: 'shield' });
|
||||
expect(yut.validate(t, 'B', { type: 'AUG_PICK', aug: 'detective' }).ok).toBe(false);
|
||||
t = act(t, 'B', { type: 'AUG_PICK', aug: 'tiger' });
|
||||
expect(t.aug!.sides[1]!.augs[0]).toMatchObject({ id: 'tiger', voided: true });
|
||||
t = act(t, 'B', { type: 'AUG_PICK', aug: 'shield' });
|
||||
expect(t.aug!.sides[1]!.augs[0]).toMatchObject({ id: 'shield', voided: true });
|
||||
expect(yut.view(t, 'A').aug!.sides[1]!.augs[0]!.voided).toBe(true);
|
||||
});
|
||||
|
||||
@@ -292,6 +292,20 @@ describe('증강 윷놀이: moves and catches', () => {
|
||||
expect(t.phase).toBe('throw');
|
||||
});
|
||||
|
||||
test('카니발리즘 + 개돼지: own catches are not counted as catches, so the computer does not loop on them', () => {
|
||||
const s = yut.setup({ players: ['bot', 'H'], options: yut.optionsSchema.parse({ augmented: true }), rng: SeededRng.fromSeed(seedN(3)), now: 0 });
|
||||
Object.assign(s.aug!, { select: null, selNo: 1, pendingBegin: false, firstSide: 0 });
|
||||
Object.assign(s, { turnSide: 0, current: 'bot', phase: 'move', throwsOwed: 0, pending: ['gae'] });
|
||||
give(s, 0, 'cannibal');
|
||||
give(s, 0, 'doggy');
|
||||
put(s, 0, 0, 2);
|
||||
const enter = yut.view(s, 'bot').legalMoves!.find((m) => m.from === 'home')!;
|
||||
expect(enter).toMatchObject({ captures: 0, ownCaptures: 1 });
|
||||
expect(decideBotAction(yut, s, 'bot', { now: 1, random: () => 0.5 })).toMatchObject({ type: 'MOVE', from: 2 });
|
||||
const t = yut.apply(s, 'bot', yut.onTimeout(s, 'bot'), { rng: SeededRng.fromSeed(seedN(5)), now: 1000 }).state;
|
||||
expect(nodesOf(t, 0)[0]).toBe(4); // the timeout moves the board piece instead of eating it
|
||||
});
|
||||
|
||||
test('히히 똥!: other pieces stop on the poop', () => {
|
||||
const s = make();
|
||||
s.aug!.objs.push({ kind: 'poop', node: 2, owner: 1 });
|
||||
@@ -689,6 +703,238 @@ describe('증강 윷놀이: review regressions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- this site's second batch
|
||||
|
||||
describe('증강 윷놀이: 이 사이트 추가 증강', () => {
|
||||
test('this site’s augments start switched off; the room can switch them on', () => {
|
||||
const custom = AUG_IDS.filter((id) => AUGS[id].custom);
|
||||
expect(custom).toHaveLength(30);
|
||||
expect(yut.defaultOptions.augOff).toEqual(custom);
|
||||
const seen = new Set<AugId>();
|
||||
for (let i = 0; i < 30; i++) {
|
||||
const s = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true }), rng: SeededRng.fromSeed(seedN(70 + i)), now: 0 });
|
||||
for (const k of ['0', '1']) for (const id of s.aug!.select!.offers[k]!) expect(AUGS[id].custom).toBeUndefined();
|
||||
const on = yut.setup({ players: ['A', 'B'], options: yut.optionsSchema.parse({ augmented: true, augOff: [] }), rng: SeededRng.fromSeed(seedN(70 + i)), now: 0 });
|
||||
for (const k of ['0', '1']) for (const id of on.aug!.select!.offers[k]!) seen.add(id);
|
||||
}
|
||||
expect([...seen].some((id) => AUGS[id].custom)).toBe(true);
|
||||
});
|
||||
|
||||
test('다시 던지기 drops one result and throws again, once a turn', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'reroll');
|
||||
moving(s, ['do']);
|
||||
let t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'reroll'), result: 'do' });
|
||||
expect(t.pending).toEqual([]);
|
||||
expect(t.phase).toBe('throw');
|
||||
t = act(t, 'A', { type: 'THROW' }, script('gae'));
|
||||
expect(t.pending).toEqual(['gae']);
|
||||
expect(yut.view(t, 'A').aug!.uses.some((u) => u.id === 'reroll')).toBe(false);
|
||||
});
|
||||
|
||||
test('곱빼기 copies a result once', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'double');
|
||||
moving(s, ['yut', 'do']);
|
||||
const t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'double'), result: 'yut' });
|
||||
expect(t.pending).toEqual(['yut', 'do', 'yut']);
|
||||
expect(yut.view(t, 'A').aug!.uses.some((u) => u.id === 'double')).toBe(false);
|
||||
});
|
||||
|
||||
test('올인: three more throws, or the results are gone and the turn ends', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'gamble');
|
||||
const win = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'gamble') }, new Script([0.1]));
|
||||
expect(win.throwsOwed).toBe(4);
|
||||
const u = make();
|
||||
give(u, 0, 'gamble');
|
||||
moving(u, ['mo']);
|
||||
const t = act(u, 'A', { type: 'AUG_USE', uid: uidOf(u, 0, 'gamble') }, new Script([0.9]));
|
||||
expect(t.pending).toEqual([]);
|
||||
expect(t.current).toBe('B');
|
||||
});
|
||||
|
||||
test('저주 인형: the cursed player throws only 도 for one turn', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'curse');
|
||||
let t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'curse'), target: 1 });
|
||||
expect(yut.view(t, 'A').aug!.sides[1]!.cursed).toBe(true);
|
||||
t = act(t, 'A', { type: 'THROW' }, script('gae'));
|
||||
t = act(t, 'A', { type: 'MOVE', throwIndex: 0, from: 'home' });
|
||||
expect(t.current).toBe('B');
|
||||
t = act(t, 'B', { type: 'THROW' }, new Script([]));
|
||||
expect(t.lastThrow).toMatchObject({ result: 'do', note: '저주 인형' });
|
||||
t = act(t, 'B', { type: 'MOVE', throwIndex: 0, from: 'home' });
|
||||
expect(t.aug!.sides[1]!.curse).toBeUndefined();
|
||||
});
|
||||
|
||||
test('얼음! freezes one enemy stack for two rounds', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'freeze');
|
||||
put(s, 1, 0, 9);
|
||||
const t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'freeze'), target: 1, node: 9 });
|
||||
expect(t.sides[1]!.pieces[0]!.frozenUntil).toBe(t.aug!.round + 2);
|
||||
expect(yut.view(t, 'B').stacks.find((st) => st.side === 1)).toMatchObject({ node: 9, frozen: true });
|
||||
});
|
||||
|
||||
test('자석 catches the enemy pieces next to my stack', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'magnet');
|
||||
put(s, 0, 0, 7);
|
||||
put(s, 1, 0, 6);
|
||||
put(s, 1, 1, 8);
|
||||
put(s, 1, 2, 12);
|
||||
const v = yut.view(s, 'A').aug!.uses.find((u) => u.id === 'magnet')!;
|
||||
expect(v.kills).toBe(2);
|
||||
const t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'magnet'), piece: 0 });
|
||||
expect(nodesOf(t, 1).slice(0, 3)).toEqual(['home', 'home', 12]);
|
||||
});
|
||||
|
||||
test('뒤로 돌아 pushes a stack 3 back (catching where it lands), never past 참먹이', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'pushback');
|
||||
put(s, 1, 0, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||
put(s, 1, 1, 2, [1, 2]);
|
||||
put(s, 0, 0, 6);
|
||||
const opts = yut.view(s, 'A').aug!.uses.filter((u) => u.id === 'pushback');
|
||||
expect(opts.map((u) => u.action.node)).toEqual([9]);
|
||||
const t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'pushback'), target: 1, node: 9 });
|
||||
expect(nodesOf(t, 1)[0]).toBe(6);
|
||||
expect(nodesOf(t, 0)[0]).toBe('home');
|
||||
});
|
||||
|
||||
test('로켓 발사 sends a stack (or a waiting piece) to 날윷, catching there', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'rocket');
|
||||
put(s, 0, 0, 3);
|
||||
put(s, 1, 0, 19);
|
||||
expect(yut.view(s, 'A').aug!.uses.filter((u) => u.id === 'rocket')).toHaveLength(2);
|
||||
const t = act(s, 'A', { type: 'AUG_USE', uid: uidOf(s, 0, 'rocket'), piece: 0 });
|
||||
expect(nodesOf(t, 0)[0]).toBe(19);
|
||||
expect(nodesOf(t, 1)[0]).toBe('home');
|
||||
});
|
||||
|
||||
test('꼴찌의 반란: one more throw when my turn starts and I am last', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'underdog');
|
||||
s.sides[1]!.pieces[3]!.status = 'done';
|
||||
Object.assign(s, { turnSide: 1, current: 'B' });
|
||||
let t = act(s, 'B', { type: 'THROW' }, script('do'));
|
||||
t = act(t, 'B', { type: 'MOVE', throwIndex: 0, from: 'home' });
|
||||
expect(t.current).toBe('A');
|
||||
expect(t.throwsOwed).toBe(2);
|
||||
});
|
||||
|
||||
test('텃세: my pieces just before 참먹이 cannot be caught', () => {
|
||||
const s = make();
|
||||
give(s, 1, 'homeground');
|
||||
put(s, 1, 0, 18);
|
||||
put(s, 0, 0, 16);
|
||||
moving(s, ['gae']);
|
||||
expect(yut.view(s, 'A').legalMoves!.find((m) => m.from === 16)!.captures).toBe(0);
|
||||
const t = act(s, 'A', { type: 'MOVE', throwIndex: 0, from: 16 });
|
||||
expect(nodesOf(t, 1)[0]).toBe(18);
|
||||
expect(nodesOf(t, 0)[0]).toBe(18);
|
||||
});
|
||||
|
||||
test('따라쟁이 copies another player’s augment', () => {
|
||||
const s = make();
|
||||
give(s, 1, 'excess');
|
||||
give(s, 0, 'copycat');
|
||||
expect(s.phase).toBe('prompt');
|
||||
const t = act(s, 'A', { type: 'AUG_ANSWER', choice: uidOf(s, 1, 'excess') });
|
||||
expect(yut.view(t, 'A').aug!.sides.map((x) => x.sticks)).toEqual([6, 6]);
|
||||
});
|
||||
|
||||
test('청개구리: my 빽도 is a 모 without the extra throw', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'frog');
|
||||
const t = act(s, 'A', { type: 'THROW' }, script('backdo'));
|
||||
expect(t.pending).toEqual(['mo']);
|
||||
expect(t.phase).toBe('move');
|
||||
});
|
||||
|
||||
test('사냥꾼: a catch gives two more throws', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'hunter');
|
||||
put(s, 0, 0, 1);
|
||||
put(s, 1, 0, 3);
|
||||
moving(s, ['gae']);
|
||||
const t = act(s, 'A', { type: 'MOVE', throwIndex: 0, from: 1 });
|
||||
expect(t.throwsOwed).toBe(2);
|
||||
});
|
||||
|
||||
test('줍줍 picks up my pieces on the way', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'pickup');
|
||||
put(s, 0, 0, 2);
|
||||
put(s, 0, 1, 4, [1, 2, 3, 4]);
|
||||
moving(s, ['yut']);
|
||||
expect(yut.view(s, 'A').legalMoves!.find((m) => m.from === 2)!.count).toBe(2);
|
||||
const t = act(s, 'A', { type: 'MOVE', throwIndex: 0, from: 2 });
|
||||
expect(nodesOf(t, 0).slice(0, 2)).toEqual([6, 6]);
|
||||
});
|
||||
|
||||
test('도장 깨기 wins after stopping on 모, 뒷모, 찌모 and 방', () => {
|
||||
const s = make();
|
||||
give(s, 0, 'stamp');
|
||||
s.aug!.sides[0]!.augs[0]!.list = [5, 10, 15];
|
||||
put(s, 0, 0, 21, [1, 2, 3, 4, 5, 20, 21]);
|
||||
moving(s, ['do']);
|
||||
const t = act(s, 'A', { type: 'MOVE', throwIndex: 0, from: 21 });
|
||||
expect(t.sides[0]!.finishedRank).toBe(1);
|
||||
expect(t.phase).toBe('finished');
|
||||
});
|
||||
|
||||
test('스타트 대시 and 방공호 at the start', () => {
|
||||
const s = make();
|
||||
put(s, 1, 0, 3);
|
||||
give(s, 0, 'dash');
|
||||
expect(nodesOf(s, 0)[0]).toBe(3);
|
||||
expect(s.sides[0]!.pieces[0]!.trail).toEqual([1, 2, 3]);
|
||||
expect(nodesOf(s, 1)[0]).toBe('home');
|
||||
give(s, 1, 'bunker');
|
||||
expect(s.sides[1]!.pieces.every((p) => p.shield)).toBe(true);
|
||||
put(s, 1, 0, 4);
|
||||
moving(s, ['do']);
|
||||
const t = act(s, 'A', { type: 'MOVE', throwIndex: 0, from: 3 });
|
||||
expect(nodesOf(t, 1)[0]).toBe(4); // the shield held
|
||||
expect(t.sides[1]!.pieces[0]!.shield).toBeUndefined();
|
||||
});
|
||||
|
||||
test('벼락 hits two random stacks', () => {
|
||||
const s = make();
|
||||
put(s, 0, 0, 5);
|
||||
put(s, 1, 0, 9);
|
||||
put(s, 1, 1, 12);
|
||||
give(s, 0, 'lightning');
|
||||
const left = s.sides.flatMap((x) => x.pieces).filter((p) => p.status === 'board').length;
|
||||
expect(left).toBe(1);
|
||||
});
|
||||
|
||||
test('블랙홀: 방 swallows what is there and every other piece that stops on it', () => {
|
||||
const s = make();
|
||||
put(s, 1, 0, 22);
|
||||
give(s, 0, 'blackhole');
|
||||
expect(nodesOf(s, 1)[0]).toBe('home');
|
||||
expect(s.aug!.objs).toContainEqual({ kind: 'hole', node: 22, owner: 0 });
|
||||
put(s, 1, 1, 21, [5, 20, 21]);
|
||||
Object.assign(s, { turnSide: 1, current: 'B' });
|
||||
moving(s, ['do']);
|
||||
const t = act(s, 'B', { type: 'MOVE', throwIndex: 0, from: 21 });
|
||||
expect(nodesOf(t, 1)[1]).toBe('home');
|
||||
});
|
||||
|
||||
test('최후의 일격 catches the furthest enemy stack', () => {
|
||||
const s = make(3);
|
||||
put(s, 1, 0, 3);
|
||||
put(s, 2, 0, 18);
|
||||
give(s, 0, 'finisher');
|
||||
expect(nodesOf(s, 1)[0]).toBe(3);
|
||||
expect(nodesOf(s, 2)[0]).toBe('home');
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- winning & going out
|
||||
|
||||
describe('증강 윷놀이: special wins and ranks', () => {
|
||||
@@ -802,6 +1048,7 @@ describe('증강 윷놀이: whole games', () => {
|
||||
const players = PLAYERS.slice(0, n);
|
||||
const options = yut.optionsSchema.parse({
|
||||
augmented: true,
|
||||
augOff: [],
|
||||
augRounds: (['standard', 'quick', 'many'] as const)[i % 3],
|
||||
augChaos: i % 4 === 0,
|
||||
augOffers: 4,
|
||||
@@ -832,7 +1079,7 @@ describe('증강 윷놀이: whole games', () => {
|
||||
for (let g = 0; g < playoutSeeds(30); g++) {
|
||||
const n = 2 + (g % 3);
|
||||
const players = ['bot1', 'bot2', 'bot3', 'H'].slice(0, n);
|
||||
const r = botPlayout(yut, { players, options: yut.optionsSchema.parse({ augmented: true, augChaos: g % 3 === 0 }), seed: seedN(g + 7), isBot: (p) => p.startsWith('bot') });
|
||||
const r = botPlayout(yut, { players, options: yut.optionsSchema.parse({ augmented: true, augOff: [], augChaos: g % 3 === 0 }), seed: seedN(g + 7), isBot: (p) => p.startsWith('bot') });
|
||||
expect(r.finished).toBe(true);
|
||||
expect(r.botTimeouts).toBe(0);
|
||||
}
|
||||
|
||||
@@ -102,16 +102,18 @@ export interface AugSide {
|
||||
bronze?: true;
|
||||
/** Went out by an augment (네크로맨서 can bring it back), not by conceding. */
|
||||
outByAug?: true;
|
||||
/** 저주 인형: every throw of this side's next turn is a 도. */
|
||||
curse?: true;
|
||||
}
|
||||
|
||||
export type AugObjKind = 'skull' | 'hat' | 'gift' | 'poop' | 'garlic' | 'mark' | 'mine';
|
||||
export type AugObjKind = 'skull' | 'hat' | 'gift' | 'poop' | 'garlic' | 'mark' | 'mine' | 'hole';
|
||||
export interface AugObj {
|
||||
kind: AugObjKind;
|
||||
node: NodeId;
|
||||
owner: SideId;
|
||||
}
|
||||
|
||||
export type AugPromptKind = 'leech' | 'fold' | 'whoami' | 'vote' | 'roulette' | 'illusion' | 'plan' | 'duel' | 'thief';
|
||||
export type AugPromptKind = 'leech' | 'fold' | 'whoami' | 'vote' | 'roulette' | 'illusion' | 'plan' | 'duel' | 'thief' | 'copycat';
|
||||
export interface AugPrompt {
|
||||
kind: AugPromptKind;
|
||||
owner: SideId;
|
||||
@@ -213,6 +215,8 @@ export interface AugSideView {
|
||||
links: { to: SideId; by: AugId; on: boolean }[];
|
||||
reason: string | null;
|
||||
bronze: boolean;
|
||||
/** 저주 인형: the next turn throws only 도. */
|
||||
cursed: boolean;
|
||||
/** Waiting special pieces (they enter on their own, see the MOVE `piece` field). */
|
||||
homeSpecial: { piece: number; kind: PieceKind }[];
|
||||
}
|
||||
@@ -400,6 +404,18 @@ const sticksOf = (s: YutState, side: SideId) => A(s).sides[side]!.sticks + (hasA
|
||||
|
||||
const emptyThrown = (): Record<Throw, number> => ({ do: 0, gae: 0, geol: 0, yut: 0, mo: 0, backdo: 0 });
|
||||
|
||||
/** 텃세: the nodes just before 참먹이 (날도~날윷, 사려·안찌), mirrored for 달걸음. */
|
||||
const HOME_STRETCH: readonly NodeId[] = [16, 17, 18, 19, 27, 28];
|
||||
function homeSafe(s: YutState, side: SideId, p: Piece): boolean {
|
||||
if (p.status !== 'board' || !hasAug(s, side, 'homeground')) return false;
|
||||
const n = hasAug(s, side, 'moonwalk') ? MIRROR_DIAG[p.node!]! : p.node!;
|
||||
return HOME_STRETCH.includes(n);
|
||||
}
|
||||
/** The node right before 참먹이 on this side's road (날윷; 도 under 달걸음). */
|
||||
const lastNode = (s: YutState, side: SideId): NodeId => (hasAug(s, side, 'moonwalk') ? MIRROR_DIAG[19]! : 19);
|
||||
/** 도장 깨기 nodes: 모, 뒷모, 찌모, 방. */
|
||||
const STAMP_NODES: readonly NodeId[] = [5, 10, 15, 22];
|
||||
|
||||
// ---------------------------------------------------------------- setup
|
||||
|
||||
export function augSetup(s: YutState, rng: Rng, events: GameEvent[]): void {
|
||||
@@ -522,8 +538,10 @@ interface AugPlan {
|
||||
piece?: number;
|
||||
alt: boolean;
|
||||
apart: boolean;
|
||||
/** Pieces that would actually be caught (enemies, or own under 카니발리즘). */
|
||||
/** Enemy pieces that would actually be caught. */
|
||||
captures: number;
|
||||
/** Own pieces caught there (카니발리즘). */
|
||||
own: number;
|
||||
}
|
||||
|
||||
type MoveSel = Pick<YutMoveAction, 'piece' | 'alt' | 'stack'>;
|
||||
@@ -581,6 +599,13 @@ function planAug(s: YutState, sideId: SideId, throwIndex: number, from: NodeId |
|
||||
}
|
||||
}
|
||||
if (to === GOAL && movers.some((p) => p.kind === 'queen')) return null;
|
||||
// 줍줍: own pieces on the nodes passed on the way join the movers.
|
||||
if (t !== 'backdo' && hasAug(s, sideId, 'pickup') && !hasAug(s, sideId, 'cannibal') && !movers.some(isSpecial)) {
|
||||
const kind = movers[0]!.kind ?? 'n';
|
||||
const passed = new Set(to === GOAL ? path : path.slice(0, -1));
|
||||
for (const p of side.pieces)
|
||||
if (p.status === 'board' && passed.has(p.node!) && !movers.includes(p) && !isSpecial(p) && (p.kind ?? 'n') === kind && !frozen(s, p)) movers.push(p);
|
||||
}
|
||||
const stackWith: number[] = [];
|
||||
if (to !== GOAL && !hasAug(s, sideId, 'cannibal')) {
|
||||
for (const p of side.pieces) {
|
||||
@@ -604,19 +629,17 @@ function planAug(s: YutState, sideId: SideId, throwIndex: number, from: NodeId |
|
||||
alt,
|
||||
apart,
|
||||
captures: to === GOAL ? 0 : previewKills(s, sideId, to, movers.map((p) => p.id), t === 'backdo'),
|
||||
own: to === GOAL || !hasAug(s, sideId, 'cannibal') ? 0 : side.pieces.filter((p) => p.status === 'board' && p.node === to && !movers.includes(p)).length,
|
||||
};
|
||||
}
|
||||
|
||||
/** How many pieces landing on `node` would catch (protections included). */
|
||||
/** How many enemy pieces landing on `node` would catch (protections included). */
|
||||
function previewKills(s: YutState, sideId: SideId, node: NodeId, movers: number[], _backdo: boolean): number {
|
||||
let n = 0;
|
||||
for (const x of s.sides) {
|
||||
const ids = x.pieces.filter((p) => p.status === 'board' && p.node === node && !(x.id === sideId && movers.includes(p.id)));
|
||||
if (x.id === sideId) continue;
|
||||
const ids = x.pieces.filter((p) => p.status === 'board' && p.node === node);
|
||||
if (!ids.length) continue;
|
||||
if (x.id === sideId) {
|
||||
if (hasAug(s, sideId, 'cannibal')) n += ids.length;
|
||||
continue;
|
||||
}
|
||||
n += killableCount(s, sideId, x.id, ids);
|
||||
}
|
||||
return n;
|
||||
@@ -625,6 +648,7 @@ function previewKills(s: YutState, sideId: SideId, node: NodeId, movers: number[
|
||||
function killableCount(s: YutState, killer: SideId | null, victim: SideId, ps: Piece[]): number {
|
||||
if (killer !== null && killer !== victim && (hasAug(s, killer, 'peace') || hasAug(s, victim, 'peace'))) return 0;
|
||||
if (killer !== victim && hasAug(s, victim, 'turtle') && ps.length >= 3) return 0;
|
||||
if (killer !== victim) ps = ps.filter((p) => !homeSafe(s, victim, p));
|
||||
let die = ps.filter((p) => !p.shield).length;
|
||||
if (killer !== victim && hasAug(s, victim, 'friendshield')) die = Math.min(die, 1);
|
||||
return die;
|
||||
@@ -695,6 +719,7 @@ const toLegal = (p: AugPlan): YutLegalMove => ({
|
||||
path: p.path,
|
||||
count: p.movers.length,
|
||||
captures: p.captures,
|
||||
...(p.own ? { ownCaptures: p.own } : {}),
|
||||
stacks: p.stackWith.length > 0,
|
||||
finishes: p.to === GOAL,
|
||||
...(p.piece !== undefined ? { piece: p.piece } : {}),
|
||||
@@ -739,6 +764,8 @@ function killPieces(s: YutState, ctx: Ctx, killer: SideId | null, victim: SideId
|
||||
if (!ps.length) return 0;
|
||||
if (other && (hasAug(s, killer!, 'peace') || hasAug(s, victim, 'peace'))) return 0;
|
||||
if (other && hasAug(s, victim, 'turtle') && ps.length >= 3 && new Set(ps.map((p) => p.node)).size === 1) return 0;
|
||||
if (killer !== victim) ps = ps.filter((p) => !homeSafe(s, victim, p));
|
||||
if (!ps.length) return 0;
|
||||
let die: Piece[] = [];
|
||||
for (const p of ps) {
|
||||
if (p.shield) {
|
||||
@@ -974,6 +1001,7 @@ function checkWins(s: YutState, ctx: Ctx): void {
|
||||
else if (has('summon') && a.sides[id]!.ritual >= 12) by = 'summon';
|
||||
else if (has('bear') && a.sides[id]!.garlic >= 3) by = 'bear';
|
||||
else if (has('queen') && (has('queen')!.n ?? 0) >= 12) by = 'queen';
|
||||
else if ((has('stamp')?.list?.length ?? 0) >= STAMP_NODES.length) by = 'stamp';
|
||||
else if (has('nofriends')) {
|
||||
const others = s.sides.filter((y) => y.id !== id && sideActive(y)).map((y) => y.id);
|
||||
if (others.length && others.every((o) => has('nofriends')!.list?.includes(o))) by = 'nofriends';
|
||||
@@ -1115,6 +1143,10 @@ function beginTurn(s: YutState, ctx: Ctx): void {
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'revenge', text: `복수의 칼날: ${as.bonus}번 더 던져요` });
|
||||
as.bonus = 0;
|
||||
}
|
||||
if (hasAug(s, id, 'underdog') && isLast(s, id)) {
|
||||
s.throwsOwed += 1;
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'underdog', text: '꼴찌의 반란: 한 번 더 던져요' });
|
||||
}
|
||||
checkWins(s, ctx);
|
||||
if (phaseOf(s) === 'finished') return;
|
||||
if (!sideActive(x)) {
|
||||
@@ -1128,10 +1160,18 @@ function beginTurn(s: YutState, ctx: Ctx): void {
|
||||
}
|
||||
}
|
||||
|
||||
/** 꼴찌의 반란: `side` alone has the fewest pieces home (ties: the longest way to go) among the sides still playing. */
|
||||
function isLast(s: YutState, side: SideId): boolean {
|
||||
const me = s.sides[side]!;
|
||||
const others = liveSides(s).filter((y) => y.id !== side);
|
||||
return others.length > 0 && others.every((y) => doneCount(y) > doneCount(me) || (doneCount(y) === doneCount(me) && sideDist(s, y) < sideDist(s, me)));
|
||||
}
|
||||
|
||||
/** The side to move is done: end-of-turn effects, then the next turn. */
|
||||
function endTurnAug(s: YutState, ctx: Ctx): void {
|
||||
const a = A(s);
|
||||
const id = s.turnSide;
|
||||
if (a.sides[id]!.curse && a.turnThrows > 0) delete a.sides[id]!.curse;
|
||||
if (a.lastDance) {
|
||||
a.lastDance = false;
|
||||
if (sideActive(s.sides[id]!)) eliminate(s, ctx, id, '라스트 댄스', 'lastdance');
|
||||
@@ -1206,6 +1246,7 @@ function eligible(s: YutState, side: SideId, id: AugId, tier: Exclude<AugTier, '
|
||||
return total >= 4;
|
||||
case 'score':
|
||||
case 'ox':
|
||||
case 'frog':
|
||||
return o.backdo;
|
||||
case 'bronze':
|
||||
return live >= 3 && !usedRanks(s).has(3) && freeRank(s) <= 3;
|
||||
@@ -1216,6 +1257,12 @@ function eligible(s: YutState, side: SideId, id: AugId, tier: Exclude<AugTier, '
|
||||
case 'whoami':
|
||||
case 'notme':
|
||||
case 'duel':
|
||||
case 'curse':
|
||||
case 'freeze':
|
||||
case 'pushback':
|
||||
case 'finisher':
|
||||
case 'copycat':
|
||||
case 'underdog':
|
||||
return live >= 2;
|
||||
}
|
||||
return true;
|
||||
@@ -1556,9 +1603,57 @@ function acquire(s: YutState, ctx: Ctx, side: SideId, id: AugId, target?: AugId)
|
||||
case 'thief':
|
||||
if (thiefTargets(s, side).length) a.prompts.push({ kind: 'thief', owner: side, actors: [side], answers: {} });
|
||||
break;
|
||||
case 'copycat':
|
||||
if (copyTargets(s, side).length) a.prompts.push({ kind: 'copycat', owner: side, actors: [side], answers: {} });
|
||||
break;
|
||||
case 'dash': {
|
||||
const p = homeDefault(x);
|
||||
if (p) {
|
||||
const path = hasAug(s, side, 'moonwalk') ? [19, 18, 17] : [1, 2, 3];
|
||||
killNodes(s, ctx, side, [path[2]!], id);
|
||||
Object.assign(p, { status: 'board', node: path[2]!, lapped: false, trail: path });
|
||||
mergeOwn(s, side, [p]);
|
||||
say(`스타트 대시: 말 하나가 ${nodeKo(path[2]!)} 자리에서 시작해요`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'bunker':
|
||||
for (const p of x.pieces) if (p.status !== 'done') p.shield = true;
|
||||
say('방공호: 내 말이 모두 보호막을 둘렀어요');
|
||||
break;
|
||||
case 'lightning': {
|
||||
const all = s.sides.flatMap((y) => stacksAug(y).map((g) => ({ side: y.id, ids: g.ids })));
|
||||
const hit = ctx.rng.shuffle(all).slice(0, 2);
|
||||
let k = 0;
|
||||
for (const g of hit) k += killPieces(s, ctx, side, g.side, s.sides[g.side]!.pieces.filter((p) => g.ids.includes(p.id) && p.status === 'board'), { aug: id });
|
||||
say(hit.length ? `벼락! ${hit.map((g) => nm(g.side)).join('·')} 말뭉치에 떨어져 말 ${k}개가 잡혔어요` : '벼락! 판에 말이 없어 빗나갔어요');
|
||||
if (k) checkAlone(s, ctx, side);
|
||||
break;
|
||||
}
|
||||
case 'blackhole': {
|
||||
const k = killNodes(s, ctx, side, [22], id);
|
||||
a.objs.push({ kind: 'hole', node: 22, owner: side });
|
||||
say(`블랙홀: 방이 블랙홀이 됐어요${k ? ` (말 ${k}개가 빨려 들어감)` : ''}`);
|
||||
break;
|
||||
}
|
||||
case 'finisher': {
|
||||
let best: { side: SideId; ps: Piece[]; d: number } | null = null;
|
||||
for (const y of others())
|
||||
for (const g of stacksAug(y)) {
|
||||
const ps = y.pieces.filter((p) => g.ids.includes(p.id));
|
||||
const d = distOf(s, y.id, ps[0]!);
|
||||
if (!best || d < best.d) best = { side: y.id, ps, d };
|
||||
}
|
||||
if (best) {
|
||||
const k = killPieces(s, ctx, side, best.side, best.ps, { aug: id });
|
||||
say(`최후의 일격: ${nm(best.side)}의 가장 앞선 말뭉치를 노려 말 ${k}개를 잡았어요`);
|
||||
if (k) checkAlone(s, ctx, side);
|
||||
} else say('최후의 일격: 판 위에 노릴 말이 없어요');
|
||||
break;
|
||||
}
|
||||
case 'storm': {
|
||||
const all = s.sides.flatMap((y) => stacksAug(y).map((g) => ({ side: y.id, ids: g.ids })));
|
||||
const nodes = ctx.rng.shuffle(Array.from({ length: 28 }, (_, i) => i + 1)).filter((n) => !a.objs.some((o) => o.node === n && (o.kind === 'skull' || o.kind === 'mine')));
|
||||
const nodes = ctx.rng.shuffle(Array.from({ length: 28 }, (_, i) => i + 1)).filter((n) => !a.objs.some((o) => o.node === n && (o.kind === 'skull' || o.kind === 'mine' || o.kind === 'hole')));
|
||||
all.forEach((g, i) => {
|
||||
const node = nodes[i];
|
||||
if (node === undefined) return;
|
||||
@@ -1577,6 +1672,20 @@ function illusionTargets(s: YutState, side: SideId): { side: SideId; o: AugOwned
|
||||
.flatMap((y) => a.sides[y.id]!.augs.filter((o) => !o.used && !o.voided && o.id !== 'cat' && !((o.catUntil ?? 0) > a.round)).map((o) => ({ side: y.id, o })));
|
||||
}
|
||||
|
||||
/** 따라쟁이: other players' augments (one per kind) I could get a copy of. */
|
||||
function copyTargets(s: YutState, side: SideId): { side: SideId; o: AugOwned }[] {
|
||||
const a = A(s);
|
||||
const seen = new Set<AugId>();
|
||||
return s.sides
|
||||
.filter((y) => y.id !== side && sideActive(y))
|
||||
.flatMap((y) => a.sides[y.id]!.augs.map((o) => ({ side: y.id, o })))
|
||||
.filter(({ o }) => {
|
||||
if (o.voided || AUGS[o.id].kind === 'instant' || o.id === 'cat' || seen.has(o.id) || a.sides[side]!.augs.some((m) => m.id === o.id && !m.voided)) return false;
|
||||
seen.add(o.id);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function thiefTargets(s: YutState, side: SideId): { side: SideId; o: AugOwned }[] {
|
||||
const a = A(s);
|
||||
return s.sides
|
||||
@@ -1614,6 +1723,8 @@ function promptChoices(s: YutState, pr: AugPrompt, side: SideId): { value: numbe
|
||||
return illusionTargets(s, side).map((t) => ({ value: t.o.uid, label: `${nm(t.side)} · ${AUGS[t.o.id].name}` }));
|
||||
case 'thief':
|
||||
return thiefTargets(s, side).map((t) => ({ value: t.o.uid, label: `${nm(t.side)} · ${AUGS[t.o.id].name}` }));
|
||||
case 'copycat':
|
||||
return copyTargets(s, side).map((t) => ({ value: t.o.uid, label: `${nm(t.side)} · ${AUGS[t.o.id].name}` }));
|
||||
case 'plan':
|
||||
return s.sides.map((y) => ({ value: y.id, label: nm(y.id) }));
|
||||
}
|
||||
@@ -1746,6 +1857,15 @@ function resolvePrompt(s: YutState, ctx: Ctx, pr: AugPrompt): void {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'copycat': {
|
||||
const uid = ans(o) as number;
|
||||
const t = a.sides.flatMap((as) => as.augs).find((x) => x.uid === uid);
|
||||
if (t && sideActive(s.sides[o]!)) {
|
||||
say('copycat', `따라쟁이: ${josa(`[${AUGS[t.id].name}]`, '을/를')} 따라 했어요`);
|
||||
acquire(s, ctx, o, t.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'plan': {
|
||||
const own = hasAug(s, o, 'plan');
|
||||
if (own) own.list = ans(o) as number[];
|
||||
@@ -1813,6 +1933,10 @@ function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, force
|
||||
results = [forced];
|
||||
sticks = sticksFor(forced, sticksOf(s, id));
|
||||
note = '손은 눈보다 빠르다';
|
||||
} else if (as.curse) {
|
||||
results = ['do'];
|
||||
sticks = sticksFor('do', sticksOf(s, id));
|
||||
note = '저주 인형';
|
||||
} else if (hasAug(s, id, 'doggy')) {
|
||||
const r = pick ?? 'gae';
|
||||
results = [r];
|
||||
@@ -1864,6 +1988,13 @@ function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, force
|
||||
}
|
||||
results = [throwOfCount(k, k === 1 && !!sticks[0], o.backdo)];
|
||||
}
|
||||
// 청개구리: my 빽도 becomes a 모 (without the extra throw).
|
||||
let frogged = false;
|
||||
if (!forced && !as.curse && hasAug(s, id, 'frog') && results.includes('backdo')) {
|
||||
results = results.map((r) => (r === 'backdo' ? 'mo' : r));
|
||||
frogged = true;
|
||||
note = '청개구리';
|
||||
}
|
||||
s.lastThrow = { no: s.throwNo, player: s.current, sticks, result: results[0]!, ...(results.length > 1 ? { results } : {}), ...(note ? { note } : {}) };
|
||||
for (const r of results) {
|
||||
s.pending.push(r);
|
||||
@@ -1871,7 +2002,7 @@ function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, force
|
||||
as.thrown[r] += 1;
|
||||
a.turnResults.push(r);
|
||||
log(s, ctx, { type: 'thrown', side: id, player: s.current, sticks, result: r });
|
||||
if ((r === 'yut' || r === 'mo') && results.length === 1) s.throwsOwed += 1;
|
||||
if ((r === 'yut' || r === 'mo') && results.length === 1 && !frogged) s.throwsOwed += 1;
|
||||
if (r === 'geol' && hasAug(s, id, 'tiger')) {
|
||||
s.throwsOwed += 1;
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'tiger', text: '호랑이 기운: 걸이라 한 번 더 던져요' });
|
||||
@@ -2027,10 +2158,11 @@ function landObjects(s: YutState, ctx: Ctx, side: SideId, movers: Piece[]): void
|
||||
a.objs.splice(a.objs.indexOf(ob), 1);
|
||||
a.sides[side]!.garlic += 1;
|
||||
log(s, ctx, { type: 'augEffect', side, aug: 'bear', text: `마늘을 주웠어요 (${a.sides[side]!.garlic}/3)` });
|
||||
} else if ((ob.kind === 'skull' || ob.kind === 'mine') && ob.owner !== side) {
|
||||
} else if ((ob.kind === 'skull' || ob.kind === 'mine' || ob.kind === 'hole') && ob.owner !== side) {
|
||||
if (ob.kind === 'mine') a.objs.splice(a.objs.indexOf(ob), 1);
|
||||
const k = killPieces(s, ctx, ob.owner, side, movers, { aug: ob.kind === 'mine' ? 'mine' : 'party' });
|
||||
log(s, ctx, { type: 'augEffect', side: ob.owner, aug: ob.kind === 'mine' ? 'mine' : 'party', text: ob.kind === 'mine' ? `지뢰가 터져 말 ${k}개가 잡혔어요` : `해골 함정에 말 ${k}개가 잡혔어요` });
|
||||
const aug: AugId = ob.kind === 'mine' ? 'mine' : ob.kind === 'hole' ? 'blackhole' : 'party';
|
||||
const k = killPieces(s, ctx, ob.owner, side, movers, { aug });
|
||||
log(s, ctx, { type: 'augEffect', side: ob.owner, aug, text: ob.kind === 'mine' ? `지뢰가 터져 말 ${k}개가 잡혔어요` : ob.kind === 'hole' ? `블랙홀에 말 ${k}개가 빨려 들어갔어요` : `해골 함정에 말 ${k}개가 잡혔어요` });
|
||||
return;
|
||||
} else if (ob.kind === 'hat' && ob.owner !== side) {
|
||||
const b = walkBack(s, side, node, movers[0]!.trail, 2);
|
||||
@@ -2129,7 +2261,19 @@ function doMoveAug(s: YutState, ctx: Ctx, act: YutMoveAction): void {
|
||||
info.captured = s.sides.map((x, i) => ({ side: x.id, count: before[i]! - x.pieces.filter((p) => p.status === 'board' && p.node === plan.to).length })).filter((c) => c.count > 0 && c.side !== id);
|
||||
s.lastMove = info;
|
||||
if (phaseOf(s) === 'finished') return;
|
||||
if (k.enemy && (plan.throw !== 'backdo' || s.options.backdoCaptureBonus)) bonus += 1;
|
||||
if (k.enemy && (plan.throw !== 'backdo' || s.options.backdoCaptureBonus)) {
|
||||
bonus += 1;
|
||||
if (hasAug(s, id, 'hunter')) {
|
||||
bonus += 1;
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'hunter', text: '사냥꾼: 두 번 더 던져요' });
|
||||
}
|
||||
}
|
||||
// 도장 깨기: count the corner / 방 this move stopped on.
|
||||
const stamp = hasAug(s, id, 'stamp');
|
||||
if (stamp && STAMP_NODES.includes(plan.to) && movers.some((p) => p.status === 'board') && !(stamp.list ?? []).includes(plan.to)) {
|
||||
stamp.list = [...(stamp.list ?? []), plan.to];
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'stamp', text: `도장 깨기: ${nodeKo(plan.to)} 도장 (${stamp.list.length}/4)` });
|
||||
}
|
||||
if (k.treason) {
|
||||
bonus += 1;
|
||||
log(s, ctx, { type: 'augEffect', side: id, aug: 'treason', text: '역모: 한 번 더 던져요' });
|
||||
@@ -2171,6 +2315,7 @@ function pieceLabel(s: YutState, side: SideId, ps: Piece[]): string {
|
||||
const kind = p.kind ? PIECE_KO[p.kind] : '말';
|
||||
return `${where} ${kind}${ps.length > 1 ? ` ${ps.length}개` : ''}`;
|
||||
}
|
||||
const THROW_NAME: Record<Throw, string> = { backdo: '빽도', do: '도', gae: '개', geol: '걸', yut: '윷', mo: '모' };
|
||||
const NODE_KO = ['참먹이', '도', '개', '걸', '윷', '모', '뒷도', '뒷개', '뒷걸', '뒷윷', '뒷모', '찌도', '찌개', '찌걸', '찌윷', '찌모', '날도', '날개', '날걸', '날윷', '앞모도', '앞모개', '방', '속윷', '속모', '뒷모도', '뒷모개', '사려', '안찌'];
|
||||
const nodeKo = (n: NodeId) => NODE_KO[n] ?? String(n);
|
||||
|
||||
@@ -2325,6 +2470,47 @@ export function useOptions(s: YutState, side: SideId): AugUseOption[] {
|
||||
for (const h of stacksAug(y)) if (h.node !== g.node) add({ piece: g.ids[0]!, target: y.id, node: h.node }, `${pieceLabel(s, side, g.ps)} ↔ ${nm(y.id)} ${nodeKo(h.node)}`);
|
||||
}
|
||||
break;
|
||||
case 'reroll':
|
||||
if (!a.sides[side]!.usedTurn.includes('reroll')) for (const r of [...new Set(s.pending)]) add({ result: r }, `${THROW_NAME[r]} 버리고 다시 던지기`);
|
||||
break;
|
||||
case 'double':
|
||||
for (const r of [...new Set(s.pending)]) add({ result: r }, `${THROW_NAME[r]} 하나 더`);
|
||||
break;
|
||||
case 'gamble':
|
||||
add({}, '올인!');
|
||||
break;
|
||||
case 'curse':
|
||||
for (const y of s.sides) if (y.id !== side && sideActive(y) && !a.sides[y.id]!.curse) add({ target: y.id }, nm(y.id));
|
||||
break;
|
||||
case 'freeze':
|
||||
case 'pushback':
|
||||
for (const y of s.sides) {
|
||||
if (y.id === side || !sideActive(y)) continue;
|
||||
const seen = new Set<NodeId>();
|
||||
for (const h of stacksAug(y)) {
|
||||
if (seen.has(h.node)) continue;
|
||||
seen.add(h.node);
|
||||
const ps = y.pieces.filter((p) => h.ids.includes(p.id));
|
||||
if (o.id === 'freeze') {
|
||||
if (!ps.every((p) => frozen(s, p))) add({ target: y.id, node: h.node }, `${nm(y.id)} ${pieceLabel(s, y.id, ps)}`);
|
||||
} else {
|
||||
const b = walkBack(s, y.id, h.node, ps[0]!.trail, 3);
|
||||
// never past 참먹이 (that would put the stack next to the finish)
|
||||
if (b.to !== GOAL && !b.path.includes(0)) add({ target: y.id, node: h.node }, `${nm(y.id)} ${pieceLabel(s, y.id, ps)} → ${nodeKo(b.to)}`, previewKills(s, y.id, b.to, h.ids, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'magnet':
|
||||
for (const g of stacks) add({ piece: g.ids[0]! }, pieceLabel(s, side, g.ps), enemiesOn([...NEIGHBOURS[g.node]!]));
|
||||
break;
|
||||
case 'rocket': {
|
||||
const dest = lastNode(s, side);
|
||||
for (const g of stacks) if (g.node !== dest && !g.ps.some((p) => isSpecial(p) || frozen(s, p))) add({ piece: g.ids[0]! }, `${pieceLabel(s, side, g.ps)} → ${nodeKo(dest)}`, enemiesOn([dest]));
|
||||
const h = homeDefault(x);
|
||||
if (h) add({ piece: h.id }, `대기 말 → ${nodeKo(dest)}`, enemiesOn([dest]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
@@ -2550,6 +2736,64 @@ function applyUse(s: YutState, ctx: Ctx, side: SideId, act: AugUse): void {
|
||||
say(`자리 바꾸기: ${nm(y.id)} 말과 자리를 바꿨어요`);
|
||||
break;
|
||||
}
|
||||
case 'reroll':
|
||||
as.usedTurn.push('reroll');
|
||||
s.pending.splice(s.pending.indexOf(act.result!), 1);
|
||||
s.throwsOwed += 1;
|
||||
s.phase = 'throw';
|
||||
say(`다시 던지기: ${josa(THROW_NAME[act.result!], '을/를')} 버리고 다시 던져요`);
|
||||
break;
|
||||
case 'double':
|
||||
s.pending.push(act.result!);
|
||||
say(`곱빼기: ${josa(THROW_NAME[act.result!], '을/를')} 하나 더 받았어요`);
|
||||
break;
|
||||
case 'gamble':
|
||||
if (ctx.rng.next() < 0.5) {
|
||||
s.throwsOwed += 3;
|
||||
s.phase = 'throw';
|
||||
say('올인 성공! 던지기 3번을 더 받아요');
|
||||
} else {
|
||||
say('올인 실패… 모아 둔 결과를 모두 잃고 차례가 끝나요');
|
||||
endsTurn = true;
|
||||
}
|
||||
break;
|
||||
case 'curse':
|
||||
a.sides[act.target!]!.curse = true;
|
||||
say(`저주 인형: ${nm(act.target!)}은 다음 차례에 도만 나와요`);
|
||||
break;
|
||||
case 'freeze': {
|
||||
const y = s.sides[act.target!]!;
|
||||
for (const p of y.pieces) if (p.status === 'board' && p.node === act.node) p.frozenUntil = Math.max(p.frozenUntil ?? 0, a.round + 2);
|
||||
say(`얼음! ${nm(y.id)}의 ${nodeKo(act.node!)} 말이 2라운드 동안 얼었어요`);
|
||||
break;
|
||||
}
|
||||
case 'pushback': {
|
||||
const y = s.sides[act.target!]!;
|
||||
const g = stacksAug(y).find((h) => h.node === act.node!)!;
|
||||
const ps = y.pieces.filter((p) => g.ids.includes(p.id));
|
||||
const b = walkBack(s, y.id, act.node!, ps[0]!.trail, 3);
|
||||
say(`뒤로 돌아: ${nm(y.id)}의 ${nodeKo(act.node!)} 말이 ${nodeKo(b.to as NodeId)}까지 밀려났어요`);
|
||||
shiftStack(s, ctx, y.id, ps, b.to, b.trail);
|
||||
break;
|
||||
}
|
||||
case 'magnet': {
|
||||
const ps = stackOf(act.piece!);
|
||||
let n = 0;
|
||||
for (const y of s.sides) if (y.id !== side) for (const node of NEIGHBOURS[ps[0]!.node!]!) n += killPieces(s, ctx, side, y.id, y.pieces.filter((p) => p.status === 'board' && p.node === node), { aug: 'magnet' });
|
||||
say(`자석: 옆 칸의 말 ${n}개를 끌어와 잡았어요`);
|
||||
if (n) checkAlone(s, ctx, side);
|
||||
break;
|
||||
}
|
||||
case 'rocket': {
|
||||
const p0 = x.pieces.find((q) => q.id === act.piece)!;
|
||||
const ps = p0.status === 'home' ? [p0] : stackOf(act.piece!);
|
||||
const dest = lastNode(s, side);
|
||||
for (const p of ps) relocate(p, dest);
|
||||
const k = landKills(s, ctx, side, ps, dest, false);
|
||||
mergeOwn(s, side, ps);
|
||||
say(`로켓 발사! ${nodeKo(dest)}까지 날아갔어요${k.enemy ? ` (말 ${k.enemy}개 잡음)` : ''}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (phaseOf(s) === 'finished') return;
|
||||
checkWins(s, ctx);
|
||||
@@ -2949,6 +3193,8 @@ function ownedNote(s: YutState, side: SideId, o: AugOwned): string | null {
|
||||
case 'detective':
|
||||
case 'delivery':
|
||||
return o.target !== undefined ? AUGS[AUG_IDS[o.target]!].name : null;
|
||||
case 'stamp':
|
||||
return `도장 ${STAMP_NODES.map((n) => ((o.list ?? []).includes(n) ? '●' : '○')).join('')}`;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -2985,6 +3231,7 @@ export function augView(s: YutState, viewer: PlayerId | null, base: YutView): Yu
|
||||
links: as.links.map((l) => ({ to: l.to, by: l.by, on: activeLink(s, x.id, l) })),
|
||||
reason: as.reason,
|
||||
bronze: !!as.bronze,
|
||||
cursed: !!as.curse,
|
||||
homeSpecial: x.pieces.filter((p) => p.status === 'home' && p.kind).map((p) => ({ piece: p.id, kind: p.kind! })),
|
||||
};
|
||||
}),
|
||||
@@ -3064,7 +3311,7 @@ export function augView(s: YutState, viewer: PlayerId | null, base: YutView): Yu
|
||||
const [i, j] = [l.indexOf(u.action.node!), l.indexOf(u.action.node2!)].sort((p, q) => p - q);
|
||||
return seen(l.slice(i!, j! + 1));
|
||||
}
|
||||
if (u.id === 'swap') return seen([u.action.node]);
|
||||
if (u.id === 'swap' || u.id === 'freeze' || u.id === 'pushback') return seen([u.action.node]);
|
||||
return true;
|
||||
})
|
||||
.map((u) => ({ ...u, kills: undefined, label: u.id === 'baduk' ? u.label.replace(/ 사이 \d+개$/, ' 사이') : u.label }));
|
||||
|
||||
@@ -42,6 +42,8 @@ export const AUG_IDS = [
|
||||
'cannibal',
|
||||
// 이 사이트 추가
|
||||
'teleport', 'shortcut', 'turtle', 'revenge', 'thief', 'mine', 'tiger', 'twins', 'swap', 'storm',
|
||||
'reroll', 'double', 'gamble', 'curse', 'freeze', 'magnet', 'pushback', 'underdog', 'homeground', 'copycat', 'frog', 'hunter',
|
||||
'pickup', 'stamp', 'dash', 'bunker', 'lightning', 'blackhole', 'rocket', 'finisher',
|
||||
] as const;
|
||||
export type AugId = (typeof AUG_IDS)[number];
|
||||
|
||||
@@ -132,6 +134,26 @@ const L: Omit<AugInfo, 'id'>[] = [
|
||||
{ name: '쌍둥이', tier: 'any', kind: 'active', once: true, custom: true, text: '대기 중인 내 말 하나를 판 위 내 말뭉치에 바로 업혀요.' },
|
||||
{ name: '자리 바꾸기', tier: 'any', kind: 'active', once: true, custom: true, text: '내 말뭉치 하나와 다른 사람 말뭉치 하나의 자리를 맞바꿔요.' },
|
||||
{ name: '회오리', tier: 'mid', kind: 'instant', custom: true, text: '판 위의 모든 말뭉치가 회오리에 휩쓸려 무작위 칸으로 흩어져요.', note: '참먹이에는 떨어지지 않고, 말뭉치끼리 겹치지 않아요.' },
|
||||
{ name: '다시 던지기', tier: 'any', kind: 'active', custom: true, text: '내 차례마다 한 번, 갖고 있는 윷 결과 하나를 버리고 다시 던져요.' },
|
||||
{ name: '곱빼기', tier: 'any', kind: 'active', once: true, custom: true, text: '갖고 있는 윷 결과 하나를 하나 더 받아요.' },
|
||||
{ name: '올인', tier: 'any', kind: 'active', once: true, custom: true, text: '반반 확률로 던지기 3번을 더 받거나, 모아 둔 결과를 모두 잃고 차례가 끝나요.' },
|
||||
{ name: '저주 인형', tier: 'any', kind: 'active', once: true, custom: true, text: '한 사람을 골라요. 그 사람은 다음 차례에 던질 때마다 도만 나와요.' },
|
||||
{ name: '얼음!', tier: 'any', kind: 'active', once: true, custom: true, text: '다른 사람 말뭉치 하나를 2라운드 동안 얼려 못 움직이게 해요.' },
|
||||
{ name: '자석', tier: 'any', kind: 'active', once: true, custom: true, text: '내 말뭉치 하나를 골라요. 바로 옆 칸(선으로 이어진 칸)에 있는 다른 사람 말을 모두 끌어와 잡아요.' },
|
||||
{ name: '뒤로 돌아', tier: 'any', kind: 'active', once: true, custom: true, text: '다른 사람 말뭉치 하나를 뒤로 3칸 보내요.', note: '밀려난 칸에 다른 말이 있으면 마녀 모자 함정처럼 그 말을 잡아요.' },
|
||||
{ name: '꼴찌의 반란', tier: 'any', kind: 'passive', custom: true, text: '내 차례가 시작될 때 내가 혼자 꼴찌면 한 번 더 던져요.', note: '난 말이 가장 적고, 같으면 남은 거리가 가장 먼 사람이 꼴찌예요.' },
|
||||
{ name: '텃세', tier: 'any', kind: 'passive', custom: true, text: '참먹이로 들어가기 바로 전 칸들(날도~날윷, 사려·안찌)에 선 내 말은 잡히지 않아요.', note: '달걸음이 있으면 반대쪽(뒷도 쪽) 칸들이에요.' },
|
||||
{ name: '따라쟁이', tier: 'any', kind: 'instant', custom: true, text: '다른 사람이 가진 증강 하나를 골라 똑같은 것을 하나 얻어요.', note: '즉시 효과 증강과 고양이는 따라 할 수 없어요.' },
|
||||
{ name: '청개구리', tier: 'any', kind: 'passive', custom: true, text: '내가 던져서 빽도가 나오면 모가 돼요. 대신 한 번 더 던지지는 않아요.' },
|
||||
{ name: '사냥꾼', tier: 'any', kind: 'passive', custom: true, text: '윷을 던져 말을 움직여 잡으면 한 번이 아니라 두 번 더 던져요.' },
|
||||
{ name: '줍줍', tier: 'any', kind: 'passive', custom: true, text: '앞으로 갈 때 지나가는 칸에 있는 내 말을 모두 주워 업고 가요.' },
|
||||
{ name: '도장 깨기', tier: 'any', kind: 'win', win: true, custom: true, text: '윷을 던져 움직인 내 말이 모·뒷모·찌모·방에 한 번씩 멈추면 이겨요.', note: '이 증강을 얻은 뒤부터 세요.' },
|
||||
{ name: '스타트 대시', tier: 'start', kind: 'instant', custom: true, text: '대기 중인 내 말 하나가 걸 자리에서 시작해요.' },
|
||||
{ name: '방공호', tier: 'start', kind: 'instant', custom: true, text: '내 말이 모두 보호막을 하나씩 두르고 시작해요.', note: '보호막은 잡힐 때 한 번 막아 줘요.' },
|
||||
{ name: '벼락', tier: 'mid', kind: 'instant', custom: true, text: '판 위 말뭉치 중 무작위 2개에 벼락이 떨어져 잡혀요. 내 말도 맞을 수 있어요.' },
|
||||
{ name: '블랙홀', tier: 'mid', kind: 'instant', custom: true, text: '방(판 가운데)이 블랙홀이 돼요. 방에 있던 말은 모두 빨려 들어가고, 이제 다른 사람 말이 방에 멈추면 잡혀요.' },
|
||||
{ name: '로켓 발사', tier: 'final', kind: 'active', once: true, custom: true, text: '내 말뭉치 하나(또는 대기 말 하나)를 참먹이 바로 앞 칸(날윷)으로 보내요.', note: '그 칸에 있던 다른 사람 말은 잡아요.' },
|
||||
{ name: '최후의 일격', tier: 'final', kind: 'instant', custom: true, text: '다른 사람 말뭉치 중 가장 앞선 것 하나를 잡아요.' },
|
||||
];
|
||||
|
||||
export const AUGS: Record<AugId, AugInfo> = Object.fromEntries(AUG_IDS.map((id, i) => [id, { id, ...L[i]! }])) as Record<AugId, AugInfo>;
|
||||
|
||||
@@ -56,6 +56,8 @@ export const yutBot: BotStrategy<YutView, YutAction> = ({ view, legal, random })
|
||||
if (m.finishes) return v + 15 * m.count;
|
||||
const to = m.to as NodeId;
|
||||
if (m.captures) v += 30 + m.captures * (STEP * (home - dist(to)) + 10);
|
||||
// 카니발리즘: catching my own pieces throws their progress away.
|
||||
if (m.ownCaptures) v -= m.ownCaptures * (STEP * (home - dist(to)) + 10);
|
||||
// Standing apart still shares the node, so a catch there takes everything; only stacking earns the small bonus.
|
||||
const group = m.count + (m.stacks || m.stack === false ? mineAt(to) : 0);
|
||||
if (m.stacks) v += 6;
|
||||
|
||||
@@ -105,7 +105,12 @@ export const yutOptionsSchema = z.object({
|
||||
.union([z.literal(2), z.literal(3), z.literal(4)])
|
||||
.default(3)
|
||||
.meta({ title: '증강: 후보 수', labels: { 2: '2개', 3: '3개', 4: '4개' } }),
|
||||
augOff: z.array(z.enum(AUG_IDS).meta({ labels: Object.fromEntries(AUG_IDS.map((id) => [id, AUGS[id].name])) })).max(AUG_IDS.length).default([]).meta({ title: '증강: 나오지 않게 뺀 증강' }),
|
||||
// This site's own augments start switched off (the room can switch them on).
|
||||
augOff: z
|
||||
.array(z.enum(AUG_IDS).meta({ labels: Object.fromEntries(AUG_IDS.map((id) => [id, AUGS[id].name])) }))
|
||||
.max(AUG_IDS.length)
|
||||
.default(() => AUG_IDS.filter((id) => AUGS[id].custom))
|
||||
.meta({ title: '증강: 나오지 않게 뺀 증강' }),
|
||||
});
|
||||
export type YutOptions = z.infer<typeof yutOptionsSchema>;
|
||||
|
||||
@@ -275,6 +280,8 @@ export interface YutLegalMove {
|
||||
count: number;
|
||||
/** Opponent pieces caught. */
|
||||
captures: number;
|
||||
/** 증강 카니발리즘: own pieces caught there. */
|
||||
ownCaptures?: number;
|
||||
stacks: boolean;
|
||||
finishes: boolean;
|
||||
/** Action fields that pick this variant (see the MOVE schema); absent for the ordinary move. */
|
||||
|
||||
Reference in New Issue
Block a user