Niki2801 commited on
Commit
2bdb136
·
verified ·
1 Parent(s): 16d90df

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +379 -19
  3. prompts.txt +2 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Heide
3
- emoji: 🦀
4
- colorFrom: red
5
- colorTo: yellow
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: heide
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: blue
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,379 @@
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="de">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>Ecosystem Game: Heathland or Coral Reef</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=Montserrat:wght@400;600;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Montserrat', sans-serif;
14
+ background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1614531341773-3bff8be6f780?ixlib=rb-4.0.3');
15
+ background-size: cover;
16
+ background-repeat: no-repeat;
17
+ background-attachment: fixed;
18
+ background-position: center;
19
+ margin: 0;
20
+ min-height: 100vh;
21
+ }
22
+
23
+ .language-btn {
24
+ position: absolute;
25
+ top: 20px;
26
+ right: 20px;
27
+ background: rgba(255,255,255,0.2);
28
+ backdrop-filter: blur(10px);
29
+ border: 1px solid rgba(255,255,255,0.3);
30
+ z-index: 20;
31
+ }
32
+
33
+ .ecosystem-btn {
34
+ transition: all 0.3s ease;
35
+ background-size: 200% auto;
36
+ }
37
+
38
+ .heide-btn {
39
+ background-image: linear-gradient(to right, #38a169 0%, #48bb78 51%, #38a169 100%);
40
+ }
41
+
42
+ .riff-btn {
43
+ background-image: linear-gradient(to right, #3182ce 0%, #4299e1 51%, #3182ce 100%);
44
+ }
45
+
46
+ .ecosystem-btn:hover {
47
+ background-position: right center;
48
+ transform: translateY(-2px);
49
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
50
+ }
51
+
52
+ .progress-bar {
53
+ height: 10px;
54
+ border-radius: 5px;
55
+ transition: width 0.5s ease;
56
+ }
57
+
58
+ .choice-btn {
59
+ transition: all 0.2s ease;
60
+ }
61
+
62
+ .choice-btn:hover {
63
+ transform: scale(1.02);
64
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
65
+ }
66
+
67
+ .fade-in {
68
+ animation: fadeIn 0.5s ease-in;
69
+ }
70
+
71
+ @keyframes fadeIn {
72
+ from { opacity: 0; transform: translateY(10px); }
73
+ to { opacity: 1; transform: translateY(0); }
74
+ }
75
+
76
+ .header-container {
77
+ position: relative;
78
+ }
79
+ </style>
80
+ </head>
81
+ <body class="flex items-center justify-center p-4">
82
+ <div id="game-container" class="w-full max-w-2xl bg-white bg-opacity-90 rounded-xl shadow-2xl overflow-hidden backdrop-filter backdrop-blur-sm">
83
+ <!-- Header with ecosystem icons -->
84
+ <div class="header-container bg-gradient-to-r from-green-600 to-blue-600 p-6 text-center">
85
+ <!-- Language Selector -->
86
+ <button id="language-btn" class="language-btn px-4 py-2 rounded-full text-white font-semibold">
87
+ <i class="fas fa-language mr-2"></i>DE/EN
88
+ </button>
89
+
90
+ <h1 id="title" class="text-3xl font-bold text-white mb-2">🌍 Wähle dein Ökosystem</h1>
91
+ <p id="subtitle" class="text-white opacity-90">Entscheide dich für die Heide oder das Korallenriff</p>
92
+ </div>
93
+
94
+ <div class="p-6">
95
+ <!-- Ecosystem Selection -->
96
+ <div class="choices grid grid-cols-1 md:grid-cols-2 gap-4 mb-6" id="ecosystem-choice">
97
+ <button onclick="startGame('heide')" class="ecosystem-btn heide-btn text-white font-bold py-8 rounded-lg text-xl">
98
+ <i class="fas fa-tree mr-2"></i>
99
+ <span id="heide-btn-text">Heide retten</span>
100
+ </button>
101
+ <button onclick="startGame('riff')" class="ecosystem-btn riff-btn text-white font-bold py-8 rounded-lg text-xl">
102
+ <i class="fas fa-water mr-2"></i>
103
+ <span id="riff-btn-text">Korallenriff schützen</span>
104
+ </button>
105
+ </div>
106
+
107
+ <!-- Game Content -->
108
+ <div id="game-content" class="hidden">
109
+ <!-- Progress Bar -->
110
+ <div class="mb-6">
111
+ <div class="flex justify-between mb-1">
112
+ <span id="progress-text" class="font-semibold">Fortschritt: 0%</span>
113
+ <span id="points" class="font-bold">0 Punkte</span>
114
+ </div>
115
+ <div class="w-full bg-gray-200 rounded-full h-2.5">
116
+ <div id="progress-bar" class="progress-bar h-2.5 rounded-full bg-gradient-to-r from-yellow-500 to-green-600" style="width: 0%"></div>
117
+ </div>
118
+ </div>
119
+
120
+ <!-- Story Text -->
121
+ <div id="story" class="bg-gray-50 p-4 rounded-lg mb-6 text-gray-700 border-l-4 border-green-500"></div>
122
+
123
+ <!-- Choices -->
124
+ <div class="choices grid grid-cols-1 gap-3" id="choices"></div>
125
+
126
+ <!-- Status Message -->
127
+ <div id="status" class="mt-6 text-center text-xl font-bold"></div>
128
+
129
+ <!-- Restart Button -->
130
+ <button id="restart-btn" class="hidden w-full mt-6 bg-gray-800 text-white py-3 rounded-lg font-semibold hover:bg-gray-900 transition">
131
+ <i class="fas fa-redo mr-2"></i>
132
+ <span id="restart-text">Neustart</span>
133
+ </button>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <script>
139
+ // Language Support
140
+ const translations = {
141
+ de: {
142
+ title: " 🌍 Wähle dein Ökosystem",
143
+ subtitle: "Entscheide dich für die Heide oder das Korallenriff",
144
+ heideBtn: "Heide retten",
145
+ riffBtn: "Korallenriff schützen",
146
+ progressText: "Fortschritt: ",
147
+ points: " Punkte",
148
+ restart: "Neustart",
149
+ ecosystemNames: {
150
+ heide: "Heide",
151
+ riff: "Korallenriff"
152
+ },
153
+ startText: "Du hast das Ökosystem <strong>{0}</strong> gewählt. Triff Entscheidungen, um es zu retten!",
154
+ winMessage: "🎉 Du hast das Ökosystem erfolgreich gerettet!",
155
+ loseMessage: "💀 Deine Entscheidungen haben das Ökosystem zerstört.",
156
+ decisions: {
157
+ heide: [
158
+ { text: "Schafe zur Heidepflege einsetzen", effect: 10, response: "Die Schafe helfen, die Heide offen zu halten und verhindern das Zuwachsen mit Büschen." },
159
+ { text: "Entbuschung manuell durchführen", effect: 8, response: "Bäume werden entfernt, Heidepflanzen haben wieder Platz zu wachsen." },
160
+ { text: "Ein Waldbrand hat gewütet – neue Bäume pflanzen", effect: -5, response: "Bäume verdrängen die Heide – schlechte Wahl für dieses Ökosystem!" },
161
+ { text: "Waldbrandfläche sich selbst überlassen", effect: 5, response: "Die Heide regeneriert sich natürlich und typische Pflanzen kehren zurück." },
162
+ { text: "Moorschutzprogramm starten", effect: 7, response: "Der Wasserhaushalt wird verbessert – super für die Heide!" },
163
+ { text: "Düngung der Heidefläche", effect: -8, response: "Heidepflanzen mögen nährstoffarme Böden – die Düngung schadet ihnen." },
164
+ { text: "Besucherwege anlegen", effect: 3, response: "Besucher werden gelenkt und sensible Bereiche geschont." },
165
+ { text: "Heidefläche für Landwirtschaft nutzen", effect: -12, response: "Intensive Nutzung zerstört das empfindliche Ökosystem." }
166
+ ],
167
+ riff: [
168
+ { text: "Plastikmüll aus dem Riff entfernen", effect: 10, response: "Du entfernst gefährlichen Abfall, der Korallen ersticken könnte – super Arbeit!" },
169
+ { text: "Korallen nachzüchten und einsetzen", effect: 8, response: "Die neuen Korallen helfen beim Wiederaufbau des geschädigten Riffs." },
170
+ { text: "Tourismus regulieren", effect: 7, response: "Weniger Schnorchler und Taucher bedeuten weniger Schäden am empfindlichen Riff." },
171
+ { text: "Tauchverbot ignorieren", effect: -10, response: "Korallen werden durch unvorsichtige Taucher beschädigt – keine gute Entscheidung." },
172
+ { text: "Mangroven aufforsten", effect: 6, response: "Mangroven schützen die Küste und verbessern die Wasserqualität für das Riff." },
173
+ { text: "Überfischung zulassen", effect: -15, response: "Ohne Fische gerät das gesamte Riffsystem aus dem Gleichgewicht." },
174
+ { text: "Klimaanlage am Strandhotel installieren", effect: -7, response: "Das warme Abwasser begünstigt Korallenbleiche." },
175
+ { text: "Korallenbleiche erforschen", effect: 5, response: "Die Forschung hilft, Lösungen gegen dieses große Problem zu finden." }
176
+ ]
177
+ }
178
+ },
179
+ en: {
180
+ title: "🌍 Choose Your Ecosystem",
181
+ subtitle: "Decide between heathland or coral reef",
182
+ heideBtn: "Save the Heathland",
183
+ riffBtn: "Protect the Coral Reef",
184
+ progressText: "Progress: ",
185
+ points: " Points",
186
+ restart: "Restart",
187
+ ecosystemNames: {
188
+ heide: "Heathland",
189
+ riff: "Coral Reef"
190
+ },
191
+ startText: "You've chosen the <strong>{0}</strong> ecosystem. Make decisions to save it!",
192
+ winMessage: "🎉 You successfully saved the ecosystem!",
193
+ loseMessage: "💀 Your decisions destroyed the ecosystem.",
194
+ decisions: {
195
+ heide: [
196
+ { text: "Use sheep for heathland maintenance", effect: 10, response: "The sheep help keep the heathland open and prevent bush encroachment." },
197
+ { text: "Manual removal of bushes", effect: 8, response: "Trees are removed, giving heathland plants space to grow." },
198
+ { text: "After a wildfire - plant new trees", effect: -5, response: "Trees displace heathland - bad choice for this ecosystem!" },
199
+ { text: "Leave wildfire area to recover naturally", effect: 5, response: "The heathland regenerates naturally and typical plants return." },
200
+ { text: "Start bog protection program", effect: 7, response: "Improves water balance - great for the heathland!" },
201
+ { text: "Fertilize the heathland", effect: -8, response: "Heath plants prefer nutrient-poor soils - fertilization harms them." },
202
+ { text: "Create visitor paths", effect: 3, response: "Visitors are directed and sensitive areas are protected." },
203
+ { text: "Use heathland for agriculture", effect: -12, response: "Intensive use destroys the fragile ecosystem." }
204
+ ],
205
+ riff: [
206
+ { text: "Remove plastic waste from the reef", effect: 10, response: "You remove dangerous waste that could suffocate corals - great job!" },
207
+ { text: "Breed and transplant corals", effect: 8, response: "New corals help rebuild the damaged reef." },
208
+ { text: "Regulate tourism", effect: 7, response: "Fewer snorkelers and divers means less damage to the fragile reef." },
209
+ { text: "Ignore diving ban", effect: -10, response: "Corals are damaged by careless divers - not a good decision." },
210
+ { text: "Restore mangroves", effect: 6, response: "Mangroves protect the coast and improve water quality for the reef." },
211
+ { text: "Allow overfishing", effect: -15, response: "Without fish, the entire reef system becomes unbalanced." },
212
+ { text: "Install AC at beach hotel", effect: -7, response: "Warm wastewater promotes coral bleaching." },
213
+ { text: "Research coral bleaching", effect: 5, response: "Research helps find solutions to this major problem." }
214
+ ]
215
+ }
216
+ }
217
+ };
218
+
219
+ // DOM Elements
220
+ const titleEl = document.getElementById("title");
221
+ const subtitleEl = document.getElementById("subtitle");
222
+ const heideBtnText = document.getElementById("heide-btn-text");
223
+ const riffBtnText = document.getElementById("riff-btn-text");
224
+ const progressTextEl = document.getElementById("progress-text");
225
+ const pointsEl = document.getElementById("points");
226
+ const restartTextEl = document.getElementById("restart-text");
227
+ const storyText = document.getElementById("story");
228
+ const choicesDiv = document.getElementById("choices");
229
+ const statusEl = document.getElementById("status");
230
+ const ecosystemChoiceDiv = document.getElementById("ecosystem-choice");
231
+ const gameContentEl = document.getElementById("game-content");
232
+ const restartBtn = document.getElementById("restart-btn");
233
+ const progressBar = document.getElementById("progress-bar");
234
+ const languageBtn = document.getElementById("language-btn");
235
+
236
+ // Game State
237
+ let currentLanguage = 'de';
238
+ let points = 0;
239
+ let currentEcosystem = "";
240
+ let maxPoints = 50;
241
+ let minPoints = -30;
242
+
243
+ // Initialize the game
244
+ function init() {
245
+ updateLanguageUI();
246
+ languageBtn.addEventListener('click', toggleLanguage);
247
+ restartBtn.addEventListener('click', resetGame);
248
+ }
249
+
250
+ // Toggle between languages
251
+ function toggleLanguage() {
252
+ currentLanguage = currentLanguage === 'de' ? 'en' : 'de';
253
+ updateLanguageUI();
254
+
255
+ // If game is in progress, update the current state
256
+ if (currentEcosystem) {
257
+ const ecosystemName = translations[currentLanguage].ecosystemNames[currentEcosystem];
258
+ storyText.innerHTML = formatString(translations[currentLanguage].startText, ecosystemName);
259
+ updatePointsDisplay();
260
+ }
261
+ }
262
+
263
+ // Update all UI elements with current language
264
+ function updateLanguageUI() {
265
+ const lang = translations[currentLanguage];
266
+ titleEl.textContent = lang.title;
267
+ subtitleEl.textContent = lang.subtitle;
268
+ heideBtnText.textContent = lang.heideBtn;
269
+ riffBtnText.textContent = lang.riffBtn;
270
+ progressTextEl.textContent = lang.progressText + "0%";
271
+ pointsEl.textContent = "0" + lang.points;
272
+ restartTextEl.textContent = lang.restart;
273
+ }
274
+
275
+ // Format string with placeholders
276
+ function formatString(str, ...args) {
277
+ return str.replace(/{(\d+)}/g, (match, number) => {
278
+ return typeof args[number] != 'undefined' ? args[number] : match;
279
+ });
280
+ }
281
+
282
+ // Start the game with selected ecosystem
283
+ function startGame(type) {
284
+ currentEcosystem = type;
285
+ points = 0;
286
+ ecosystemChoiceDiv.classList.add('hidden');
287
+ gameContentEl.classList.remove('hidden');
288
+ statusEl.innerHTML = "";
289
+
290
+ const ecosystemName = translations[currentLanguage].ecosystemNames[type];
291
+ storyText.innerHTML = formatString(translations[currentLanguage].startText, ecosystemName);
292
+ storyText.classList.add('fade-in');
293
+
294
+ updatePointsDisplay();
295
+ showChoices();
296
+ }
297
+
298
+ // Show available choices for current situation
299
+ function showChoices() {
300
+ choicesDiv.innerHTML = "";
301
+ const decisions = translations[currentLanguage].decisions[currentEcosystem];
302
+
303
+ // Shuffle and pick 3 random decisions
304
+ const shuffled = [...decisions].sort(() => 0.5 - Math.random()).slice(0, 3);
305
+
306
+ shuffled.forEach(decision => {
307
+ const btn = document.createElement("button");
308
+ btn.textContent = decision.text;
309
+ btn.className = "choice-btn bg-white p-4 rounded-lg border border-gray-200 hover:border-green-500 text-left";
310
+ btn.onclick = () => handleChoice(decision);
311
+ btn.classList.add('fade-in');
312
+ choicesDiv.appendChild(btn);
313
+ });
314
+ }
315
+
316
+ // Handle player's choice
317
+ function handleChoice(decision) {
318
+ points += decision.effect;
319
+ storyText.innerHTML = decision.response;
320
+ storyText.classList.remove('fade-in');
321
+ void storyText.offsetWidth; // Trigger reflow
322
+ storyText.classList.add('fade-in');
323
+
324
+ updatePointsDisplay();
325
+
326
+ // Check win/lose conditions
327
+ if (points >= maxPoints) {
328
+ endGame(true);
329
+ } else if (points <= minPoints) {
330
+ endGame(false);
331
+ } else {
332
+ showChoices();
333
+ }
334
+ }
335
+
336
+ // Update points and progress display
337
+ function updatePointsDisplay() {
338
+ const lang = translations[currentLanguage];
339
+ const progress = Math.min(100, Math.max(0, ((points + 30) / (maxPoints + 30)) * 100));
340
+
341
+ pointsEl.textContent = points + lang.points;
342
+ progressTextEl.textContent = lang.progressText + Math.round(progress) + "%";
343
+ progressBar.style.width = progress + "%";
344
+
345
+ // Change progress bar color based on progress
346
+ if (points < 0) {
347
+ progressBar.className = "progress-bar h-2.5 rounded-full bg-gradient-to-r from-red-500 to-yellow-500";
348
+ } else if (points < maxPoints/2) {
349
+ progressBar.className = "progress-bar h-2.5 rounded-full bg-gradient-to-r from-yellow-500 to-yellow-400";
350
+ } else {
351
+ progressBar.className = "progress-bar h-2.5 rounded-full bg-gradient-to-r from-yellow-500 to-green-600";
352
+ }
353
+ }
354
+
355
+ // End the game (win or lose)
356
+ function endGame(win) {
357
+ const lang = translations[currentLanguage];
358
+ statusEl.innerHTML = win ? lang.winMessage : lang.loseMessage;
359
+ statusEl.className = win ? "text-green-600" : "text-red-600";
360
+ choicesDiv.innerHTML = "";
361
+ restartBtn.classList.remove('hidden');
362
+ }
363
+
364
+ // Reset the game to initial state
365
+ function resetGame() {
366
+ currentEcosystem = "";
367
+ points = 0;
368
+ gameContentEl.classList.add('hidden');
369
+ ecosystemChoiceDiv.classList.remove('hidden');
370
+ statusEl.innerHTML = "";
371
+ restartBtn.classList.add('hidden');
372
+ updatePointsDisplay();
373
+ }
374
+
375
+ // Initialize the game when page loads
376
+ window.onload = init;
377
+ </script>
378
+ <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=Niki2801/heide" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
379
+ </html>
prompts.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ erstelle, dass man das gesamte spiel in english und deutsch übersetzen kann
2
+ das de/en steht über dem text ,,wähle dein ökos." korrigiere dies bitte