LordXido commited on
Commit
f1eacbc
·
verified ·
1 Parent(s): 8ced202

Create engine.js

Browse files
Files changed (1) hide show
  1. engine.js +65 -0
engine.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const logEl = document.getElementById("log");
2
+ const psiInput = document.getElementById("psiInput");
3
+ const orbits = document.getElementById("orbits");
4
+ const core = document.getElementById("core");
5
+
6
+ const log = msg => {
7
+ logEl.innerHTML += msg + "<br>";
8
+ logEl.scrollTop = logEl.scrollHeight;
9
+ };
10
+
11
+ /* Ξ State (Hybrid Continuous / Discrete) */
12
+ let Xi = {
13
+ r: 40,
14
+ theta: 0,
15
+ omega: 0,
16
+ iter: 0,
17
+ psiStrength: 1
18
+ };
19
+
20
+ /* Spawn VM Processes (Orbit Nodes) */
21
+ const NODE_COUNT = 12;
22
+ for (let i = 0; i < NODE_COUNT; i++) {
23
+ const c = document.createElementNS("http://www.w3.org/2000/svg", "circle");
24
+ c.setAttribute("r", 4);
25
+ c.setAttribute("fill", "#00ffcc");
26
+ orbits.appendChild(c);
27
+ }
28
+
29
+ /* Core Evolution Step */
30
+ function step() {
31
+ Xi.iter++;
32
+
33
+ /* Ω memory + Φ structure */
34
+ Xi.theta += 0.01 * Xi.psiStrength;
35
+ Xi.omega = Math.sin(Xi.iter * 0.05);
36
+ Xi.r = 40 + 10 * Math.sin(Xi.theta);
37
+
38
+ [...orbits.children].forEach((node, i) => {
39
+ const angle = Xi.theta + i * (2 * Math.PI / NODE_COUNT);
40
+ node.setAttribute("cx", Math.cos(angle) * Xi.r);
41
+ node.setAttribute("cy", Math.sin(angle) * Xi.r);
42
+ });
43
+
44
+ core.setAttribute("r", 35 + 6 * Xi.omega);
45
+ }
46
+
47
+ /* Intent Injection (Ψ syscall) */
48
+ psiInput.addEventListener("keydown", e => {
49
+ if (e.key === "Enter") {
50
+ const psi = psiInput.value.trim();
51
+ if (!psi) return;
52
+
53
+ Xi.psiStrength = Math.max(0.5, Math.min(3, psi.length * 0.1));
54
+ log(`Ψ(t) injected → "${psi}"`);
55
+ psiInput.value = "";
56
+ }
57
+ });
58
+
59
+ /* VM Clock */
60
+ setInterval(step, 30);
61
+
62
+ /* Boot */
63
+ log("System booted.");
64
+ log("Virtual machine online.");
65
+ log("Awaiting Ψ(t) …");