다빈치 코드 조커 숨김·공개 타일 표시, 바퀴벌레 포커 내 빠른 말 표시, 난수를 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:
@@ -84,7 +84,7 @@ describe('M1 integration scenarios', () => {
|
||||
const stats = await api(s.base, '/api/me/stats', { cookie: a.cookie });
|
||||
expect(stats.body.stats).toEqual([{ gameId: 'omok', played: 1, wins: 1, draws: 0 }]);
|
||||
const room2 = (await a.next('room', (m) => m.room.status === 'finished').catch(() => a.lastOf('room')!)).room;
|
||||
expect(room2.lastSeed).toMatch(/^[0-9a-f]{32}$/);
|
||||
expect(room2.lastSeed).toMatch(/^[0-9a-f]{64}$/);
|
||||
expect(room2.sessionStats[a.id]).toEqual({ played: 1, wins: 1 });
|
||||
});
|
||||
|
||||
|
||||
@@ -295,8 +295,10 @@ const CSS = `
|
||||
.cp-true:hover:not(:disabled), .cp-false:hover:not(:disabled) { filter: brightness(1.08); }
|
||||
.cp-peek { min-height: 56px; }
|
||||
.cp-why { font-size: .85rem; color: var(--text-sub); }
|
||||
.cp-me { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 10px 12px; border: 3px solid var(--primary); display: flex; flex-direction: column; gap: 8px; }
|
||||
.cp-me { position: relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 10px 12px; border: 3px solid var(--primary); display: flex; flex-direction: column; gap: 8px; }
|
||||
.cp-me.turn { border-color: var(--focus); }
|
||||
/* My own 빠른 말: next to my name (the timer sits on the right). */
|
||||
.cp-me > .cp-bubble { right: auto; left: 16px; top: -16px; }
|
||||
.cp-me-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
|
||||
.cp-me-row > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
||||
.cp-help { font-size: .85rem; color: var(--text-sub); }
|
||||
@@ -683,12 +685,32 @@ function WaitPanel({ v, players, me }: { v: CockroachView; players: Record<strin
|
||||
);
|
||||
}
|
||||
|
||||
function MyArea({ v, me, players, deadline, offering }: { v: CockroachView; me: string; players: Record<string, PublicUser>; deadline: number | null; offering: boolean }) {
|
||||
function MyArea({
|
||||
v,
|
||||
me,
|
||||
players,
|
||||
deadline,
|
||||
offering,
|
||||
bubble,
|
||||
}: {
|
||||
v: CockroachView;
|
||||
me: string;
|
||||
players: Record<string, PublicUser>;
|
||||
deadline: number | null;
|
||||
offering: boolean;
|
||||
/** What I just said with 빠른 말: shown over my own area too, like everybody else's. */
|
||||
bubble: string | null;
|
||||
}) {
|
||||
const front = v.fronts[me]!;
|
||||
const active = waitingOn(v) === me;
|
||||
const total = v.handCounts[me] ?? 0;
|
||||
return (
|
||||
<section className={`cp-me${active ? ' turn' : ''}`} aria-label="내 자리">
|
||||
{bubble && (
|
||||
<span className="cp-bubble" aria-hidden>
|
||||
{bubble}
|
||||
</span>
|
||||
)}
|
||||
<div className="cp-head">
|
||||
<Avatar user={userOf(players, me)} size={26} />
|
||||
<span className="cp-name">{nick(players, me)} (나)</span>
|
||||
@@ -792,12 +814,7 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP
|
||||
<WaitPanel v={v} players={players} me={me} />
|
||||
)}
|
||||
</div>
|
||||
{amPlayer && <MyArea v={v} me={me!} players={players} deadline={deadline} offering={offering} />}
|
||||
{amPlayer && bubbles[me!] && (
|
||||
<span className="sr-only" aria-hidden>
|
||||
{bubbles[me!]}
|
||||
</span>
|
||||
)}
|
||||
{amPlayer && <MyArea v={v} me={me!} players={players} deadline={deadline} offering={offering} bubble={bubbles[me!] ?? null} />}
|
||||
<p className="sr-only" aria-live="polite">
|
||||
{announce}
|
||||
</p>
|
||||
|
||||
@@ -34,7 +34,7 @@ export function helpNow(v: DavinciView, me: string | null, players: Record<strin
|
||||
draw: '타일을 가져오는 중이에요',
|
||||
guess: '추리하는 중이에요',
|
||||
afterCorrect: '맞혀서 계속할지 고르는 중이에요',
|
||||
placeJoker: '조커를 넣을 자리를 고르는 중이에요',
|
||||
placeJoker: '타일을 놓는 중이에요', // never shown: the server hides this phase from the others
|
||||
revealOwn: '틀려서 자기 타일을 공개하는 중이에요',
|
||||
};
|
||||
return `${curNick}이 ${doing[v.phase] ?? '차례를 진행하는 중이에요'}. 기다려 주세요.\n내 숨은 타일은 ${hidden(v, me!)}개 남았어요. 공개된 숫자와 위치, 추리 기록을 보며 상대 숫자를 짐작해 보세요.`;
|
||||
|
||||
@@ -57,7 +57,8 @@ const CSS = `
|
||||
.dv-badge.turn { background: var(--focus); color: #1c1e21; }
|
||||
.dv-badge.out { background: var(--danger-soft); color: var(--danger); }
|
||||
.dv-badge.ok { background: var(--success-soft); color: var(--success); }
|
||||
.dv-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding-top: 8px; }
|
||||
.dv-row { --lift: 34px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding-top: calc(8px + var(--lift)); }
|
||||
.dv-me .dv-row { --lift: 40px; }
|
||||
.dv-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
|
||||
.dv-pos { font-size: .75rem; color: var(--text-sub); font-variant-numeric: tabular-nums; line-height: 1; }
|
||||
.dv-tile { --w: 46px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: 8px; display: flex; align-items: center; justify-content: center;
|
||||
@@ -68,7 +69,8 @@ const CSS = `
|
||||
.dv-tile.back.black { background: repeating-linear-gradient(45deg, #2a2c33 0 5px, #1b1c21 5px 10px); }
|
||||
.dv-tile.back.white { background: repeating-linear-gradient(45deg, #fbf9f4 0 5px, #e6e1d6 5px 10px); }
|
||||
.dv-tile .q { opacity: .45; font-size: .62em; }
|
||||
.dv-tile.open::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: 4px; height: 4px; border-radius: 2px; background: #f59e0b; }
|
||||
.dv-slot.open > .dv-pick { position: relative; top: calc(-1 * var(--lift)); }
|
||||
.dv-slot.open > .dv-pick::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -7px; height: 5px; border-radius: 3px; background: #f59e0b; }
|
||||
.dv-tile.secret { outline: 3px dashed var(--primary); outline-offset: 2px; }
|
||||
.dv-tile.sm { --w: 30px; }
|
||||
.dv-tile.lg { --w: 54px; }
|
||||
@@ -128,7 +130,8 @@ const CSS = `
|
||||
@media (max-width: 719px) {
|
||||
.dv-tile { --w: 34px; border-radius: 6px; }
|
||||
.dv-tile.lg { --w: 37px; }
|
||||
.dv-row { gap: 4px; }
|
||||
.dv-row { gap: 4px; --lift: 26px; }
|
||||
.dv-me .dv-row { --lift: 28px; }
|
||||
.dv-mid { grid-template-columns: minmax(0, 1fr); }
|
||||
.dv-board { max-height: none; overflow: visible; }
|
||||
}
|
||||
@@ -308,7 +311,7 @@ function PlayerRow({
|
||||
const can = canPick && !t.revealed;
|
||||
const selected = sel?.target === id && sel.index === i;
|
||||
return (
|
||||
<div className="dv-slot" key={i}>
|
||||
<div className={`dv-slot${t.revealed ? ' open' : ''}`} key={i}>
|
||||
<button
|
||||
type="button"
|
||||
className={`dv-pick${can ? ' can' : ''}${selected ? ' sel' : ''}`}
|
||||
@@ -368,7 +371,7 @@ function MyRow({
|
||||
const can = revealing && !t.revealed;
|
||||
return [
|
||||
gap(i),
|
||||
<div className="dv-slot" key={i}>
|
||||
<div className={`dv-slot${t.revealed ? ' open' : ''}`} key={i}>
|
||||
{can ? (
|
||||
<button type="button" className="dv-pick can" aria-label={`내 ${tileLabel(t, i, true)}, 눌러서 공개`} onClick={() => act({ type: 'revealOwn', index: i })}>
|
||||
<Tile color={t.color} n={t.n} revealed={t.revealed} mine size="lg" fx={fx.get(`${me}:${i}`)} />
|
||||
@@ -392,7 +395,7 @@ function MyRow({
|
||||
<span className="dv-mini white" style={{ outline: '2px dashed var(--primary)', outlineOffset: 1 }} /> 점선: 상대에게 숨김
|
||||
</span>
|
||||
<span>
|
||||
<span className="dv-mini white" style={{ boxShadow: 'inset 0 -4px 0 #f59e0b' }} /> 아래 노란 줄: 모두에게 공개됨
|
||||
<span className="dv-mini white" style={{ boxShadow: 'inset 0 -4px 0 #f59e0b' }} /> 반 칸 위 + 아래 노란 줄: 모두에게 공개됨
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -510,7 +513,7 @@ function ActionPanel({
|
||||
draw: '타일을 가져오는 중이에요',
|
||||
guess: '추리하는 중이에요',
|
||||
afterCorrect: '맞혔어요! 계속할지 고르는 중이에요',
|
||||
placeJoker: '조커를 넣을 자리를 고르는 중이에요',
|
||||
placeJoker: '타일을 놓는 중이에요', // never shown: the server hides this phase from the others
|
||||
revealOwn: '틀려서 자기 타일을 공개하는 중이에요',
|
||||
finished: '',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user