/
LadyChat2015
/
stepik
Обзор
Документация
Войти
/
LadyChat2015
/
stepik
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
bell.html
341 строка
11 KB
LadyChat2015
upload files
01 мар 2026, 18:00
Верифицирован
01 мар 2026, 18:00
867504e
Код
Авторство
О чём код?
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Квантовый симулятор Белла</title> <style> /* Максимально простой, но рабочий стиль */ * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #0a0f1e; color: #00ffff; font-family: 'Courier New', monospace; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; } .container { background: #111827; border-radius: 20px; padding: 30px; max-width: 700px; width: 100%; border: 2px solid #00ffff; box-shadow: 0 0 30px #00ffff; } h1 { text-align: center; margin-bottom: 30px; font-size: 32px; text-shadow: 0 0 15px #00ffff; } .circuit { background: #0f172a; border-radius: 15px; padding: 40px 20px; margin-bottom: 30px; border: 1px solid #00ffff; position: relative; } .qubit { display: flex; align-items: center; height: 80px; position: relative; border-bottom: 1px dashed #00ffff33; } .qubit:last-child { border-bottom: none; } .qubit-label { width: 50px; font-size: 20px; font-weight: bold; color: #ff66ff; text-shadow: 0 0 10px #ff66ff; } .wire { flex: 1; height: 2px; background: #00ffff; box-shadow: 0 0 10px #00ffff; position: relative; } .gate { position: absolute; background: #1e2a3a; border: 2px solid #00ffff; border-radius: 8px; padding: 8px 15px; font-weight: bold; box-shadow: 0 0 15px #00ffff; } .gate-h { left: 150px; top: 20px; } .cnot-group { position: absolute; left: 280px; display: flex; flex-direction: column; align-items: center; } .cnot-dot { width: 20px; height: 20px; border-radius: 50%; background: #ff66ff; box-shadow: 0 0 15px #ff66ff; margin-bottom: 20px; } .cnot-line { width: 2px; height: 40px; background: #ff66ff; box-shadow: 0 0 10px #ff66ff; } .cnot-plus { width: 30px; height: 30px; border: 2px solid #ff66ff; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 20px; color: #ff66ff; margin-top: 20px; } .measure { position: absolute; right: 100px; background: #1e2a3a; border: 2px solid #00ffff; border-radius: 20px; padding: 8px 20px; box-shadow: 0 0 15px #00ffff; } .measure::before { content: "⚡"; margin-right: 5px; } button { width: 100%; padding: 20px; font-size: 24px; font-weight: bold; background: #00ffff; border: none; border-radius: 50px; color: #0a0f1e; cursor: pointer; font-family: 'Courier New', monospace; margin-bottom: 20px; box-shadow: 0 0 30px #00ffff; transition: 0.3s; } button:hover { background: #ff66ff; box-shadow: 0 0 40px #ff66ff; } .result-panel { background: #0f172a; border-radius: 15px; padding: 20px; border: 1px solid #00ffff; } .current { text-align: center; font-size: 60px; font-weight: bold; margin: 20px 0; text-shadow: 0 0 20px #00ffff; } .stats { display: flex; gap: 20px; } .stat { flex: 1; background: #1a2a3a; border-radius: 10px; padding: 15px; text-align: center; } .stat-label { font-size: 20px; color: #00ffff; margin-bottom: 10px; } .stat-number { font-size: 36px; font-weight: bold; color: #ff66ff; text-shadow: 0 0 10px #ff66ff; } .stat-percent { color: #7b8ab8; margin-top: 5px; } footer { text-align: center; margin-top: 20px; color: #4a5a78; } </style> </head> <body> <div class="container"> <h1>⚛️ СОСТОЯНИЕ БЕЛЛА ⚛️</h1> <!-- Квантовая схема --> <div class="circuit"> <!-- Первый кубит --> <div class="qubit"> <span class="qubit-label">|q₀⟩</span> <div class="wire"></div> <div class="gate gate-h">H</div> <div class="measure">M</div> </div> <!-- Второй кубит --> <div class="qubit"> <span class="qubit-label">|q₁⟩</span> <div class="wire"></div> <div class="measure" style="right: 100px;">M</div> </div> <!-- CNOT группа (отдельно для наглядности) --> <div class="cnot-group" style="top: 30px;"> <div class="cnot-dot"></div> <div class="cnot-line"></div> <div class="cnot-plus">⊕</div> </div> </div> <!-- Кнопка измерения --> <button id="measureBtn">ИЗМЕРИТЬ</button> <!-- Панель результатов --> <div class="result-panel"> <div class="current" id="currentResult">--</div> <div class="stats"> <div class="stat"> <div class="stat-label">|00⟩</div> <div class="stat-number" id="count00">0</div> <div class="stat-percent" id="percent00">0%</div> </div> <div class="stat"> <div class="stat-label">|11⟩</div> <div class="stat-number" id="count11">0</div> <div class="stat-percent" id="percent11">0%</div> </div> </div> </div> <footer>только |00⟩ или |11⟩ · вероятность 50%</footer> </div> <script> // Простейший симулятор состояния Белла (function() { // Счетчики let count00 = 0; let count11 = 0; let total = 0; // Элементы DOM const measureBtn = document.getElementById('measureBtn'); const currentResult = document.getElementById('currentResult'); const count00El = document.getElementById('count00'); const count11El = document.getElementById('count11'); const percent00El = document.getElementById('percent00'); const percent11El = document.getElementById('percent11'); // Проверка, что все элементы найдены console.log('Элементы:', { measureBtn, currentResult, count00El, count11El, percent00El, percent11El }); // Функция обновления интерфейса function updateDisplay(result) { // Обновляем текущий результат if (currentResult) currentResult.textContent = result; // Обновляем счетчики if (count00El) count00El.textContent = count00; if (count11El) count11El.textContent = count11; // Обновляем проценты if (total > 0) { if (percent00El) percent00El.textContent = ((count00 / total) * 100).toFixed(1) + '%'; if (percent11El) percent11El.textContent = ((count11 / total) * 100).toFixed(1) + '%'; } } // Обработчик клика if (measureBtn) { measureBtn.addEventListener('click', function() { // Генерируем 0 или 1 с вероятностью 50% const random = Math.random() < 0.5 ? 0 : 1; // Определяем результат const result = random === 0 ? '00' : '11'; // Обновляем счетчики if (result === '00') { count00++; } else { count11++; } total++; // Обновляем экран updateDisplay(result); console.log('Измерение:', result, 'Всего:', total); }); } // Начальное обновление updateDisplay('--'); })(); </script> </body> </html>