const logEl = document.getElementById("log"); const psiInput = document.getElementById("psiInput"); const svg = document.getElementById("svgEngine"); const log = msg => { logEl.innerHTML += msg + "
"; logEl.scrollTop = logEl.scrollHeight; }; // Initialize SVG Core + Nodes function makeSVGElem(tag, attrs) { const el = document.createElementNS("http://www.w3.org/2000/svg", tag); for (let k in attrs) el.setAttribute(k, attrs[k]); return el; } const core = makeSVGElem("circle", { cx: 0, cy: 0, r: 35, fill: "#00ffff" }); svg.appendChild(core); const nodesGroup = document.createElementNS("http://www.w3.org/2000/svg", "g"); svg.appendChild(nodesGroup); let nodes = []; const NODE_COUNT = 14; for (let i = 0; i < NODE_COUNT; i++) { const node = makeSVGElem("circle", { r: 5, fill: "#00ffcc" }); nodesGroup.appendChild(node); nodes.push(node); } let state = { theta: 0, iter: 0, psiStrength: 1 }; function stepEngine() { state.iter++; state.theta += 0.015 * state.psiStrength; const radius = 40 + 12 * Math.sin(state.theta); core.setAttribute("r", 30 + 6 * Math.sin(state.iter * 0.05)); nodes.forEach((n, idx) => { const angle = state.theta + (idx * 2 * Math.PI / nodes.length); n.setAttribute("cx", Math.cos(angle) * radius); n.setAttribute("cy", Math.sin(angle) * radius); }); } psiInput.addEventListener("keydown", e => { if (e.key === "Enter") { const psi = e.target.value.trim(); if (psi.length) { state.psiStrength = Math.min(3, Math.max(0.5, psi.length * 0.1)); log(`Ψ(t) injected: "${psi}"`); e.target.value = ""; } } }); setInterval(stepEngine, 40); log("System online. Awaiting Ψ(t) …");