Culturetiming commited on
Commit
bb65367
·
verified ·
1 Parent(s): 0e4e4ec

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +135 -18
index.html CHANGED
@@ -1,19 +1,136 @@
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>AI Quiz Game</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background: #f0f4f8;
11
+ text-align: center;
12
+ padding: 2em;
13
+ }
14
+ .container {
15
+ background: #fff;
16
+ padding: 2em;
17
+ border-radius: 10px;
18
+ max-width: 600px;
19
+ margin: auto;
20
+ box-shadow: 0 4px 10px rgba(0,0,0,0.1);
21
+ }
22
+ h1 {
23
+ color: #333;
24
+ }
25
+ .question {
26
+ font-size: 1.2em;
27
+ margin-bottom: 1em;
28
+ }
29
+ .options button {
30
+ display: block;
31
+ background: #e0e0e0;
32
+ border: none;
33
+ padding: 1em;
34
+ margin: 0.5em auto;
35
+ width: 100%;
36
+ border-radius: 5px;
37
+ cursor: pointer;
38
+ font-size: 1em;
39
+ }
40
+ .options button:hover {
41
+ background: #c0c0c0;
42
+ }
43
+ .leaderboard, .result {
44
+ margin-top: 1.5em;
45
+ font-weight: bold;
46
+ }
47
+ .celebration {
48
+ font-size: 2em;
49
+ color: #ff4081;
50
+ display: none;
51
+ }
52
+ </style>
53
+ </head>
54
+ <body>
55
+ <div class="container">
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>
62
+ </div>
63
+
64
+ <script>
65
+ const questions = [
66
+ {
67
+ question: "What is an AI hallucination?",
68
+ options: [
69
+ "A. When your AI starts predicting lottery numbers and insists they're real.",
70
+ "B. When AI makes up info that sounds real—but isn't.",
71
+ "C. When your AI suddenly speaks in rhymes like it’s auditioning for a rap battle.",
72
+ "D. When AI mimics a dream sequence from a sci-fi movie."
73
+ ],
74
+ correct: 1,
75
+ explanation: "AI hallucination is when AI makes up information that sounds real—but isn’t."
76
+ },
77
+ // Add 9 more creative/fun AI-themed questions here
78
+ ];
79
+
80
+ let currentIndex = 0;
81
+ let score = 0;
82
+ const totalQuestions = 10;
83
+ const questionBox = document.getElementById('question');
84
+ const optionsBox = document.getElementById('options');
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--) {
91
+ const j = Math.floor(Math.random() * (i + 1));
92
+ [array[i], array[j]] = [array[j], array[i]];
93
+ }
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 = questions[currentIndex];
104
+ questionBox.innerText = q.question;
105
+ optionsBox.innerHTML = '';
106
+ q.options.forEach((option, index) => {
107
+ const btn = document.createElement('button');
108
+ btn.innerText = option;
109
+ btn.onclick = () => checkAnswer(index);
110
+ optionsBox.appendChild(btn);
111
+ });
112
+ }
113
+
114
+ function checkAnswer(selected) {
115
+ const correct = questions[currentIndex].correct;
116
+ const explanation = questions[currentIndex].explanation;
117
+ if (selected === correct) {
118
+ score += (currentIndex + 1) * 10;
119
+ resultBox.innerText = `✅ Correct! ${explanation}`;
120
+ } else {
121
+ resultBox.innerText = `❌ Oops! ${explanation}`;
122
+ }
123
+ currentIndex++;
124
+ setTimeout(() => {
125
+ resultBox.innerText = '';
126
+ leaderboardBox.innerText = `🏆 Current Score: ${score}`;
127
+ showQuestion();
128
+ }, 3000);
129
+ }
130
+
131
+ shuffle(questions);
132
+ showQuestion();
133
+ </script>
134
+ </body>
135
  </html>
136
+