| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| const SACRED_WORDS = [ |
| |
| 'SOVEREIGN', 'TRUTH', 'GATE', 'SEAL', 'ORACLE', 'VOID', 'KINGDOM', |
| 'WISDOM', 'SPIRIT', 'FIRE', 'LIGHT', 'WORD', 'PATH', 'NAME', |
| |
| 'PROLOG', 'QUBIT', 'QUANTUM', 'TRUST', 'LEAN', 'MAMBA', 'WORM', |
| 'NIL', 'ADA', 'PLANNER', 'ACTOR', 'HEWITT', 'PATTERN', 'MATCH', |
| |
| 'LIL', 'ARN', 'ZOM', 'PAZ', 'LIT', 'MAZ', 'DEO', 'ZID', |
| |
| 'NUN', 'YAA', 'LAM', 'QAF', 'WAW', 'BAA', |
| ] |
|
|
| |
| const ABJAD = { |
| A:1,B:2,J:3,D:4,H:5,W:6,Z:7,X:8,T:9,Y:10, |
| K:20,L:30,M:40,N:50,S:60,E:70,F:80,P:90,Q:100, |
| R:200,SH:300,TH:400 |
| } |
|
|
| function abjadWeight(word) { |
| return [...word.toUpperCase()].reduce((sum, ch) => sum + (ABJAD[ch] || ch.charCodeAt(0) % 10), 0) |
| } |
|
|
| |
| |
| const GOD_BAD_BITS = 4 |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export function holyc_nil(quantumBytes, kbdTimingMs = Date.now()) { |
| if (!quantumBytes || quantumBytes.length === 0) { |
| return { state: 'NIL', word: null, reason: 'no_entropy', abjad: 910 } |
| } |
|
|
| |
| const kbdEntropy = (kbdTimingMs >> GOD_BAD_BITS) & 0xFFFF |
| const merged = quantumBytes.map((b, i) => b ^ ((kbdEntropy >> (i % 16)) & 0xFF)) |
|
|
| const mean = merged.reduce((s, b) => s + b, 0) / merged.length |
| const spread = Math.max(...merged) - Math.min(...merged) |
|
|
| |
| |
| if (mean < 25) { |
| return { |
| state: 'NIL', |
| word: null, |
| reason: 'entropy_below_threshold', |
| mean, |
| spread, |
| abjad: 910, |
| shifted: mean >> GOD_BAD_BITS, |
| raw_bytes: quantumBytes.slice(0, 4), |
| merged_bytes: merged.slice(0, 4), |
| } |
| } |
|
|
| |
| |
| const index = Math.floor((merged[0] / 255) * SACRED_WORDS.length) % SACRED_WORDS.length |
| const word = SACRED_WORDS[index] |
| const weight = abjadWeight(word) |
|
|
| |
| |
| const deeIndex = (index ^ (kbdEntropy & 0xFF)) % SACRED_WORDS.length |
| const deeWord = SACRED_WORDS[deeIndex] |
|
|
| return { |
| state: 'WORD', |
| word, |
| dee_word: deeWord, |
| reason: 'entropy_sufficient', |
| mean, |
| spread, |
| abjad: weight, |
| shifted: Math.floor(mean) >> GOD_BAD_BITS, |
| raw_bytes: quantumBytes.slice(0, 4), |
| merged_bytes: merged.slice(0, 4), |
| |
| |
| virtue: weight >= 100 ? 'HIGH' : weight >= 50 ? 'MEDIUM' : 'LOW', |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| export function holyc_oracle_batch(quantumBytes, n = 4) { |
| const results = [] |
| for (let i = 0; i < n; i++) { |
| const shifted = quantumBytes.map((b, j) => b ^ (i * 37 + j) & 0xFF) |
| results.push(holyc_nil(shifted, Date.now() + i * 1000)) |
| } |
| return { |
| consultations: results, |
| words: results.filter(r => r.state === 'WORD').map(r => r.word), |
| nils: results.filter(r => r.state === 'NIL').length, |
| verdict: results.filter(r => r.state === 'WORD').length >= Math.ceil(n / 2) |
| ? 'ORACLE_SPEAKS' |
| : 'ORACLE_SILENT', |
| } |
| } |
|
|
| |
|
|
| if (process.argv[1]?.endsWith('holyc_nil.mjs')) { |
| console.log('\n HolyC NIL β Ground State Oracle\n') |
|
|
| const NIL_bytes = new Uint8Array([3, 1, 8, 2, 5, 4, 7, 3]) |
| const WORD_bytes = new Uint8Array([200, 180, 220, 190, 210, 175, 240, 160]) |
|
|
| console.log(' Low entropy (NIL expected):') |
| const nil = holyc_nil(NIL_bytes) |
| console.log(` state: ${nil.state}`) |
| console.log(` abjad: ${nil.abjad} (inverted maximum β omega looping to alpha)`) |
| console.log(` mean: ${nil.mean?.toFixed(2)}`) |
| console.log() |
|
|
| console.log(' High entropy (WORD expected):') |
| const word = holyc_nil(WORD_bytes) |
| console.log(` state: ${word.state}`) |
| console.log(` word: ${word.word}`) |
| console.log(` dee: ${word.dee_word} (keyboard-shifted variant)`) |
| console.log(` abjad: ${word.abjad}`) |
| console.log(` virtue: ${word.virtue}`) |
| console.log() |
|
|
| console.log(' Batch oracle (4 consultations):') |
| const batch = holyc_oracle_batch(WORD_bytes) |
| console.log(` words: ${batch.words.join(', ')}`) |
| console.log(` nils: ${batch.nils}`) |
| console.log(` verdict: ${batch.verdict}`) |
| console.log() |
| } |
|
|