증강 윷놀이: 모 아니면 도 증강에도 낙 규칙 적용(낙 확률·낙 처리 방식 그대로), 증강 설명에 안내 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 02:40:50 +09:00
parent c2ce1979b2
commit 0cbda8f551
3 changed files with 43 additions and 16 deletions

View File

@@ -228,6 +228,27 @@ describe('증강 윷놀이: throws', () => {
expect(t.lastThrow!.result).toBe('do');
});
test('모 아니면 도 can 낙 too (house-rule odds)', () => {
let s = make(2, { nakPercent: 10 });
give(s, 0, 'moordo');
let t = act(s, 'A', { type: 'THROW' }, new Script([0.05]));
expect(t.lastThrow!.result).toBe('nak');
expect(t.stats.throws.nak).toBe(1);
expect(t.current).toBe('B'); // 낙: that throw is void, the turn passes
s = make(2, { nakPercent: 10 });
give(s, 0, 'moordo');
t = act(s, 'A', { type: 'THROW' }, new Script([0.5, 0.1]));
expect(t.lastThrow!.result).toBe('mo');
t = act(t, 'A', { type: 'THROW' }, new Script([0.5, 0.9]));
expect(t.pending).toEqual(['mo', 'do']);
s = make(2, { nakPercent: 10, nakRule: 'lose' });
give(s, 0, 'moordo');
t = act(s, 'A', { type: 'THROW' }, new Script([0.5, 0.1]));
t = act(t, 'A', { type: 'THROW' }, new Script([0.01]));
expect(t.pending).toEqual([]);
expect(t.current).toBe('B');
});
test('이도류 throws two pairs: two results, 모 becomes 도', () => {
const s = make();
give(s, 0, 'dual');

View File

@@ -1957,6 +1957,25 @@ function sticksFor(t: Throw, n: number): boolean[] {
return out;
}
/** 낙 for a real throw (house-rule odds). Returns true when the throw was a 낙 and has been fully handled. */
function rollNak(s: YutState, ctx: Ctx, id: SideId): boolean {
const o = s.options;
if (!(o.nakPercent > 0 && ctx.rng.next() < o.nakPercent / 100)) return false;
s.stats.throws.nak += 1;
s.lastThrow = { no: s.throwNo, player: s.current, sticks: null, result: 'nak' };
if (o.nakRule === 'lose') {
log(s, ctx, { type: 'nak', side: id, player: s.current, endsTurn: true });
if (s.pending.length) log(s, ctx, { type: 'discarded', side: id, player: s.current, throws: [...s.pending] });
s.pending = [];
s.throwsOwed = 0;
endTurnAug(s, ctx);
return true;
}
log(s, ctx, { type: 'nak', side: id, player: s.current });
afterThrow(s, ctx);
return true;
}
function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, forced?: Throw): void {
const a = A(s);
const id = s.turnSide;
@@ -1987,6 +2006,7 @@ function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, force
sticks = sticksFor('mo', sticksOf(s, id));
note = '도베르만';
} else if (hasAug(s, id, 'moordo')) {
if (rollNak(s, ctx, id)) return;
const r: Throw = ctx.rng.next() < 0.4 ? 'mo' : 'do';
results = [r];
sticks = sticksFor(r, sticksOf(s, id));
@@ -2000,21 +2020,7 @@ function doThrowAug(s: YutState, ctx: Ctx, pick: 'do' | 'gae' | undefined, force
}
note = '이도류';
} else {
if (o.nakPercent > 0 && ctx.rng.next() < o.nakPercent / 100) {
s.stats.throws.nak += 1;
s.lastThrow = { no: s.throwNo, player: s.current, sticks: null, result: 'nak' };
if (o.nakRule === 'lose') {
log(s, ctx, { type: 'nak', side: id, player: s.current, endsTurn: true });
if (s.pending.length) log(s, ctx, { type: 'discarded', side: id, player: s.current, throws: [...s.pending] });
s.pending = [];
s.throwsOwed = 0;
endTurnAug(s, ctx);
return;
}
log(s, ctx, { type: 'nak', side: id, player: s.current });
afterThrow(s, ctx);
return;
}
if (rollNak(s, ctx, id)) return;
// 과유불급 sticks are always half-and-half (with 실제 윷 odds six 배 would come up far too often).
const p = o.stickModel === 'fair' || hasAug(s, id, 'excess') ? 0.5 : 0.6;
sticks = Array.from({ length: sticksOf(s, id) }, () => ctx.rng.next() < p);

View File

@@ -64,7 +64,7 @@ const L: Omit<AugInfo, 'id'>[] = [
{ name: '돌려돌려 돌림판', tier: 'any', kind: 'instant', text: '판을 돌려 모든 말이 돌아간 자리로 옮겨져요. 결과가 마음에 안 들면 한 번 더 돌릴 수 있어요.' },
{ name: '명사수', tier: 'any', kind: 'active', text: '던지기 한 번을 써서 칸 하나를 조준해요. 다음 내 차례가 시작될 때 그 칸의 말을 모두 잡아요.', note: '한 차례에 한 번, 조준은 한 곳만 할 수 있어요. 내 말도 잡혀요.' },
{ name: '명탐정', tier: 'any', kind: 'instant', text: '증강 하나를 지목해요. 이번 증강 선택에서 다른 사람이 그 증강을 고르면 무효가 돼요.' },
{ name: '모 아니면 도', tier: 'any', kind: 'passive', text: '던지면 모 아니면 도만 나와요. 모가 나올 확률은 40%예요.' },
{ name: '모 아니면 도', tier: 'any', kind: 'passive', text: '던지면 모 아니면 도만 나와요. 모가 나올 확률은 40%예요.', note: '낙 규칙을 켰다면 낙은 평소 확률대로 나와요.' },
{ name: '바둑', tier: 'any', kind: 'active', once: true, text: '한 줄 위에 있는 내 말뭉치 둘 사이의 다른 편 말을 모두 잡고, 잡은 말 수만큼 더 던져요.' },
{ name: '배달', tier: 'any', kind: 'instant', text: '증강 하나를 주문해요. 다음 증강 선택 때 그 증강이 내 후보에 꼭 나와요.' },
{ name: '변환: 도깨비', tier: 'any', kind: 'active', once: true, text: '내 일반 말 하나를 도깨비로 바꿔요. 도깨비는 내 차례마다 한 번, 던지지 않고 앞이나 뒤로 1칸 갈 수 있어요.' },