eaglelandsonce commited on
Commit
3d1507e
·
verified ·
1 Parent(s): 33a0b2e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +442 -18
index.html CHANGED
@@ -1,19 +1,443 @@
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
+ <title>RDD Hangman</title>
6
+ <style>
7
+ body {
8
+ font-family: Arial, sans-serif;
9
+ background: #f0f2f5;
10
+ margin: 0;
11
+ padding: 0;
12
+ text-align: center;
13
+ }
14
+ header {
15
+ background-color: #0078d4;
16
+ color: #fff;
17
+ padding: 1rem;
18
+ }
19
+ h1 {
20
+ margin: 0;
21
+ font-size: 1.8rem;
22
+ }
23
+ .container {
24
+ max-width: 900px;
25
+ margin: 2rem auto;
26
+ background: #fff;
27
+ padding: 2rem;
28
+ border-radius: 8px;
29
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
30
+ text-align: left;
31
+ }
32
+ #hangman-container {
33
+ display: flex;
34
+ flex-wrap: wrap;
35
+ justify-content: center;
36
+ align-items: flex-start;
37
+ }
38
+ /* SVG container */
39
+ #svg-container {
40
+ width: 250px;
41
+ margin-right: 2rem;
42
+ margin-bottom: 2rem;
43
+ }
44
+ #quiz-content {
45
+ flex: 1;
46
+ margin: 0 1rem;
47
+ min-width: 250px;
48
+ }
49
+ #question {
50
+ font-size: 1.2rem;
51
+ font-weight: bold;
52
+ margin-bottom: 1rem;
53
+ }
54
+ .btn-row {
55
+ margin-top: 1rem;
56
+ }
57
+ button {
58
+ padding: 0.6rem 1.2rem;
59
+ font-size: 1rem;
60
+ margin: 0.5rem;
61
+ cursor: pointer;
62
+ border: none;
63
+ border-radius: 4px;
64
+ background-color: #0078d4;
65
+ color: #fff;
66
+ transition: background-color 0.3s ease;
67
+ }
68
+ button:hover {
69
+ background-color: #005fa3;
70
+ }
71
+ #feedback {
72
+ font-weight: bold;
73
+ margin-top: 1rem;
74
+ min-height: 24px;
75
+ }
76
+ #explanation {
77
+ margin-top: 1rem;
78
+ padding: 1rem;
79
+ border: 1px solid #ccc;
80
+ border-radius: 6px;
81
+ display: none;
82
+ background: #fafafa;
83
+ }
84
+ #next-btn, #restart-btn {
85
+ margin-top: 1rem;
86
+ }
87
+ #restart-btn {
88
+ background-color: #ff7675;
89
+ }
90
+ #restart-btn:hover {
91
+ background-color: #d63031;
92
+ }
93
+ #hint-btn {
94
+ background-color: #f1c40f;
95
+ color: #000;
96
+ }
97
+ #hint-btn:hover {
98
+ background-color: #d4ac0d;
99
+ color: #fff;
100
+ }
101
+ /* Cheat Sheet styling */
102
+ #cheat-sheet {
103
+ display: none;
104
+ position: fixed;
105
+ top: 10%;
106
+ left: 50%;
107
+ transform: translateX(-50%);
108
+ background: #fff;
109
+ padding: 20px;
110
+ border: 2px solid #444;
111
+ box-shadow: 0 0 10px rgba(0,0,0,0.5);
112
+ z-index: 999;
113
+ width: 80%;
114
+ max-width: 600px;
115
+ }
116
+ #cheat-sheet h2 {
117
+ margin-top: 0;
118
+ }
119
+ #cheat-sheet ul {
120
+ list-style: disc;
121
+ margin: 1rem 0 0 1.5rem;
122
+ padding: 0;
123
+ text-align: left;
124
+ }
125
+ #close-cheat {
126
+ float: right;
127
+ cursor: pointer;
128
+ font-weight: bold;
129
+ font-size: 18px;
130
+ color: red;
131
+ }
132
+ /* Responsive layout */
133
+ @media (max-width: 600px) {
134
+ #hangman-container {
135
+ flex-direction: column;
136
+ align-items: center;
137
+ }
138
+ #svg-container {
139
+ margin-right: 0;
140
+ margin-bottom: 1.5rem;
141
+ }
142
+ #quiz-content {
143
+ margin: 0;
144
+ }
145
+ }
146
+ </style>
147
+ </head>
148
+ <body>
149
+ <header>
150
+ <h1>RDD Hangman</h1>
151
+ </header>
152
+ <div class="container">
153
+ <div id="hangman-container">
154
+ <!-- SVG Hangman -->
155
+ <div id="svg-container">
156
+ <svg
157
+ width="250"
158
+ height="300"
159
+ viewBox="0 0 250 300"
160
+ style="border:1px solid #ccc;"
161
+ >
162
+ <!-- Base line -->
163
+ <line id="base-line" x1="10" y1="280" x2="240" y2="280" stroke="#444" stroke-width="4" style="display:none;" />
164
+ <!-- Upright post -->
165
+ <line id="upright-post" x1="60" y1="280" x2="60" y2="40" stroke="#444" stroke-width="4" style="display:none;" />
166
+ <!-- Top beam -->
167
+ <line id="top-beam" x1="60" y1="40" x2="160" y2="40" stroke="#444" stroke-width="4" style="display:none;" />
168
+ <!-- Rope -->
169
+ <line id="rope" x1="160" y1="40" x2="160" y2="80" stroke="#444" stroke-width="4" style="display:none;" />
170
+ <!-- Head -->
171
+ <circle id="head" cx="160" cy="100" r="20" stroke="#444" stroke-width="4" fill="none" style="display:none;" />
172
+ <!-- Body -->
173
+ <line id="body" x1="160" y1="120" x2="160" y2="180" stroke="#444" stroke-width="4" style="display:none;" />
174
+ <!-- Left arm -->
175
+ <line id="left-arm" x1="160" y1="140" x2="120" y2="120" stroke="#444" stroke-width="4" style="display:none;" />
176
+ <!-- Right arm -->
177
+ <line id="right-arm" x1="160" y1="140" x2="200" y2="120" stroke="#444" stroke-width="4" style="display:none;" />
178
+ <!-- Left leg -->
179
+ <line id="left-leg" x1="160" y1="180" x2="130" y2="220" stroke="#444" stroke-width="4" style="display:none;" />
180
+ <!-- Right leg -->
181
+ <line id="right-leg" x1="160" y1="180" x2="190" y2="220" stroke="#444" stroke-width="4" style="display:none;" />
182
+ </svg>
183
+ </div>
184
+ <!-- Quiz Section -->
185
+ <div id="quiz-content">
186
+ <div id="question">Loading question...</div>
187
+ <div class="btn-row">
188
+ <button id="yes-btn">YES</button>
189
+ <button id="no-btn">NO</button>
190
+ </div>
191
+ <div id="feedback"></div>
192
+ <div id="explanation"></div>
193
+ <button id="hint-btn">Hint</button>
194
+ <button id="next-btn" style="display:none;">Next</button>
195
+ <button id="restart-btn" style="display:none;">Restart</button>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ <!-- Cheat Sheet Popup -->
200
+ <div id="cheat-sheet">
201
+ <span id="close-cheat">X</span>
202
+ <h2>Key RDD Concepts</h2>
203
+ <ul>
204
+ <li><b>Fault Tolerance:</b> RDDs automatically recover from node failures.</li>
205
+ <li><b>Lazy Evaluation:</b> Transformations are computed only when an action is invoked.</li>
206
+ <li><b>Caching:</b> Use persist() or cache() to keep RDDs in memory.</li>
207
+ <li><b>Transformations &amp; Actions:</b> Transformations create new RDDs; actions return results to the driver.</li>
208
+ <li><b>Partitioning:</b> Data is divided across nodes for parallel processing.</li>
209
+ <li><b>Shared Variables:</b> Broadcast variables and accumulators help manage data and counters.</li>
210
+ <li><b>Shuffling:</b> Redistribution of data during aggregations or joins.</li>
211
+ <li><b>SparkContext:</b> Entry point for Spark functionality.</li>
212
+ <li><b>Data Sources:</b> RDDs can be created from files, collections, and various storage systems.</li>
213
+ <li><b>Efficient Aggregation:</b> Operations like reduceByKey optimize data processing.</li>
214
+ </ul>
215
+ </div>
216
+ <script>
217
+ /****************************************************
218
+ * QUIZ QUESTIONS
219
+ ****************************************************/
220
+ const quizData = [
221
+ {
222
+ question: "Does GitHub Copilot dramatically accelerate developer productivity?",
223
+ correctAnswer: "yes",
224
+ explanation: "Yes. Research from GitHub and Microsoft shows a 55% increase in overall productivity when using GitHub Copilot."
225
+ },
226
+ {
227
+ question: "Is GitHub Copilot limited to only one programming language?",
228
+ correctAnswer: "no",
229
+ explanation: "No. GitHub Copilot supports all popular programming languages, helping developers regardless of language choice."
230
+ },
231
+ {
232
+ question: "Was GitHub Copilot developed solely by GitHub?",
233
+ correctAnswer: "no",
234
+ explanation: "No. GitHub Copilot was developed through a collaboration between GitHub and OpenAI, and it’s powered by OpenAI Codex."
235
+ },
236
+ {
237
+ question: "Is GitHub Copilot powered by OpenAI Codex?",
238
+ correctAnswer: "yes",
239
+ explanation: "Yes. GitHub Copilot leverages OpenAI Codex, an AI system more capable than GPT-3 in generating code completions."
240
+ },
241
+ {
242
+ question: "Does GitHub Copilot integrate with multiple IDEs such as Visual Studio Code, Visual Studio, Vim/Neovim, and JetBrains?",
243
+ correctAnswer: "yes",
244
+ explanation: "Yes. GitHub Copilot is available as an extension for these popular integrated development environments."
245
+ },
246
+ {
247
+ question: "Does GitHub Copilot Free offer unlimited code completions and chat messages?",
248
+ correctAnswer: "no",
249
+ explanation: "No. The free tier is limited to 2000 code completions and 50 chat messages per month."
250
+ },
251
+ {
252
+ question: "Is GitHub Copilot Pro free for verified students, teachers, and maintainers of popular open source projects?",
253
+ correctAnswer: "yes",
254
+ explanation: "Yes. Verified students, teachers, and open source maintainers can access GitHub Copilot Pro for free."
255
+ },
256
+ {
257
+ question: "Do organizations benefit from features like policy management and audit logs with GitHub Copilot Business?",
258
+ correctAnswer: "yes",
259
+ explanation: "Yes. GitHub Copilot Business adds organization-wide controls such as policy management and audit logs."
260
+ },
261
+ {
262
+ question: "Does GitHub Copilot Enterprise provide additional features like fine tuning a custom large language model?",
263
+ correctAnswer: "yes",
264
+ explanation: "Yes. In addition to Business features, GitHub Copilot Enterprise includes capabilities such as fine tuning a custom large language model."
265
+ },
266
+ {
267
+ question: "Is GitHub Copilot Chat completely free from biases and inaccuracies?",
268
+ correctAnswer: "no",
269
+ explanation: "No. While powerful, Copilot Chat can exhibit biases from its training data and may sometimes generate inaccurate code."
270
+ }
271
+ ];
272
+
273
+ /****************************************************
274
+ * HANGMAN PARTS
275
+ ****************************************************/
276
+ const hangmanParts = [
277
+ "base-line",
278
+ "upright-post",
279
+ "top-beam",
280
+ "rope",
281
+ "head",
282
+ "body",
283
+ "left-arm",
284
+ "right-arm",
285
+ "left-leg",
286
+ "right-leg"
287
+ ];
288
+ const maxMistakes = hangmanParts.length; // 10 parts
289
+
290
+ /****************************************************
291
+ * GAME STATE VARIABLES
292
+ ****************************************************/
293
+ let currentQuestionIndex = 0;
294
+ let mistakes = 0;
295
+ let gameOver = false;
296
+ // DOM references
297
+ const questionDiv = document.getElementById("question");
298
+ const yesBtn = document.getElementById("yes-btn");
299
+ const noBtn = document.getElementById("no-btn");
300
+ const nextBtn = document.getElementById("next-btn");
301
+ const restartBtn = document.getElementById("restart-btn");
302
+ const feedbackDiv = document.getElementById("feedback");
303
+ const explanationDiv = document.getElementById("explanation");
304
+ const hintBtn = document.getElementById("hint-btn");
305
+ const cheatSheet = document.getElementById("cheat-sheet");
306
+ const closeCheat = document.getElementById("close-cheat");
307
+ // Get references to the SVG parts
308
+ const svgParts = hangmanParts.map(id => document.getElementById(id));
309
+
310
+ /****************************************************
311
+ * INIT GAME
312
+ ****************************************************/
313
+ function initGame() {
314
+ mistakes = 0;
315
+ currentQuestionIndex = 0;
316
+ gameOver = false;
317
+ feedbackDiv.textContent = "";
318
+ explanationDiv.style.display = "none";
319
+ restartBtn.style.display = "none";
320
+ nextBtn.style.display = "none";
321
+ // Hide all hangman parts
322
+ svgParts.forEach(part => {
323
+ if (part) part.style.display = "none";
324
+ });
325
+ loadQuestion();
326
+ }
327
+
328
+ /****************************************************
329
+ * LOAD QUESTION
330
+ ****************************************************/
331
+ function loadQuestion() {
332
+ if (currentQuestionIndex >= quizData.length) {
333
+ // All questions answered
334
+ endGame(true);
335
+ return;
336
+ }
337
+ feedbackDiv.textContent = "";
338
+ explanationDiv.style.display = "none";
339
+ nextBtn.style.display = "none";
340
+ const currentQ = quizData[currentQuestionIndex];
341
+ questionDiv.textContent = currentQ.question;
342
+ }
343
+
344
+ /****************************************************
345
+ * HANDLE ANSWER
346
+ ****************************************************/
347
+ function handleAnswer(userAnswer) {
348
+ if (gameOver || currentQuestionIndex >= quizData.length) return;
349
+ const currentQ = quizData[currentQuestionIndex];
350
+ explanationDiv.textContent = currentQ.explanation;
351
+ explanationDiv.style.display = "block";
352
+ if (userAnswer === currentQ.correctAnswer) {
353
+ feedbackDiv.textContent = "Correct!";
354
+ } else {
355
+ feedbackDiv.textContent = "Incorrect!";
356
+ mistakes++;
357
+ updateHangman();
358
+ if (mistakes >= maxMistakes) {
359
+ // Reached maximum mistakes
360
+ endGame(false);
361
+ return;
362
+ }
363
+ }
364
+ // Show Next button if not the last question
365
+ if (currentQuestionIndex < quizData.length) {
366
+ nextBtn.style.display = "inline-block";
367
+ }
368
+ }
369
+
370
+ /****************************************************
371
+ * UPDATE HANGMAN (DRAW)
372
+ ****************************************************/
373
+ function updateHangman() {
374
+ // Reveal the next part
375
+ const partToShow = hangmanParts[mistakes - 1];
376
+ if (partToShow) {
377
+ document.getElementById(partToShow).style.display = "block";
378
+ }
379
+ }
380
+
381
+ /****************************************************
382
+ * END GAME
383
+ ****************************************************/
384
+ function endGame(userCompletedAll) {
385
+ gameOver = true;
386
+ yesBtn.disabled = true;
387
+ noBtn.disabled = true;
388
+ nextBtn.style.display = "none";
389
+ restartBtn.style.display = "inline-block";
390
+ if (userCompletedAll && mistakes < maxMistakes) {
391
+ feedbackDiv.textContent = `Congratulations! You answered all ${quizData.length} questions with ${mistakes} mistake(s).`;
392
+ explanationDiv.textContent = "Game Complete!";
393
+ explanationDiv.style.display = "block";
394
+ } else {
395
+ questionDiv.textContent = "Game Over!";
396
+ feedbackDiv.textContent = `You made ${mistakes} mistake(s).`;
397
+ explanationDiv.textContent = "The game has ended.";
398
+ explanationDiv.style.display = "block";
399
+ }
400
+ }
401
+
402
+ /****************************************************
403
+ * NEXT QUESTION
404
+ ****************************************************/
405
+ function loadNextQuestion() {
406
+ currentQuestionIndex++;
407
+ loadQuestion();
408
+ }
409
+
410
+ /****************************************************
411
+ * RESTART GAME
412
+ ****************************************************/
413
+ function restartGame() {
414
+ yesBtn.disabled = false;
415
+ noBtn.disabled = false;
416
+ initGame();
417
+ }
418
+
419
+ /****************************************************
420
+ * CHEAT SHEET
421
+ ****************************************************/
422
+ function showCheatSheet() {
423
+ cheatSheet.style.display = "block";
424
+ }
425
+ function hideCheatSheet() {
426
+ cheatSheet.style.display = "none";
427
+ }
428
+
429
+ /****************************************************
430
+ * EVENT LISTENERS
431
+ ****************************************************/
432
+ yesBtn.addEventListener("click", () => handleAnswer("yes"));
433
+ noBtn.addEventListener("click", () => handleAnswer("no"));
434
+ nextBtn.addEventListener("click", loadNextQuestion);
435
+ restartBtn.addEventListener("click", restartGame);
436
+ hintBtn.addEventListener("click", showCheatSheet);
437
+ closeCheat.addEventListener("click", hideCheatSheet);
438
+
439
+ // Initialize the game on page load
440
+ initGame();
441
+ </script>
442
+ </body>
443
  </html>