Spaces:
Running
Running
its almost right, but the "mines" blocks are not resetting after getting clicked. also the mines locations should be random. the mines should have a bomb instead of an X and the good tiles should have a diamond instead of nothing
Browse files200 unmodified lines20120220320420520620720820921020420520620720820921221321021121221321411 unmodified lines2262272282312322292302312322337 unmodified lines24124224324624424524624793 unmodified lines341342343344345347348346347348349200 unmodified lines revealedTiles = 0; multiplier = 1; minePositions = []; // Generate random mine positions while (minePositions.length < minesCount) { const randomPos = Math.floor(Math.random() * 25); if (!minePositions.includes(randomPos)) { minePositions.push(randomPos); } // Generate random mine positions using Fisher-Yates shuffle let positions = Array.from({length: 25}, (_, i) => i); for (let i = positions.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [positions[i], positions[j]] = [positions[j], positions[i]]; }
playBtn.classList.add('hidden'); minePositions = positions.slice(0, minesCount);playBtn.classList.add('hidden'); cashoutBtn.classList.remove('hidden'); updateMultiplier(); }11 unmodified lines if (minePositions.includes(index)) { // Mine hit - game over tile.innerHTML += '<div class="explosion"></div>'; tile.innerHTML += '<i data-feather="x" class="text-red-500 w-8 h-8"></i>'; feather.replace(); tile.innerHTML += '<i data-feather="alert-octagon" class="text-red-500 w-8 h-8"></i>';feather.replace(); gameActive = false; playBtn.classList.remove('hidden'); cashoutBtn.classList.add('hidden');7 unmodified lines} else { // Safe tile tile.innerHTML += '<i data-feather="diamond" class="diamond text-green-400 w-6 h-6"></i>'; feather.replace();feather.replace(); // Calculate and update multiplier multiplier = calculateMultiplier();93 unmodified lines tile.classList.remove('revealed'); tile.innerHTML = '<div class="absolute inset-0 bg-purple-600 opacity-0 transition-opacity duration-300"></div>'; }); initGame(); // Reinitialize game to reset mines }
// Initialize// Initialize initGame(); feather.replace(); mines.html+12-14