good.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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>Объект 07 // Акустический Щит</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com">
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  9. <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Roboto+Mono:wght@400;700&display=swap" rel="stylesheet">
  10. <style>
  11. :root {
  12. --wood-dark: #2b1d14;
  13. --wood-light: #4a3222;
  14. --bakelite: #1a1c19;
  15. --brass: #b5a642;
  16. --brass-dark: #8c7d2f;
  17. --gold: #d4af37;
  18. --soviet-red: #8b0000;
  19. --crt-green: #39ff14;
  20. --crt-dim: #1e3b1e;
  21. --text-main: #e8dcc4;
  22. }
  23. * { box-sizing: border-box; }
  24. body {
  25. background-color: var(--wood-dark);
  26. background-image:
  27. repeating-linear-gradient(45deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 2px, transparent 2px, transparent 4px),
  28. radial-gradient(circle at center, #3a2516 0%, #1a100a 100%);
  29. color: var(--text-main);
  30. font-family: 'Playfair Display', serif;
  31. padding: 20px;
  32. display: flex;
  33. justify-content: center;
  34. min-height: 100vh;
  35. margin: 0;
  36. }
  37. .device-container {
  38. background-color: var(--wood-light);
  39. border: 6px solid var(--wood-dark);
  40. border-radius: 8px;
  41. width: 100%;
  42. max-width: 680px;
  43. padding: 25px;
  44. box-shadow:
  45. 0 20px 50px rgba(0,0,0,0.8),
  46. inset 0 0 0 2px var(--brass-dark),
  47. inset 0 0 20px rgba(0,0,0,0.8);
  48. position: relative;
  49. }
  50. .device-container::before, .device-container::after {
  51. content: ''; position: absolute; width: 12px; height: 12px; border-radius: 50%;
  52. background: radial-gradient(circle, var(--gold) 0%, var(--brass-dark) 100%);
  53. box-shadow: inset -1px -1px 2px rgba(0,0,0,0.8), 1px 1px 2px rgba(0,0,0,0.5);
  54. }
  55. .device-container::before { top: 10px; left: 10px; }
  56. .device-container::after { top: 10px; right: 10px; }
  57. h1 {
  58. text-align: center;
  59. font-size: 28px;
  60. font-weight: 900;
  61. text-transform: uppercase;
  62. letter-spacing: 3px;
  63. color: var(--gold);
  64. text-shadow: 2px 2px 0px #000, 0 0 10px rgba(212, 175, 55, 0.3);
  65. margin-top: 0;
  66. margin-bottom: 25px;
  67. border-bottom: 3px double var(--brass);
  68. padding-bottom: 15px;
  69. position: relative;
  70. }
  71. h1::after {
  72. content: '★';
  73. position: absolute;
  74. bottom: -14px;
  75. left: 50%;
  76. transform: translateX(-50%);
  77. background: var(--wood-light);
  78. padding: 0 10px;
  79. color: var(--soviet-red);
  80. font-size: 18px;
  81. }
  82. .scene { display: none; flex-direction: column; gap: 20px; }
  83. .scene.active { display: flex; animation: fadeIn 0.4s ease-out; }
  84. @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
  85. .panel {
  86. background-color: var(--bakelite);
  87. border: 2px solid var(--brass-dark);
  88. border-radius: 4px;
  89. padding: 20px;
  90. box-shadow:
  91. inset 0 0 20px rgba(0,0,0,0.9),
  92. 0 4px 6px rgba(0,0,0,0.4);
  93. position: relative;
  94. }
  95. .gauge-row {
  96. display: flex; justify-content: space-between; align-items: center;
  97. margin-bottom: 15px;
  98. padding-bottom: 10px;
  99. border-bottom: 1px dashed var(--brass-dark);
  100. }
  101. .gauge-label {
  102. font-family: 'Roboto Mono', monospace;
  103. font-size: 13px;
  104. text-transform: uppercase;
  105. letter-spacing: 1px;
  106. color: #a89f91;
  107. }
  108. .gauge-value {
  109. font-family: 'Roboto Mono', monospace;
  110. font-size: 22px;
  111. font-weight: bold;
  112. color: var(--crt-green);
  113. text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
  114. background: #000;
  115. padding: 4px 12px;
  116. border-radius: 3px;
  117. border: 1px solid #333;
  118. box-shadow: inset 0 0 10px #000;
  119. min-width: 90px;
  120. text-align: right;
  121. }
  122. input[type=range] {
  123. -webkit-appearance: none;
  124. width: 100%;
  125. background: transparent;
  126. margin: 10px 0;
  127. }
  128. input[type=range]:focus { outline: none; }
  129. input[type=range]::-webkit-slider-runnable-track {
  130. width: 100%; height: 12px;
  131. background: linear-gradient(to bottom, #111, #333);
  132. border: 1px solid #000;
  133. border-radius: 6px;
  134. box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
  135. }
  136. input[type=range]::-webkit-slider-thumb {
  137. -webkit-appearance: none;
  138. height: 28px; width: 18px;
  139. border-radius: 3px;
  140. background: radial-gradient(circle at 30% 30%, #e6d380, var(--brass-dark));
  141. border: 1px solid #000;
  142. margin-top: -9px;
  143. cursor: pointer;
  144. box-shadow:
  145. 0 3px 5px rgba(0,0,0,0.6),
  146. inset 0 1px 1px rgba(255,255,255,0.5);
  147. }
  148. .switch-row {
  149. display: flex; justify-content: space-between; align-items: center;
  150. background: #111;
  151. padding: 15px;
  152. border-radius: 4px;
  153. border: 1px solid #333;
  154. margin: 15px 0;
  155. }
  156. .indicator {
  157. width: 20px; height: 20px; border-radius: 50%;
  158. background: #222; border: 2px solid #000;
  159. box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
  160. transition: all 0.3s;
  161. }
  162. .indicator.on {
  163. background: var(--soviet-red);
  164. box-shadow: 0 0 15px var(--soviet-red), inset 0 0 5px #ff6666;
  165. border-color: #500000;
  166. }
  167. button {
  168. background: linear-gradient(to bottom, #4a3222, #2b1d14);
  169. color: var(--gold);
  170. border: 2px solid var(--brass-dark);
  171. border-radius: 4px;
  172. padding: 12px 20px;
  173. cursor: pointer;
  174. font-family: 'Playfair Display', serif;
  175. font-weight: 700;
  176. font-size: 16px;
  177. text-transform: uppercase;
  178. letter-spacing: 1px;
  179. box-shadow:
  180. 0 4px 0 #1a100a,
  181. 0 5px 10px rgba(0,0,0,0.5);
  182. transition: all 0.1s;
  183. width: 100%;
  184. }
  185. button:active {
  186. transform: translateY(4px);
  187. box-shadow: 0 0 0 #1a100a, 0 2px 5px rgba(0,0,0,0.5);
  188. }
  189. button.start {
  190. background: linear-gradient(to bottom, var(--soviet-red), #500000);
  191. color: #fff;
  192. border-color: #ff6666;
  193. box-shadow: 0 4px 0 #300000, 0 5px 10px rgba(0,0,0,0.5);
  194. }
  195. .spy { font-size: 50px; text-align: center; transition: opacity 0.5s; filter: drop-shadow(0 0 10px rgba(0,0,0,0.8)); }
  196. .formula-box {
  197. background: #d4c9a8;
  198. background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0,0,0,0.1) 20px);
  199. color: #2b1d14;
  200. padding: 15px;
  201. border-radius: 2px;
  202. font-family: 'Roboto Mono', monospace;
  203. font-size: 12px;
  204. margin-top: 20px;
  205. box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
  206. position: relative;
  207. border: 1px solid #8c7d2f;
  208. }
  209. .formula-box::before {
  210. content: 'УТВЕРЖДЕНО';
  211. position: absolute;
  212. top: 5px; right: 10px;
  213. font-size: 10px;
  214. color: var(--soviet-red);
  215. border: 1px solid var(--soviet-red);
  216. padding: 2px 5px;
  217. transform: rotate(-10deg);
  218. opacity: 0.7;
  219. font-weight: bold;
  220. }
  221. .formula-box div { margin-bottom: 5px; font-weight: bold;}
  222. .question { margin-bottom: 20px; font-family: 'Roboto Mono', monospace; font-size: 14px; }
  223. .question label { display: block; margin-bottom: 8px; cursor: pointer; color: #ccc; }
  224. .question input[type="radio"] { margin-right: 10px; accent-color: var(--soviet-red); }
  225. hr { border: 0; height: 2px; background: var(--brass-dark); margin: 20px 0; box-shadow: 0 1px 0 #000; }
  226. </style>
  227. </head>
  228. <body>
  229. <div class="device-container">
  230. <h1>Объект 07 // Акустический Щит</h1>
  231. <div id="scene1" class="scene active">
  232. <div class="panel" style="text-align: center;">
  233. <p style="font-size: 18px; margin-bottom: 20px;">Товарищ! В режимном помещении диктуется секретный пароль. За окном работает вражеский агент с направленным микрофоном.</p>
  234. <div class="spy" id="spy1">🕵️‍♂️</div>
  235. <button class="start" style="margin-top: 20px;" onclick="initAudio(); nextScene(2)">▶ Включить питание</button>
  236. </div>
  237. </div>
  238. <div id="scene2" class="scene">
  239. <div class="panel">
  240. <div class="gauge-row">
  241. <span class="gauge-label">Дистанция до агента:</span>
  242. <span class="gauge-value" id="distVal">1</span>
  243. </div>
  244. <input type="range" id="dist" min="1" max="10" value="1" oninput="onDistChange()">
  245. <hr>
  246. <div class="gauge-row">
  247. <span class="gauge-label">Уровень сигнала (дБ):</span>
  248. <span class="gauge-value" id="sigVal">0</span>
  249. </div>
  250. <div class="gauge-row" style="border: none; margin-bottom: 0; padding-bottom: 0;">
  251. <span class="gauge-label">Громкость речи (%):</span>
  252. <span class="gauge-value" id="volVal" style="color: var(--gold); text-shadow: 0 0 8px rgba(212, 175, 55, 0.6);">0</span>
  253. </div>
  254. <hr>
  255. <div class="switch-row">
  256. <span class="gauge-label">Генератор шума (Р-330):</span>
  257. <div class="indicator" id="jamInd"></div>
  258. </div>
  259. <button id="jamBtn" onclick="toggleJam()" style="margin-bottom: 15px;">ВКЛ / ВЫКЛ</button>
  260. <div class="gauge-row" style="margin-top: 20px;">
  261. <span class="gauge-label">Мощность шума (дБ):</span>
  262. <span class="gauge-value" id="noiseVal" style="color: var(--soviet-red); text-shadow: 0 0 8px rgba(139, 0, 0, 0.6);">0</span>
  263. </div>
  264. <input type="range" id="noise" min="0" max="100" value="0" oninput="onNoiseChange()">
  265. <div class="gauge-row" style="border: none; margin-top: 20px;">
  266. <span class="gauge-label">Отношение С/Ш (SNR):</span>
  267. <span class="gauge-value" id="snrVal">0</span>
  268. </div>
  269. <div class="formula-box">
  270. <div>[РУКОВОДСТВО] Сигнал = 60 - 20 * log10(Расстояние)</div>
  271. <div>[РУКОВОДСТВО] SNR = Сигнал - Шум</div>
  272. </div>
  273. </div>
  274. <button onclick="playClick(); nextScene(3)">Перейти к оценке разборчивости ▶</button>
  275. </div>
  276. <div id="scene3" class="scene">
  277. <div class="panel">
  278. <div class="gauge-row">
  279. <span class="gauge-label">Разборчивость речи (%):</span>
  280. <span class="gauge-value" id="intVal" style="font-size: 28px;">0</span>
  281. </div>
  282. <input type="range" id="noise2" min="0" max="100" value="0" oninput="onNoise2Change()">
  283. <div class="spy" id="spy2" style="margin-top: 20px;">🕵️‍♂️</div>
  284. <div class="formula-box">
  285. <div>[РУКОВОДСТВО] R = 100 / (1 + exp(-0.5 * (SNR - 5)))</div>
  286. <div>[ОГРАНИЧЕНИЕ] R = max(0, min(100, R))</div>
  287. </div>
  288. </div>
  289. <button onclick="playClick(); nextScene(4)">Завершить испытания ▶</button>
  290. </div>
  291. <div id="scene4" class="scene">
  292. <div class="panel" id="testContainer">
  293. <h3 style="margin-top:0; color: var(--gold); border-bottom: 1px solid var(--brass-dark); padding-bottom: 10px;">Итоговый контроль знаний</h3>
  294. </div>
  295. <button onclick="playClick(); checkTest()">Проверить ведомость</button>
  296. </div>
  297. </div>
  298. <script>
  299. let dist = 1, noise = 0, isJamming = false;
  300. let audioCtx, noiseSource, noiseGain;
  301. let utterance, isSpeaking = false;
  302. // Трекеры для щелчков (чтобы не трещало при быстром движении)
  303. let lastDist = 1;
  304. let lastNoise = 0;
  305. let lastNoise2 = 0;
  306. // --- Звук механического щелчка ---
  307. function playClick() {
  308. if (!audioCtx) return;
  309. if (audioCtx.state === 'suspended') audioCtx.resume();
  310. const now = audioCtx.currentTime;
  311. const bufferSize = Math.floor(audioCtx.sampleRate * 0.015);
  312. const buffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
  313. const data = buffer.getChannelData(0);
  314. // Затухающий шумовой импульс
  315. for (let i = 0; i < bufferSize; i++) {
  316. data[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / bufferSize, 6);
  317. }
  318. const src = audioCtx.createBufferSource();
  319. src.buffer = buffer;
  320. const filter = audioCtx.createBiquadFilter();
  321. filter.type = 'bandpass';
  322. filter.frequency.value = 2800;
  323. filter.Q.value = 1.2;
  324. const gain = audioCtx.createGain();
  325. gain.gain.value = 0.25;
  326. src.connect(filter);
  327. filter.connect(gain);
  328. gain.connect(audioCtx.destination);
  329. src.start(now);
  330. }
  331. // Щелчок потяжелее — для тумблера
  332. function playSwitchClick() {
  333. if (!audioCtx) return;
  334. if (audioCtx.state === 'suspended') audioCtx.resume();
  335. const now = audioCtx.currentTime;
  336. const bufferSize = Math.floor(audioCtx.sampleRate * 0.05);
  337. const buffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
  338. const data = buffer.getChannelData(0);
  339. for (let i = 0; i < bufferSize; i++) {
  340. data[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / bufferSize, 4);
  341. }
  342. const src = audioCtx.createBufferSource();
  343. src.buffer = buffer;
  344. const filter = audioCtx.createBiquadFilter();
  345. filter.type = 'lowpass';
  346. filter.frequency.value = 1500;
  347. const gain = audioCtx.createGain();
  348. gain.gain.value = 0.4;
  349. src.connect(filter);
  350. filter.connect(gain);
  351. gain.connect(audioCtx.destination);
  352. src.start(now);
  353. }
  354. function initAudio() {
  355. audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  356. const bufferSize = audioCtx.sampleRate * 2;
  357. const buffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
  358. const data = buffer.getChannelData(0);
  359. for (let i = 0; i < bufferSize; i++) data[i] = Math.random() * 2 - 1;
  360. noiseSource = audioCtx.createBufferSource();
  361. noiseSource.buffer = buffer;
  362. noiseSource.loop = true;
  363. noiseGain = audioCtx.createGain();
  364. noiseGain.gain.value = 0;
  365. noiseSource.connect(noiseGain);
  366. noiseGain.connect(audioCtx.destination);
  367. noiseSource.start();
  368. utterance = new SpeechSynthesisUtterance("Пароль от сейфа: ноль, ноль, семь. Повторяю, ноль, ноль, семь.");
  369. utterance.lang = 'ru-RU';
  370. utterance.rate = 0.9;
  371. utterance.onend = function() {
  372. if (isSpeaking) {
  373. setTimeout(() => {
  374. if (isSpeaking) speechSynthesis.speak(utterance);
  375. }, 1000);
  376. }
  377. };
  378. startSpeech();
  379. playSwitchClick(); // Щелчок при включении питания
  380. }
  381. function startSpeech() {
  382. if (!isSpeaking) {
  383. isSpeaking = true;
  384. speechSynthesis.cancel();
  385. speechSynthesis.speak(utterance);
  386. }
  387. }
  388. function nextScene(n) {
  389. document.querySelectorAll('.scene').forEach(el => el.classList.remove('active'));
  390. document.getElementById('scene' + n).classList.add('active');
  391. if (n === 2) {
  392. updateSignal();
  393. updateNoise();
  394. startSpeech();
  395. }
  396. if (n === 3) {
  397. document.getElementById('noise2').value = noise;
  398. lastNoise2 = noise;
  399. updateInt();
  400. startSpeech();
  401. }
  402. if (n === 4) {
  403. isSpeaking = false;
  404. speechSynthesis.cancel();
  405. if (noiseGain) noiseGain.gain.value = 0;
  406. renderTest();
  407. }
  408. }
  409. // --- Обработчики с щелчками ---
  410. function onDistChange() {
  411. const newVal = parseFloat(document.getElementById('dist').value);
  412. if (newVal !== lastDist) {
  413. playClick();
  414. lastDist = newVal;
  415. }
  416. updateSignal();
  417. }
  418. function onNoiseChange() {
  419. const newVal = parseFloat(document.getElementById('noise').value);
  420. if (newVal !== lastNoise) {
  421. playClick();
  422. lastNoise = newVal;
  423. }
  424. updateNoise();
  425. }
  426. function onNoise2Change() {
  427. const newVal = parseFloat(document.getElementById('noise2').value);
  428. if (newVal !== lastNoise2) {
  429. playClick();
  430. lastNoise2 = newVal;
  431. }
  432. updateInt();
  433. }
  434. function updateSignal() {
  435. dist = parseFloat(document.getElementById('dist').value);
  436. document.getElementById('distVal').innerText = dist;
  437. let signal = 60 - (20 * Math.log10(dist));
  438. document.getElementById('sigVal').innerText = signal.toFixed(1);
  439. let vol = Math.max(0, Math.min(1, signal / 60));
  440. document.getElementById('volVal').innerText = Math.round(vol * 100);
  441. if (utterance) {
  442. utterance.volume = vol;
  443. if (isSpeaking && speechSynthesis.speaking) {
  444. speechSynthesis.cancel();
  445. speechSynthesis.speak(utterance);
  446. }
  447. }
  448. updateSNR();
  449. }
  450. function toggleJam() {
  451. playSwitchClick();
  452. isJamming = !isJamming;
  453. document.getElementById('jamInd').classList.toggle('on', isJamming);
  454. document.getElementById('jamBtn').innerText = isJamming ? 'ОСТАНОВИТЬ' : 'ВКЛ / ВЫКЛ';
  455. if (isJamming) {
  456. if (audioCtx.state === 'suspended') audioCtx.resume();
  457. startSpeech();
  458. }
  459. updateNoise();
  460. }
  461. function updateNoise() {
  462. noise = isJamming ? parseFloat(document.getElementById('noise').value) : 0;
  463. document.getElementById('noiseVal').innerText = noise;
  464. if (noiseGain) noiseGain.gain.setTargetAtTime(noise / 100, audioCtx.currentTime, 0.1);
  465. updateSNR();
  466. }
  467. function updateSNR() {
  468. let d = parseFloat(document.getElementById('dist').value);
  469. let signal = 60 - (20 * Math.log10(d));
  470. let currentNoise = isJamming ? parseFloat(document.getElementById('noise').value) : 0;
  471. document.getElementById('snrVal').innerText = (signal - currentNoise).toFixed(1);
  472. }
  473. function updateInt() {
  474. let d = parseFloat(document.getElementById('dist').value);
  475. let n = parseFloat(document.getElementById('noise2').value);
  476. document.getElementById('noiseVal').innerText = n;
  477. let signal = 60 - (20 * Math.log10(d));
  478. let snr = signal - n;
  479. let intelligibility = 100 / (1 + Math.exp(-0.5 * (snr - 5)));
  480. intelligibility = Math.max(0, Math.min(100, intelligibility));
  481. document.getElementById('intVal').innerText = intelligibility.toFixed(1);
  482. if (noiseGain) noiseGain.gain.setTargetAtTime(n / 100, audioCtx.currentTime, 0.1);
  483. if (intelligibility < 20) {
  484. document.getElementById('spy2').style.opacity = '0.1';
  485. document.getElementById('spy2').innerText = '💨';
  486. } else {
  487. document.getElementById('spy2').style.opacity = '1';
  488. document.getElementById('spy2').innerText = '🕵️‍♂️';
  489. }
  490. }
  491. const questions = [
  492. { q: "Что такое SNR?", a: ["Отношение сигнал/шум", "Скорость передачи", "Уровень сигнала"], c: 0 },
  493. { q: "Как затухает звук от расстояния?", a: ["Линейно", "По логарифмическому закону", "Не затухает"], c: 1 },
  494. { q: "Зачем нужен генератор шума?", a: ["Для музыки", "Для маскировки речи", "Для увеличения громкости"], c: 1 },
  495. { q: "Если шум больше сигнала, то...", a: ["Разборчивость падает", "Разборчивость растет", "Ничего не меняется"], c: 0 },
  496. { q: "Разборчивость может быть отрицательной?", a: ["Да", "Нет", "Иногда"], c: 1 }
  497. ];
  498. function renderTest() {
  499. let html = '';
  500. questions.forEach((item, i) => {
  501. html += `<div class="question"><p style="color:var(--gold); margin-bottom:10px;"><b>${i+1}. ${item.q}</b></p>`;
  502. item.a.forEach((ans, j) => {
  503. html += `<label><input type="radio" name="q${i}" value="${j}" onchange="playClick()"> ${ans}</label>`;
  504. });
  505. html += `</div>`;
  506. });
  507. document.getElementById('testContainer').innerHTML = `<h3 style="margin-top:0; color: var(--gold); border-bottom: 1px solid var(--brass-dark); padding-bottom: 10px;">Итоговый контроль знаний</h3>` + html;
  508. }
  509. function checkTest() {
  510. let score = 0;
  511. questions.forEach((item, i) => {
  512. const selected = document.querySelector(`input[name="q${i}"]:checked`);
  513. if (selected && parseInt(selected.value) === item.c) score++;
  514. });
  515. alert(`Результат: ${score} из ${questions.length}. ${score === 5 ? 'Отлично, товарищ!' : 'Требуется повторный инструктаж.'}`);
  516. }
  517. </script>
  518. </body>
  519. </html>