erstelle eine interaktive simulation mit bedienelementen
- User
erstelle eine interaktive simulation mit bedienelementen
Assistant
Hier ist eine interaktive Simulation des Energie-Kredit-Systems für die Weltraumkolonie:
<!DOCTYPE html> <html lang="de"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Weltraumkolonie Wirtschaftssimulation - Energie-Kredite (EK)</title> <style> body { font-family: Arial, sans-serif; background-color: #0a0a0a; color: #e0e0e0; margin: 0; padding: 20px; } .container { max-width: 1200px; margin: 0 auto; } h1 { text-align: center; color: #4a90e2; margin-bottom: 30px; } .controls { background-color: #1a1a1a; padding: 20px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); } .control-group { margin-bottom: 15px; } label { display: inline-block; width: 250px; color: #a0a0a0; } input[type="range"] { width: 200px; margin: 0 10px; } .value-display { display: inline-block; width: 80px; color: #4a90e2; font-weight: bold; } .charts-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; } canvas { background-color: #1a1a1a; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); } .info-panel { background-color: #1a1a1a; padding: 20px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); } .info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; } .info-item { background-color: #252525; padding: 15px; border-radius: 5px; text-align: center; } .info-label { color: #808080; font-size: 14px; margin-bottom: 5px; } .info-value { color: #4a90e2; font-size: 24px; font-weight: bold; } .buttons { margin-top: 20px; text-align: center; } button { background-color: #4a90e2; color: white; border: none; padding: 10px 20px; margin: 0 10px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.3s; } button:hover { background-color: #357abd; } button:active { transform: scale(0.95); } .warning { color: #ff6b6b; font-weight: bold; } .success { color: #51cf66; font-weight: bold; } </style> </head> <body> <div class="container"> <h1>🚀 Weltraumkolonie Wirtschaftssimulation - Energie-Kredite (EK)</h1> <div class="controls"> <h2>Simulationsparameter</h2> <div class="control-group"> <label for="energyCapacity">Energieproduktionskapazität (K):</label> <input type="range" id="energyCapacity" min="50" max="200" value="100" step="1"> <span class="value-display" id="energyCapacityValue">100</span> GWh </div> <div class="control-group"> <label for="moneySupply">Geldmenge (M) - EK im Umlauf:</label> <input type="range" id="moneySupply" min="50" max="200" value="100" step="1"> <span class="value-display" id="moneySupplyValue">100</span> Mio EK </div> <div class="control-group"> <label for="demandShift">Nachfrageschock:</label> <input type="range" id="demandShift" min="-50" max="50" value="0" step="1"> <span class="value-display" id="demandShiftValue">0</span> % </div> <div class="control-group"> <label for="supplyShock">Angebotsschock:</label> <input type="range" id="supplyShock" min="-50" max="50" value="0" step="1"> <span class="value-display" id="supplyShockValue">0</span> % </div> <div class="control-group"> <label for="adjustmentSpeed">Anpassungsgeschwindigkeit (k):</label> <input type="range" id="adjustmentSpeed" min="0.1" max="2" value="0.5" step="0.1"> <span class="value-display" id="adjustmentSpeedValue">0.5</span> </div> </div> <div class="charts-container"> <canvas id="supplyDemandChart" width="400" height="300"></canvas> <canvas id="priceHistoryChart" width="400" height="300"></canvas> </div> <div class="info-panel"> <h2>Wirtschaftsindikatoren</h2> <div class="info-grid"> <div class="info-item"> <div class="info-label">Aktuelles Preisniveau</div> <div class="info-value" id="currentPrice">1.00</div> </div> <div class="info-item"> <div class="info-label">Gleichgewichtspreis</div> <div class="info-value" id="equilibriumPrice">1.00</div> </div> <div class="info-item"> <div class="info-label">Marktstatus</div> <div class="info-value" id="marketStatus">Gleichgewicht</div> </div> <div class="info-item"> <div class="info-label">M/K Verhältnis</div> <div class="info-value" id="mkRatio">1.00</div> </div> <div class="info-item"> <div class="info-label">Inflationsrate</div> <div class="info-value" id="inflationRate">0%</div> </div> <div class="info-item"> <div class="info-label">Konvergenzzeit</div> <div class="info-value" id="convergenceTime">0s</div> </div> </div> </div> <div class="buttons"> <button onclick="startSimulation()">▶️ Simulation Starten</button> <button onclick="pauseSimulation()">⏸️ Pausieren</button> <button onclick="resetSimulation()">🔄 Zurücksetzen</button> <button onclick="createShock()">⚡ Zufälliger Schock</button> </div> </div> <script> // Globale Variablen let isRunning = false; let animationId = null; let priceHistory = []; let currentPrice = 1.0; let time = 0; // Canvas Contexts const sdCanvas = document.getElementById('supplyDemandChart'); const sdCtx = sdCanvas.getContext('2d'); const phCanvas = document.getElementById('priceHistoryChart'); const phCtx = phCanvas.getContext('2d'); // Parameter let params = { K: 100, // Energiekapazität M: 100, // Geldmenge demandShift: 0, supplyShock: 0, k: 0.5, // Anpassungsgeschwindigkeit a: 150, // Nachfrageparameter b: 50, // Nachfrageneigung c: 50, // Angebotsparameter d: 50 // Angebotsneigung }; // Event Listeners document.getElementById('energyCapacity').addEventListener('input', updateParameters); document.getElementById('moneySupply').addEventListener('input', updateParameters); document.getElementById('demandShift').addEventListener('input', updateParameters); document.getElementById('supplyShock').addEventListener('input', updateParameters); document.getElementById('adjustmentSpeed').addEventListener('input', updateParameters); function updateParameters() { params.K = parseFloat(document.getElementById('energyCapacity').value); params.M = parseFloat(document.getElementById('moneySupply').value); params.demandShift = parseFloat(document.getElementById('demandShift').value) / 100; params.supplyShock = parseFloat(document.getElementById('supplyShock').value) / 100; params.k = parseFloat(document.getElementById('adjustmentSpeed').value); // Update display values document.getElementById('energyCapacityValue').textContent = params.K; document.getElementById('moneySupplyValue').textContent = params.M; document.getElementById('demandShiftValue').textContent = (params.demandShift * 100).toFixed(0); document.getElementById('supplyShockValue').textContent = (params.supplyShock * 100).toFixed(0); document.getElementById('adjustmentSpeedValue').textContent = params.k.toFixed(1); updateDisplay(); } // Wirtschaftsfunktionen function demand(p) { const mkEffect = params.M / params.K; return (params.a * (1 + params.demandShift) * mkEffect) - params.b * p; } function supply(p) { return (params.c * (1 + params.supplyShock)) + params.d * p; } function equilibriumPrice() { const mkEffect = params.M / params.K; const adjustedA = params.a * (1 + params.demandShift) * mkEffect; const adjustedC = params.c * (1 + params.supplyShock); return Math.max(0.1, (adjustedA - adjustedC) / (params.b + params.d)); } function priceAdjustment(p) { const excess = demand(p) - supply(p); return params.k * excess; } // Visualisierungsfunktionen function drawSupplyDemand() { sdCtx.clearRect(0, 0, sdCanvas.width, sdCanvas.height); // Achsen sdCtx.strokeStyle = '#666'; sdCtx.lineWidth = 2; sdCtx.beginPath(); sdCtx.moveTo(50, 250); sdCtx.lineTo(350, 250); sdCtx.moveTo(50, 50); sdCtx.lineTo(50, 250); sdCtx.stroke(); // Achsenbeschriftungen sdCtx.fillStyle = '#999'; sdCtx.font = '12px Arial'; sdCtx.fillText('Menge', 340, 270); sdCtx.fillText('Preis', 10, 60); sdCtx.fillText('Angebot & Nachfrage', 120, 30); // Nachfragekurve sdCtx.strokeStyle = '#ff6b6b'; sdCtx.lineWidth = 3; sdCtx.beginPath(); for (let p = 0; p <= 3; p += 0.1) { const q = demand(p); const x = 50 + q * 2; const y = 250 - p * 60; if (p === 0) sdCtx.moveTo(x, y); else sdCtx.lineTo(x, y); } sdCtx.stroke(); // Angebotskurve sdCtx.strokeStyle = '#51cf66'; sdCtx.lineWidth = 3; sdCtx.beginPath(); for (let p = 0; p <= 3; p += 0.1) { const q = supply(p); const x = 50 + q * 2; const y = 250 - p * 60; if (p === 0) sdCtx.moveTo(x, y); else sdCtx.lineTo(x, y); } sdCtx.stroke(); // Aktueller Preis const currentQ = (demand(currentPrice) + supply(currentPrice)) / 2; sdCtx.fillStyle = '#4a90e2'; sdCtx.beginPath(); sdCtx.arc(50 + currentQ * 2, 250 - currentPrice * 60, 6, 0, 2 * Math.PI); sdCtx.fill(); // Gleichgewichtspunkt const eqPrice = equilibriumPrice(); const eqQ = demand(eqPrice); sdCtx.strokeStyle = '#ffd93d'; sdCtx.lineWidth = 2; sdCtx.setLineDash([5, 5]); sdCtx.beginPath(); sdCtx.moveTo(50 + eqQ * 2, 250); sdCtx.lineTo(50 + eqQ * 2, 250 - eqPrice * 60); sdCtx.lineTo(50, 250 - eqPrice * 60); sdCtx.stroke(); sdCtx.setLineDash([]); // Legende sdCtx.fillStyle = '#ff6b6b'; sdCtx.fillRect(260, 60, 20, 3); sdCtx.fillStyle = '#999'; sdCtx.fillText('Nachfrage', 285, 65); sdCtx.fillStyle = '#51cf66'; sdCtx.fillRect(260, 80, 20, 3); sdCtx.fillStyle = '#999'; sdCtx.fillText('Angebot', 285, 85); } function drawPriceHistory() { phCtx.clearRect(0, 0, phCanvas.width, phCanvas.height); // Achsen phCtx.strokeStyle = '#666'; phCtx.lineWidth = 2; phCtx.beginPath(); phCtx.moveTo(50, 250); phCtx.lineTo(350, 250); phCtx.moveTo(50, 50); phCtx.lineTo(50, 250); phCtx.stroke(); // Achsenbeschriftungen phCtx.fillStyle = '#999'; phCtx.font = '12px Arial'; phCtx.fillText('Zeit', 340, 270); phCtx.fillText('Preis', 10, 60); phCtx.fillText('Preisentwicklung', 130, 30); // Gleichgewichtslinie const eqPrice = equilibriumPrice(); phCtx.strokeStyle = '#ffd93d'; phCtx.lineWidth = 2; phCtx.setLineDash([5, 5]); phCtx.beginPath(); phCtx.moveTo(50, 250 - eqPrice * 60); phCtx.lineTo(350, 250 - eqPrice * 60); phCtx.stroke(); phCtx.setLineDash([]); // Preisverlauf if (priceHistory.length > 1) { phCtx.strokeStyle = '#4a90e2'; phCtx.lineWidth = 3; phCtx.beginPath(); for (let i = 0; i < priceHistory.length; i++) { const x = 50 + (i / priceHistory.length) * 300; const y = 250 - priceHistory[i] * 60; if (i === 0) phCtx.moveTo(x, y); else phCtx.lineTo(x, y); } phCtx.stroke(); } } function updateDisplay() { const eqPrice = equilibriumPrice(); const mkRatio = params.M / params.K; const inflationRate = ((currentPrice - 1) * 100).toFixed(1); const convergenceTime = Math.abs(currentPrice - eqPrice) / (params.k * 10); document.getElementById('currentPrice').textContent = currentPrice.toFixed(3); document.getElementById('equilibriumPrice').textContent = eqPrice.toFixed(3); document.getElementById('mkRatio').textContent = mkRatio.toFixed(2); document.getElementById('inflationRate').textContent = inflationRate + '%'; document.getElementById('convergenceTime').textContent = convergenceTime.toFixed(1) + 's'; // Marktstatus const statusEl = document.getElementById('marketStatus'); const priceDiff = currentPrice - eqPrice; if (Math.abs(priceDiff) < 0.01) { statusEl.textContent = 'Gleichgewicht'; statusEl.className = 'info-value success'; } else if (priceDiff > 0) { statusEl.textContent = 'Inflation'; statusEl.className = 'info-value warning'; } else { statusEl.textContent = 'Deflation'; statusEl.className = 'info-value warning'; } drawSupplyDemand(); drawPriceHistory(); } function simulate() { if (!isRunning) return; // Preisanpassung const adjustment = priceAdjustment(currentPrice); currentPrice = Math.max(0.1, currentPrice + adjustment * 0.01); // Historie aktualisieren priceHistory.push(currentPrice); if (priceHistory.length > 200) { priceHistory.shift(); } time += 0.01; updateDisplay(); animationId = requestAnimationFrame(simulate); } function startSimulation() { if (!isRunning) { isRunning = true; simulate(); } } function pauseSimulation() { isRunning = false; if (animationId) { cancelAnimationFrame(animationId); } } function resetSimulation() { pauseSimulation(); currentPrice = 1.0; priceHistory = [currentPrice]; time = 0; params.demandShift = 0; params.supplyShock = 0; document.getElementById('demandShift').value = 0; document.getElementById('supplyShock').value = 0; updateParameters(); } function createShock() { // Zufälliger Schock const shockType = Math.random() > 0.5 ? 'demand' : 'supply'; const shockMagnitude = (Math.random() - 0.5) * 40; if (shockType === 'demand') { document.getElementById('demandShift').value = shockMagnitude; } else { document.getElementById('supplyShock').value = shockMagnitude; } updateParameters(); } // Initialisierung resetSimulation(); updateDisplay(); </script> </body> </html>Diese interaktive Simulation bietet folgende Funktionen:
Bedienelemente:
- Energieproduktionskapazität (K): Steuert die maximale Energieproduktion der Kolonie
- Geldmenge (M): Anzahl der EK im Umlauf
- Nachfrageschock: Simuliert plötzliche Änderungen in der Nachfrage
- Angebotsschock: Simuliert Produktionsstörungen
- Anpassungsgeschwindigkeit: Wie schnell der Markt zum Gleichgewicht zurückkehrt
Visualisierungen:
- Links: Angebot-Nachfrage-Diagramm mit aktuellen Kurven
- Rechts: Preisentwicklung über Zeit
Wirtschaftsindikatoren:
- Aktuelles Preisniveau und Gleichgewichtspreis
- Marktstatus (Inflation/Deflation/Gleichgewicht)
- M/K-Verhältnis (Geldmenge zu Energiekapazität)
- Inflationsrate und Konvergenzzeit
Steuerungsbuttons:
- Start/Pause: Kontrolle der Simulation
- Zurücksetzen: Neustart mit Standardwerten
- Zufälliger Schock: Erzeugt realistische Marktstörungen
Die Simulation demonstriert live, wie das System auf Störungen reagiert und zum Gleichgewicht zurückkehrt, genau wie im theoretischen Beweis beschrieben.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.