johangras commited on
Commit
0158489
·
1 Parent(s): 8f352ef

⚛️ Add QUANTUM PARTICLE EFFECTS and reality glitches

Browse files

- Quantum particles that split and tunnel through space
- Particle trails showing quantum superposition
- Wormhole effect at 99% fitness
- Reality glitch filter effect (inversion/hue rotation)
- Quantum realm announcement at 95% fitness
- Singularity approach at 99% fitness
- Special quantum burst patterns
- Enhanced particle physics with wave functions
- Massive quantum explosions for major achievements
- Visual indication of entering quantum realm

Files changed (1) hide show
  1. app.py +180 -4
app.py CHANGED
@@ -97,7 +97,7 @@ resizeCanvas();
97
  window.addEventListener('resize', resizeCanvas);
98
 
99
  class Particle {
100
- constructor(x, y, color) {
101
  this.x = x;
102
  this.y = y;
103
  this.vx = (Math.random() - 0.5) * 10;
@@ -105,9 +105,37 @@ class Particle {
105
  this.life = 100;
106
  this.color = color;
107
  this.size = Math.random() * 4 + 2;
 
 
 
 
108
  }
109
 
110
  update() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  // Mouse attraction
112
  const dx = mouseX - this.x;
113
  const dy = mouseY - this.y;
@@ -127,12 +155,58 @@ class Particle {
127
  this.vy *= 0.98;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  draw() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  ctx.save();
132
  ctx.globalAlpha = this.life / 100;
133
  ctx.fillStyle = this.color;
134
- ctx.shadowBlur = 20;
135
  ctx.shadowColor = this.color;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  ctx.beginPath();
137
  ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
138
  ctx.fill();
@@ -140,12 +214,32 @@ class Particle {
140
  }
141
  }
142
 
143
- function createBurst(intensity) {
144
  const centerX = canvas.width / 2;
145
  const centerY = canvas.height / 2;
146
  const colors = ['#00FF88', '#7B3FF2', '#00AAFF', '#FFD700', '#FF6B6B', '#4ECDC4', '#45B7D1'];
147
 
148
- // Create multiple burst patterns
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  for (let i = 0; i < 100 * intensity; i++) {
150
  const angle = (Math.PI * 2 * i) / (100 * intensity);
151
  const speed = Math.random() * 15 + 5;
@@ -167,6 +261,33 @@ function createBurst(intensity) {
167
  particles.push(lightningParticle);
168
  }
169
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
172
  function animate() {
@@ -208,6 +329,42 @@ setInterval(() => {
208
  }
209
  }, 2000);
210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  // Epic initial burst sequence
212
  setTimeout(() => {
213
  createBurst(5); // Massive initial burst
@@ -492,6 +649,21 @@ def simulate_evolution():
492
  "message": f"🏆 ACHIEVEMENT UNLOCKED: {ach['name']}"
493
  })
494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  return event
496
 
497
  def get_evolved_code():
@@ -648,6 +820,10 @@ def format_events():
648
  color = "#FFD700"
649
  icon = "🏆"
650
  style = "font-size: 16px; font-weight: bold; background: linear-gradient(45deg, #7B3FF2, #00AAFF); padding: 10px; border-radius: 5px; margin: 5px 0;"
 
 
 
 
651
  elif event["type"] == "multiplayer":
652
  color = "#FF6B6B"
653
  icon = "⚔️"
 
97
  window.addEventListener('resize', resizeCanvas);
98
 
99
  class Particle {
100
+ constructor(x, y, color, type = 'normal') {
101
  this.x = x;
102
  this.y = y;
103
  this.vx = (Math.random() - 0.5) * 10;
 
105
  this.life = 100;
106
  this.color = color;
107
  this.size = Math.random() * 4 + 2;
108
+ this.type = type;
109
+ this.angle = Math.random() * Math.PI * 2;
110
+ this.splitCount = 0;
111
+ this.trail = [];
112
  }
113
 
114
  update() {
115
+ // Store trail for quantum particles
116
+ if (this.type === 'quantum' && this.trail.length < 20) {
117
+ this.trail.push({x: this.x, y: this.y, alpha: this.life / 100});
118
+ }
119
+
120
+ // Quantum behavior
121
+ if (this.type === 'quantum') {
122
+ // Quantum tunneling
123
+ if (Math.random() < 0.02) {
124
+ this.x += (Math.random() - 0.5) * 100;
125
+ this.y += (Math.random() - 0.5) * 100;
126
+ }
127
+
128
+ // Wave function collapse
129
+ this.angle += 0.1;
130
+ this.vx += Math.sin(this.angle) * 0.5;
131
+ this.vy += Math.cos(this.angle) * 0.5;
132
+
133
+ // Particle splitting
134
+ if (this.life === 50 && this.splitCount === 0) {
135
+ this.split();
136
+ }
137
+ }
138
+
139
  // Mouse attraction
140
  const dx = mouseX - this.x;
141
  const dy = mouseY - this.y;
 
155
  this.vy *= 0.98;
156
  }
157
 
158
+ split() {
159
+ this.splitCount++;
160
+ for (let i = 0; i < 3; i++) {
161
+ const newParticle = new Particle(this.x, this.y, this.color, 'quantum');
162
+ newParticle.vx = (Math.random() - 0.5) * 15;
163
+ newParticle.vy = (Math.random() - 0.5) * 15;
164
+ newParticle.life = 50;
165
+ newParticle.size = this.size * 0.7;
166
+ particles.push(newParticle);
167
+ }
168
+ }
169
+
170
  draw() {
171
+ // Draw trail for quantum particles
172
+ if (this.type === 'quantum' && this.trail.length > 1) {
173
+ ctx.save();
174
+ ctx.strokeStyle = this.color;
175
+ ctx.lineWidth = this.size * 0.5;
176
+ for (let i = 1; i < this.trail.length; i++) {
177
+ ctx.globalAlpha = this.trail[i].alpha * 0.3;
178
+ ctx.beginPath();
179
+ ctx.moveTo(this.trail[i-1].x, this.trail[i-1].y);
180
+ ctx.lineTo(this.trail[i].x, this.trail[i].y);
181
+ ctx.stroke();
182
+ }
183
+ ctx.restore();
184
+ }
185
+
186
  ctx.save();
187
  ctx.globalAlpha = this.life / 100;
188
  ctx.fillStyle = this.color;
189
+ ctx.shadowBlur = this.type === 'quantum' ? 30 : 20;
190
  ctx.shadowColor = this.color;
191
+
192
+ // Draw quantum particles with special effect
193
+ if (this.type === 'quantum') {
194
+ // Outer glow
195
+ ctx.beginPath();
196
+ ctx.arc(this.x, this.y, this.size * 2, 0, Math.PI * 2);
197
+ ctx.globalAlpha = (this.life / 100) * 0.3;
198
+ ctx.fill();
199
+
200
+ // Inner core
201
+ ctx.globalAlpha = this.life / 100;
202
+ ctx.fillStyle = '#FFFFFF';
203
+ ctx.beginPath();
204
+ ctx.arc(this.x, this.y, this.size * 0.5, 0, Math.PI * 2);
205
+ ctx.fill();
206
+ }
207
+
208
+ // Normal particle
209
+ ctx.fillStyle = this.color;
210
  ctx.beginPath();
211
  ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
212
  ctx.fill();
 
214
  }
215
  }
216
 
217
+ function createBurst(intensity, type = 'normal') {
218
  const centerX = canvas.width / 2;
219
  const centerY = canvas.height / 2;
220
  const colors = ['#00FF88', '#7B3FF2', '#00AAFF', '#FFD700', '#FF6B6B', '#4ECDC4', '#45B7D1'];
221
 
222
+ if (type === 'quantum' || intensity > 4) {
223
+ // Create quantum particles for high intensity
224
+ for (let i = 0; i < 30 * intensity; i++) {
225
+ const angle = (Math.PI * 2 * i) / (30 * intensity);
226
+ const speed = Math.random() * 20 + 10;
227
+ const color = colors[Math.floor(Math.random() * colors.length)];
228
+
229
+ const quantum = new Particle(
230
+ centerX + Math.cos(angle) * 30,
231
+ centerY + Math.sin(angle) * 30,
232
+ color,
233
+ 'quantum'
234
+ );
235
+ quantum.vx = Math.cos(angle) * speed;
236
+ quantum.vy = Math.sin(angle) * speed;
237
+ quantum.size = Math.random() * 6 + 3;
238
+ particles.push(quantum);
239
+ }
240
+ }
241
+
242
+ // Create normal burst
243
  for (let i = 0; i < 100 * intensity; i++) {
244
  const angle = (Math.PI * 2 * i) / (100 * intensity);
245
  const speed = Math.random() * 15 + 5;
 
261
  particles.push(lightningParticle);
262
  }
263
  }
264
+
265
+ // Add wormhole effect at 99%
266
+ if (intensity > 5) {
267
+ createWormhole();
268
+ }
269
+ }
270
+
271
+ function createWormhole() {
272
+ const centerX = canvas.width / 2;
273
+ const centerY = canvas.height / 2;
274
+
275
+ // Create spiral of quantum particles
276
+ for (let i = 0; i < 100; i++) {
277
+ const angle = (i / 100) * Math.PI * 8;
278
+ const radius = i * 2;
279
+
280
+ const wormhole = new Particle(
281
+ centerX + Math.cos(angle) * radius,
282
+ centerY + Math.sin(angle) * radius,
283
+ '#FF00FF',
284
+ 'quantum'
285
+ );
286
+ wormhole.vx = -Math.cos(angle) * 5;
287
+ wormhole.vy = -Math.sin(angle) * 5;
288
+ wormhole.life = 200;
289
+ particles.push(wormhole);
290
+ }
291
  }
292
 
293
  function animate() {
 
329
  }
330
  }, 2000);
331
 
332
+ // Reality glitch effect
333
+ let glitchActive = false;
334
+ function triggerGlitch() {
335
+ glitchActive = true;
336
+ document.body.style.filter = 'hue-rotate(180deg) invert(100%)';
337
+
338
+ setTimeout(() => {
339
+ document.body.style.filter = 'hue-rotate(90deg)';
340
+ }, 100);
341
+
342
+ setTimeout(() => {
343
+ document.body.style.filter = 'none';
344
+ glitchActive = false;
345
+ }, 300);
346
+
347
+ // Create massive quantum burst
348
+ createBurst(10, 'quantum');
349
+ }
350
+
351
+ // Watch for quantum events
352
+ const watchQuantum = new MutationObserver((mutations) => {
353
+ mutations.forEach((mutation) => {
354
+ const text = mutation.target.textContent || '';
355
+ if (text.includes('QUANTUM REALM ENTERED')) {
356
+ createBurst(5, 'quantum');
357
+ } else if (text.includes('APPROACHING SINGULARITY')) {
358
+ triggerGlitch();
359
+ }
360
+ });
361
+ });
362
+
363
+ setTimeout(() => {
364
+ const eventLog = document.querySelector('[id*="event_log"]');
365
+ if (eventLog) watchQuantum.observe(eventLog, { childList: true, subtree: true });
366
+ }, 2000);
367
+
368
  // Epic initial burst sequence
369
  setTimeout(() => {
370
  createBurst(5); // Massive initial burst
 
649
  "message": f"🏆 ACHIEVEMENT UNLOCKED: {ach['name']}"
650
  })
651
 
652
+ # Trigger quantum effects at high fitness levels
653
+ if new_fitness >= 0.95 and current_fitness < 0.95:
654
+ state["events"].append({
655
+ "time": datetime.now().strftime("%H:%M:%S"),
656
+ "type": "quantum",
657
+ "message": "⚛️ QUANTUM REALM ENTERED! Reality is bending..."
658
+ })
659
+
660
+ if new_fitness >= 0.99:
661
+ state["events"].append({
662
+ "time": datetime.now().strftime("%H:%M:%S"),
663
+ "type": "quantum",
664
+ "message": "🌌 APPROACHING SINGULARITY! Wormhole detected..."
665
+ })
666
+
667
  return event
668
 
669
  def get_evolved_code():
 
820
  color = "#FFD700"
821
  icon = "🏆"
822
  style = "font-size: 16px; font-weight: bold; background: linear-gradient(45deg, #7B3FF2, #00AAFF); padding: 10px; border-radius: 5px; margin: 5px 0;"
823
+ elif event["type"] == "quantum":
824
+ color = "#FF00FF"
825
+ icon = "⚛️"
826
+ style = "font-size: 18px; font-weight: bold; background: linear-gradient(45deg, #FF00FF, #00FFFF); padding: 12px; border-radius: 8px; margin: 8px 0; animation: pulse 1s infinite; text-shadow: 0 0 10px #FF00FF;"
827
  elif event["type"] == "multiplayer":
828
  color = "#FF6B6B"
829
  icon = "⚔️"