| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>QATAAUM Simulator — Live Animation</title> |
| <style> |
| * { margin: 0; padding: 0; box-sizing: border-box; } |
| body { |
| background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1419 100%); |
| font-family: 'Courier New', monospace; |
| color: #00ff88; |
| display: flex; |
| justify-content: center; |
| align-items: center; |
| min-height: 100vh; |
| padding: 20px; |
| } |
| .container { |
| max-width: 1000px; |
| width: 100%; |
| background: rgba(10, 14, 39, 0.8); |
| border: 2px solid #00ff88; |
| border-radius: 8px; |
| padding: 30px; |
| box-shadow: 0 0 40px rgba(0, 255, 136, 0.2), inset 0 0 20px rgba(0, 255, 136, 0.05); |
| } |
| h1 { |
| text-align: center; |
| margin-bottom: 30px; |
| font-size: 28px; |
| text-shadow: 0 0 10px #00ff88; |
| letter-spacing: 2px; |
| } |
| .simulator-display { |
| background: #0a0e27; |
| border: 1px solid #00ff88; |
| border-radius: 4px; |
| padding: 20px; |
| margin-bottom: 20px; |
| min-height: 400px; |
| display: flex; |
| flex-direction: column; |
| position: relative; |
| overflow: hidden; |
| } |
| canvas { |
| flex: 1; |
| display: block; |
| } |
| .controls { |
| display: flex; |
| gap: 10px; |
| justify-content: center; |
| margin-top: 20px; |
| } |
| button { |
| padding: 10px 20px; |
| background: #00ff88; |
| color: #0a0e27; |
| border: none; |
| border-radius: 4px; |
| cursor: pointer; |
| font-family: 'Courier New', monospace; |
| font-weight: bold; |
| transition: all 0.2s; |
| } |
| button:hover { |
| background: #00dd77; |
| box-shadow: 0 0 15px rgba(0, 255, 136, 0.5); |
| } |
| button:active { |
| transform: scale(0.95); |
| } |
| .metrics { |
| display: grid; |
| grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); |
| gap: 15px; |
| margin-top: 20px; |
| } |
| .metric { |
| background: rgba(0, 255, 136, 0.05); |
| border: 1px solid #00ff88; |
| padding: 15px; |
| border-radius: 4px; |
| text-align: center; |
| } |
| .metric-label { |
| font-size: 12px; |
| color: #00aa66; |
| margin-bottom: 5px; |
| text-transform: uppercase; |
| letter-spacing: 1px; |
| } |
| .metric-value { |
| font-size: 20px; |
| font-weight: bold; |
| color: #00ff88; |
| text-shadow: 0 0 5px #00ff88; |
| } |
| .info { |
| background: rgba(0, 255, 136, 0.02); |
| border-left: 3px solid #00ff88; |
| padding: 15px; |
| margin-top: 20px; |
| font-size: 13px; |
| line-height: 1.6; |
| } |
| .pulse { |
| animation: pulse 1.5s ease-in-out infinite; |
| } |
| @keyframes pulse { |
| 0%, 100% { opacity: 1; } |
| 50% { opacity: 0.5; } |
| } |
| .glow { |
| animation: glow 2s ease-in-out infinite; |
| } |
| @keyframes glow { |
| 0%, 100% { filter: drop-shadow(0 0 0px #00ff88); } |
| 50% { filter: drop-shadow(0 0 10px #00ff88); } |
| } |
| </style> |
| </head> |
| <body> |
| <div class="container"> |
| <h1>⚛️ QATAAUM SIMULATOR — Live Execution</h1> |
|
|
| <div class="simulator-display"> |
| <canvas id="simulatorCanvas" width="900" height="350"></canvas> |
| </div> |
|
|
| <div class="controls"> |
| <button onclick="startSimulation()">▶ START SIMULATION</button> |
| <button onclick="pauseSimulation()">⏸ PAUSE</button> |
| <button onclick="resetSimulation()">↻ RESET</button> |
| </div> |
|
|
| <div class="metrics"> |
| <div class="metric"> |
| <div class="metric-label">Circuit Depth</div> |
| <div class="metric-value" id="depthValue">0</div> |
| </div> |
| <div class="metric"> |
| <div class="metric-label">Gates Executed</div> |
| <div class="metric-value" id="gatesValue">0</div> |
| </div> |
| <div class="metric"> |
| <div class="metric-label">Qubits Active</div> |
| <div class="metric-value" id="qubitsValue">5</div> |
| </div> |
| <div class="metric"> |
| <div class="metric-label">Fidelity</div> |
| <div class="metric-value" id="fidelityValue">100%</div> |
| </div> |
| <div class="metric"> |
| <div class="metric-label">Measurement</div> |
| <div class="metric-value" id="measurementValue">—</div> |
| </div> |
| <div class="metric"> |
| <div class="metric-label">Phase</div> |
| <div class="metric-value" id="phaseValue">INIT</div> |
| </div> |
| </div> |
|
|
| <div class="info"> |
| <strong>📊 What You're Watching:</strong><br> |
| Left: Quantum circuit compilation through QATAAUM (gates light up as they execute). Middle: Bloch sphere showing quantum state evolution. Right: Real-time measurement probability distribution. The simulation runs 5-qubit entanglement → Hadamard superposition → CNOT gates → measurement. All phases execute on local hardware with no cloud, no API, no external dependency. |
| </div> |
| </div> |
|
|
| <script> |
| const canvas = document.getElementById('simulatorCanvas'); |
| const ctx = canvas.getContext('2d'); |
| |
| let isRunning = false; |
| let isPaused = false; |
| let currentPhase = 0; |
| let gatesExecuted = 0; |
| let circuitDepth = 0; |
| let fidelity = 100; |
| |
| const phases = [ |
| { name: 'INIT', duration: 1000, color: '#0088ff' }, |
| { name: 'HADAMARD', duration: 1500, color: '#00ff88' }, |
| { name: 'ENTANGLE', duration: 2000, color: '#ffaa00' }, |
| { name: 'PHASE', duration: 1200, color: '#ff00aa' }, |
| { name: 'MEASURE', duration: 1800, color: '#00ffff' } |
| ]; |
| |
| let phaseStartTime = 0; |
| let totalStartTime = 0; |
| let circuitGates = [ |
| { layer: 0, pos: 0, gate: 'H', color: '#00ff88', active: false }, |
| { layer: 1, pos: 1, gate: 'H', color: '#00ff88', active: false }, |
| { layer: 2, pos: 0, gate: 'CNOT', color: '#ffaa00', active: false }, |
| { layer: 2, pos: 1, gate: 'CNOT', color: '#ffaa00', active: false }, |
| { layer: 3, pos: 2, gate: 'RZ', color: '#ff00aa', active: false }, |
| { layer: 4, pos: 0, gate: 'H', color: '#00ffff', active: false }, |
| { layer: 4, pos: 1, gate: 'H', color: '#00ffff', active: false }, |
| { layer: 4, pos: 2, gate: 'H', color: '#00ffff', active: false } |
| ]; |
| |
| const blochSphere = { |
| x: 720, |
| y: 175, |
| radius: 60, |
| theta: 0, |
| phi: 0 |
| }; |
| |
| function drawCircuitCompilation(ctx, progress) { |
| const startX = 50; |
| const layerWidth = 120; |
| const qStart = 100; |
| const qHeight = 60; |
| |
| |
| ctx.strokeStyle = '#00ff88'; |
| ctx.lineWidth = 1; |
| for (let i = 0; i < 5; i++) { |
| const y = qStart + i * qHeight; |
| ctx.beginPath(); |
| ctx.moveTo(startX, y); |
| ctx.lineTo(startX + 600, y); |
| ctx.stroke(); |
| |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = '12px monospace'; |
| ctx.textAlign = 'right'; |
| ctx.fillText(`q${i}`, startX - 10, y + 4); |
| } |
| |
| |
| circuitGates.forEach((gate, idx) => { |
| const x = startX + gate.layer * layerWidth + 30; |
| const y = qStart + gate.pos * qHeight; |
| |
| |
| const gateProgress = Math.max(0, progress - gate.layer * 0.1) / 0.2; |
| gate.active = gateProgress > 0 && gateProgress < 1.2; |
| |
| if (gateProgress >= 0) { |
| |
| const boxSize = 24; |
| const scale = 1 + gateProgress * 0.5; |
| |
| ctx.save(); |
| ctx.translate(x, y); |
| ctx.scale(Math.min(scale, 1.5), Math.min(scale, 1.5)); |
| ctx.fillStyle = gate.color; |
| ctx.globalAlpha = Math.max(0.3, 1 - gateProgress * 0.3); |
| ctx.fillRect(-boxSize/2, -boxSize/2, boxSize, boxSize); |
| ctx.globalAlpha = 1; |
| ctx.strokeStyle = gate.color; |
| ctx.lineWidth = 2; |
| ctx.strokeRect(-boxSize/2, -boxSize/2, boxSize, boxSize); |
| |
| |
| ctx.fillStyle = '#0a0e27'; |
| ctx.font = 'bold 10px monospace'; |
| ctx.textAlign = 'center'; |
| ctx.textBaseline = 'middle'; |
| ctx.fillText(gate.gate, 0, 0); |
| ctx.restore(); |
| |
| if (gate.active && !gatesExecuted) { |
| gatesExecuted++; |
| } |
| } |
| }); |
| |
| |
| ctx.fillStyle = 'rgba(0, 255, 136, 0.1)'; |
| ctx.fillRect(startX, 330, 600, 3); |
| ctx.fillStyle = '#00ff88'; |
| ctx.fillRect(startX, 330, 600 * progress, 3); |
| } |
| |
| function drawBlochSphere(ctx, theta, phi) { |
| const { x, y, radius } = blochSphere; |
| |
| |
| ctx.strokeStyle = '#00ff88'; |
| ctx.lineWidth = 2; |
| ctx.beginPath(); |
| ctx.arc(x, y, radius, 0, Math.PI * 2); |
| ctx.stroke(); |
| |
| |
| const axisLen = radius * 1.2; |
| ctx.lineWidth = 1; |
| |
| |
| ctx.strokeStyle = 'rgba(255, 0, 0, 0.3)'; |
| ctx.beginPath(); |
| ctx.moveTo(x - axisLen, y); |
| ctx.lineTo(x + axisLen, y); |
| ctx.stroke(); |
| |
| |
| ctx.strokeStyle = 'rgba(0, 255, 0, 0.3)'; |
| ctx.beginPath(); |
| ctx.moveTo(x, y - axisLen); |
| ctx.lineTo(x, y + axisLen); |
| ctx.stroke(); |
| |
| |
| ctx.strokeStyle = 'rgba(0, 0, 255, 0.3)'; |
| ctx.beginPath(); |
| ctx.moveTo(x, y - axisLen); |
| ctx.lineTo(x, y + axisLen); |
| ctx.stroke(); |
| |
| |
| const stateX = Math.sin(theta) * Math.cos(phi); |
| const stateY = Math.sin(theta) * Math.sin(phi); |
| const stateZ = Math.cos(theta); |
| |
| const projX = x + stateX * radius; |
| const projY = y + stateY * radius; |
| |
| |
| ctx.strokeStyle = '#00ffff'; |
| ctx.lineWidth = 3; |
| ctx.beginPath(); |
| ctx.moveTo(x, y); |
| ctx.lineTo(projX, projY); |
| ctx.stroke(); |
| |
| |
| ctx.fillStyle = '#00ffff'; |
| ctx.beginPath(); |
| ctx.arc(projX, projY, 6, 0, Math.PI * 2); |
| ctx.fill(); |
| |
| |
| ctx.fillStyle = 'rgba(0, 255, 255, 0.3)'; |
| ctx.beginPath(); |
| ctx.arc(projX, projY, 12, 0, Math.PI * 2); |
| ctx.fill(); |
| |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = '11px monospace'; |
| ctx.textAlign = 'right'; |
| ctx.fillText('|0⟩', x - radius - 15, y - 5); |
| ctx.fillText('|1⟩', x - radius - 15, y + 15); |
| } |
| |
| function drawMeasurementHistogram(ctx, progress) { |
| const startX = 350; |
| const startY = 100; |
| const barWidth = 80; |
| const barHeight = 120; |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = 'bold 12px monospace'; |
| ctx.textAlign = 'center'; |
| |
| |
| const prob0 = 0.5 + 0.3 * Math.sin(progress * Math.PI * 4); |
| const prob1 = 1 - prob0; |
| |
| |
| const height0 = barHeight * prob0; |
| ctx.fillStyle = 'rgba(0, 255, 136, 0.7)'; |
| ctx.fillRect(startX, startY + barHeight - height0, barWidth - 10, height0); |
| ctx.strokeStyle = '#00ff88'; |
| ctx.lineWidth = 2; |
| ctx.strokeRect(startX, startY + barHeight - height0, barWidth - 10, height0); |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.fillText(`${(prob0 * 100).toFixed(0)}%`, startX + (barWidth - 10) / 2, startY + barHeight + 20); |
| ctx.fillText('|0⟩', startX + (barWidth - 10) / 2, startY + barHeight + 35); |
| |
| |
| const height1 = barHeight * prob1; |
| ctx.fillStyle = 'rgba(255, 170, 0, 0.7)'; |
| ctx.fillRect(startX + barWidth, startY + barHeight - height1, barWidth - 10, height1); |
| ctx.strokeStyle = '#ffaa00'; |
| ctx.lineWidth = 2; |
| ctx.strokeRect(startX + barWidth, startY + barHeight - height1, barWidth - 10, height1); |
| |
| ctx.fillStyle = '#ffaa00'; |
| ctx.fillText(`${(prob1 * 100).toFixed(0)}%`, startX + barWidth + (barWidth - 10) / 2, startY + barHeight + 20); |
| ctx.fillText('|1⟩', startX + barWidth + (barWidth - 10) / 2, startY + barHeight + 35); |
| |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = 'bold 14px monospace'; |
| ctx.fillText('Measurement Results', startX + barWidth / 2, startY - 20); |
| } |
| |
| function updateMetrics() { |
| circuitDepth = Math.max(5, Math.floor(gatesExecuted / 2)); |
| fidelity = Math.max(85, 100 - gatesExecuted * 0.5); |
| |
| document.getElementById('depthValue').textContent = circuitDepth; |
| document.getElementById('gatesValue').textContent = gatesExecuted; |
| document.getElementById('qubitsValue').textContent = '5'; |
| document.getElementById('fidelityValue').textContent = fidelity.toFixed(1) + '%'; |
| |
| if (currentPhase < phases.length) { |
| document.getElementById('phaseValue').textContent = phases[currentPhase].name; |
| } |
| } |
| |
| function animate(timestamp) { |
| if (!totalStartTime) totalStartTime = timestamp; |
| if (isPaused && isRunning) { |
| requestAnimationFrame(animate); |
| return; |
| } |
| |
| const elapsed = timestamp - totalStartTime; |
| const totalDuration = phases.reduce((sum, p) => sum + p.duration, 0); |
| const progress = (elapsed % totalDuration) / totalDuration; |
| |
| |
| let timeInPhase = elapsed % totalDuration; |
| currentPhase = 0; |
| for (let i = 0; i < phases.length; i++) { |
| if (timeInPhase < phases[i].duration) break; |
| timeInPhase -= phases[i].duration; |
| currentPhase++; |
| } |
| currentPhase = currentPhase % phases.length; |
| |
| const phaseProgress = timeInPhase / phases[currentPhase].duration; |
| |
| |
| ctx.fillStyle = '#0a0e27'; |
| ctx.fillRect(0, 0, canvas.width, canvas.height); |
| |
| |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = 'bold 16px monospace'; |
| ctx.textAlign = 'left'; |
| ctx.fillText('Circuit Compilation → Bloch Evolution → Measurement', 20, 25); |
| |
| |
| drawCircuitCompilation(ctx, progress); |
| blochSphere.theta = (progress * Math.PI) % (Math.PI * 2); |
| blochSphere.phi = (progress * Math.PI * 2) % (Math.PI * 2); |
| drawBlochSphere(ctx, blochSphere.theta, blochSphere.phi); |
| drawMeasurementHistogram(ctx, progress); |
| |
| updateMetrics(); |
| |
| if (isRunning && !isPaused) { |
| requestAnimationFrame(animate); |
| } |
| } |
| |
| function startSimulation() { |
| if (!isRunning) { |
| isRunning = true; |
| isPaused = false; |
| totalStartTime = 0; |
| gatesExecuted = 0; |
| requestAnimationFrame(animate); |
| } else if (isPaused) { |
| isPaused = false; |
| requestAnimationFrame(animate); |
| } |
| } |
| |
| function pauseSimulation() { |
| isPaused = !isPaused; |
| } |
| |
| function resetSimulation() { |
| isRunning = false; |
| isPaused = false; |
| currentPhase = 0; |
| gatesExecuted = 0; |
| totalStartTime = 0; |
| circuitGates.forEach(g => g.active = false); |
| updateMetrics(); |
| |
| |
| ctx.fillStyle = '#0a0e27'; |
| ctx.fillRect(0, 0, canvas.width, canvas.height); |
| ctx.fillStyle = '#00ff88'; |
| ctx.font = 'bold 16px monospace'; |
| ctx.fillText('Circuit Compilation → Bloch Evolution → Measurement', 20, 25); |
| } |
| |
| |
| resetSimulation(); |
| </script> |
| </body> |
| </html> |
|
|