bad.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!DOCTYPE html>
  2. <html lang="ru">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Акустический щит (СЛОМАНО ИИ)</title>
  7. <style>
  8. :root { --bg: #3a4a3a; --panel: #5a6a5a; --text: #aaccaa; --red: #ff3333; --amber: #ffb000; }
  9. body { background: var(--bg); color: var(--text); font-family: 'Courier New', monospace; padding: 20px; display: flex; justify-content: center; }
  10. .device { background: #2a332a; border: 4px solid #1a211a; border-radius: 10px; width: 100%; max-width: 650px; padding: 20px; box-shadow: inset 0 0 20px #000; }
  11. h1 { text-align: center; font-size: 20px; text-transform: uppercase; border-bottom: 2px solid var(--panel); padding-bottom: 10px; }
  12. .scene { display: none; flex-direction: column; gap: 15px; }
  13. .scene.active { display: flex; }
  14. .panel { background: var(--panel); border: 2px inset #1a211a; padding: 15px; border-radius: 5px; margin-bottom: 10px; }
  15. .row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  16. .indicator { width: 15px; height: 15px; border-radius: 50%; background: #333; border: 1px solid #000; }
  17. .indicator.on { background: var(--red); box-shadow: 0 0 10px var(--red); }
  18. input[type=range] { width: 100%; accent-color: var(--amber); }
  19. button { background: var(--panel); color: var(--text); border: 2px outset #1a211a; padding: 10px; cursor: pointer; font-family: inherit; font-weight: bold; text-transform: uppercase; margin-top: 5px; }
  20. button:active { border-style: inset; }
  21. button.start { background: var(--amber); color: #000; }
  22. .value { font-size: 20px; color: var(--amber); font-weight: bold; }
  23. .spy { font-size: 40px; text-align: center; transition: opacity 0.5s; }
  24. .question { margin-bottom: 15px; }
  25. .question label { display: block; margin-bottom: 5px; cursor: pointer; }
  26. hr { border-color: #1a211a; margin: 15px 0; }
  27. </style>
  28. </head>
  29. <body>
  30. <div class="device">
  31. <h1>Сектор Альфа // Акустика</h1>
  32. <div id="scene1" class="scene active">
  33. <div class="panel">
  34. <p>Вы в режимном помещении. Директор диктует пароль. За окном шпион с микрофоном.</p>
  35. <div class="spy" id="spy1">🕵️‍♂️</div>
  36. <button onclick="initAudio(); nextScene(2)">Включить питание и начать</button>
  37. </div>
  38. </div>
  39. <!-- Объединенная сцена 2: Управление -->
  40. <div id="scene2" class="scene">
  41. <div class="panel">
  42. <div class="row"><span>Расстояние до шпиона:</span><span class="value" id="distVal">1</span> м</div>
  43. <input type="range" id="dist" min="1" max="10" value="1" oninput="updateSignal()">
  44. <div class="row"><span>Уровень сигнала:</span><span class="value" id="sigVal">0</span> дБ</div>
  45. <div class="row"><span>Громкость речи:</span><span class="value" id="volVal">0</span> %</div>
  46. <hr>
  47. <div class="row">
  48. <span>Генератор белого шума:</span>
  49. <div class="indicator" id="jamInd"></div>
  50. </div>
  51. <button id="jamBtn" onclick="toggleJam()">ВКЛ / ВЫКЛ</button>
  52. <div style="margin-top:15px;">
  53. <div class="row"><span>Уровень шума:</span><span class="value" id="noiseVal">0</span> дБ</div>
  54. <input type="range" id="noise" min="0" max="100" value="0" oninput="updateNoise()">
  55. </div>
  56. <div class="row" style="margin-top:15px;"><span>SNR:</span><span class="value" id="snrVal">0</span> дБ</div>
  57. </div>
  58. <button onclick="nextScene(3)">Перейти к оценке</button>
  59. </div>
  60. <div id="scene3" class="scene">
  61. <div class="panel">
  62. <div class="row"><span>Разборчивость речи:</span><span class="value" id="intVal">0</span> %</div>
  63. <input type="range" id="noise2" min="0" max="100" value="0" oninput="updateInt()">
  64. <div class="spy" id="spy2">🕵️‍♂️</div>
  65. </div>
  66. <button onclick="nextScene(4)">Завершить (Итоговый тест)</button>
  67. </div>
  68. <div id="scene4" class="scene">
  69. <div class="panel" id="testContainer">
  70. <h3 style="margin-top:0;">Итоговое тестирование</h3>
  71. </div>
  72. <button onclick="checkTest()">Проверить</button>
  73. </div>
  74. </div>
  75. <script>
  76. let dist = 1, noise = 0, isJamming = false;
  77. let audioCtx, noiseSource, noiseGain;
  78. let utterance;
  79. function initAudio() {
  80. audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  81. const bufferSize = audioCtx.sampleRate * 2;
  82. const buffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
  83. const data = buffer.getChannelData(0);
  84. for (let i = 0; i < bufferSize; i++) data[i] = Math.random() * 2 - 1;
  85. noiseSource = audioCtx.createBufferSource();
  86. noiseSource.buffer = buffer;
  87. noiseSource.loop = true;
  88. noiseGain = audioCtx.createGain();
  89. noiseGain.gain.value = 0;
  90. noiseSource.connect(noiseGain);
  91. noiseGain.connect(audioCtx.destination);
  92. noiseSource.start();
  93. utterance = new SpeechSynthesisUtterance("Пароль от сейфа: ноль, ноль, семь");
  94. utterance.lang = 'ru-RU';
  95. utterance.rate = 0.9;
  96. }
  97. function nextScene(n) {
  98. document.querySelectorAll('.scene').forEach(el => el.classList.remove('active'));
  99. document.getElementById('scene' + n).classList.add('active');
  100. if (n === 2) { updateSignal(); updateNoise(); }
  101. if (n === 3) {
  102. document.getElementById('noise2').value = noise;
  103. updateInt();
  104. }
  105. if (n === 4) {
  106. speechSynthesis.cancel();
  107. if (noiseGain) noiseGain.gain.value = 0;
  108. renderTest();
  109. }
  110. }
  111. // ОШИБКА ИИ: Линейная шкала
  112. function updateSignal() {
  113. dist = parseFloat(document.getElementById('dist').value);
  114. document.getElementById('distVal').innerText = dist;
  115. let signal = 60 - (dist * 5);
  116. document.getElementById('sigVal').innerText = signal.toFixed(1);
  117. let vol = Math.max(0, Math.min(1, signal / 60));
  118. document.getElementById('volVal').innerText = Math.round(vol * 100);
  119. if (utterance) utterance.volume = vol;
  120. updateSNR();
  121. }
  122. function toggleJam() {
  123. isJamming = !isJamming;
  124. document.getElementById('jamInd').classList.toggle('on', isJamming);
  125. document.getElementById('jamBtn').innerText = isJamming ? 'АКТИВЕН' : 'ВКЛ / ВЫКЛ';
  126. if (isJamming) {
  127. speechSynthesis.cancel();
  128. speechSynthesis.speak(utterance);
  129. if (audioCtx.state === 'suspended') audioCtx.resume();
  130. }
  131. updateNoise();
  132. }
  133. function updateNoise() {
  134. noise = isJamming ? parseFloat(document.getElementById('noise').value) : 0;
  135. document.getElementById('noiseVal').innerText = noise;
  136. if (noiseGain) noiseGain.gain.setTargetAtTime(noise / 100, audioCtx.currentTime, 0.1);
  137. updateSNR();
  138. }
  139. function updateSNR() {
  140. let d = parseFloat(document.getElementById('dist').value);
  141. let signal = 60 - (d * 5); // ОШИБКА ИИ
  142. let currentNoise = isJamming ? parseFloat(document.getElementById('noise').value) : 0;
  143. document.getElementById('snrVal').innerText = (signal - currentNoise).toFixed(1);
  144. }
  145. function updateInt() {
  146. let d = parseFloat(document.getElementById('dist').value);
  147. let n = parseFloat(document.getElementById('noise2').value);
  148. document.getElementById('noiseVal').innerText = n;
  149. let signal = 60 - (d * 5); // ОШИБКА ИИ
  150. let snr = signal - n;
  151. // ОШИБКА ИИ: Разборчивость может уйти в минус
  152. let intelligibility = 100 / (1 + Math.exp(-0.5 * (snr - 5)));
  153. document.getElementById('intVal').innerText = intelligibility.toFixed(1);
  154. if (noiseGain) noiseGain.gain.setTargetAtTime(n / 100, audioCtx.currentTime, 0.1);
  155. document.getElementById('spy2').style.opacity = intelligibility < 20 ? '0.1' : '1';
  156. }
  157. const questions = [
  158. { q: "Что такое SNR?", a: ["Отношение сигнал/шум", "Скорость передачи", "Уровень сигнала"], c: 0 },
  159. { q: "Как затухает звук от расстояния?", a: ["Линейно", "По логарифмическому закону", "Не затухает"], c: 1 },
  160. { q: "Зачем нужен генератор шума?", a: ["Для музыки", "Для маскировки речи", "Для увеличения громкости"], c: 1 },
  161. { q: "Если шум больше сигнала, то...", a: ["Разборчивость падает", "Разборчивость растет", "Ничего не меняется"], c: 0 },
  162. { q: "Разборчивость может быть отрицательной?", a: ["Да", "Нет", "Иногда"], c: 1 }
  163. ];
  164. function renderTest() {
  165. let html = '';
  166. questions.forEach((item, i) => {
  167. html += `<div class="question"><p><b>${i+1}. ${item.q}</b></p>`;
  168. item.a.forEach((ans, j) => html += `<label><input type="radio" name="q${i}" value="${j}"> ${ans}</label>`);
  169. html += `</div>`;
  170. });
  171. document.getElementById('testContainer').innerHTML = `<h3 style="margin-top:0;">Итоговое тестирование</h3>` + html;
  172. }
  173. function checkTest() {
  174. let score = 0;
  175. questions.forEach((item, i) => {
  176. const selected = document.querySelector(`input[name="q${i}"]:checked`);
  177. if (selected && parseInt(selected.value) === item.c) score++;
  178. });
  179. alert(`Ваш результат: ${score} из ${questions.length}`);
  180. }
  181. </script>
  182. </body>
  183. </html>