Yatharth999 commited on
Commit
bd19f5d
·
verified ·
1 Parent(s): c472f3e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +3 -71
index.html CHANGED
@@ -553,7 +553,7 @@
553
  <h2 style="letter-spacing: 5px; margin-bottom: 5px;">ADAPTIVE<span style="color:#00ffcc">EMOTION ENGINE</span></h2>
554
  <div id="auth-overlay">
555
  <div id="auth-header">
556
- <h1>ADAPTIVE CARTOON DEFENDER</h1>
557
  <p id="motivational-quote">"The galaxy is waiting for you… it’s calling for your raw energy, your pulse,
558
  your fire. The mission is alive, and only you can ignite it.
559
  "</p>
@@ -588,8 +588,6 @@
588
  </div>
589
  <div id="ui-layer">
590
  <div class="stat-box"><span class="label">Score</span><span id="score" class="val">0</span></div>
591
- <div class="stat-box"><span class="label">AI Sentiment</span><span id="emotion" class="val"
592
- style="color:#00ffcc">OFFLINE</span></div>
593
  <div class="stat-box" style="border-color: #ffcc00;"><span class="label">Level</span><span id="level-val"
594
  class="val" style="color: #ffcc00;">1</span></div>
595
  <div class="stat-box"><span class="label">Threat Level</span><span id="danger-lvl" class="val">1.0x</span></div>
@@ -686,20 +684,11 @@
686
  let highScoreToBeat = 0; // The threshold for the flash message
687
  let recordBroken = false; // Prevents the flash message from repeating every frame
688
 
689
- // --- WebSocket Initialization ---
690
- const isProd = window.location.hostname !== 'localhost';
691
-
692
  // On Hugging Face, window.location.origin already includes 'https://'
693
  // We use that to build the API and WebSocket links dynamically
694
  const apiUrl = isProd ? `${window.location.origin}` : `http://localhost:8000`;
695
-
696
- // WebSocket requires 'wss' for secure Hugging Face spaces
697
- const wsUrl = isProd
698
- ? `wss://${window.location.host}/ws/emotion`
699
- : `ws://localhost:8000/ws/emotion`;
700
-
701
- console.log("Mission Control: Connecting to", apiUrl);
702
- const socket = new WebSocket(wsUrl);
703
 
704
  // --- PROGRESSION VARIABLES ---
705
  let unlockedWeapons = [1, 2, 3, 4, 5]; // Default weapons start unlocked
@@ -1340,54 +1329,6 @@
1340
  // --- Background Setup ---
1341
  for (let i = 0; i < 100; i++) stars.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, size: Math.random() * 2, speed: Math.random() * 3 + 0.5 });
1342
 
1343
- // --- WebSocket Setup ---
1344
-
1345
- socket.onmessage = (event) => {
1346
- if (Math.random() > 0.7) triggerWittyComment(); // 30% chance to comment on every AI update
1347
- const data = JSON.parse(event.data);
1348
- if (data && data.emotion) {
1349
- document.getElementById('emotion').innerText = data.emotion.toUpperCase();
1350
- const sentiment = data.emotion.toLowerCase();
1351
-
1352
- // LOGIC: Increase Ceiling if Boring or Sarcastic
1353
- if (sentiment.includes("boring") || sentiment.includes("too easy") || sentiment.includes("sarcasm")) {
1354
- ceilingBonus += 0.2; // Permanently raise the ceiling for this level
1355
- ddaMultiplier = 1.5; // Immediate difficulty spike
1356
- showMsg("AI DETECTED BOREDOM: INCREASING INTENSITY!", "#ff00ff");
1357
- }
1358
- // LOGIC: Drastically lower difficulty if Frustrated (No lower bar)
1359
- else if (sentiment.includes("frustrated") || sentiment.includes("angry")) {
1360
- ddaMultiplier = 0.4; // Drop difficulty to 40% of base
1361
- showMsg("REDUCING STRESS... CALIBRATING.", "#00ffcc");
1362
- }
1363
- else {
1364
- ddaMultiplier = 1.0; // Normal flow
1365
- }
1366
- }
1367
-
1368
- switch (data.difficulty_adjustment) {
1369
- case "powerup":
1370
- tripleShotTimer = 600;
1371
- showMsg("🚀 TRIPLE SHOT ACTIVATED!", "#00ffcc");
1372
- break;
1373
- case "easy":
1374
- ddaMultiplier = 0.5; hasShield = true; evolutionTimer = 0;
1375
- showMsg("REDUCING THREAT... SHIELD UP! 🛡️", "#ffcc00");
1376
- break;
1377
- case "hard_evolution":
1378
- ddaMultiplier = 2.0; evolutionTimer = 1500;
1379
- showMsg("NEGATIVITY DETECTED: HARD MODE! 💀", "#ff0000");
1380
- break;
1381
- case "evolution":
1382
- ddaMultiplier = 2.0; evolutionTimer = 1500;
1383
- showMsg("EVOLUTION MODE ON! 🔥", "#ff00ff");
1384
- break;
1385
- case "normal":
1386
- ddaMultiplier = 1.0;
1387
- break;
1388
- }
1389
- };
1390
-
1391
  function changeSuit(id) {
1392
  currentSuit = id;
1393
  document.querySelectorAll('.suit-btn').forEach(b => b.classList.remove('active'));
@@ -2217,15 +2158,6 @@
2217
  }, 1500);
