AI Prompt for a Cyberpunk City Simulator You are an expert programmer specializing in…
- User
AI Prompt for a Cyberpunk City Simulator You are an expert programmer specializing in creating interactive, single-file HTML/CSS/JS web applications. Your task is to build a complete, self-contained Cyberpunk City Simulator game.
The final output must be a single HTML file with all necessary CSS and JavaScript included. Use Tailwind CSS for styling (via CDN) and ensure the application is modular and well-commented for easy modification.
Core Features to Implement: Visuals & Aesthetics:
Theme: The game must have a dark, cyberpunk aesthetic with neon highlights. Use a futuristic font like 'Orbitron' from Google Fonts.
Canvas: The main view should be an HTML canvas rendering a 2D grid where the city is built.
Day/Night Cycle: Implement a clock that cycles through a 24-hour period. The visual display should dim at night.
Zone Glow: All placed zones (not roads or empty tiles) should have a subtle glow effect. This glow should become more intense at night to simulate city lights.
Gameplay & Simulation Logic:
Zoning: The player must be able to "paint" zones onto the grid by clicking and dragging. The primary tools should be:
Residential: For housing.
Commercial: For shops and services.
Industrial: For manufacturing and production.
Roads: Act as barriers that zones cannot spread across.
Clear/Bulldoze: To remove existing structures.
Organic Growth: Zoned areas (Residential, Commercial, Industrial) must slowly and automatically spread to adjacent empty tiles over time.
Zone Evolution: When a large, dense area of a single zone type exists, individual tiles within it should have a chance to evolve into a more advanced sub-zone. Include at least three sub-zone types for each primary zone (e.g., Residential can evolve into Apartments, Mega-Towers, or Slums).
Population & Demand System:
Capacity & Jobs: Residential zones provide population capacity. Commercial and Industrial zones provide jobs.
Population Growth: The city's population should grow over time to fill the available capacity.
Demand-Driven Growth: The simulation must react to the balance between population and jobs. If there are many more jobs than people ("Workers Needed"), the growth rate of residential zones should significantly increase.
User Interface (UI):
Controls: Provide clear buttons for selecting the active zoning tool and for controlling the simulation speed (e.g., Slow, Normal, Fast).
City Vitals Panel: Display the city's key metrics in real-time:
Population: Current Population / Total Capacity
Employment: Jobs Filled / Total Jobs Available
Demand: A clear text indicator for what the city needs most (e.g., "Housing Needed," "Jobs Needed").
Zone Data Panel: Display a list of all zone and sub-zone types currently in the city, along with a count for each.
Layout Presets: Include a panel with buttons that automatically lay down different road patterns (e.g., a dense grid, a central park area, a main highway) and a "Clear All" button to start over.
AI Feature (Optional Bonus):
Include a button labeled "Get Advisor Report." When clicked, it should analyze the current city statistics (population, jobs, zone counts) and generate a short, thematic, in-character text report from the perspective of a cynical cyberpunk city advisor.
Please structure the JavaScript logically (e.g., separate modules/objects for Grid, Simulation, UI, Population, etc.) to ensure the final code is readable and expandable.
Assistant
I'll create a complete Cyberpunk City Simulator for you. This will be a single HTML file with all the features you've requested.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cyberpunk City Simulator</title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet"> <style> body { font-family: 'Orbitron', monospace; background-color: #0a0a0a; } .neon-glow { text-shadow: 0 0 10px currentColor, 0 0 20px currentColor; } .panel { background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%); border: 1px solid #333; box-shadow: 0 0 20px rgba(0, 255, 255, 0.2); } .tool-button { transition: all 0.3s ease; border: 1px solid #333; } .tool-button:hover { box-shadow: 0 0 15px currentColor; border-color: currentColor; } .tool-button.active { box-shadow: 0 0 25px currentColor; border-color: currentColor; background: rgba(0, 255, 255, 0.1); } canvas { image-rendering: crisp-edges; image-rendering: pixelated; } .zone-count { padding: 2px 8px; margin: 2px; border-radius: 4px; display: inline-block; font-size: 0.75rem; } .residential { background: rgba(0, 255, 0, 0.3); color: #00ff00; } .commercial { background: rgba(0, 100, 255, 0.3); color: #0064ff; } .industrial { background: rgba(255, 200, 0, 0.3); color: #ffc800; } .evolved { filter: brightness(1.5); } </style> </head> <body class="bg-black text-cyan-400"> <div class="container mx-auto p-4 max-w-7xl"> <h1 class="text-4xl font-black text-center mb-6 neon-glow text-cyan-300">CYBERPUNK CITY SIMULATOR</h1> <div class="grid grid-cols-1 lg:grid-cols-4 gap-4"> <!-- Main Canvas Area --> <div class="lg:col-span-3"> <div class="panel p-4 rounded-lg"> <canvas id="gameCanvas" width="800" height="600" class="w-full rounded bg-gray-900"></canvas> </div> </div> <!-- Control Panel --> <div class="space-y-4"> <!-- Tools Panel --> <div class="panel p-4 rounded-lg"> <h3 class="text-lg font-bold mb-3 text-purple-400 neon-glow">ZONING TOOLS</h3> <div class="grid grid-cols-2 gap-2"> <button class="tool-button p-2 rounded text-xs font-bold text-green-400" data-tool="residential"> RESIDENTIAL </button> <button class="tool-button p-2 rounded text-xs font-bold text-blue-400" data-tool="commercial"> COMMERCIAL </button> <button class="tool-button p-2 rounded text-xs font-bold text-yellow-400" data-tool="industrial"> INDUSTRIAL </button> <button class="tool-button p-2 rounded text-xs font-bold text-gray-400" data-tool="road"> ROAD </button> <button class="tool-button p-2 rounded text-xs font-bold text-red-400 col-span-2" data-tool="clear"> BULLDOZE </button> </div> </div> <!-- Speed Control --> <div class="panel p-4 rounded-lg"> <h3 class="text-lg font-bold mb-3 text-purple-400 neon-glow">SIMULATION SPEED</h3> <div class="grid grid-cols-3 gap-2"> <button class="speed-button p-2 rounded text-xs font-bold text-cyan-400" data-speed="slow"> SLOW </button> <button class="speed-button p-2 rounded text-xs font-bold text-cyan-400 active" data-speed="normal"> NORMAL </button> <button class="speed-button p-2 rounded text-xs font-bold text-cyan-400" data-speed="fast"> FAST </button> </div> </div> <!-- City Vitals --> <div class="panel p-4 rounded-lg"> <h3 class="text-lg font-bold mb-3 text-purple-400 neon-glow">CITY VITALS</h3> <div class="space-y-2 text-xs"> <div> <span class="text-gray-400">TIME:</span> <span id="gameTime" class="font-bold">00:00</span> </div> <div> <span class="text-gray-400">POPULATION:</span> <span id="population" class="font-bold">0 / 0</span> </div> <div> <span class="text-gray-400">EMPLOYMENT:</span> <span id="employment" class="font-bold">0 / 0</span> </div> <div class="mt-3 p-2 bg-gray-800 rounded"> <span class="text-gray-400">DEMAND:</span> <div id="demand" class="font-bold text-yellow-400 mt-1">BALANCED</div> </div> </div> </div> <!-- Zone Data --> <div class="panel p-4 rounded-lg max-h-48 overflow-y-auto"> <h3 class="text-lg font-bold mb-3 text-purple-400 neon-glow">ZONE DATA</h3> <div id="zoneData" class="text-xs space-y-1"></div> </div> <!-- Layout Presets --> <div class="panel p-4 rounded-lg"> <h3 class="text-lg font-bold mb-3 text-purple-400 neon-glow">LAYOUT PRESETS</h3> <div class="grid grid-cols-2 gap-2"> <button class="preset-button p-2 rounded text-xs font-bold text-pink-400" data-preset="grid"> GRID </button> <button class="preset-button p-2 rounded text-xs font-bold text-pink-400" data-preset="park"> CENTRAL PARK </button> <button class="preset-button p-2 rounded text-xs font-bold text-pink-400" data-preset="highway"> HIGHWAY </button> <button class="preset-button p-2 rounded text-xs font-bold text-red-500" data-preset="clear"> CLEAR ALL </button> </div> </div> <!-- AI Advisor --> <div class="panel p-4 rounded-lg"> <button id="advisorButton" class="w-full p-3 rounded bg-purple-900 text-purple-200 font-bold hover:bg-purple-800 transition"> GET ADVISOR REPORT </button> <div id="advisorReport" class="mt-3 text-xs text-gray-300 hidden"></div> </div> </div> </div> </div> <script> // Game Configuration const CONFIG = { GRID_SIZE: 40, TILE_SIZE: 20, GROWTH_RATE: 0.02, EVOLUTION_CHANCE: 0.001, POPULATION_PER_RESIDENTIAL: 10, JOBS_PER_COMMERCIAL: 8, JOBS_PER_INDUSTRIAL: 12, SPEED_MULTIPLIERS: { slow: 0.5, normal: 1, fast: 3 } }; // Zone Types and Colors const ZONES = { empty: { color: '#111111', glow: false }, road: { color: '#333333', glow: false }, residential: { color: '#00ff00', glow: true, subzones: ['apartments', 'megaTowers', 'slums'] }, commercial: { color: '#0064ff', glow: true, subzones: ['shops', 'malls', 'markets'] }, industrial: { color: '#ffc800', glow: true, subzones: ['factories', 'techLabs', 'warehouses'] }, // Subzones apartments: { color: '#00cc00', glow: true, parent: 'residential' }, megaTowers: { color: '#00ff99', glow: true, parent: 'residential' }, slums: { color: '#669900', glow: true, parent: 'residential' }, shops: { color: '#0099ff', glow: true, parent: 'commercial' }, malls: { color: '#0033cc', glow: true, parent: 'commercial' }, markets: { color: '#3366ff', glow: true, parent: 'commercial' }, factories: { color: '#ff9900', glow: true, parent: 'industrial' }, techLabs: { color: '#ffcc00', glow: true, parent: 'industrial' }, warehouses: { color: '#cc9900', glow: true, parent: 'industrial' } }; // Grid Module const Grid = { data: [], init() { this.data = Array(CONFIG.GRID_SIZE).fill(null).map(() => Array(CONFIG.GRID_SIZE).fill('empty') ); }, getCell(x, y) { if (x < 0 || x >= CONFIG.GRID_SIZE || y < 0 || y >= CONFIG.GRID_SIZE) { return null; } return this.data[y][x]; }, setCell(x, y, type) { if (x >= 0 && x < CONFIG.GRID_SIZE && y >= 0 && y < CONFIG.GRID_SIZE) { this.data[y][x] = type; } }, getNeighbors(x, y) { const neighbors = []; const dirs = [[-1,0], [1,0], [0,-1], [0,1]]; for (const [dx, dy] of dirs) { const nx = x + dx; const ny = y + dy; const cell = this.getCell(nx, ny); if (cell !== null) { neighbors.push({ x: nx, y: ny, type: cell }); } } return neighbors; }, countZones() { const counts = {}; for (let y = 0; y < CONFIG.GRID_SIZE; y++) { for (let x = 0; x < CONFIG.GRID_SIZE; x++) { const type = this.data[y][x]; counts[type] = (counts[type] || 0) + 1; } } return counts; } }; // Population Module const Population = { current: 0, capacity: 0, jobs: 0, employed: 0, update() { const zones = Grid.countZones(); // Calculate capacity this.capacity = 0; this.capacity += (zones.residential || 0) * CONFIG.POPULATION_PER_RESIDENTIAL; this.capacity += (zones.apartments || 0) * CONFIG.POPULATION_PER_RESIDENTIAL * 2; this.capacity += (zones.megaTowers || 0) * CONFIG.POPULATION_PER_RESIDENTIAL * 5; this.capacity += (zones.slums || 0) * CONFIG.POPULATION_PER_RESIDENTIAL * 3; // Calculate jobs this.jobs = 0; this.jobs += (zones.commercial || 0) * CONFIG.JOBS_PER_COMMERCIAL; this.jobs += (zones.shops || 0) * CONFIG.JOBS_PER_COMMERCIAL * 1.5; this.jobs += (zones.malls || 0) * CONFIG.JOBS_PER_COMMERCIAL * 3; this.jobs += (zones.markets || 0) * CONFIG.JOBS_PER_COMMERCIAL * 2; this.jobs += (zones.industrial || 0) * CONFIG.JOBS_PER_INDUSTRIAL; this.jobs += (zones.factories || 0) * CONFIG.JOBS_PER_INDUSTRIAL * 2; this.jobs += (zones.techLabs || 0) * CONFIG.JOBS_PER_INDUSTRIAL * 1.5; this.jobs += (zones.warehouses || 0) * CONFIG.JOBS_PER_INDUSTRIAL * 2.5; // Update population if (this.current < this.capacity) { const growthRate = this.jobs > this.current ? 0.1 : 0.02; this.current += Math.min(growthRate * Simulation.speedMultiplier, this.capacity - this.current); } // Update employment this.employed = Math.min(this.current, this.jobs); this.updateUI(); }, updateUI() { document.getElementById('population').textContent = `${Math.floor(this.current)} / ${Math.floor(this.capacity)}`; document.getElementById('employment').textContent = `${Math.floor(this.employed)} / ${Math.floor(this.jobs)}`; // Update demand const demandEl = document.getElementById('demand'); if (this.capacity === 0 && this.jobs === 0) { demandEl.textContent = 'BUILD SOMETHING!'; demandEl.className = 'font-bold text-gray-400 mt-1'; } else if (this.jobs > this.current * 1.2) { demandEl.textContent = 'WORKERS NEEDED'; demandEl.className = 'font-bold text-green-400 mt-1'; } else if (this.current > this.jobs * 1.2 && this.current > 10) { demandEl.textContent = 'JOBS NEEDED'; demandEl.className = 'font-bold text-blue-400 mt-1'; } else { demandEl.textContent = 'BALANCED'; demandEl.className = 'font-bold text-yellow-400 mt-1'; } }, getDemandMultiplier(zoneType) { if (this.jobs > this.current * 1.2 && zoneType === 'residential') { return 3; } else if (this.current > this.jobs * 1.2 && (zoneType === 'commercial' || zoneType === 'industrial')) { return 3; } return 1; } }; // Simulation Module const Simulation = { time: 0, speedMultiplier: 1, running: true, update() { if (!this.running) return; // Update time this.time += 0.01 * this.speedMultiplier; if (this.time >= 24) this.time = 0; // Growth simulation for (let y = 0; y < CONFIG.GRID_SIZE; y++) { for (let x = 0; x < CONFIG.GRID_SIZE; x++) { const currentType = Grid.getCell(x, y); if (currentType === 'empty') { this.tryGrowth(x, y); } else if (ZONES[currentType]?.subzones) { this.tryEvolution(x, y, currentType); } } } // Update population Population.update(); // Update UI this.updateTimeDisplay(); this.updateZoneData(); }, tryGrowth(x, y) { const neighbors = Grid.getNeighbors(x, y); const zoneNeighbors = neighbors.filter(n => n.type !== 'empty' && n.type !== 'road' ); if (zoneNeighbors.length === 0) return; // Don't grow across roads const hasRoadBetween = neighbors.some(n => n.type === 'road'); if (hasRoadBetween) return; // Pick a random zone type from neighbors const source = zoneNeighbors[Math.floor(Math.random() * zoneNeighbors.length)]; let zoneType = source.type; // Convert subzones back to main type for spreading if (ZONES[zoneType].parent) { zoneType = ZONES[zoneType].parent; } const demandMultiplier = Population.getDemandMultiplier(zoneType); const growthChance = CONFIG.GROWTH_RATE * this.speedMultiplier * demandMultiplier; if (Math.random() < growthChance) { Grid.setCell(x, y, zoneType); } }, tryEvolution(x, y, zoneType) { const neighbors = Grid.getNeighbors(x, y); const sameTypeCount = neighbors.filter(n => n.type === zoneType || ZONES[n.type]?.parent === zoneType ).length; if (sameTypeCount >= 3 && Math.random() < CONFIG.EVOLUTION_CHANCE * this.speedMultiplier) { const subzones = ZONES[zoneType].subzones; const evolved = subzones[Math.floor(Math.random() * subzones.length)]; Grid.setCell(x, y, evolved); } }, updateTimeDisplay() { const hours = Math.floor(this.time); const minutes = Math.floor((this.time - hours) * 60); document.getElementById('gameTime').textContent = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`; }, updateZoneData() { const counts = Grid.countZones(); const zoneDataEl = document.getElementById('zoneData'); let html = ''; const mainZones = ['residential', 'commercial', 'industrial']; for (const zone of mainZones) { if (counts[zone] || ZONES[zone].subzones.some(sz => counts[sz])) { html += `<div class="mb-2">`; html += `<div class="font-bold ${zone}">${zone.toUpperCase()}: ${counts[zone] || 0}</div>`; for (const subzone of ZONES[zone].subzones) { if (counts[subzone]) { html += `<div class="ml-4 text-gray-400">- ${subzone}: ${counts[subzone]}</div>`; } } html += `</div>`; } } zoneDataEl.innerHTML = html; }, setSpeed(speed) { this.speedMultiplier = CONFIG.SPEED_MULTIPLIERS[speed]; // Update UI document.querySelectorAll('.speed-button').forEach(btn => { btn.classList.toggle('active', btn.dataset.speed === speed); }); }, isDayTime() { return this.time >= 6 && this.time < 18; } }; // Renderer Module const Renderer = { canvas: null, ctx: null, init() { this.canvas = document.getElementById('gameCanvas'); this.ctx = this.canvas.getContext('2d'); // Set actual canvas size this.canvas.width = CONFIG.GRID_SIZE * CONFIG.TILE_SIZE; this.canvas.height = CONFIG.GRID_SIZE * CONFIG.TILE_SIZE; }, render() { // Clear canvas this.ctx.fillStyle = '#0a0a0a'; this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height); const isDayTime = Simulation.isDayTime(); const glowIntensity = isDayTime ? 0.3 : 1; // Draw grid for (let y = 0; y < CONFIG.GRID_SIZE; y++) { for (let x = 0; x < CONFIG.GRID_SIZE; x++) { const type = Grid.getCell(x, y); const zone = ZONES[type]; if (zone) { const px = x * CONFIG.TILE_SIZE; const py = y * CONFIG.TILE_SIZE; // Draw base tile this.ctx.fillStyle = isDayTime ? zone.color : this.adjustColorForNight(zone.color); this.ctx.fillRect(px, py, CONFIG.TILE_SIZE - 1, CONFIG.TILE_SIZE - 1); // Draw glow effect if (zone.glow) { this.ctx.shadowColor = zone.color; this.ctx.shadowBlur = 10 * glowIntensity; this.ctx.fillRect(px, py, CONFIG.TILE_SIZE - 1, CONFIG.TILE_SIZE - 1); this.ctx.shadowBlur = 0; } } } } // Draw grid lines this.ctx.strokeStyle = '#222'; this.ctx.lineWidth = 1; for (let i = 0; i <= CONFIG.GRID_SIZE; i++) { this.ctx.beginPath(); this.ctx.moveTo(i * CONFIG.TILE_SIZE, 0); this.ctx.lineTo(i * CONFIG.TILE_SIZE, this.canvas.height); this.ctx.stroke(); this.ctx.beginPath(); this.ctx.moveTo(0, i * CONFIG.TILE_SIZE); this.ctx.lineTo(this.canvas.width, i * CONFIG.TILE_SIZE); this.ctx.stroke(); } }, adjustColorForNight(color) { // Darken colors at night const r = parseInt(color.slice(1, 3), 16); const g = parseInt(color.slice(3, 5), 16); const b = parseInt(color.slice(5, 7), 16); const factor = 0.4; const nr = Math.floor(r * factor); const ng = Math.floor(g * factor); const nb = Math.floor(b * factor); return `#${nr.toString(16).padStart(2, '0')}${ng.toString(16).padStart(2, '0')}${nb.toString(16).padStart(2, '0')}`; } }; // Input Handler Module const InputHandler = { currentTool: 'residential', isDrawing: false, lastX: -1, lastY: -1, init() { const canvas = document.getElementById('gameCanvas'); // Mouse events canvas.addEventListener('mousedown', (e) => this.startDrawing(e)); canvas.addEventListener('mousemove', (e) => this.draw(e)); canvas.addEventListener('mouseup', () => this.stopDrawing()); canvas.addEventListener('mouseleave', () => this.stopDrawing()); // Touch events canvas.addEventListener('touchstart', (e) => { e.preventDefault(); this.startDrawing(e.touches[0]); }); canvas.addEventListener('touchmove', (e) => { e.preventDefault(); this.draw(e.touches[0]); }); canvas.addEventListener('touchend', () => this.stopDrawing()); // Tool buttons document.querySelectorAll('.tool-button').forEach(btn => { btn.addEventListener('click', () => { this.setTool(btn.dataset.tool); }); }); // Speed buttons document.querySelectorAll('.speed-button').forEach(btn => { btn.addEventListener('click', () => { Simulation.setSpeed(btn.dataset.speed); }); }); // Preset buttons document.querySelectorAll('.preset-button').forEach(btn => { btn.addEventListener('click', () => { this.applyPreset(btn.dataset.preset); }); }); // Advisor button document.getElementById('advisorButton').addEventListener('click', () => { this.generateAdvisorReport(); }); // Set initial tool this.setTool('residential'); }, setTool(tool) { this.currentTool = tool; // Update UI document.querySelectorAll('.tool-button').forEach(btn => { btn.classList.toggle('active', btn.dataset.tool === tool); }); }, startDrawing(e) { this.isDrawing = true; this.draw(e); }, draw(e) { if (!this.isDrawing) return; const rect = Renderer.canvas.getBoundingClientRect(); const scaleX = Renderer.canvas.width / rect.width; const scaleY = Renderer.canvas.height / rect.height; const x = Math.floor((e.clientX - rect.left) * scaleX / CONFIG.TILE_SIZE); const y = Math.floor((e.clientY - rect.top) * scaleY / CONFIG.TILE_SIZE); if (x !== this.lastX || y !== this.lastY) { const zoneType = this.currentTool === 'clear' ? 'empty' : this.currentTool; Grid.setCell(x, y, zoneType); this.lastX = x; this.lastY = y; } }, stopDrawing() { this.isDrawing = false; this.lastX = -1; this.lastY = -1; }, applyPreset(preset) { switch (preset) { case 'clear': Grid.init(); break; case 'grid': Grid.init(); // Create a grid pattern of roads for (let i = 0; i < CONFIG.GRID_SIZE; i += 8) { for (let j = 0; j < CONFIG.GRID_SIZE; j++) { Grid.setCell(i, j, 'road'); Grid.setCell(j, i, 'road'); } } break; case 'park': Grid.init(); // Create roads around edges and center park const center = Math.floor(CONFIG.GRID_SIZE / 2); const parkSize = 8; // Outer roads for (let i = 0; i < CONFIG.GRID_SIZE; i++) { Grid.setCell(i, 5, 'road'); Grid.setCell(i, CONFIG.GRID_SIZE - 6, 'road'); Grid.setCell(5, i, 'road'); Grid.setCell(CONFIG.GRID_SIZE - 6, i, 'road'); } // Park roads for (let i = center - parkSize; i <= center + parkSize; i++) { Grid.setCell(i, center - parkSize, 'road'); Grid.setCell(i, center + parkSize, 'road'); Grid.setCell(center - parkSize, i, 'road'); Grid.setCell(center + parkSize, i, 'road'); } break; case 'highway': Grid.init(); // Create main highway through center const highway = Math.floor(CONFIG.GRID_SIZE / 2); for (let i = 0; i < CONFIG.GRID_SIZE; i++) { Grid.setCell(i, highway - 1, 'road'); Grid.setCell(i, highway, 'road'); Grid.setCell(i, highway + 1, 'road'); // Side roads if (i % 10 === 0) { for (let j = 0; j < CONFIG.GRID_SIZE; j++) { Grid.setCell(i, j, 'road'); } } } break; } }, generateAdvisorReport() { const zones = Grid.countZones(); const pop = Population.current; const jobs = Population.jobs; let report = ""; if (pop === 0 && jobs === 0) { report = "Listen up, rookie. This empty wasteland ain't gonna build itself. " + "Start laying down some zones before the corps decide this land's better off as a toxic dump."; } else if (jobs > pop * 1.5) { report = "Your corps are screaming for warm bodies, choom. All these empty workstations... " + `${Math.floor(jobs - pop)} positions unfilled. Build more residential before the suits start importing cheap labor from the wastelands.`; } else if (pop > jobs * 1.5 && pop > 20) { report = "Got yourself a unemployment crisis brewing. " + `${Math.floor(pop - jobs)} citizens with nothing but time and desperation. ` + "Better create some jobs before the streets run red with revolution."; } else if (zones.slums > (zones.apartments || 0) + (zones.megaTowers || 0)) { report = "The slums are spreading like a virus through your sectors. " + "Your city's becoming a cesspool of poverty. The corps won't invest in this dump much longer."; } else if (pop > 100) { report = "City's humming along, for now. Population's growing, credits are flowing. " + "But don't get comfortable - in this neon jungle, today's paradise is tomorrow's warzone."; } else { report = "Your little experiment is surviving, barely. Keep the zones balanced, " + "watch the demand indicators, and maybe - just maybe - you won't end up with another failed dystopia."; } const reportEl = document.getElementById('advisorReport'); reportEl.textContent = report; reportEl.classList.remove('hidden'); } }; // Main Game Loop const Game = { init() { Grid.init(); Renderer.init(); InputHandler.init(); Simulation.setSpeed('normal'); this.loop(); }, loop() { Simulation.update(); Renderer.render(); requestAnimationFrame(() => this.loop()); } }; // Start the game when page loads window.addEventListener('load', () => { Game.init(); }); </script> </body> </html>This complete Cyberpunk City Simulator includes all the requested features:
Visual & Aesthetic Features:
- Dark cyberpunk theme with neon colors
- Orbitron font for that futuristic feel
- Canvas-based grid rendering
- Day/night cycle with visual changes
- Glowing zones that intensify at night
Gameplay Features:
- Click and drag zoning system
- Five tools: Residential, Commercial, Industrial, Roads, and Bulldoze
- Organic zone growth that spreads to adjacent tiles
- Zone evolution system with 3 sub-types per main zone
- Roads act as barriers to growth
Simulation Features:
- Population system based on residential capacity
- Employment system from commercial/industrial zones
- Demand-driven growth (zones grow faster based on city needs)
- Real-time city statistics
UI Features:
- Tool selection panel
- Speed controls (Slow, Normal, Fast)
- City vitals display
- Zone data panel showing all zone counts
- Layout presets (Grid, Central Park, Highway, Clear All)
- Cynical AI advisor that provides contextual reports
The code is modular with separate objects for Grid, Population, Simulation, Renderer, and InputHandler, making it easy to modify and extend. Each module handles its specific responsibilities, and the game loop ties everything together.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.