// Whack-a-Mole Game Functions let whackamoleScore = 0; let whackamoleStreak = 0; let whackamoleTimeLeft = 60; let whackamoleTimer = null; let currentMoleWord = null; let activeMoles = []; let whackamoleGameActive = false; let moleSpeed = 2000; // milliseconds each mole stays up function createWhackamoleGame() { const whackamoleBoard = document.getElementById('whackamoleBoard'); if (!whackamoleBoard) return; // Create 9 holes (3x3 grid) whackamoleBoard.innerHTML = ''; for (let i = 0; i < 9; i++) { const hole = document.createElement('div'); hole.className = 'mole-hole'; hole.setAttribute('data-hole', i); const mole = document.createElement('div'); mole.className = 'mole'; mole.setAttribute('data-hole', i); mole.addEventListener('click', () => whackMole(mole)); hole.appendChild(mole); whackamoleBoard.appendChild(hole); } // Reset game state whackamoleScore = 0; whackamoleStreak = 0; whackamoleTimeLeft = 60; whackamoleGameActive = false; activeMoles = []; currentMoleWord = null; moleSpeed = 2000; updateWhackamoleStats(); document.getElementById('clueText').textContent = 'Click "Start Game" to begin!'; document.getElementById('speakClueBtn').style.display = 'none'; document.getElementById('whackamoleComplete').style.display = 'none'; } function startWhackamoleGame() { if (whackamoleGameActive) return; playChime(); whackamoleGameActive = true; // Start timer whackamoleTimer = setInterval(() => { whackamoleTimeLeft--; updateWhackamoleStats(); if (whackamoleTimeLeft <= 0) { endWhackamoleGame(); } }, 1000); // Start spawning moles spawnNextMole(); document.getElementById('startWhackamoleBtn').textContent = '🎯 Playing...'; document.getElementById('startWhackamoleBtn').disabled = true; } function spawnNextMole() { if (!whackamoleGameActive) return; // Clear previous moles activeMoles.forEach(mole => { mole.classList.remove('pop-up'); mole.classList.add('missed'); mole.parentElement.classList.remove('active'); setTimeout(() => { mole.classList.remove('missed'); mole.textContent = ''; }, 400); }); activeMoles = []; // Select a random clue type and word const clueTypes = ['definition', 'synonym', 'antonym']; const clueType = clueTypes[Math.floor(Math.random() * clueTypes.length)]; const correctWord = vocabulary[Math.floor(Math.random() * vocabulary.length)]; currentMoleWord = correctWord; let clueText = ''; switch (clueType) { case 'definition': clueText = `Find the word that means: ${correctWord.definition}`; break; case 'synonym': clueText = `Find a SYNONYM for: ${correctWord.synonyms[0]}`; break; case 'antonym': clueText = `Find an ANTONYM for: ${correctWord.antonyms[0]}`; break; } document.getElementById('clueText').textContent = clueText; document.getElementById('speakClueBtn').style.display = 'inline-block'; // Speak the clue setTimeout(() => speakCurrentClue(), 300); // Create list of words to show (correct + distractors) const otherWords = vocabulary.filter(w => w.word !== correctWord.word); const shuffledOthers = otherWords.sort(() => Math.random() - 0.5); const wordsToShow = [correctWord, ...shuffledOthers.slice(0, 4)]; const finalWords = wordsToShow.sort(() => Math.random() - 0.5); // Spawn moles with random timing finalWords.forEach((word, index) => { setTimeout(() => { if (!whackamoleGameActive) return; spawnMole(word); }, index * 300); }); // Schedule next round setTimeout(() => { if (whackamoleGameActive) { spawnNextMole(); } }, moleSpeed + 1000); } function spawnMole(wordObj) { const holes = document.querySelectorAll('.mole'); const availableHoles = Array.from(holes).filter(hole => !hole.classList.contains('pop-up')); if (availableHoles.length === 0) return; const randomHole = availableHoles[Math.floor(Math.random() * availableHoles.length)]; const holeContainer = randomHole.parentElement; randomHole.textContent = wordObj.word; randomHole.setAttribute('data-word', wordObj.word); randomHole.classList.add('pop-up'); holeContainer.classList.add('active'); activeMoles.push(randomHole); // Auto-hide mole after delay setTimeout(() => { if (randomHole.classList.contains('pop-up')) { randomHole.classList.remove('pop-up'); randomHole.classList.add('missed'); holeContainer.classList.remove('active'); setTimeout(() => { randomHole.classList.remove('missed'); randomHole.textContent = ''; }, 400); } }, moleSpeed); } function whackMole(mole) { if (!whackamoleGameActive || !mole.classList.contains('pop-up')) return; const moleWord = mole.getAttribute('data-word'); const holeContainer = mole.parentElement; playChime(); if (moleWord === currentMoleWord.word) { // Correct! whackamoleScore++; whackamoleStreak++; mole.classList.remove('pop-up'); mole.classList.add('whacked'); holeContainer.classList.remove('active'); playSuccessChime(); // Bonus points for streaks if (whackamoleStreak >= 5) { whackamoleScore += 2; } else if (whackamoleStreak >= 3) { whackamoleScore += 1; } // Increase speed slightly for difficulty moleSpeed = Math.max(1000, moleSpeed - 50); } else { // Wrong! whackamoleStreak = 0; mole.classList.remove('pop-up'); mole.classList.add('missed'); holeContainer.classList.remove('active'); } updateWhackamoleStats(); setTimeout(() => { mole.classList.remove('whacked', 'missed'); mole.textContent = ''; }, 400); } function speakCurrentClue() { const clueText = document.getElementById('clueText').textContent; speakWord(clueText); } function updateWhackamoleStats() { document.getElementById('whackamoleScore').textContent = `Score: ${whackamoleScore}`; document.getElementById('whackamoleStreak').textContent = `Streak: ${whackamoleStreak}`; document.getElementById('whackamoleTimer').textContent = `Time: ${whackamoleTimeLeft}s`; } function endWhackamoleGame() { whackamoleGameActive = false; clearInterval(whackamoleTimer); // Clear all active moles activeMoles.forEach(mole => { mole.classList.remove('pop-up'); mole.classList.add('missed'); mole.parentElement.classList.remove('active'); setTimeout(() => { mole.classList.remove('missed'); mole.textContent = ''; }, 400); }); activeMoles = []; let performance = ""; if (whackamoleScore >= 25) { performance = "🏆 VOCABULARY CHAMPION! Incredible reflexes!"; } else if (whackamoleScore >= 20) { performance = "🌟 AMAZING! Lightning-fast vocabulary skills!"; } else if (whackamoleScore >= 15) { performance = "🎯 EXCELLENT! Great word recognition!"; } else if (whackamoleScore >= 10) { performance = "👍 GOOD JOB! Solid vocabulary knowledge!"; } else { performance = "😊 NICE TRY! Keep practicing those words!"; } document.getElementById('whackamoleResults').innerHTML = ` ${performance}
Final Score: ${whackamoleScore} points
Best Streak: ${whackamoleStreak} in a row
🔨 Vocabulary Whacker! 🔨`; document.getElementById('whackamoleComplete').style.display = 'block'; document.getElementById('startWhackamoleBtn').textContent = '🎯 Start Game'; document.getElementById('startWhackamoleBtn').disabled = false; // Celebration sounds setTimeout(() => { playSuccessChime(); setTimeout(playSuccessChime, 200); setTimeout(playSuccessChime, 400); }, 300); } function startNewWhackamoleGame() { document.getElementById('whackamoleComplete').style.display = 'none'; createWhackamoleGame(); } // Update the main goToPage function to handle new pages and check game access function goToPage(page) { playChime(); // Play soft chime sound // Check if trying to access games without permission if ((page == 8 || page === '8_memory') && !gamesUnlocked) { alert('🔒 Games are locked! You need to score 90% or higher on your test to unlock them. Keep studying and try again! 💪'); return; } // Check if trying to access whack-a-mole without completing memory game if (page === '8_whackamole' && !whackAMoleUnlocked) { alert('🔒 Complete the Memory game first to unlock this ultimate challenge! 🎯'); return; } var pages = document.querySelectorAll('.page'); pages.forEach(p => p.classList.remove('active')); var pageElement = document.getElementById('page' + page); if (pageElement) { pageElement.classList.add('active'); currentPage = page; // Initialize games when accessing their pages if (page === '8_memory') { setTimeout(createMemoryGame, 100); } else if (page === '8_whackamole') { setTimeout(createWhackamoleGame, 100); } else if (page == 8) { // Update game access status when returning to game menu setTimeout(updateWhackamoleAccess, 100); } } if (page == 1) { document.getElementById('studentPassword').value = ''; // Reset test status when going back to start testCompleted = false; gamesUnlocked = false; finalTestScore = 0; memoryGameCompleted = false; whackAMoleUnlocked = false; } } // Whack-a-Mole Game Functions let whackamoleScore = 0; let whackamoleStreak = 0; let whackamoleTimeLeft = 60; let whackamoleTimer = null; let currentMoleWord = null; let activeMoles = []; let whackamoleGameActive = false; let moleSpeed = 2000; // milliseconds each mole stays up function createWhackamoleGame() { const whackamoleBoard = document.getElementById('whackamoleBoard'); if (!whackamoleBoard) return; // Create 9 holes (3x3 grid) whackamoleBoard.innerHTML = ''; for (let i = 0; i < 9; i++) { const hole = document.createElement('div'); hole.className = 'mole-hole'; hole.setAttribute('data-hole', i); const mole = document.createElement('div'); mole.className = 'mole'; mole.setAttribute('data-hole', i); mole.addEventListener('click', () => whackMole(mole)); hole.appendChild(mole); whackamoleBoard.appendChild(hole); } // Reset game state whackamoleScore = 0; whackamoleStreak = 0; whackamoleTimeLeft = 60; whackamoleGameActive = false; activeMoles = []; currentMoleWord = null; updateWhackamoleStats(); document.getElementById('clueText').textContent = 'Click "Start Game" to begin!'; document.getElementById('speakClueBtn').style.display = 'none'; document.getElementById('whackamoleComplete').style.display = 'none'; } function startWhackamoleGame() { if (whackamoleGameActive) return; playChime(); whackamoleGameActive = true; // Start timer whackamoleTimer = setInterval(() => { whackamoleTimeLeft--; updateWhackamoleStats(); if (whackamoleTimeLeft <= 0) { endWhackamoleGame(); } }, 1000); // Start spawning moles spawnNextMole(); document.getElementById('startWhackamoleBtn').textContent = '🎯 Playing...'; document.getElementById('startWhackamoleBtn').disabled = true; } function spawnNextMole() { if (!whackamoleGameActive) return; // Clear previous moles activeMoles.forEach(mole => { mole.classList.remove('pop-up'); mole.classList.add('missed'); setTimeout(() => { mole.classList.remove('missed'); mole.textContent = ''; }, 400); }); activeMoles = []; // Select a random clue type and word const clueTypes = ['definition', 'synonym', 'antonym']; const clueType = clueTypes[Math.floor(Math.random() * clueTypes.length)]; const correctWord = vocabulary[Math.floor(Math.random() * vocabulary.length)]; currentMoleWord = correctWord; let clueText = ''; switch (clueType) { case 'definition': clueText = `Find the word that means: ${correctWord.definition}`; break; case 'synonym': clueText = `Find a SYNONYM for: ${correctWord.synonyms[0]}`; break; case 'antonym': clueText = `Find an ANTONYM for: ${correctWord.antonyms[0]}`; break; } document.getElementById('clueText').textContent = clueText; document.getElementById('speakClueBtn').style.display = 'inline-block'; // Speak the clue setTimeout(() => speakCurrentClue(), 300); // Create list of words to show (correct + distractors) const otherWords = vocabulary.filter(w => w.word !== correctWord.word); const shuffledOthers = otherWords.sort(() => Math.random() - 0.5); const wordsToShow = [correctWord, ...shuffledOthers.slice(0, 4)]; const finalWords = wordsToShow.sort(() => Math.random() - 0.5); // Spawn moles with random timing finalWords.forEach((word, index) => { setTimeout(() => { if (!whackamoleGameActive) return; spawnMole(word); }, index * 300); }); // Schedule next round setTimeout(() => { if (whackamoleGameActive) { spawnNextMole(); } }, moleSpeed + 1000); } function spawnMole(wordObj) { const holes = document.querySelectorAll('.mole'); const availableHoles = Array.from(holes).filter(hole => !hole.classList.contains('pop-up')); if (availableHoles.length === 0) return; const randomHole = availableHoles[Math.floor(Math.random() * availableHoles.length)]; const holeContainer = randomHole.parentElement; randomHole.textContent = wordObj.word; randomHole.setAttribute('data-word', wordObj.word); randomHole.classList.add('pop-up'); holeContainer.classList.add('active'); activeMoles.push(randomHole); // Auto-hide mole after delay setTimeout(() => { if (randomHole.classList.contains('pop-up')) { randomHole.classList.remove('pop-up'); randomHole.classList.add('missed'); holeContainer.classList.remove('active'); setTimeout(() => { randomHole.classList.remove('missed'); randomHole.textContent = ''; }, 400); } }, moleSpeed); } function whackMole(mole) { if (!whackamoleGameActive || !mole.classList.contains('pop-up')) return; const moleWord = mole.getAttribute('data-word'); const holeContainer = mole.parentElement; playChime(); if (moleWord === currentMoleWord.word) { // Correct! whackamoleScore++; whackamoleStreak++; mole.classList.remove('pop-up'); mole.classList.add('whacked'); holeContainer.classList.remove('active'); playSuccessChime(); // Bonus points for streaks if (whackamoleStreak >= 5) { whackamoleScore += 2; } else if (whackamoleStreak >= 3) { whackamoleScore += 1; } // Increase speed slightly for difficulty moleSpeed = Math.max(1000, moleSpeed - 50); } else { // Wrong! whackamoleStreak = 0; mole.classList.remove('pop-up'); mole.classList.add('missed'); holeContainer.classList.remove('active'); } updateWhackamoleStats(); setTimeout(() => { mole.classList.remove('whacked', 'missed'); mole.textContent = ''; }, Vocabulary Test App - Week 4

📚 Vocabulary Test - Week 4

Test your vocabulary knowledge!

📖 Vocabulary Review

Learn the words with definitions, synonyms, and antonyms

🔗 Matching Exercise

Match each word with its correct definition

✅ Matching - Correct Answers

Review the correct answers

🔄 Synonym vs Antonym Sort

Sort the options into synonyms and antonyms

✅ Synonym vs Antonym - Correct Answers

Review the correct answers

✏️ Fill in the Blanks

Complete each sentence

✅ Fill in the Blanks - Correct Answers

Review the correct answers

📚 Reading Passage

Read the passage and fill in the blanks

✅ Reading Passage - Correct Answers

Review the correct answers

🎉 Test Results

🎮 Fun Vocabulary Games

Choose a game to practice your vocabulary! 🌟

🧠

Memory Match

Find matching word and definition pairs!

🔓 Available
🔨

Whack-a-Mole

Whack the mole with the correct word!

🔒 Complete Memory game first

🧠 Vocabulary Memory Game

Match the words with their definitions! Find all pairs to win! 🌟

Moves: 0 | Pairs Found: 0/6 | Time: 0s

🎯 Word Bingo

Listen to the definition and click the correct word! Get 4 in a row to win! 🏆

Score: 0 | Round: 1 | Target: Get 4 in a row!

Click "Next Word" to start!