2218
  }
2219
 
2220
- async function setupMic() {
2221
- try {
2222
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
2223
- const mediaRecorder = new MediaRecorder(stream);
2224
- mediaRecorder.ondataavailable = async (e) => { if (socket.readyState === 1) socket.send(await e.data.arrayBuffer()); };
2225
- setInterval(() => { if (mediaRecorder.state === "recording") { mediaRecorder.stop(); mediaRecorder.start(); } }, 3000);
2226
- mediaRecorder.start();
2227
- } catch (err) { console.error("Mic access needed for AI."); }
2228
- }
2229
  update();
2230
  const MOTIVATIONAL_QUOTES = [
2231
  "The AI is hungry for your vibes. Don't keep it waiting.",
 
553
  <h2 style="letter-spacing: 5px; margin-bottom: 5px;">ADAPTIVE<span style="color:#00ffcc">EMOTION ENGINE</span></h2>
554
  <div id="auth-overlay">
555
  <div id="auth-header">
556
+ <h1>MIGHTY CARTOON DEFENDER</h1>
557
  <p id="motivational-quote">"The galaxy is waiting for you… it’s calling for your raw energy, your pulse,
558
  your fire. The mission is alive, and only you can ignite it.
559
  "</p>
 
588
  </div>
589
  <div id="ui-layer">
590
  <div class="stat-box"><span class="label">Score</span><span id="score" class="val">0</span></div>
 
 
591
  <div class="stat-box" style="border-color: #ffcc00;"><span class="label">Level</span><span id="level-val"
592
  class="val" style="color: #ffcc00;">1</span></div>
593
  <div class="stat-box"><span class="label">Threat Level</span><span id="danger-lvl" class="val">1.0x</span></div>
 
684
  let highScoreToBeat = 0; // The threshold for the flash message
685
  let recordBroken = false; // Prevents the flash message from repeating every frame
686
 
687
+
 
 
688
  // On Hugging Face, window.location.origin already includes 'https://'
689
  // We use that to build the API and WebSocket links dynamically
690
  const apiUrl = isProd ? `${window.location.origin}` : `http://localhost:8000`;
691
+
 
 
 
 
 
 
 
692
 
693
  // --- PROGRESSION VARIABLES ---
694
  let unlockedWeapons = [1, 2, 3, 4, 5]; // Default weapons start unlocked
 
1329
  // --- Background Setup ---
1330
  for (let i = 0; i < 100; i++) stars.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, size: Math.random() * 2, speed: Math.random() * 3 + 0.5 });
1331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1332
  function changeSuit(id) {
1333
  currentSuit = id;
1334
  document.querySelectorAll('.suit-btn').forEach(b => b.classList.remove('active'));
 
2158
  }, 1500);
2159
  }
2160
 
 
 
 
 
 
 
 
 
 
2161
  update();
2162
  const MOTIVATIONAL_QUOTES = [
2163
  "The AI is hungry for your vibes. Don't keep it waiting.",