Add 2 files
Browse files- README.md +7 -5
- index.html +452 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
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: vibe-coded-90s-whack-a-mole
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: green
|
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,452 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>90's Whack-a-Mole with AI Questions</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 |
+
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
|
11 |
+
|
12 |
+
body {
|
13 |
+
font-family: 'Comic Sans MS', cursive, sans-serif;
|
14 |
+
background-color: #ffccf5;
|
15 |
+
background-image: linear-gradient(to right, #ffccf5, #ccf2ff);
|
16 |
+
overflow-x: hidden;
|
17 |
+
}
|
18 |
+
|
19 |
+
.title {
|
20 |
+
font-family: 'Press Start 2P', cursive;
|
21 |
+
text-shadow: 3px 3px 0 #ff00ff, 6px 6px 0 #00ffff;
|
22 |
+
animation: rainbow 5s linear infinite;
|
23 |
+
}
|
24 |
+
|
25 |
+
.hole {
|
26 |
+
background: radial-gradient(circle, #4d2e00 30%, #000 100%);
|
27 |
+
box-shadow: inset 0 10px 0 0 #3a2200, 0 10px 0 0 rgba(0,0,0,0.3);
|
28 |
+
}
|
29 |
+
|
30 |
+
.mole {
|
31 |
+
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="30" r="25" fill="%23333"/><circle cx="40" cy="25" r="3" fill="%23fff"/><circle cx="60" cy="25" r="3" fill="%23fff"/><path d="M45 35 Q50 40 55 35" stroke="%23fff" fill="transparent" stroke-width="2"/><circle cx="50" cy="50" r="30" fill="%23333"/></svg>') center/contain no-repeat;
|
32 |
+
cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M10 10 L90 90 M10 90 L90 10" stroke="%23ff0000" stroke-width="8"/></svg>'), auto;
|
33 |
+
}
|
34 |
+
|
35 |
+
.hit {
|
36 |
+
animation: hit 0.3s;
|
37 |
+
}
|
38 |
+
|
39 |
+
.missed {
|
40 |
+
animation: missed 0.5s;
|
41 |
+
}
|
42 |
+
|
43 |
+
@keyframes hit {
|
44 |
+
0% { transform: translateY(0) rotate(0deg); }
|
45 |
+
50% { transform: translateY(-20px) rotate(20deg); }
|
46 |
+
100% { transform: translateY(0) rotate(0deg); }
|
47 |
+
}
|
48 |
+
|
49 |
+
@keyframes missed {
|
50 |
+
0% { transform: translateY(0); }
|
51 |
+
50% { transform: translateY(10px); }
|
52 |
+
100% { transform: translateY(0); }
|
53 |
+
}
|
54 |
+
|
55 |
+
@keyframes rainbow {
|
56 |
+
0% { color: #ff0000; }
|
57 |
+
14% { color: #ff7f00; }
|
58 |
+
28% { color: #ffff00; }
|
59 |
+
42% { color: #00ff00; }
|
60 |
+
57% { color: #0000ff; }
|
61 |
+
71% { color: #4b0082; }
|
62 |
+
85% { color: #9400d3; }
|
63 |
+
100% { color: #ff0000; }
|
64 |
+
}
|
65 |
+
|
66 |
+
.question-box {
|
67 |
+
background: linear-gradient(135deg, #ffcc00, #ff9900);
|
68 |
+
border: 5px dashed #ff0066;
|
69 |
+
animation: pulse 2s infinite;
|
70 |
+
}
|
71 |
+
|
72 |
+
@keyframes pulse {
|
73 |
+
0% { transform: scale(1); }
|
74 |
+
50% { transform: scale(1.05); }
|
75 |
+
100% { transform: scale(1); }
|
76 |
+
}
|
77 |
+
|
78 |
+
.button {
|
79 |
+
transition: all 0.3s;
|
80 |
+
}
|
81 |
+
|
82 |
+
.button:hover {
|
83 |
+
transform: scale(1.1) rotate(5deg);
|
84 |
+
}
|
85 |
+
|
86 |
+
.cursor-trail {
|
87 |
+
position: absolute;
|
88 |
+
width: 20px;
|
89 |
+
height: 20px;
|
90 |
+
background-color: rgba(255, 0, 255, 0.5);
|
91 |
+
border-radius: 50%;
|
92 |
+
pointer-events: none;
|
93 |
+
transform: translate(-50%, -50%);
|
94 |
+
z-index: 9999;
|
95 |
+
}
|
96 |
+
</style>
|
97 |
+
</head>
|
98 |
+
<body class="min-h-screen flex flex-col items-center justify-center p-4">
|
99 |
+
<div id="cursor-trails"></div>
|
100 |
+
|
101 |
+
<h1 class="title text-4xl md:text-6xl mb-8 text-center">90's WHACK-A-MOLE</h1>
|
102 |
+
|
103 |
+
<div class="flex flex-col md:flex-row items-center justify-center gap-8 mb-8">
|
104 |
+
<div class="bg-purple-200 p-4 rounded-lg border-4 border-dashed border-pink-500">
|
105 |
+
<p class="text-xl font-bold text-purple-800">Score: <span id="score" class="text-3xl">0</span></p>
|
106 |
+
</div>
|
107 |
+
<div class="bg-blue-200 p-4 rounded-lg border-4 border-dashed border-cyan-500">
|
108 |
+
<p class="text-xl font-bold text-blue-800">Time: <span id="time" class="text-3xl">60</span>s</p>
|
109 |
+
</div>
|
110 |
+
<div class="bg-yellow-200 p-4 rounded-lg border-4 border-dashed border-orange-500">
|
111 |
+
<p class="text-xl font-bold text-yellow-800">Misses: <span id="misses" class="text-3xl">0</span></p>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<div class="grid grid-cols-3 gap-4 md:gap-8 mb-8">
|
116 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
117 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
118 |
+
</div>
|
119 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
120 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
121 |
+
</div>
|
122 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
123 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
124 |
+
</div>
|
125 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
126 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
127 |
+
</div>
|
128 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
129 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
130 |
+
</div>
|
131 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
132 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
133 |
+
</div>
|
134 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
135 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
136 |
+
</div>
|
137 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
138 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
139 |
+
</div>
|
140 |
+
<div class="hole w-20 h-20 md:w-32 md:h-32 rounded-full relative overflow-hidden">
|
141 |
+
<div class="mole absolute inset-0 w-full h-full transition-all duration-300 opacity-0"></div>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
|
145 |
+
<div class="flex gap-4 mb-8">
|
146 |
+
<button id="start-btn" class="button bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-6 rounded-full text-xl shadow-lg">
|
147 |
+
<i class="fas fa-play mr-2"></i> START
|
148 |
+
</button>
|
149 |
+
<button id="reset-btn" class="button bg-red-500 hover:bg-red-600 text-white font-bold py-3 px-6 rounded-full text-xl shadow-lg">
|
150 |
+
<i class="fas fa-redo mr-2"></i> RESET
|
151 |
+
</button>
|
152 |
+
</div>
|
153 |
+
|
154 |
+
<div id="question-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
155 |
+
<div class="question-box p-6 md:p-8 rounded-xl max-w-md w-full mx-4 text-center">
|
156 |
+
<h2 class="text-2xl md:text-3xl font-bold mb-4 text-purple-800">AI QUESTION!</h2>
|
157 |
+
<p id="question-text" class="text-xl mb-6">Would you like to answer a question?</p>
|
158 |
+
<div class="flex justify-center gap-4">
|
159 |
+
<button id="yes-btn" class="button bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-6 rounded-full text-lg">
|
160 |
+
YES
|
161 |
+
</button>
|
162 |
+
<button id="no-btn" class="button bg-pink-500 hover:bg-pink-600 text-white font-bold py-2 px-6 rounded-full text-lg">
|
163 |
+
NO
|
164 |
+
</button>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
|
169 |
+
<div id="answer-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
170 |
+
<div class="question-box p-6 md:p-8 rounded-xl max-w-md w-full mx-4 text-center">
|
171 |
+
<h2 class="text-2xl md:text-3xl font-bold mb-4 text-purple-800">AI SAYS:</h2>
|
172 |
+
<p id="answer-text" class="text-xl mb-6">The answer to your question is...</p>
|
173 |
+
<button id="close-answer-btn" class="button bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-6 rounded-full text-lg">
|
174 |
+
CONTINUE GAME
|
175 |
+
</button>
|
176 |
+
</div>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<div class="mt-8 text-center">
|
180 |
+
<p class="text-lg text-gray-700">Made with <i class="fas fa-heart text-red-500"></i> for the 90s kids!</p>
|
181 |
+
<div class="flex justify-center gap-4 mt-2">
|
182 |
+
<i class="fas fa-gamepad text-2xl text-purple-600"></i>
|
183 |
+
<i class="fas fa-music text-2xl text-blue-600"></i>
|
184 |
+
<i class="fas fa-tv text-2xl text-green-600"></i>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
<script>
|
189 |
+
// Game variables
|
190 |
+
let score = 0;
|
191 |
+
let timeLeft = 60;
|
192 |
+
let misses = 0;
|
193 |
+
let gameInterval;
|
194 |
+
let moleInterval;
|
195 |
+
let timerInterval;
|
196 |
+
let isGameRunning = false;
|
197 |
+
|
198 |
+
// DOM elements
|
199 |
+
const holes = document.querySelectorAll('.hole');
|
200 |
+
const moles = document.querySelectorAll('.mole');
|
201 |
+
const scoreDisplay = document.getElementById('score');
|
202 |
+
const timeDisplay = document.getElementById('time');
|
203 |
+
const missesDisplay = document.getElementById('misses');
|
204 |
+
const startBtn = document.getElementById('start-btn');
|
205 |
+
const resetBtn = document.getElementById('reset-btn');
|
206 |
+
const questionModal = document.getElementById('question-modal');
|
207 |
+
const questionText = document.getElementById('question-text');
|
208 |
+
const answerModal = document.getElementById('answer-modal');
|
209 |
+
const answerText = document.getElementById('answer-text');
|
210 |
+
const yesBtn = document.getElementById('yes-btn');
|
211 |
+
const noBtn = document.getElementById('no-btn');
|
212 |
+
const closeAnswerBtn = document.getElementById('close-answer-btn');
|
213 |
+
const cursorTrails = document.getElementById('cursor-trails');
|
214 |
+
|
215 |
+
// 90s-themed AI questions
|
216 |
+
const questions = [
|
217 |
+
"Is the internet just a fad?",
|
218 |
+
"Will Y2K cause computers to crash worldwide?",
|
219 |
+
"Is dial-up the future of internet connectivity?",
|
220 |
+
"Should we be worried about the Millennium Bug?",
|
221 |
+
"Will CDs replace cassette tapes completely?",
|
222 |
+
"Is virtual reality just a passing trend?",
|
223 |
+
"Should I upgrade to Windows 95?",
|
224 |
+
"Will email replace traditional mail?",
|
225 |
+
"Is the World Wide Web here to stay?",
|
226 |
+
"Should I get a pager or a mobile phone?",
|
227 |
+
"Will Tamagotchis make us better parents?",
|
228 |
+
"Is the Clippy assistant helpful in Microsoft Office?",
|
229 |
+
"Should I use AltaVista or Yahoo for web searches?",
|
230 |
+
"Will DVD replace VHS tapes?",
|
231 |
+
"Is the Furby a security risk?",
|
232 |
+
"Should I be worried about computer viruses?",
|
233 |
+
"Will AOL dominate the internet forever?",
|
234 |
+
"Is the iMac's colorful design just a gimmick?",
|
235 |
+
"Should I upgrade to a 56k modem?",
|
236 |
+
"Will MP3 players replace CD players?"
|
237 |
+
];
|
238 |
+
|
239 |
+
// AI answers (simplified for this demo)
|
240 |
+
const answers = [
|
241 |
+
"The internet is definitely not a fad - it's the future!",
|
242 |
+
"Y2K was overhyped, but some systems did have minor issues.",
|
243 |
+
"Dial-up is slow but was essential before broadband.",
|
244 |
+
"The Millennium Bug was real but mostly mitigated in time.",
|
245 |
+
"CDs did replace cassettes, but both were later replaced by digital.",
|
246 |
+
"VR took decades but is now making a strong comeback.",
|
247 |
+
"Windows 95 was revolutionary for its time!",
|
248 |
+
"Email became dominant but traditional mail still exists.",
|
249 |
+
"The Web changed everything and is definitely permanent.",
|
250 |
+
"Mobile phones won, but pagers had their moment.",
|
251 |
+
"Tamagotchis were fun but didn't teach real parenting.",
|
252 |
+
"Clippy was annoying and was eventually removed.",
|
253 |
+
"Neither - Google came along and dominated search.",
|
254 |
+
"DVDs did replace VHS, but streaming replaced both.",
|
255 |
+
"Furbies were just toys, not actual security risks.",
|
256 |
+
"Viruses are real threats - always use protection!",
|
257 |
+
"AOL declined but was important in early internet days.",
|
258 |
+
"The iMac's design was innovative and influential.",
|
259 |
+
"56k was the peak of dial-up before broadband.",
|
260 |
+
"MP3 players led to smartphones replacing both."
|
261 |
+
];
|
262 |
+
|
263 |
+
// Cursor trail effect
|
264 |
+
document.addEventListener('mousemove', (e) => {
|
265 |
+
const trail = document.createElement('div');
|
266 |
+
trail.className = 'cursor-trail';
|
267 |
+
trail.style.left = `${e.pageX}px`;
|
268 |
+
trail.style.top = `${e.pageY}px`;
|
269 |
+
cursorTrails.appendChild(trail);
|
270 |
+
|
271 |
+
// Remove the trail after a short delay
|
272 |
+
setTimeout(() => {
|
273 |
+
trail.style.opacity = '0';
|
274 |
+
trail.style.transform = 'translate(-50%, -50%) scale(2)';
|
275 |
+
setTimeout(() => {
|
276 |
+
cursorTrails.removeChild(trail);
|
277 |
+
}, 300);
|
278 |
+
}, 500);
|
279 |
+
});
|
280 |
+
|
281 |
+
// Start game
|
282 |
+
startBtn.addEventListener('click', () => {
|
283 |
+
if (isGameRunning) return;
|
284 |
+
|
285 |
+
isGameRunning = true;
|
286 |
+
score = 0;
|
287 |
+
timeLeft = 60;
|
288 |
+
misses = 0;
|
289 |
+
updateDisplays();
|
290 |
+
|
291 |
+
// Start timer
|
292 |
+
timerInterval = setInterval(() => {
|
293 |
+
timeLeft--;
|
294 |
+
updateDisplays();
|
295 |
+
|
296 |
+
if (timeLeft <= 0) {
|
297 |
+
endGame();
|
298 |
+
}
|
299 |
+
}, 1000);
|
300 |
+
|
301 |
+
// Start mole popping up
|
302 |
+
moleInterval = setInterval(popRandomMole, 800);
|
303 |
+
|
304 |
+
startBtn.disabled = true;
|
305 |
+
startBtn.classList.add('opacity-50');
|
306 |
+
});
|
307 |
+
|
308 |
+
// Reset game
|
309 |
+
resetBtn.addEventListener('click', () => {
|
310 |
+
endGame();
|
311 |
+
score = 0;
|
312 |
+
timeLeft = 60;
|
313 |
+
misses = 0;
|
314 |
+
updateDisplays();
|
315 |
+
|
316 |
+
// Hide all moles
|
317 |
+
moles.forEach(mole => {
|
318 |
+
mole.classList.remove('hit', 'missed');
|
319 |
+
mole.style.opacity = '0';
|
320 |
+
mole.style.pointerEvents = 'none';
|
321 |
+
});
|
322 |
+
|
323 |
+
startBtn.disabled = false;
|
324 |
+
startBtn.classList.remove('opacity-50');
|
325 |
+
});
|
326 |
+
|
327 |
+
// Pop up a random mole
|
328 |
+
function popRandomMole() {
|
329 |
+
if (!isGameRunning) return;
|
330 |
+
|
331 |
+
// Hide all moles first
|
332 |
+
moles.forEach(mole => {
|
333 |
+
mole.style.opacity = '0';
|
334 |
+
mole.style.pointerEvents = 'none';
|
335 |
+
});
|
336 |
+
|
337 |
+
// Select a random mole
|
338 |
+
const randomIndex = Math.floor(Math.random() * moles.length);
|
339 |
+
const mole = moles[randomIndex];
|
340 |
+
|
341 |
+
// Show the mole
|
342 |
+
mole.style.opacity = '1';
|
343 |
+
mole.style.pointerEvents = 'auto';
|
344 |
+
|
345 |
+
// Set timeout to hide the mole if not clicked
|
346 |
+
setTimeout(() => {
|
347 |
+
if (mole.style.opacity === '1') { // Mole wasn't clicked
|
348 |
+
mole.classList.add('missed');
|
349 |
+
misses++;
|
350 |
+
updateDisplays();
|
351 |
+
|
352 |
+
// Show question after miss
|
353 |
+
setTimeout(() => {
|
354 |
+
showQuestion();
|
355 |
+
}, 300);
|
356 |
+
|
357 |
+
setTimeout(() => {
|
358 |
+
mole.classList.remove('missed');
|
359 |
+
mole.style.opacity = '0';
|
360 |
+
mole.style.pointerEvents = 'none';
|
361 |
+
}, 500);
|
362 |
+
}
|
363 |
+
}, 700);
|
364 |
+
}
|
365 |
+
|
366 |
+
// Whack the mole
|
367 |
+
moles.forEach(mole => {
|
368 |
+
mole.addEventListener('click', () => {
|
369 |
+
if (!isGameRunning) return;
|
370 |
+
|
371 |
+
mole.classList.add('hit');
|
372 |
+
score++;
|
373 |
+
updateDisplays();
|
374 |
+
|
375 |
+
setTimeout(() => {
|
376 |
+
mole.classList.remove('hit');
|
377 |
+
mole.style.opacity = '0';
|
378 |
+
mole.style.pointerEvents = 'none';
|
379 |
+
}, 300);
|
380 |
+
});
|
381 |
+
});
|
382 |
+
|
383 |
+
// Show AI question
|
384 |
+
function showQuestion() {
|
385 |
+
if (!isGameRunning) return;
|
386 |
+
|
387 |
+
// Pause game
|
388 |
+
clearInterval(moleInterval);
|
389 |
+
|
390 |
+
// Select random question
|
391 |
+
const randomIndex = Math.floor(Math.random() * questions.length);
|
392 |
+
questionText.textContent = questions[randomIndex];
|
393 |
+
|
394 |
+
// Store answer index for later
|
395 |
+
questionModal.dataset.answerIndex = randomIndex;
|
396 |
+
|
397 |
+
// Show modal
|
398 |
+
questionModal.classList.remove('hidden');
|
399 |
+
}
|
400 |
+
|
401 |
+
// Handle yes button (show answer)
|
402 |
+
yesBtn.addEventListener('click', () => {
|
403 |
+
questionModal.classList.add('hidden');
|
404 |
+
|
405 |
+
const answerIndex = questionModal.dataset.answerIndex;
|
406 |
+
answerText.textContent = answers[answerIndex];
|
407 |
+
|
408 |
+
answerModal.classList.remove('hidden');
|
409 |
+
});
|
410 |
+
|
411 |
+
// Handle no button (resume game)
|
412 |
+
noBtn.addEventListener('click', () => {
|
413 |
+
questionModal.classList.add('hidden');
|
414 |
+
resumeGame();
|
415 |
+
});
|
416 |
+
|
417 |
+
// Close answer and resume game
|
418 |
+
closeAnswerBtn.addEventListener('click', () => {
|
419 |
+
answerModal.classList.add('hidden');
|
420 |
+
resumeGame();
|
421 |
+
});
|
422 |
+
|
423 |
+
// Resume game after question
|
424 |
+
function resumeGame() {
|
425 |
+
if (isGameRunning) {
|
426 |
+
moleInterval = setInterval(popRandomMole, 800);
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
// End game
|
431 |
+
function endGame() {
|
432 |
+
isGameRunning = false;
|
433 |
+
clearInterval(moleInterval);
|
434 |
+
clearInterval(timerInterval);
|
435 |
+
|
436 |
+
// Hide any open modals
|
437 |
+
questionModal.classList.add('hidden');
|
438 |
+
answerModal.classList.add('hidden');
|
439 |
+
|
440 |
+
startBtn.disabled = false;
|
441 |
+
startBtn.classList.remove('opacity-50');
|
442 |
+
}
|
443 |
+
|
444 |
+
// Update displays
|
445 |
+
function updateDisplays() {
|
446 |
+
scoreDisplay.textContent = score;
|
447 |
+
timeDisplay.textContent = timeLeft;
|
448 |
+
missesDisplay.textContent = misses;
|
449 |
+
}
|
450 |
+
</script>
|
451 |
+
<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=linoyts/vibe-coded-90s-whack-a-mole" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
452 |
+
</html>
|