Skip to content

Commit 9dc2854

Browse files
popojanclaude
andcommitted
Simplify signature encoding: k = minute * P + N
Remove era cycling complexity from snow-clock.html and snow8-clock.html. The simple formula k = (minute * P + N) % PERIOD: - Matches hraj-si (which recorded the test video) - P detectable from k-delta between consecutive minutes - Full PERIOD preserved when P is coprime with 2 and 3 - No division-by-zero edge cases - Simpler code, no era length calculations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9bd2b62 commit 9dc2854

2 files changed

Lines changed: 17 additions & 58 deletions

File tree

web/snow-clock.html

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,10 @@
248248
}
249249

250250
function perm(minute, P, N) {
251-
let k;
252-
if (P <= 1n) {
253-
k = minute % CLOCK_PERIOD;
254-
} else {
255-
// Era length in minutes
256-
const eraLen = CLOCK_PERIOD / P;
257-
// Offset for this signature value
258-
const offset = (N % P) * eraLen;
259-
k = (minute + offset) % CLOCK_PERIOD;
260-
}
251+
// Signature encoding: k = minute * P + N
252+
// P detectable from k-delta between consecutive minutes
253+
// Full PERIOD preserved when P is coprime with 2 and 3
254+
let k = (minute * P + N) % CLOCK_PERIOD;
261255

262256
// Original 7-bit permutation algorithm
263257
let ret = [];
@@ -356,19 +350,9 @@
356350
if (sigP <= 1n) {
357351
eraInfo.textContent = 'Signature: disabled (P=1)';
358352
} else {
359-
const eraMinutes = CLOCK_PERIOD / sigP;
360-
const eraYears = Number(eraMinutes) / (60 * 24 * 365.25);
361-
let eraStr;
362-
if (eraYears >= 1e9) {
363-
eraStr = (eraYears / 1e9).toFixed(1) + ' billion years';
364-
} else if (eraYears >= 1e6) {
365-
eraStr = (eraYears / 1e6).toFixed(1) + ' million years';
366-
} else if (eraYears >= 1000) {
367-
eraStr = (eraYears / 1000).toFixed(1) + ' thousand years';
368-
} else {
369-
eraStr = eraYears.toFixed(1) + ' years';
370-
}
371-
eraInfo.innerHTML = `Signature: P=<span class="highlight">${sigP}</span> N=${sigN}<br>Era length: ${eraStr}`;
353+
// Simple formula: k = minute * P + N
354+
// P detectable from k-delta, full PERIOD preserved
355+
eraInfo.innerHTML = `Signature: P=<span class="highlight">${sigP}</span> N=${sigN}`;
372356
}
373357
}
374358

@@ -417,13 +401,10 @@
417401
el.style.backgroundColor = colors[cellWeight];
418402
}
419403

420-
// Update minute counter with era info
404+
// Update minute counter with signature info
421405
let counterText = `Minute: ${minute} | Second: ${currentSecond}`;
422406
if (sigP > 1n) {
423-
const eraLen = CLOCK_PERIOD / sigP;
424-
const localEra = (minute / eraLen) % sigP;
425-
const currentEra = (localEra + sigN) % sigP; // N is starting era
426-
counterText += ` | Era: ${currentEra}/${sigP}`;
407+
counterText += ` | Signature: N=${sigN}`;
427408
}
428409
document.getElementById('minuteCounter').textContent = counterText;
429410

web/snow8-clock.html

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,10 @@
316316
}
317317

318318
// Permutation function with signature encoding
319-
// For minute m, signature value N, period P:
320-
// k = (m + N * (CLOCK_PERIOD / P)) mod CLOCK_PERIOD
319+
// Simple formula: k = minute * P + N
320+
// P detectable from k-delta, full PERIOD preserved when P coprime with 2,3
321321
function perm(minute, P, N) {
322-
let k;
323-
if (P <= 1n) {
324-
k = minute % CLOCK_PERIOD;
325-
} else {
326-
// Era length in minutes
327-
const eraLen = CLOCK_PERIOD / P;
328-
// Offset for this signature value
329-
const offset = (N % P) * eraLen;
330-
k = (minute + offset) % CLOCK_PERIOD;
331-
}
322+
let k = (minute * P + N) % CLOCK_PERIOD;
332323

333324
// Convert to combo indices
334325
let ret = [];
@@ -373,19 +364,9 @@
373364
if (sigP <= 1n) {
374365
eraInfo.textContent = 'Signature: disabled (P=1)';
375366
} else {
376-
const eraMinutes = CLOCK_PERIOD / sigP;
377-
const eraYears = Number(eraMinutes) / (60 * 24 * 365.25);
378-
let eraStr;
379-
if (eraYears >= 1e9) {
380-
eraStr = (eraYears / 1e9).toFixed(1) + ' billion years';
381-
} else if (eraYears >= 1e6) {
382-
eraStr = (eraYears / 1e6).toFixed(1) + ' million years';
383-
} else if (eraYears >= 1000) {
384-
eraStr = (eraYears / 1000).toFixed(1) + ' thousand years';
385-
} else {
386-
eraStr = eraYears.toFixed(1) + ' years';
387-
}
388-
eraInfo.innerHTML = `Signature: P=<span class="highlight">${sigP}</span> N=${sigN}<br>Era length: ${eraStr}`;
367+
// Simple formula: k = minute * P + N
368+
// P detectable from k-delta, full PERIOD preserved
369+
eraInfo.innerHTML = `Signature: P=<span class="highlight">${sigP}</span> N=${sigN}`;
389370
}
390371
}
391372

@@ -434,13 +415,10 @@
434415
el.style.backgroundColor = colors[cellWeight];
435416
}
436417

437-
// Update minute counter with era info
418+
// Update minute counter with signature info
438419
let counterText = `Minute: ${minute} | Second: ${currentSecond}`;
439420
if (sigP > 1n) {
440-
const eraLen = CLOCK_PERIOD / sigP;
441-
const localEra = (minute / eraLen) % sigP;
442-
const currentEra = (localEra + sigN) % sigP; // N is starting era
443-
counterText += ` | Era: ${currentEra}/${sigP}`;
421+
counterText += ` | Signature: N=${sigN}`;
444422
}
445423
document.getElementById('minuteCounter').textContent = counterText;
446424

0 commit comments

Comments
 (0)