iarman commited on
Commit
984c426
·
verified ·
1 Parent(s): cd8129e

Add 2 files

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