File size: 17,513 Bytes
984c426 7d90c38 984c426 7d90c38 984c426 7d90c38 984c426 7d90c38 984c426 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stone Paper Scissor Lizard Spock</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}
.bounce-animation {
animation: bounce 0.5s ease infinite;
}
.choice-btn {
transition: all 0.3s ease;
}
.choice-btn:hover {
transform: scale(1.1);
}
.winner {
box-shadow: 0 0 20px 5px rgba(59, 130, 246, 0.7);
}
.pulse {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body class="bg-gradient-to-br from-gray-900 to-gray-800 min-h-screen text-white">
<div class="container mx-auto px-4 py-8 flex flex-col items-center">
<h1 class="text-4xl md:text-5xl font-bold mb-2 text-center bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-600">
Stone Paper Scissor Lizard Spock
</h1>
<div class="mb-8 text-center">
<p class="text-lg text-gray-300 mb-4">The classic game with a <span class="font-bold text-purple-400">Big Bang Theory</span> twist!</p>
<div class="bg-gray-800 rounded-lg p-4 max-w-md mx-auto">
<h3 class="text-xl font-semibold mb-2 text-blue-300">Rules:</h3>
<ul class="text-left space-y-1 text-gray-300">
<li><span class="font-bold">Scissors</span> cut <span class="font-bold">Paper</span></li>
<li><span class="font-bold">Paper</span> covers <span class="font-bold">Rock</span></li>
<li><span class="font-bold">Rock</span> crushes <span class="font-bold">Lizard</span></li>
<li><span class="font-bold">Lizard</span> poisons <span class="font-bold">Spock</span></li>
<li><span class="font-bold">Spock</span> smashes <span class="font-bold">Scissors</span></li>
<li><span class="font-bold">Scissors</span> decapitate <span class="font-bold">Lizard</span></li>
<li><span class="font-bold">Lizard</span> eats <span class="font-bold">Paper</span></li>
<li><span class="font-bold">Paper</span> disproves <span class="font-bold">Spock</span></li>
<li><span class="font-bold">Spock</span> vaporizes <span class="font-bold">Rock</span></li>
<li><span class="font-bold">Rock</span> crushes <span class="font-bold">Scissors</span></li>
</ul>
</div>
</div>
<div class="w-full max-w-2xl">
<div class="flex justify-between items-center mb-8">
<div class="text-center">
<h3 class="text-xl font-semibold mb-2">You</h3>
<div class="text-2xl font-bold text-blue-400" id="player-score">0</div>
</div>
<div class="text-center">
<h3 class="text-xl font-semibold mb-2">Round</h3>
<div class="text-2xl font-bold text-purple-400" id="round">1</div>
</div>
<div class="text-center">
<h3 class="text-xl font-semibold mb-2">Computer</h3>
<div class="text-2xl font-bold text-red-400" id="computer-score">0</div>
</div>
</div>
<div class="flex justify-center mb-12">
<div class="relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4" id="player-choice">
<div class="text-4xl md:text-5xl" id="player-icon"></div>
</div>
<div class="flex items-center mx-4">
<div class="text-xl md:text-2xl font-bold" id="result-text">VS</div>
</div>
<div class="relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4" id="computer-choice">
<div class="text-4xl md:text-5xl" id="computer-icon"></div>
</div>
</div>
<div class="grid grid-cols-3 md:grid-cols-5 gap-4 mb-8">
<button class="choice-btn bg-blue-600 hover:bg-blue-700 rounded-full p-4 flex flex-col items-center justify-center transition-all" data-choice="rock">
<i class="fas fa-hand-rock text-3xl mb-2"></i>
<span>Rock</span>
</button>
<button class="choice-btn bg-green-600 hover:bg-green-700 rounded-full p-4 flex flex-col items-center justify-center" data-choice="paper">
<i class="fas fa-hand-paper text-3xl mb-2"></i>
<span>Paper</span>
</button>
<button class="choice-btn bg-red-600 hover:bg-red-700 rounded-full p-4 flex flex-col items-center justify-center" data-choice="scissors">
<i class="fas fa-hand-scissors text-3xl mb-2"></i>
<span>Scissors</span>
</button>
<button class="choice-btn bg-yellow-600 hover:bg-yellow-700 rounded-full p-4 flex flex-col items-center justify-center" data-choice="lizard">
<i class="fas fa-hand-lizard text-3xl mb-2"></i>
<span>Lizard</span>
</button>
<button class="choice-btn bg-purple-600 hover:bg-purple-700 rounded-full p-4 flex flex-col items-center justify-center" data-choice="spock">
<i class="fas fa-hand-spock text-3xl mb-2"></i>
<span>Spock</span>
</button>
</div>
<div class="text-center">
<button id="reset-btn" class="bg-gray-700 hover:bg-gray-600 px-6 py-2 rounded-full font-semibold transition-all">
Reset Game
</button>
</div>
</div>
<div id="game-over-modal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center hidden z-50">
<div class="bg-gray-800 rounded-xl p-8 max-w-md w-full mx-4 text-center">
<h2 class="text-3xl font-bold mb-4" id="game-over-text">Game Over!</h2>
<p class="text-xl mb-6" id="final-result">You won the game!</p>
<button id="play-again-btn" class="bg-blue-600 hover:bg-blue-700 px-6 py-3 rounded-full font-semibold text-lg transition-all">
Play Again
</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Game state
let playerScore = 0;
let computerScore = 0;
let round = 1;
const maxRounds = 5;
// DOM elements
const playerScoreEl = document.getElementById('player-score');
const computerScoreEl = document.getElementById('computer-score');
const roundEl = document.getElementById('round');
const playerChoiceEl = document.getElementById('player-choice');
const computerChoiceEl = document.getElementById('computer-choice');
const playerIconEl = document.getElementById('player-icon');
const computerIconEl = document.getElementById('computer-icon');
const resultTextEl = document.getElementById('result-text');
const choiceButtons = document.querySelectorAll('.choice-btn');
const resetBtn = document.getElementById('reset-btn');
const gameOverModal = document.getElementById('game-over-modal');
const gameOverTextEl = document.getElementById('game-over-text');
const finalResultEl = document.getElementById('final-result');
const playAgainBtn = document.getElementById('play-again-btn');
// Choice icons
const choiceIcons = {
rock: 'fas fa-hand-rock',
paper: 'fas fa-hand-paper',
scissors: 'fas fa-hand-scissors',
lizard: 'fas fa-hand-lizard',
spock: 'fas fa-hand-spock'
};
// Game logic - what beats what
const gameRules = {
rock: ['scissors', 'lizard'],
paper: ['rock', 'spock'],
scissors: ['paper', 'lizard'],
lizard: ['paper', 'spock'],
spock: ['rock', 'scissors']
};
// Color classes for choices
const choiceColors = {
rock: 'bg-blue-600',
paper: 'bg-green-600',
scissors: 'bg-red-600',
lizard: 'bg-yellow-600',
spock: 'bg-purple-600'
};
// Event listeners
choiceButtons.forEach(button => {
button.addEventListener('click', () => {
if (round > maxRounds) return;
const playerChoice = button.dataset.choice;
playRound(playerChoice);
});
});
resetBtn.addEventListener('click', resetGame);
playAgainBtn.addEventListener('click', resetGame);
// Game functions
function playRound(playerChoice) {
// Disable buttons during animation
choiceButtons.forEach(btn => btn.disabled = true);
// Player selection
playerIconEl.className = `${choiceIcons[playerChoice]} text-4xl md:text-5xl`;
playerChoiceEl.className = `relative w-32 h-32 md:w-40 md:h-40 ${choiceColors[playerChoice]} rounded-full flex items-center justify-center mx-4 bounce-animation`;
// Computer random choice
const choices = ['rock', 'paper', 'scissors', 'lizard', 'spock'];
const computerChoice = choices[Math.floor(Math.random() * choices.length)];
// Show computer choice with delay
setTimeout(() => {
computerIconEl.className = `${choiceIcons[computerChoice]} text-4xl md:text-5xl`;
computerChoiceEl.className = `relative w-32 h-32 md:w-40 md:h-40 ${choiceColors[computerChoice]} rounded-full flex items-center justify-center mx-4 bounce-animation`;
// Determine winner with another delay
setTimeout(() => {
determineWinner(playerChoice, computerChoice);
}, 500);
}, 500);
}
function determineWinner(playerChoice, computerChoice) {
// Stop bounce animation
playerChoiceEl.classList.remove('bounce-animation');
computerChoiceEl.classList.remove('bounce-animation');
if (playerChoice === computerChoice) {
// Tie
resultTextEl.textContent = "It's a tie!";
resultTextEl.className = "text-xl md:text-2xl font-bold text-yellow-400";
// Highlight both choices
playerChoiceEl.classList.add('winner');
computerChoiceEl.classList.add('winner');
setTimeout(() => {
playerChoiceEl.classList.remove('winner');
computerChoiceEl.classList.remove('winner');
}, 1000);
} else if (gameRules[playerChoice].includes(computerChoice)) {
// Player wins
playerScore++;
playerScoreEl.textContent = playerScore;
resultTextEl.textContent = "You win!";
resultTextEl.className = "text-xl md:text-2xl font-bold text-green-400";
// Highlight player choice
playerChoiceEl.classList.add('winner');
playerChoiceEl.classList.add('pulse');
} else {
// Computer wins
computerScore++;
computerScoreEl.textContent = computerScore;
resultTextEl.textContent = "Computer wins!";
resultTextEl.className = "text-xl md:text-2xl font-bold text-red-400";
// Highlight computer choice
computerChoiceEl.classList.add('winner');
computerChoiceEl.classList.add('pulse');
}
// Next round or game over
round++;
roundEl.textContent = round;
if (round > maxRounds) {
setTimeout(() => {
showGameOver();
}, 1500);
} else {
// Re-enable buttons after delay
setTimeout(() => {
choiceButtons.forEach(btn => btn.disabled = false);
playerChoiceEl.classList.remove('pulse');
computerChoiceEl.classList.remove('pulse');
// Reset display for next round
playerIconEl.className = "";
computerIconEl.className = "";
playerChoiceEl.className = "relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4";
computerChoiceEl.className = "relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4";
resultTextEl.textContent = "VS";
resultTextEl.className = "text-xl md:text-2xl font-bold";
}, 1500);
}
}
function showGameOver() {
gameOverModal.classList.remove('hidden');
if (playerScore > computerScore) {
gameOverTextEl.textContent = "You Won!";
gameOverTextEl.className = "text-3xl font-bold mb-4 text-green-400";
finalResultEl.textContent = `You beat the computer ${playerScore}-${computerScore}!`;
} else if (computerScore > playerScore) {
gameOverTextEl.textContent = "You Lost!";
gameOverTextEl.className = "text-3xl font-bold mb-4 text-red-400";
finalResultEl.textContent = `The computer beat you ${computerScore}-${playerScore}!`;
} else {
gameOverTextEl.textContent = "It's a Tie!";
gameOverTextEl.className = "text-3xl font-bold mb-4 text-yellow-400";
finalResultEl.textContent = `The game ended ${playerScore}-${computerScore}!`;
}
}
function resetGame() {
// Reset scores
playerScore = 0;
computerScore = 0;
round = 1;
// Update DOM
playerScoreEl.textContent = playerScore;
computerScoreEl.textContent = computerScore;
roundEl.textContent = round;
// Reset choices display
playerIconEl.className = "";
computerIconEl.className = "";
playerChoiceEl.className = "relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4";
computerChoiceEl.className = "relative w-32 h-32 md:w-40 md:h-40 bg-gray-800 rounded-full flex items-center justify-center mx-4";
resultTextEl.textContent = "VS";
resultTextEl.className = "text-xl md:text-2xl font-bold";
// Re-enable buttons
choiceButtons.forEach(btn => btn.disabled = false);
// Hide modal if shown
gameOverModal.classList.add('hidden');
}
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=iarman/bbt-game" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |