Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514· AnthropicHugging Face LMArena Human Preference 140K

Make me a html script game that will be fun, make more replayable and fun game than the…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-pro-preview-05-06’s answer.
  1. User

    Make me a html script game that will be fun, make more replayable and fun game than the other ai.

  2. Claude Assistant

    I'll create an engaging HTML game for you! Here's "Cosmic Defender" - a space shooter with progressive difficulty, power-ups, and multiple enemy types:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Cosmic Defender</title>
        <style>
            body {
                margin: 0;
                padding: 0;
                background: linear-gradient(45deg, #0a0a2e, #16213e, #0f3460);
                display: flex;
                justify-content: center;
                align-items: center;
                min-height: 100vh;
                font-family: 'Courier New', monospace;
                color: white;
            }
            
            #gameContainer {
                text-align: center;
                position: relative;
            }
            
            canvas {
                border: 2px solid #00ffff;
                background: radial-gradient(circle, #001122, #000011);
                box-shadow: 0 0 20px #00ffff;
            }
            
            #ui {
                position: absolute;
                top: 10px;
                left: 10px;
                font-size: 18px;
                text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            }
            
            #gameOver {
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background: rgba(0,0,0,0.9);
                padding: 30px;
                border-radius: 10px;
                border: 2px solid #ff0066;
                display: none;
            }
            
            button {
                background: linear-gradient(45deg, #ff0066, #ff3399);
                color: white;
                border: none;
                padding: 10px 20px;
                font-size: 16px;
                border-radius: 5px;
                cursor: pointer;
                margin: 10px;
                transition: all 0.3s;
            }
            
            button:hover {
                transform: scale(1.1);
                box-shadow: 0 0 15px #ff0066;
            }
        </style>
    </head>
    <body>
        <div id="gameContainer">
            <canvas id="gameCanvas" width="800" height="600"></canvas>
            <div id="ui">
                <div>Score: <span id="score">0</span></div>
                <div>Lives: <span id="lives">3</span></div>
                <div>Level: <span id="level">1</span></div>
                <div>Wave: <span id="wave">1</span></div>
            </div>
            <div id="gameOver">
                <h2>Game Over!</h2>
                <p>Final Score: <span id="finalScore">0</span></p>
                <p>Level Reached: <span id="finalLevel">1</span></p>
                <button onclick="restartGame()">Play Again</button>
            </div>
        </div>
    
        <script>
            const canvas = document.getElementById('gameCanvas');
            const ctx = canvas.getContext('2d');
            
            // Game state
            let gameState = {
                score: 0,
                lives: 3,
                level: 1,
                wave: 1,
                gameRunning: true,
                keys: {},
                lastTime: 0
            };
            
            // Player object
            const player = {
                x: canvas.width / 2,
                y: canvas.height - 50,
                width: 30,
                height: 30,
                speed: 5,
                fireRate: 200,
                lastFire: 0,
                powerUp: null,
                powerUpTime: 0
            };
            
            // Arrays for game objects
            let bullets = [];
            let enemies = [];
            let powerUps = [];
            let particles = [];
            let stars = [];
            
            // Enemy types
            const enemyTypes = {
                basic: { health: 1, speed: 1, points: 10, color: '#ff4444' },
                fast: { health: 1, speed: 3, points: 20, color: '#44ff44' },
                tank: { health: 3, speed: 0.5, points: 50, color: '#4444ff' },
                zigzag: { health: 2, speed: 2, points: 30, color: '#ffff44' }
            };
            
            // Initialize stars for background
            function initStars() {
                for (let i = 0; i < 100; i++) {
                    stars.push({
                        x: Math.random() * canvas.width,
                        y: Math.random() * canvas.height,
                        speed: Math.random() * 2 + 0.5,
                        size: Math.random() * 2 + 1
                    });
                }
            }
            
            // Input handling
            document.addEventListener('keydown', (e) => {
                gameState.keys[e.code] = true;
            });
            
            document.addEventListener('keyup', (e) => {
                gameState.keys[e.code] = false;
            });
            
            // Player movement and shooting
            function updatePlayer(deltaTime) {
                if (gameState.keys['ArrowLeft'] && player.x > 0) {
                    player.x -= player.speed;
                }
                if (gameState.keys['ArrowRight'] && player.x < canvas.width - player.width) {
                    player.x += player.speed;
                }
                if (gameState.keys['ArrowUp'] && player.y > 0) {
                    player.y -= player.speed;
                }
                if (gameState.keys['ArrowDown'] && player.y < canvas.height - player.height) {
                    player.y += player.speed;
                }
                
                if (gameState.keys['Space'] && Date.now() - player.lastFire > player.fireRate) {
                    shoot();
                    player.lastFire = Date.now();
                }
                
                // Update power-up
                if (player.powerUp && Date.now() - player.powerUpTime > 5000) {
                    player.powerUp = null;
                }
            }
            
            function shoot() {
                if (player.powerUp === 'triple') {
                    bullets.push(createBullet(player.x + player.width/2 - 2, player.y));
                    bullets.push(createBullet(player.x + player.width/2 - 10, player.y + 5));
                    bullets.push(createBullet(player.x + player.width/2 + 6, player.y + 5));
                } else {
                    bullets.push(createBullet(player.x + player.width/2 - 2, player.y));
                }
            }
            
            function createBullet(x, y) {
                return {
                    x: x,
                    y: y,
                    width: 4,
                    height: 10,
                    speed: 8,
                    color: player.powerUp === 'power' ? '#ff00ff' : '#00ffff'
                };
            }
            
            // Enemy management
            function spawnEnemies() {
                const enemyCount = Math.min(5 + gameState.level, 15);
                const waveMultiplier = Math.floor(gameState.wave / 3) + 1;
                
                for (let i = 0; i < enemyCount; i++) {
                    setTimeout(() => {
                        if (gameState.gameRunning) {
                            const types = Object.keys(enemyTypes);
                            let type = types[Math.floor(Math.random() * Math.min(types.length, 1 + Math.floor(gameState.level / 2)))];
                            
                            enemies.push({
                                x: Math.random() * (canvas.width - 30),
                                y: -30,
                                width: 30,
                                height: 30,
                                type: type,
                                health: enemyTypes[type].health * waveMultiplier,
                                maxHealth: enemyTypes[type].health * waveMultiplier,
                                speed: enemyTypes[type].speed + gameState.level * 0.1,
                                points: enemyTypes[type].points * waveMultiplier,
                                color: enemyTypes[type].color,
                                zigzagOffset: Math.random() * Math.PI * 2,
                                zigzagTime: 0
                            });
                        }
                    }, i * 500);
                }
            }
            
            function updateEnemies(deltaTime) {
                enemies.forEach((enemy, index) => {
                    if (enemy.type === 'zigzag') {
                        enemy.zigzagTime += deltaTime;
                        enemy.x += Math.sin(enemy.zigzagTime * 0.005 + enemy.zigzagOffset) * 2;
                    }
                    
                    enemy.y += enemy.speed;
                    
                    if (enemy.y > canvas.height) {
                        enemies.splice(index, 1);
                        gameState.lives--;
                        updateUI();
                    }
                });
            }
            
            // Power-up system
            function spawnPowerUp(x, y) {
                if (Math.random() < 0.3) {
                    const types = ['health', 'triple', 'power', 'speed'];
                    powerUps.push({
                        x: x,
                        y: y,
                        width: 20,
                        height: 20,
                        type: types[Math.floor(Math.random() * types.length)],
                        speed: 2
                    });
                }
            }
            
            function updatePowerUps() {
                powerUps.forEach((powerUp, index) => {
                    powerUp.y += powerUp.speed;
                    
                    if (powerUp.y > canvas.height) {
                        powerUps.splice(index, 1);
                    }
                });
            }
            
            // Collision detection
            function checkCollisions() {
                // Bullets vs enemies
                bullets.forEach((bullet, bulletIndex) => {
                    enemies.forEach((enemy, enemyIndex) => {
                        if (bullet.x < enemy.x + enemy.width &&
                            bullet.x + bullet.width > enemy.x &&
                            bullet.y < enemy.y + enemy.height &&
                            bullet.y + bullet.height > enemy.y) {
                            
                            const damage = player.powerUp === 'power' ? 2 : 1;
                            enemy.health -= damage;
                            bullets.splice(bulletIndex, 1);
                            
                            createParticles(enemy.x + enemy.width/2, enemy.y + enemy.height/2, enemy.color);
                            
                            if (enemy.health <= 0) {
                                gameState.score += enemy.points;
                                spawnPowerUp(enemy.x, enemy.y);
                                enemies.splice(enemyIndex, 1);
                            }
                        }
                    });
                });
                
                // Player vs enemies
                enemies.forEach((enemy, index) => {
                    if (player.x < enemy.x + enemy.width &&
                        player.x + player.width > enemy.x &&
                        player.y < enemy.y + enemy.height &&
                        player.y + player.height > enemy.y) {
                        
                        enemies.splice(index, 1);
                        gameState.lives--;
                        createParticles(player.x + player.width/2, player.y + player.height/2, '#ffffff');
                    }
                });
                
                // Player vs power-ups
                powerUps.forEach((powerUp, index) => {
                    if (player.x < powerUp.x + powerUp.width &&
                        player.x + player.width > powerUp.x &&
                        player.y < powerUp.y + powerUp.height &&
                        player.y + player.height > powerUp.y) {
                        
                        applyPowerUp(powerUp.type);
                        powerUps.splice(index, 1);
                    }
                });
            }
            
            function applyPowerUp(type) {
                switch(type) {
                    case 'health':
                        gameState.lives = Math.min(gameState.lives + 1, 5);
                        break;
                    case 'triple':
                    case 'power':
                        player.powerUp = type;
                        player.powerUpTime = Date.now();
                        break;
                    case 'speed':
                        player.speed = Math.min(player.speed + 1, 8);
                        break;
                }
            }
            
            // Particle system
            function createParticles(x, y, color) {
                for (let i = 0; i < 8; i++) {
                    particles.push({
                        x: x,
                        y: y,
                        vx: (Math.random() - 0.5) * 8,
                        vy: (Math.random() - 0.5) * 8,
                        life: 30,
                        color: color
                    });
                }
            }
            
            function updateParticles() {
                particles.forEach((particle, index) => {
                    particle.x += particle.vx;
                    particle.y += particle.vy;
                    particle.life--;
                    
                    if (particle.life <= 0) {
                        particles.splice(index, 1);
                    }
                });
            }
            
            // Rendering
            function render() {
                ctx.clearRect(0, 0, canvas.width, canvas.height);
                
                // Draw stars
                ctx.fillStyle = '#ffffff';
                stars.forEach(star => {
                    ctx.globalAlpha = 0.8;
                    ctx.fillRect(star.x, star.y, star.size, star.size);
                    star.y += star.speed;
                    if (star.y > canvas.height) {
                        star.y = -star.size;
                        star.x = Math.random() * canvas.width;
                    }
                });
                ctx.globalAlpha = 1;
                
                // Draw player
                ctx.fillStyle = player.powerUp ? '#ffff00' : '#00ffff';
                ctx.fillRect(player.x, player.y, player.width, player.height);
                
                // Draw bullets
                bullets.forEach(bullet => {
                    ctx.fillStyle = bullet.color;
                    ctx.fillRect(bullet.x, bullet.y, bullet.width, bullet.height);
                });
                
                // Draw enemies
                enemies.forEach(enemy => {
                    ctx.fillStyle = enemy.color;
                    ctx.fillRect(enemy.x, enemy.y, enemy.width, enemy.height);
                    
                    // Health bar
                    if (enemy.health < enemy.maxHealth) {
                        ctx.fillStyle = '#ff0000';
                        ctx.fillRect(enemy.x, enemy.y - 8, enemy.width, 4);
                        ctx.fillStyle = '#00ff00';
                        ctx.fillRect(enemy.x, enemy.y - 8, (enemy.health / enemy.maxHealth) * enemy.width, 4);
                    }
                });
                
                // Draw power-ups
                powerUps.forEach(powerUp => {
                    const colors = {
                        health: '#ff0000',
                        triple: '#00ff00',
                        power: '#ff00ff',
                        speed: '#ffff00'
                    };
                    ctx.fillStyle = colors[powerUp.type];
                    ctx.fillRect(powerUp.x, powerUp.y, powerUp.width, powerUp.height);
                });
                
                // Draw particles
                particles.forEach(particle => {
                    ctx.globalAlpha = particle.life / 30;
                    ctx.fillStyle = particle.color;
                    ctx.fillRect(particle.x, particle.y,
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.