47 lines
2.9 KiB
JavaScript
47 lines
2.9 KiB
JavaScript
// ★ 最终读数:【全部出自引擎自己的 kai】—— 不是复算,是产物。
|
||
import { DYNASTIES, computeRank, computeAxes } from '../src/dynasties.js';
|
||
import { SUB_REGISTRY } from '../src/talents.js';
|
||
const SUBS = SUB_REGISTRY.map((s) => s.id);
|
||
const WANGS = [0, 29, 30, 54, 55, 74, 75, 100];
|
||
const S = {}; const P = {};
|
||
for (const d of DYNASTIES) {
|
||
S[d.id] = {}; P[d.id] = { noRoad: 0, hasKai: 0 };
|
||
for (const c of d.channels) S[d.id][c.id] = { n: c.name, open: 0, walk: 0, not: 0, tier: 0, ceiling: 0, lex: 0, idx: 0, unsorted: 0 };
|
||
}
|
||
const t0 = Date.now();
|
||
for (let m = 0; m < (1 << 16); m++) {
|
||
const subs = []; for (let i = 0; i < 16; i++) if (m & (1 << i)) subs.push(SUBS[i]);
|
||
const axes = computeAxes(subs);
|
||
for (const wang of WANGS) for (const d of DYNASTIES) {
|
||
const r = computeRank({ axes, wang }, d.id);
|
||
if (!r.channel) { P[d.id].noRoad++; continue; }
|
||
if (r.kai.length > 1) P[d.id].hasKai++;
|
||
for (const k of r.kai) {
|
||
const s = S[d.id][k.channelId];
|
||
s.open++;
|
||
if (k.walked) s.walk++; else { s.not++; s[k.lostAt]++; }
|
||
}
|
||
}
|
||
}
|
||
const secs = ((Date.now() - t0) / 1000).toFixed(0);
|
||
const TOT = (1 << 16) * WANGS.length;
|
||
const pad = (s, n) => String(s).padEnd(n), num = (s, n) => String(s).padStart(n);
|
||
console.log(`\n══ 引擎自产读数(r.kai):${TOT.toLocaleString()} × ${DYNASTIES.length} 朝 = ${(TOT * DYNASTIES.length).toLocaleString()} 格 / ${secs}s ══\n`);
|
||
console.log(pad('朝/通道', 24) + num('开着', 9) + num('走了', 9) + num('开着没走', 10) + ' │' + num('tier', 8) + num('ceiling', 9) + num('lex', 9) + num('_idx', 9) + num('unsorted', 9));
|
||
console.log('─'.repeat(97));
|
||
const G = { tier: 0, ceiling: 0, lex: 0, idx: 0, unsorted: 0, not: 0 };
|
||
for (const d of DYNASTIES) {
|
||
for (const c of d.channels) {
|
||
const s = S[d.id][c.id];
|
||
for (const k of ['tier', 'ceiling', 'lex', 'idx', 'unsorted', 'not']) G[k] += s[k];
|
||
console.log(pad(`${d.id}/${c.id}`, 24) + num(s.open.toLocaleString(), 9) + num(s.walk.toLocaleString(), 9) + num(s.not.toLocaleString(), 10) +
|
||
' │' + num(s.tier.toLocaleString(), 8) + num(s.ceiling.toLocaleString(), 9) + num(s.lex.toLocaleString(), 9) + num(s.idx.toLocaleString(), 9) + num(s.unsorted, 9));
|
||
}
|
||
console.log(pad(` ↳ ${d.name}`, 24) + `一条路都不开 ${P[d.id].noRoad.toLocaleString()} 有【开着没走】的 ${P[d.id].hasKai.toLocaleString()} (${(P[d.id].hasKai / TOT * 100).toFixed(1)}%)\n`);
|
||
}
|
||
const H = Object.values(P).reduce((a, x) => a + x.hasKai, 0);
|
||
console.log(`【总计】${(TOT * DYNASTIES.length).toLocaleString()} 格中 ${H.toLocaleString()} 格(${(H / (TOT * DYNASTIES.length) * 100).toFixed(1)}%)至少有一条【开着但没走】的路。`);
|
||
console.log(`【输在哪一级】共 ${G.not.toLocaleString()} 条次:`);
|
||
for (const k of ['ceiling', 'tier', 'lex', 'idx', 'unsorted'])
|
||
console.log(` ${pad(k, 10)} ${num(G[k].toLocaleString(), 11)} (${(G[k] / G.not * 100).toFixed(1)}%)`);
|