Your Source For Motorcycle Safety: ArriveAlivePodcast.com
// Answer key (multiple correct answers possible) const answers = { '0-0': ['the reflex', 'reflex', 'new moon on monday'], '0-1': ['like a virgin', 'material girl', 'borderline'], '0-2': ['thriller', 'billie jean', 'beat it', 'p.y.t.'], '1-0': ['girls on film'], '1-1': ['material girl'], '1-2': ['the girl is mine'], '2-0': ['notorious', 'skin trade', 'meet el presidente'], '2-1': ['who\'s that girl', 'causing a commotion', 'the look of love'], '2-2': ['bad', 'the way you make me feel', 'man in the mirror', 'dirty diana', 'smooth criminal', 'i just can\'t stop loving you'] }; function normalizeString(str) { return str.toLowerCase() .replace(/[^a-z0-9\s]/g, '') .replace(/\s+/g, ' ') .trim(); } function checkAnswers() { const cells = document.querySelectorAll('.cell'); let correct = 0; let total = 0; cells.forEach(cell => { const input = cell.querySelector('input'); const userAnswer = normalizeString(input.value); const row = cell.dataset.row; const col = cell.dataset.col; const key = `${row}-${col}`; if (userAnswer) { total++; const validAnswers = answers[key].map(a => normalizeString(a)); if (validAnswers.some(answer => userAnswer === answer || userAnswer.includes(answer) || answer.includes(userAnswer))) { cell.classList.add('correct'); cell.classList.remove('incorrect'); correct++; } else { cell.classList.add('incorrect'); cell.classList.remove('correct'); } } }); if (total > 0) { document.getElementById('score').textContent = `You got ${correct} out of ${total} correct!`; document.getElementById('results').style.display = 'block'; } else { alert('Fill in some answers first!'); } } function resetGrid() { const cells = document.querySelectorAll('.cell');