Spaces:
Sleeping
Sleeping
Update pi-forge-integration.js
Browse files- pi-forge-integration.js +4 -53
pi-forge-integration.js
CHANGED
|
@@ -1,53 +1,4 @@
|
|
| 1 |
-
//
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
this.resonance = 0;
|
| 6 |
-
this.canvas = document.getElementById('onion-pi-canvas');
|
| 7 |
-
this.ctx = this.canvas.getContext('2d');
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
generateFractal() {
|
| 11 |
-
const ctx = this.ctx;
|
| 12 |
-
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
| 13 |
-
for (let i = 0; i < 1000; i++) {
|
| 14 |
-
const x = Math.random() * this.canvas.width;
|
| 15 |
-
const y = Math.random() * this.canvas.height;
|
| 16 |
-
const size = Math.random() * 5 + 1;
|
| 17 |
-
ctx.fillStyle = `rgba(${Math.random()*255}, ${Math.random()*255}, 0, 0.7)`;
|
| 18 |
-
ctx.beginPath();
|
| 19 |
-
ctx.arc(x, y, size, 0, 2*Math.PI);
|
| 20 |
-
ctx.fill();
|
| 21 |
-
}
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
increaseResonance(value) {
|
| 25 |
-
this.resonance += value;
|
| 26 |
-
console.log(`Resonance: ${this.resonance}`);
|
| 27 |
-
}
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
class OnionPiViz {
|
| 31 |
-
constructor(engine) {
|
| 32 |
-
this.engine = engine;
|
| 33 |
-
this.animate();
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
animate() {
|
| 37 |
-
this.engine.generateFractal();
|
| 38 |
-
requestAnimationFrame(() => this.animate());
|
| 39 |
-
}
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
const forgeEngine = new PiForgeEngine();
|
| 43 |
-
const viz = new OnionPiViz(forgeEngine);
|
| 44 |
-
|
| 45 |
-
// Button actions
|
| 46 |
-
document.getElementById('start-audit').addEventListener('click', () => {
|
| 47 |
-
forgeEngine.increaseResonance(100);
|
| 48 |
-
alert('Ethical audit complete! Resonance increased.');
|
| 49 |
-
});
|
| 50 |
-
|
| 51 |
-
document.getElementById('activate-boost').addEventListener('click', () => {
|
| 52 |
-
alert('Mining boost activated! ⛏️');
|
| 53 |
-
});
|
|
|
|
| 1 |
+
// In your pi-forge-integration.js, update the mining boost check:
|
| 2 |
+
if (event.data.results.resonance >= 69) { // Changed from 691 to 69
|
| 3 |
+
await this.activateMiningBoost();
|
| 4 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|