Spaces:
Running
Running
Update index.html
Browse files- index.html +126 -6
index.html
CHANGED
|
@@ -49,6 +49,10 @@
|
|
| 49 |
color: #ff4081;
|
| 50 |
display: none;
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
</style>
|
| 53 |
</head>
|
| 54 |
<body>
|
|
@@ -56,6 +60,7 @@
|
|
| 56 |
<h1>AI Quiz Game</h1>
|
| 57 |
<div class="question" id="question"></div>
|
| 58 |
<div class="options" id="options"></div>
|
|
|
|
| 59 |
<div class="result" id="result"></div>
|
| 60 |
<div class="leaderboard" id="leaderboard"></div>
|
| 61 |
<div class="celebration" id="celebration">🎉 Fireworks! 🎆</div>
|
|
@@ -74,7 +79,105 @@
|
|
| 74 |
correct: 1,
|
| 75 |
explanation: "AI hallucination is when AI makes up information that sounds real—but isn’t."
|
| 76 |
},
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
];
|
| 79 |
|
| 80 |
let currentIndex = 0;
|
|
@@ -85,6 +188,9 @@
|
|
| 85 |
const resultBox = document.getElementById('result');
|
| 86 |
const leaderboardBox = document.getElementById('leaderboard');
|
| 87 |
const celebrationBox = document.getElementById('celebration');
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
function shuffle(array) {
|
| 90 |
for (let i = array.length - 1; i > 0; i--) {
|
|
@@ -94,13 +200,19 @@
|
|
| 94 |
return array;
|
| 95 |
}
|
| 96 |
|
|
|
|
|
|
|
| 97 |
function showQuestion() {
|
| 98 |
if (currentIndex >= totalQuestions) {
|
| 99 |
celebrationBox.style.display = 'block';
|
| 100 |
leaderboardBox.innerText = `🎯 Final Score: ${score}`;
|
| 101 |
return;
|
| 102 |
}
|
| 103 |
-
const q =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
questionBox.innerText = q.question;
|
| 105 |
optionsBox.innerHTML = '';
|
| 106 |
q.options.forEach((option, index) => {
|
|
@@ -111,9 +223,19 @@
|
|
| 111 |
});
|
| 112 |
}
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
function checkAnswer(selected) {
|
| 115 |
-
|
| 116 |
-
const
|
|
|
|
| 117 |
if (selected === correct) {
|
| 118 |
score += (currentIndex + 1) * 10;
|
| 119 |
resultBox.innerText = `✅ Correct! ${explanation}`;
|
|
@@ -128,9 +250,7 @@
|
|
| 128 |
}, 3000);
|
| 129 |
}
|
| 130 |
|
| 131 |
-
shuffle(questions);
|
| 132 |
showQuestion();
|
| 133 |
</script>
|
| 134 |
</body>
|
| 135 |
</html>
|
| 136 |
-
|
|
|
|
| 49 |
color: #ff4081;
|
| 50 |
display: none;
|
| 51 |
}
|
| 52 |
+
.timer {
|
| 53 |
+
font-size: 1.2em;
|
| 54 |
+
margin-top: 1em;
|
| 55 |
+
}
|
| 56 |
</style>
|
| 57 |
</head>
|
| 58 |
<body>
|
|
|
|
| 60 |
<h1>AI Quiz Game</h1>
|
| 61 |
<div class="question" id="question"></div>
|
| 62 |
<div class="options" id="options"></div>
|
| 63 |
+
<div class="timer" id="timer"></div>
|
| 64 |
<div class="result" id="result"></div>
|
| 65 |
<div class="leaderboard" id="leaderboard"></div>
|
| 66 |
<div class="celebration" id="celebration">🎉 Fireworks! 🎆</div>
|
|
|
|
| 79 |
correct: 1,
|
| 80 |
explanation: "AI hallucination is when AI makes up information that sounds real—but isn’t."
|
| 81 |
},
|
| 82 |
+
{
|
| 83 |
+
question: "Which of the following is NOT a real AI model?",
|
| 84 |
+
options: [
|
| 85 |
+
"A. GPT-4",
|
| 86 |
+
"B. BERT",
|
| 87 |
+
"C. SHREK",
|
| 88 |
+
"D. Claude"
|
| 89 |
+
],
|
| 90 |
+
correct: 2,
|
| 91 |
+
explanation: "SHREK is a beloved ogre, not an AI model."
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
question: "What is machine learning?",
|
| 95 |
+
options: [
|
| 96 |
+
"A. Teaching your toaster to surf the web",
|
| 97 |
+
"B. Programming robots to play soccer",
|
| 98 |
+
"C. Algorithms learning from data without explicit programming",
|
| 99 |
+
"D. Machines that lift weights"
|
| 100 |
+
],
|
| 101 |
+
correct: 2,
|
| 102 |
+
explanation: "Machine learning is when algorithms learn patterns from data without being explicitly programmed."
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
question: "Which of the following is a risk of AI use?",
|
| 106 |
+
options: [
|
| 107 |
+
"A. Biased outputs",
|
| 108 |
+
"B. Ethical concerns",
|
| 109 |
+
"C. Misinformation",
|
| 110 |
+
"D. All of the above"
|
| 111 |
+
],
|
| 112 |
+
correct: 3,
|
| 113 |
+
explanation: "All of the above are legitimate risks of AI use."
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
question: "Which industry has NOT adopted AI heavily yet?",
|
| 117 |
+
options: [
|
| 118 |
+
"A. Healthcare",
|
| 119 |
+
"B. Agriculture",
|
| 120 |
+
"C. Beekeeping",
|
| 121 |
+
"D. Finance"
|
| 122 |
+
],
|
| 123 |
+
correct: 2,
|
| 124 |
+
explanation: "Beekeeping isn’t widely using AI… yet."
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
question: "What does 'training' an AI model mean?",
|
| 128 |
+
options: [
|
| 129 |
+
"A. Sending it to bootcamp",
|
| 130 |
+
"B. Feeding it data to learn patterns",
|
| 131 |
+
"C. Teaching it to talk",
|
| 132 |
+
"D. Giving it motivational speeches"
|
| 133 |
+
],
|
| 134 |
+
correct: 1,
|
| 135 |
+
explanation: "Training means feeding data into a model so it can learn patterns and make predictions."
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
question: "Why should we care about explainable AI?",
|
| 139 |
+
options: [
|
| 140 |
+
"A. So we can trust the results",
|
| 141 |
+
"B. To debug AI outputs",
|
| 142 |
+
"C. For regulatory compliance",
|
| 143 |
+
"D. All of the above"
|
| 144 |
+
],
|
| 145 |
+
correct: 3,
|
| 146 |
+
explanation: "Explainable AI helps with trust, debugging, and meeting legal requirements."
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
question: "What is deep learning?",
|
| 150 |
+
options: [
|
| 151 |
+
"A. When AI takes philosophy classes",
|
| 152 |
+
"B. Neural networks with many layers",
|
| 153 |
+
"C. The emotional side of AI",
|
| 154 |
+
"D. A sleep mode for robots"
|
| 155 |
+
],
|
| 156 |
+
correct: 1,
|
| 157 |
+
explanation: "Deep learning uses neural networks with many layers to model complex patterns."
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
question: "What’s the main ingredient of generative AI?",
|
| 161 |
+
options: [
|
| 162 |
+
"A. Creativity",
|
| 163 |
+
"B. Predefined rules",
|
| 164 |
+
"C. Labeled images",
|
| 165 |
+
"D. Massive datasets and models"
|
| 166 |
+
],
|
| 167 |
+
correct: 3,
|
| 168 |
+
explanation: "Generative AI relies on huge datasets and models to generate new content."
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
question: "What's the best way to ensure ethical AI use?",
|
| 172 |
+
options: [
|
| 173 |
+
"A. Hope for the best",
|
| 174 |
+
"B. Involve diverse teams and clear guidelines",
|
| 175 |
+
"C. Let AI police itself",
|
| 176 |
+
"D. Ask ChatGPT every time"
|
| 177 |
+
],
|
| 178 |
+
correct: 1,
|
| 179 |
+
explanation: "Diverse human input and responsible governance ensure AI is used ethically."
|
| 180 |
+
}
|
| 181 |
];
|
| 182 |
|
| 183 |
let currentIndex = 0;
|
|
|
|
| 188 |
const resultBox = document.getElementById('result');
|
| 189 |
const leaderboardBox = document.getElementById('leaderboard');
|
| 190 |
const celebrationBox = document.getElementById('celebration');
|
| 191 |
+
const timerBox = document.getElementById('timer');
|
| 192 |
+
let timer;
|
| 193 |
+
let timeLeft = 10;
|
| 194 |
|
| 195 |
function shuffle(array) {
|
| 196 |
for (let i = array.length - 1; i > 0; i--) {
|
|
|
|
| 200 |
return array;
|
| 201 |
}
|
| 202 |
|
| 203 |
+
const shuffledQuestions = shuffle(questions).slice(0, totalQuestions);
|
| 204 |
+
|
| 205 |
function showQuestion() {
|
| 206 |
if (currentIndex >= totalQuestions) {
|
| 207 |
celebrationBox.style.display = 'block';
|
| 208 |
leaderboardBox.innerText = `🎯 Final Score: ${score}`;
|
| 209 |
return;
|
| 210 |
}
|
| 211 |
+
const q = shuffledQuestions[currentIndex];
|
| 212 |
+
timeLeft = 10;
|
| 213 |
+
timerBox.innerText = `⏱️ ${timeLeft} seconds left`;
|
| 214 |
+
timer = setInterval(updateTimer, 1000);
|
| 215 |
+
|
| 216 |
questionBox.innerText = q.question;
|
| 217 |
optionsBox.innerHTML = '';
|
| 218 |
q.options.forEach((option, index) => {
|
|
|
|
| 223 |
});
|
| 224 |
}
|
| 225 |
|
| 226 |
+
function updateTimer() {
|
| 227 |
+
timeLeft--;
|
| 228 |
+
timerBox.innerText = `⏱️ ${timeLeft} seconds left`;
|
| 229 |
+
if (timeLeft <= 0) {
|
| 230 |
+
clearInterval(timer);
|
| 231 |
+
checkAnswer(-1);
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
function checkAnswer(selected) {
|
| 236 |
+
clearInterval(timer);
|
| 237 |
+
const correct = shuffledQuestions[currentIndex].correct;
|
| 238 |
+
const explanation = shuffledQuestions[currentIndex].explanation;
|
| 239 |
if (selected === correct) {
|
| 240 |
score += (currentIndex + 1) * 10;
|
| 241 |
resultBox.innerText = `✅ Correct! ${explanation}`;
|
|
|
|
| 250 |
}, 3000);
|
| 251 |
}
|
| 252 |
|
|
|
|
| 253 |
showQuestion();
|
| 254 |
</script>
|
| 255 |
</body>
|
| 256 |
</html>
|
|
|