다빈치 코드 조커 숨김·공개 타일 표시, 바퀴벌레 포커 내 빠른 말 표시, 난수를 ChaCha20으로

- 다빈치 코드: 조커를 놓는 단계(placeJoker)를 상대·관전자 화면에는 바로 전 단계로 보여 줌(서버 view)
- 다빈치 코드: 공개된 타일은 반 칸 위로 올리고 아래에 노란 줄, 숨은 타일은 제자리
- 바퀴벌레 포커: 내가 한 빠른 말도 내 자리 위 말풍선으로 표시
- 난수: 새 게임은 256비트 OS 시드 + ChaCha20(RFC 8439, 암호학적 생성기). 옛 게임(128비트)은 sfc32 그대로라 다시 보기 동일
- 테스트: RFC 테스트 벡터, 균등성(카이제곱), 상태 이어받기, 조커 단계 비공개

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-11 03:12:48 +09:00
parent 92e8b2100f
commit 0fe7e27eb2
10 changed files with 207 additions and 41 deletions

View File

@@ -371,6 +371,23 @@ describe('조커 (§5.1, §5.2)', () => {
expect(shown(s, 'A')).toEqual([false, false, false]);
expect(davinci.view(s, 'B').rows.A![2]).toEqual({ color: 'white', revealed: false, wrong: [] });
});
test('조커를 놓는 중이라는 걸 남은 모른다: 상대·관전자 화면은 바로 전 단계(멈추기 전 / 추리)로 보인다', () => {
let s = rigged({ A: ['b1', 'w4'], B: ['b0', 'w3'] }, { jokers: true }, { white: ['wJ', 'w5'] });
s = act(s, 'A', { type: 'draw', color: 'white' });
s = act(s, 'A', guess('B', 0, 0));
s = act(s, 'A', { type: 'stop' });
expect(davinci.view(s, 'A').phase).toBe('placeJoker');
expect(davinci.view(s, 'B').phase).toBe('afterCorrect');
expect(davinci.view(s, null).phase).toBe('afterCorrect');
expect(JSON.stringify(davinci.view(s, 'B'))).not.toMatch(/placeJoker|"n":"joker"|wJ/);
// Wrong guess with a drawn joker: the others still see "guessing" until it is placed (face up).
let t = rigged({ A: ['b1', 'w4'], B: ['b0', 'w3'] }, { jokers: true }, { white: ['wJ', 'w5'] });
t = act(t, 'A', { type: 'draw', color: 'white' });
t = act(t, 'A', guess('B', 0, 7));
expect(davinci.view(t, 'A').phase).toBe('placeJoker');
expect(davinci.view(t, 'B').phase).toBe('guess');
});
});
describe('거부 (§8.2)', () => {

View File

@@ -706,7 +706,9 @@ export const davinci: GameDefinition<DavinciState, DavinciAction, DavinciView, D
options: s.options,
me,
seats: s.seats,
phase: ph.kind,
// Placing a drawn joker is secret: the others see the step before it (after 멈추기 → still deciding; after a
// wrong guess → still guessing), never "조커를 넣는 중".
phase: ph.kind === 'placeJoker' && me !== s.current ? (ph.reveal ? 'guess' : 'afterCorrect') : ph.kind,
current: s.current,
startCount: s.startCount,
rows,