arbib commited on
Commit
f1c55b8
·
verified ·
1 Parent(s): 93862b1

je veux une jeux educatife pour la geographie pour les adultes - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +641 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Test
3
- emoji: 📈
4
- colorFrom: blue
5
- colorTo: red
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: test
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: yellow
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,641 @@
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="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>GéoChallenge - Jeu éducatif de géographie</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
+ .country-flag {
11
+ height: 120px;
12
+ object-fit: contain;
13
+ background-color: #f8fafc;
14
+ border-radius: 8px;
15
+ padding: 8px;
16
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
17
+ }
18
+ .monument-image {
19
+ height: 180px;
20
+ width: 100%;
21
+ object-fit: cover;
22
+ border-radius: 8px;
23
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
24
+ }
25
+ .progress-bar {
26
+ transition: width 0.5s ease-in-out;
27
+ }
28
+ .option-btn {
29
+ transition: all 0.2s ease;
30
+ }
31
+ .option-btn:hover {
32
+ transform: translateY(-2px);
33
+ }
34
+ .option-btn.correct {
35
+ background-color: #10b981 !important;
36
+ color: white !important;
37
+ }
38
+ .option-btn.incorrect {
39
+ background-color: #ef4444 !important;
40
+ color: white !important;
41
+ }
42
+ .pulse-animation {
43
+ animation: pulse 2s infinite;
44
+ }
45
+ @keyframes pulse {
46
+ 0% { transform: scale(1); }
47
+ 50% { transform: scale(1.05); }
48
+ 100% { transform: scale(1); }
49
+ }
50
+ </style>
51
+ </head>
52
+ <body class="bg-gray-50 min-h-screen font-sans">
53
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
54
+ <!-- Header -->
55
+ <header class="text-center mb-8">
56
+ <h1 class="text-4xl font-bold text-blue-800 mb-2">GéoChallenge</h1>
57
+ <p class="text-lg text-gray-600">Testez vos connaissances en géographie mondiale</p>
58
+ <div class="flex justify-center mt-4">
59
+ <div class="w-full bg-gray-200 rounded-full h-4 max-w-xl">
60
+ <div id="progress-bar" class="progress-bar bg-blue-600 h-4 rounded-full" style="width: 0%"></div>
61
+ </div>
62
+ </div>
63
+ <div id="score-display" class="mt-2 text-lg font-semibold text-blue-700">
64
+ Score: <span id="score">0</span>/<span id="total-questions">0</span>
65
+ </div>
66
+ </header>
67
+
68
+ <!-- Game Area -->
69
+ <main>
70
+ <!-- Start Screen -->
71
+ <div id="start-screen" class="bg-white rounded-xl shadow-lg p-8 text-center">
72
+ <div class="mb-6">
73
+ <i class="fas fa-globe-europe text-6xl text-blue-600 mb-4"></i>
74
+ <h2 class="text-2xl font-bold text-gray-800 mb-2">Bienvenue sur GéoChallenge</h2>
75
+ <p class="text-gray-600 mb-6">Un jeu éducatif pour tester et améliorer vos connaissances en géographie. Prêt à relever le défi ?</p>
76
+ </div>
77
+ <div class="mb-6">
78
+ <label for="difficulty" class="block text-gray-700 font-medium mb-2">Niveau de difficulté</label>
79
+ <select id="difficulty" class="w-full md:w-64 px-4 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500">
80
+ <option value="easy">Facile</option>
81
+ <option value="medium">Moyen</option>
82
+ <option value="hard">Difficile</option>
83
+ </select>
84
+ </div>
85
+ <button id="start-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-lg text-lg transition-all duration-300 transform hover:scale-105 pulse-animation">
86
+ Commencer le jeu <i class="fas fa-play ml-2"></i>
87
+ </button>
88
+ </div>
89
+
90
+ <!-- Question Screen -->
91
+ <div id="question-screen" class="hidden bg-white rounded-xl shadow-lg p-6 md:p-8">
92
+ <div class="flex justify-between items-center mb-6">
93
+ <div id="question-number" class="text-gray-500 font-medium">Question 1/10</div>
94
+ <div id="timer" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full font-semibold flex items-center">
95
+ <i class="fas fa-clock mr-2"></i>
96
+ <span id="time">30</span>s
97
+ </div>
98
+ </div>
99
+
100
+ <div id="question-container">
101
+ <h2 id="question-text" class="text-xl md:text-2xl font-bold text-gray-800 mb-6"></h2>
102
+
103
+ <!-- Flag Question -->
104
+ <div id="flag-question" class="hidden mb-8">
105
+ <div class="flex justify-center">
106
+ <img id="flag-image" src="" alt="Drapeau du pays" class="country-flag">
107
+ </div>
108
+ </div>
109
+
110
+ <!-- Monument Question -->
111
+ <div id="monument-question" class="hidden mb-8">
112
+ <div class="flex justify-center">
113
+ <img id="monument-image" src="" alt="Monument" class="monument-image">
114
+ </div>
115
+ </div>
116
+
117
+ <!-- Options Container -->
118
+ <div id="options-container" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
119
+ <!-- Options will be inserted here by JavaScript -->
120
+ </div>
121
+ </div>
122
+
123
+ <div class="flex justify-between items-center mt-6">
124
+ <button id="hint-btn" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 font-medium py-2 px-4 rounded-lg flex items-center">
125
+ <i class="fas fa-lightbulb mr-2"></i> Indice
126
+ </button>
127
+ <button id="next-btn" class="hidden bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-6 rounded-lg">
128
+ Suivant <i class="fas fa-arrow-right ml-2"></i>
129
+ </button>
130
+ </div>
131
+ </div>
132
+
133
+ <!-- Hint Modal -->
134
+ <div id="hint-modal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
135
+ <div class="bg-white rounded-xl p-6 max-w-md mx-4">
136
+ <div class="flex justify-between items-center mb-4">
137
+ <h3 class="text-xl font-bold text-gray-800"><i class="fas fa-lightbulb text-yellow-500 mr-2"></i> Indice</h3>
138
+ <button id="close-hint" class="text-gray-500 hover:text-gray-700">
139
+ <i class="fas fa-times"></i>
140
+ </button>
141
+ </div>
142
+ <p id="hint-text" class="text-gray-700 mb-4"></p>
143
+ <div class="text-right">
144
+ <button id="use-hint" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg">
145
+ Utiliser cet indice
146
+ </button>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ <!-- Results Screen -->
152
+ <div id="results-screen" class="hidden bg-white rounded-xl shadow-lg p-8 text-center">
153
+ <div class="mb-6">
154
+ <div class="flex justify-center mb-4">
155
+ <div class="w-24 h-24 rounded-full bg-blue-100 flex items-center justify-center">
156
+ <i class="fas fa-trophy text-4xl text-yellow-500"></i>
157
+ </div>
158
+ </div>
159
+ <h2 class="text-2xl font-bold text-gray-800 mb-2">Résultats finaux</h2>
160
+ <p id="result-message" class="text-gray-600 mb-6"></p>
161
+ </div>
162
+
163
+ <div class="bg-gray-50 rounded-lg p-6 mb-8">
164
+ <div class="grid grid-cols-3 gap-4 text-center">
165
+ <div>
166
+ <div class="text-3xl font-bold text-blue-600" id="final-score">0</div>
167
+ <div class="text-gray-500">Score</div>
168
+ </div>
169
+ <div>
170
+ <div class="text-3xl font-bold text-green-600" id="correct-answers">0</div>
171
+ <div class="text-gray-500">Correctes</div>
172
+ </div>
173
+ <div>
174
+ <div class="text-3xl font-bold text-red-600" id="wrong-answers">0</div>
175
+ <div class="text-gray-500">Incorrectes</div>
176
+ </div>
177
+ </div>
178
+ </div>
179
+
180
+ <div class="mb-6">
181
+ <h3 class="text-lg font-semibold text-gray-700 mb-3">Détail des réponses</h3>
182
+ <div id="answers-detail" class="space-y-3 max-h-60 overflow-y-auto">
183
+ <!-- Answers detail will be inserted here -->
184
+ </div>
185
+ </div>
186
+
187
+ <button id="restart-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-lg text-lg">
188
+ Rejouer <i class="fas fa-redo ml-2"></i>
189
+ </button>
190
+ </div>
191
+ </main>
192
+
193
+ <!-- Footer -->
194
+ <footer class="mt-12 text-center text-gray-500 text-sm">
195
+ <p>GéoChallenge - Un jeu éducatif pour apprendre la géographie en s'amusant</p>
196
+ <p class="mt-1">© 2023 Tous droits réservés</p>
197
+ </footer>
198
+ </div>
199
+
200
+ <script>
201
+ // Game data
202
+ const gameData = {
203
+ easy: [
204
+ {
205
+ type: "capital",
206
+ question: "Quelle est la capitale de la France ?",
207
+ options: ["Lyon", "Marseille", "Paris", "Bordeaux"],
208
+ answer: "Paris",
209
+ hint: "Cette ville est connue comme la 'Ville Lumière' et abrite la Tour Eiffel."
210
+ },
211
+ {
212
+ type: "flag",
213
+ question: "À quel pays appartient ce drapeau ?",
214
+ flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Flag_of_Brazil.svg/320px-Flag_of_Brazil.svg.png",
215
+ options: ["Argentine", "Brésil", "Colombie", "Venezuela"],
216
+ answer: "Brésil",
217
+ hint: "Ce pays est le plus grand d'Amérique du Sud et est connu pour le Carnaval de Rio."
218
+ },
219
+ {
220
+ type: "monument",
221
+ question: "Dans quel pays se trouve ce monument ?",
222
+ monument: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/NYC_Empire_State_Building.jpg/320px-NYC_Empire_State_Building.jpg",
223
+ options: ["Canada", "États-Unis", "Royaume-Uni", "Australie"],
224
+ answer: "États-Unis",
225
+ hint: "Ce gratte-ciel emblématique est situé à New York."
226
+ },
227
+ {
228
+ type: "capital",
229
+ question: "Quelle est la capitale du Japon ?",
230
+ options: ["Osaka", "Kyoto", "Tokyo", "Hiroshima"],
231
+ answer: "Tokyo",
232
+ hint: "C'est la plus grande ville du Japon et l'une des métropoles les plus peuplées du monde."
233
+ },
234
+ {
235
+ type: "flag",
236
+ question: "À quel pays appartient ce drapeau ?",
237
+ flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Flag_of_the_People%27s_Republic_of_China.svg/320px-Flag_of_the_People%27s_Republic_of_China.svg.png",
238
+ options: ["Japon", "Corée du Sud", "Chine", "Vietnam"],
239
+ answer: "Chine",
240
+ hint: "Ce pays est le plus peuplé du monde et abrite la Grande Muraille."
241
+ }
242
+ ],
243
+ medium: [
244
+ {
245
+ type: "capital",
246
+ question: "Quelle est la capitale de l'Afrique du Sud ?",
247
+ options: ["Pretoria", "Le Cap", "Bloemfontein", "Les trois"],
248
+ answer: "Les trois",
249
+ hint: "Ce pays a trois capitales officielles pour différentes branches du gouvernement."
250
+ },
251
+ {
252
+ type: "monument",
253
+ question: "Dans quel pays se trouve ce monument ?",
254
+ monument: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/Colosseo_2020.jpg/320px-Colosseo_2020.jpg",
255
+ options: ["Grèce", "Italie", "Espagne", "Turquie"],
256
+ answer: "Italie",
257
+ hint: "Cet amphithéâtre antique est situé dans la capitale de ce pays."
258
+ },
259
+ {
260
+ type: "flag",
261
+ question: "À quel pays appartient ce drapeau ?",
262
+ flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Flag_of_Japan.svg/320px-Flag_of_Japan.svg.png",
263
+ options: ["Corée du Sud", "Japon", "Chine", "Thaïlande"],
264
+ answer: "Japon",
265
+ hint: "Ce pays est connu comme le 'Pays du Soleil Levant'."
266
+ },
267
+ {
268
+ type: "capital",
269
+ question: "Quelle est la capitale du Canada ?",
270
+ options: ["Toronto", "Montréal", "Ottawa", "Vancouver"],
271
+ answer: "Ottawa",
272
+ hint: "Cette ville est située dans la province de l'Ontario, près de la frontière avec le Québec."
273
+ },
274
+ {
275
+ type: "monument",
276
+ question: "Dans quel pays se trouve ce monument ?",
277
+ monument: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Sydney_Opera_House_and_Harbour_Bridge_Dusk_%282%29_2019-06-21.jpg/320px-Sydney_Opera_House_and_Harbour_Bridge_Dusk_%282%29_2019-06-21.jpg",
278
+ options: ["Nouvelle-Zélande", "Australie", "Afrique du Sud", "Argentine"],
279
+ answer: "Australie",
280
+ hint: "Ce monument emblématique est situé dans la plus grande ville de ce pays."
281
+ }
282
+ ],
283
+ hard: [
284
+ {
285
+ type: "capital",
286
+ question: "Quelle est la capitale de la Suisse ?",
287
+ options: ["Zurich", "Genève", "Berne", "Bâle"],
288
+ answer: "Berne",
289
+ hint: "Bien que ce ne soit pas la plus grande ville du pays, c'est la capitale fédérale."
290
+ },
291
+ {
292
+ type: "flag",
293
+ question: "À quel pays appartient ce drapeau ?",
294
+ flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Flag_of_Portugal.svg/320px-Flag_of_Portugal.svg.png",
295
+ options: ["Portugal", "Serbie", "Slovaquie", "Lituanie"],
296
+ answer: "Portugal",
297
+ hint: "Ce pays européen est connu pour ses explorateurs comme Vasco de Gama."
298
+ },
299
+ {
300
+ type: "monument",
301
+ question: "Dans quel pays se trouve ce monument ?",
302
+ monument: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Machu_Picchu%2C_Peru.jpg/320px-Machu_Picchu%2C_Peru.jpg",
303
+ options: ["Mexique", "Pérou", "Bolivie", "Équateur"],
304
+ answer: "Pérou",
305
+ hint: "Cette ancienne cité inca est située dans les Andes."
306
+ },
307
+ {
308
+ type: "capital",
309
+ question: "Quelle est la capitale de la Nouvelle-Zélande ?",
310
+ options: ["Auckland", "Christchurch", "Wellington", "Dunedin"],
311
+ answer: "Wellington",
312
+ hint: "Cette ville est située à l'extrémité sud de l'île du Nord."
313
+ },
314
+ {
315
+ type: "flag",
316
+ question: "À quel pays appartient ce drapeau ?",
317
+ flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/Flag_of_the_Czech_Republic.svg/320px-Flag_of_the_Czech_Republic.svg.png",
318
+ options: ["Tchéquie", "Slovaquie", "Slovénie", "Croatie"],
319
+ answer: "Tchéquie",
320
+ hint: "Ce pays d'Europe centrale a pour capitale Prague."
321
+ }
322
+ ]
323
+ };
324
+
325
+ // Game state
326
+ let currentQuestions = [];
327
+ let currentQuestionIndex = 0;
328
+ let score = 0;
329
+ let timer;
330
+ let timeLeft = 30;
331
+ let usedHints = 0;
332
+ let answersDetail = [];
333
+
334
+ // DOM elements
335
+ const startScreen = document.getElementById('start-screen');
336
+ const questionScreen = document.getElementById('question-screen');
337
+ const resultsScreen = document.getElementById('results-screen');
338
+ const startBtn = document.getElementById('start-btn');
339
+ const nextBtn = document.getElementById('next-btn');
340
+ const hintBtn = document.getElementById('hint-btn');
341
+ const useHintBtn = document.getElementById('use-hint');
342
+ const closeHintBtn = document.getElementById('close-hint');
343
+ const hintModal = document.getElementById('hint-modal');
344
+ const restartBtn = document.getElementById('restart-btn');
345
+ const difficultySelect = document.getElementById('difficulty');
346
+ const questionText = document.getElementById('question-text');
347
+ const optionsContainer = document.getElementById('options-container');
348
+ const questionNumber = document.getElementById('question-number');
349
+ const timeDisplay = document.getElementById('time');
350
+ const scoreDisplay = document.getElementById('score');
351
+ const totalQuestions = document.getElementById('total-questions');
352
+ const progressBar = document.getElementById('progress-bar');
353
+ const flagQuestion = document.getElementById('flag-question');
354
+ const flagImage = document.getElementById('flag-image');
355
+ const monumentQuestion = document.getElementById('monument-question');
356
+ const monumentImage = document.getElementById('monument-image');
357
+ const hintText = document.getElementById('hint-text');
358
+ const finalScore = document.getElementById('final-score');
359
+ const correctAnswers = document.getElementById('correct-answers');
360
+ const wrongAnswers = document.getElementById('wrong-answers');
361
+ const resultMessage = document.getElementById('result-message');
362
+ const answersDetailContainer = document.getElementById('answers-detail');
363
+
364
+ // Event listeners
365
+ startBtn.addEventListener('click', startGame);
366
+ nextBtn.addEventListener('click', nextQuestion);
367
+ hintBtn.addEventListener('click', showHint);
368
+ useHintBtn.addEventListener('click', useHint);
369
+ closeHintBtn.addEventListener('click', closeHint);
370
+ restartBtn.addEventListener('click', restartGame);
371
+
372
+ // Start the game
373
+ function startGame() {
374
+ const difficulty = difficultySelect.value;
375
+ currentQuestions = [...gameData[difficulty]];
376
+ currentQuestionIndex = 0;
377
+ score = 0;
378
+ usedHints = 0;
379
+ answersDetail = [];
380
+
381
+ // Shuffle questions for random order
382
+ shuffleArray(currentQuestions);
383
+
384
+ // Update UI
385
+ startScreen.classList.add('hidden');
386
+ questionScreen.classList.remove('hidden');
387
+ totalQuestions.textContent = currentQuestions.length;
388
+ updateScore();
389
+
390
+ // Load first question
391
+ loadQuestion();
392
+ }
393
+
394
+ // Load the current question
395
+ function loadQuestion() {
396
+ const question = currentQuestions[currentQuestionIndex];
397
+
398
+ // Reset UI
399
+ optionsContainer.innerHTML = '';
400
+ nextBtn.classList.add('hidden');
401
+ flagQuestion.classList.add('hidden');
402
+ monumentQuestion.classList.add('hidden');
403
+
404
+ // Update question info
405
+ questionText.textContent = question.question;
406
+ questionNumber.textContent = `Question ${currentQuestionIndex + 1}/${currentQuestions.length}`;
407
+
408
+ // Show appropriate content based on question type
409
+ if (question.type === 'flag') {
410
+ flagQuestion.classList.remove('hidden');
411
+ flagImage.src = question.flag;
412
+ flagImage.alt = `Drapeau de ${question.answer}`;
413
+ } else if (question.type === 'monument') {
414
+ monumentQuestion.classList.remove('hidden');
415
+ monumentImage.src = question.monument;
416
+ monumentImage.alt = `Monument de ${question.answer}`;
417
+ }
418
+
419
+ // Create options
420
+ const shuffledOptions = [...question.options];
421
+ shuffleArray(shuffledOptions);
422
+
423
+ shuffledOptions.forEach(option => {
424
+ const button = document.createElement('button');
425
+ button.textContent = option;
426
+ button.className = 'option-btn bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-3 px-4 rounded-lg text-left';
427
+ button.addEventListener('click', () => selectAnswer(option));
428
+ optionsContainer.appendChild(button);
429
+ });
430
+
431
+ // Set hint text
432
+ hintText.textContent = question.hint;
433
+
434
+ // Start timer
435
+ startTimer();
436
+
437
+ // Update progress bar
438
+ const progress = ((currentQuestionIndex) / currentQuestions.length) * 100;
439
+ progressBar.style.width = `${progress}%`;
440
+ }
441
+
442
+ // Select an answer
443
+ function selectAnswer(selectedOption) {
444
+ clearInterval(timer);
445
+
446
+ const question = currentQuestions[currentQuestionIndex];
447
+ const isCorrect = selectedOption === question.answer;
448
+
449
+ // Disable all buttons
450
+ const buttons = document.querySelectorAll('.option-btn');
451
+ buttons.forEach(button => {
452
+ button.disabled = true;
453
+ if (button.textContent === question.answer) {
454
+ button.classList.add('correct');
455
+ } else if (button.textContent === selectedOption && !isCorrect) {
456
+ button.classList.add('incorrect');
457
+ }
458
+ });
459
+
460
+ // Update score if correct
461
+ if (isCorrect) {
462
+ score++;
463
+ updateScore();
464
+ }
465
+
466
+ // Store answer detail
467
+ answersDetail.push({
468
+ question: question.question,
469
+ correctAnswer: question.answer,
470
+ userAnswer: selectedOption,
471
+ isCorrect: isCorrect
472
+ });
473
+
474
+ // Show next button
475
+ nextBtn.classList.remove('hidden');
476
+ }
477
+
478
+ // Next question
479
+ function nextQuestion() {
480
+ currentQuestionIndex++;
481
+
482
+ if (currentQuestionIndex < currentQuestions.length) {
483
+ loadQuestion();
484
+ } else {
485
+ showResults();
486
+ }
487
+ }
488
+
489
+ // Show results
490
+ function showResults() {
491
+ questionScreen.classList.add('hidden');
492
+ resultsScreen.classList.remove('hidden');
493
+
494
+ const correctCount = answersDetail.filter(answer => answer.isCorrect).length;
495
+ const wrongCount = answersDetail.length - correctCount;
496
+
497
+ // Update results
498
+ finalScore.textContent = score;
499
+ correctAnswers.textContent = correctCount;
500
+ wrongAnswers.textContent = wrongCount;
501
+
502
+ // Set result message based on performance
503
+ let message;
504
+ const percentage = (correctCount / answersDetail.length) * 100;
505
+
506
+ if (percentage >= 80) {
507
+ message = "Félicitations ! Vous êtes un véritable expert en géographie !";
508
+ } else if (percentage >= 60) {
509
+ message = "Bon travail ! Vous avez de solides connaissances en géographie.";
510
+ } else if (percentage >= 40) {
511
+ message = "Pas mal ! Continuez à apprendre et vous vous améliorerez.";
512
+ } else {
513
+ message = "Ne vous découragez pas ! La géographie s'apprend avec le temps.";
514
+ }
515
+
516
+ resultMessage.textContent = message;
517
+
518
+ // Show answers detail
519
+ answersDetailContainer.innerHTML = '';
520
+ answersDetail.forEach((answer, index) => {
521
+ const answerElement = document.createElement('div');
522
+ answerElement.className = 'bg-gray-50 p-3 rounded-lg';
523
+
524
+ const questionText = document.createElement('p');
525
+ questionText.className = 'font-medium text-gray-800';
526
+ questionText.textContent = `${index + 1}. ${answer.question}`;
527
+
528
+ const userAnswer = document.createElement('p');
529
+ userAnswer.className = `text-sm ${answer.isCorrect ? 'text-green-600' : 'text-red-600'}`;
530
+ userAnswer.innerHTML = `<span class="font-medium">Votre réponse:</span> ${answer.userAnswer}`;
531
+
532
+ if (!answer.isCorrect) {
533
+ const correctAnswer = document.createElement('p');
534
+ correctAnswer.className = 'text-sm text-gray-600';
535
+ correctAnswer.innerHTML = `<span class="font-medium">Réponse correcte:</span> ${answer.correctAnswer}`;
536
+ answerElement.appendChild(correctAnswer);
537
+ }
538
+
539
+ answerElement.prepend(userAnswer);
540
+ answerElement.prepend(questionText);
541
+ answersDetailContainer.appendChild(answerElement);
542
+ });
543
+
544
+ // Update progress bar to 100%
545
+ progressBar.style.width = '100%';
546
+ }
547
+
548
+ // Restart game
549
+ function restartGame() {
550
+ resultsScreen.classList.add('hidden');
551
+ startScreen.classList.remove('hidden');
552
+ }
553
+
554
+ // Update score display
555
+ function updateScore() {
556
+ scoreDisplay.textContent = score;
557
+ }
558
+
559
+ // Start timer for current question
560
+ function startTimer() {
561
+ timeLeft = 30;
562
+ timeDisplay.textContent = timeLeft;
563
+
564
+ timer = setInterval(() => {
565
+ timeLeft--;
566
+ timeDisplay.textContent = timeLeft;
567
+
568
+ if (timeLeft <= 0) {
569
+ clearInterval(timer);
570
+ timeUp();
571
+ }
572
+ }, 1000);
573
+ }
574
+
575
+ // Handle time up
576
+ function timeUp() {
577
+ const question = currentQuestions[currentQuestionIndex];
578
+
579
+ // Disable all buttons
580
+ const buttons = document.querySelectorAll('.option-btn');
581
+ buttons.forEach(button => {
582
+ button.disabled = true;
583
+ if (button.textContent === question.answer) {
584
+ button.classList.add('correct');
585
+ }
586
+ });
587
+
588
+ // Store answer detail (no answer)
589
+ answersDetail.push({
590
+ question: question.question,
591
+ correctAnswer: question.answer,
592
+ userAnswer: "Aucune réponse (temps écoulé)",
593
+ isCorrect: false
594
+ });
595
+
596
+ // Show next button
597
+ nextBtn.classList.remove('hidden');
598
+ }
599
+
600
+ // Show hint modal
601
+ function showHint() {
602
+ hintModal.classList.remove('hidden');
603
+ }
604
+
605
+ // Use hint
606
+ function useHint() {
607
+ usedHints++;
608
+ closeHint();
609
+
610
+ // Remove two incorrect options
611
+ const question = currentQuestions[currentQuestionIndex];
612
+ const buttons = Array.from(document.querySelectorAll('.option-btn'));
613
+ const incorrectButtons = buttons.filter(btn => btn.textContent !== question.answer);
614
+
615
+ // Shuffle and remove two incorrect options
616
+ shuffleArray(incorrectButtons);
617
+ for (let i = 0; i < Math.min(2, incorrectButtons.length); i++) {
618
+ incorrectButtons[i].classList.add('hidden');
619
+ }
620
+
621
+ // Disable hint button
622
+ hintBtn.disabled = true;
623
+ hintBtn.classList.add('opacity-50');
624
+ }
625
+
626
+ // Close hint modal
627
+ function closeHint() {
628
+ hintModal.classList.add('hidden');
629
+ }
630
+
631
+ // Utility function to shuffle array
632
+ function shuffleArray(array) {
633
+ for (let i = array.length - 1; i > 0; i--) {
634
+ const j = Math.floor(Math.random() * (i + 1));
635
+ [array[i], array[j]] = [array[j], array[i]];
636
+ }
637
+ return array;
638
+ }
639
+ </script>
640
+ <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=arbib/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
641
+ </html>