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
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Quantum Simulator</title>
|
7 |
+
<style>
|
8 |
+
* {
|
9 |
+
margin: 0;
|
10 |
+
padding: 0;
|
11 |
+
box-sizing: border-box;
|
12 |
+
font-family: 'Arial', sans-serif;
|
13 |
+
}
|
14 |
+
|
15 |
+
body {
|
16 |
+
background: #000;
|
17 |
+
color: #fff;
|
18 |
+
min-height: 100vh;
|
19 |
+
display: flex;
|
20 |
+
flex-direction: column;
|
21 |
+
align-items: center;
|
22 |
+
padding: 2rem;
|
23 |
+
}
|
24 |
+
|
25 |
+
.controls {
|
26 |
+
margin: 2rem 0;
|
27 |
+
display: flex;
|
28 |
+
gap: 1rem;
|
29 |
+
flex-wrap: wrap;
|
30 |
+
justify-content: center;
|
31 |
+
}
|
32 |
+
|
33 |
+
button {
|
34 |
+
padding: 0.5rem 1rem;
|
35 |
+
background: #333;
|
36 |
+
color: #fff;
|
37 |
+
border: 1px solid #666;
|
38 |
+
border-radius: 4px;
|
39 |
+
cursor: pointer;
|
40 |
+
transition: all 0.3s;
|
41 |
+
}
|
42 |
+
|
43 |
+
button:hover {
|
44 |
+
background: #444;
|
45 |
+
}
|
46 |
+
|
47 |
+
#quantumCanvas {
|
48 |
+
border: 1px solid #333;
|
49 |
+
background: rgba(0, 0, 0, 0.8);
|
50 |
+
}
|
51 |
+
|
52 |
+
.particles {
|
53 |
+
position: relative;
|
54 |
+
width: 800px;
|
55 |
+
height: 400px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.particle {
|
59 |
+
position: absolute;
|
60 |
+
width: 4px;
|
61 |
+
height: 4px;
|
62 |
+
background: #fff;
|
63 |
+
border-radius: 50%;
|
64 |
+
filter: blur(1px);
|
65 |
+
}
|
66 |
+
|
67 |
+
.info-panel {
|
68 |
+
margin-top: 2rem;
|
69 |
+
padding: 1rem;
|
70 |
+
background: rgba(51, 51, 51, 0.5);
|
71 |
+
border-radius: 8px;
|
72 |
+
font-size: 0.9rem;
|
73 |
+
}
|
74 |
+
|
75 |
+
.quantum-stats {
|
76 |
+
display: grid;
|
77 |
+
grid-template-columns: repeat(2, 1fr);
|
78 |
+
gap: 1rem;
|
79 |
+
margin-top: 1rem;
|
80 |
+
}
|
81 |
+
</style>
|
82 |
+
</head>
|
83 |
+
<body>
|
84 |
+
<h1>Quantum Particle Simulator</h1>
|
85 |
+
|
86 |
+
<div class="controls">
|
87 |
+
<button onclick="toggleSimulation()">Start/Stop</button>
|
88 |
+
<button onclick="addParticle()">Add Particle</button>
|
89 |
+
<button onclick="changeEntanglement()">Toggle Entanglement</button>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<canvas id="quantumCanvas" width="800" height="400"></canvas>
|
93 |
+
|
94 |
+
<div class="info-panel">
|
95 |
+
<div class="quantum-stats">
|
96 |
+
<div>Particles: <span id="particleCount">0</span></div>
|
97 |
+
<div>Entangled Pairs: <span id="entangledCount">0</span></div>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<script>
|
102 |
+
const canvas = document.getElementById('quantumCanvas');
|
103 |
+
const ctx = canvas.getContext('2d');
|
104 |
+
let particles = [];
|
105 |
+
let isRunning = false;
|
106 |
+
let entanglementEnabled = false;
|
107 |
+
|
108 |
+
class QuantumParticle {
|
109 |
+
constructor(x, y) {
|
110 |
+
this.x = x;
|
111 |
+
this.y = y;
|
112 |
+
this.vx = (Math.random() - 0.5) * 4;
|
113 |
+
this.vy = (Math.random() - 0.5) * 4;
|
114 |
+
this.phase = Math.random() * Math.PI * 2;
|
115 |
+
this.entangled = null;
|
116 |
+
this.color = `hsl(${Math.random() * 360}, 100%, 70%)`;
|
117 |
+
}
|
118 |
+
|
119 |
+
update() {
|
120 |
+
this.x += this.vx;
|
121 |
+
this.y += this.vy;
|
122 |
+
this.phase += 0.1;
|
123 |
+
|
124 |
+
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
|
125 |
+
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
|
126 |
+
|
127 |
+
if (this.entangled) {
|
128 |
+
const dx = this.entangled.x - this.x;
|
129 |
+
const dy = this.entangled.y - this.y;
|
130 |
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
131 |
+
if (dist > 100) {
|
132 |
+
this.vx += dx * 0.001;
|
133 |
+
this.vy += dy * 0.001;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
draw() {
|
139 |
+
ctx.beginPath();
|
140 |
+
ctx.arc(this.x, this.y, 4 + Math.sin(this.phase) * 2, 0, Math.PI * 2);
|
141 |
+
ctx.fillStyle = this.color;
|
142 |
+
ctx.fill();
|
143 |
+
|
144 |
+
if (this.entangled) {
|
145 |
+
ctx.beginPath();
|
146 |
+
ctx.moveTo(this.x, this.y);
|
147 |
+
ctx.lineTo(this.entangled.x, this.entangled.y);
|
148 |
+
ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
|
149 |
+
ctx.stroke();
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
function addParticle() {
|
155 |
+
const particle = new QuantumParticle(
|
156 |
+
Math.random() * canvas.width,
|
157 |
+
Math.random() * canvas.height
|
158 |
+
);
|
159 |
+
particles.push(particle);
|
160 |
+
updateStats();
|
161 |
+
}
|
162 |
+
|
163 |
+
function changeEntanglement() {
|
164 |
+
entanglementEnabled = !entanglementEnabled;
|
165 |
+
if (entanglementEnabled) {
|
166 |
+
for (let i = 0; i < particles.length; i += 2) {
|
167 |
+
if (i + 1 < particles.length) {
|
168 |
+
particles[i].entangled = particles[i + 1];
|
169 |
+
particles[i + 1].entangled = particles[i];
|
170 |
+
}
|
171 |
+
}
|
172 |
+
} else {
|
173 |
+
particles.forEach(p => p.entangled = null);
|
174 |
+
}
|
175 |
+
updateStats();
|
176 |
+
}
|
177 |
+
|
178 |
+
function updateStats() {
|
179 |
+
document.getElementById('particleCount').textContent = particles.length;
|
180 |
+
document.getElementById('entangledCount').textContent =
|
181 |
+
particles.filter(p => p.entangled).length / 2;
|
182 |
+
}
|
183 |
+
|
184 |
+
function animate() {
|
185 |
+
if (!isRunning) return;
|
186 |
+
|
187 |
+
ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
|
188 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
189 |
+
|
190 |
+
particles.forEach(particle => {
|
191 |
+
particle.update();
|
192 |
+
particle.draw();
|
193 |
+
});
|
194 |
+
|
195 |
+
requestAnimationFrame(animate);
|
196 |
+
}
|
197 |
+
|
198 |
+
function toggleSimulation() {
|
199 |
+
isRunning = !isRunning;
|
200 |
+
if (isRunning) animate();
|
201 |
+
}
|
202 |
+
|
203 |
+
// Initialize with some particles
|
204 |
+
for (let i = 0; i < 10; i++) {
|
205 |
+
addParticle();
|
206 |
+
}
|
207 |
+
</script>
|
208 |
+
</body>
|
209 |
+
</html>
|