Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-r1-0528· DeepSeekHugging Face LMArena Human Preference 140K

Gra nie dziala

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-medium-2505’s answer.
  1. User

    Gra nie dziala

  2. DeepSeek Assistant

    Przepraszam, że gra nie działała. Poprawiłem błędy i teraz wszystko powinno działać poprawnie. Oto pełny, działający kod:

    <!DOCTYPE html>
    <html lang="pl">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Piesek vs Koty</title>
        <style>
            body {
                margin: 0;
                padding: 20px;
                display: flex;
                justify-content: center;
                align-items: center;
                min-height: 100vh;
                background: linear-gradient(to bottom, #1a2980, #26d0ce);
                font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
                overflow: hidden;
            }
            #gameContainer {
                text-align: center;
                background: rgba(255, 255, 255, 0.1);
                border-radius: 15px;
                padding: 20px;
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
                backdrop-filter: blur(10px);
            }
            canvas {
                border: 4px solid #2c3e50;
                background: linear-gradient(to bottom, #87CEEB 0%, #63b3ed 100%);
                border-radius: 10px;
                display: block;
                margin: 10px auto;
                box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            }
            h1 {
                color: #fff;
                text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
                margin-bottom: 10px;
                font-size: 36px;
            }
            #score {
                font-size: 24px;
                margin: 10px 0;
                font-weight: bold;
                color: #fff;
                text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
            }
            #gameOver {
                display: none;
                font-size: 48px;
                color: #e74c3c;
                margin: 20px 0;
                font-weight: bold;
                text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
                animation: pulse 1s infinite;
            }
            #restart {
                display: none;
                padding: 12px 30px;
                font-size: 22px;
                cursor: pointer;
                background: linear-gradient(to bottom, #2ecc71, #27ae60);
                color: white;
                border: none;
                border-radius: 50px;
                margin: 15px auto;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
                transition: all 0.2s;
            }
            #restart:hover {
                transform: scale(1.05);
                box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
            }
            .controls {
                margin-top: 15px;
                font-size: 18px;
                color: #ecf0f1;
                text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
            }
            .footer {
                color: #bdc3c7;
                margin-top: 20px;
                font-size: 14px;
            }
            
            @keyframes pulse {
                0% { transform: scale(1); }
                50% { transform: scale(1.1); }
                100% { transform: scale(1); }
            }
        </style>
    </head>
    <body>
        <div id="gameContainer">
            <h1>🐕 Piesek vs Koty 🐈</h1>
            <div id="score">Punkty: 0 | Życia: 3</div>
            <canvas id="gameCanvas" width="800" height="450"></canvas>
            <div id="gameOver">KONIEC GRY!</div>
            <button id="restart">Zagraj ponownie</button>
            <div class="controls">
                <p>Sterowanie: ← → (ruch), SPACJA (skok)</p>
            </div>
            <div class="footer">Unikaj kotów i zbieraj kości!</div>
        </div>
    
        <script>
            // Elementy DOM
            const canvas = document.getElementById('gameCanvas');
            const ctx = canvas.getContext('2d');
            const scoreDisplay = document.getElementById('score');
            const gameOverDisplay = document.getElementById('gameOver');
            const restartButton = document.getElementById('restart');
            
            // Gracz (piesek)
            const player = {
                x: 100,
                y: 350,
                width: 40,
                height: 50,
                velX: 0,
                velY: 0,
                speed: 5,
                jumping: false,
                grounded: false,
                lives: 3,
                invulnerable: false,
                invulnerableTime: 0
            };
            
            // Platformy
            const platforms = [
                {x: 0, y: 400, width: 800, height: 50}, // podłoga
                {x: 150, y: 330, width: 120, height: 20},
                {x: 350, y: 280, width: 100, height: 20},
                {x: 550, y: 250, width: 150, height: 20},
                {x: 200, y: 200, width: 100, height: 20},
                {x: 450, y: 180, width: 100, height: 20}
            ];
            
            // Koty (wrogowie)
            let cats = [
                {x: 300, y: 360, width: 40, height: 40, speed: 2, direction: 1},
                {x: 500, y: 210, width: 40, height: 40, speed: 3, direction: -1},
                {x: 650, y: 210, width: 40, height: 40, speed: 2, direction: 1}
            ];
            
            // Kości (do zbierania)
            let bones = [
                {x: 180, y: 290, width: 25, height: 15, collected: false},
                {x: 400, y: 240, width: 25, height: 15, collected: false},
                {x: 620, y: 210, width: 25, height: 15, collected: false},
                {x: 250, y: 160, width: 25, height: 15, collected: false},
                {x: 500, y: 140, width: 25, height: 15, collected: false}
            ];
            
            // Parametry gry
            let score = 0;
            let gameRunning = true;
            const gravity = 0.8;
            const keys = {};
            
            // Obsługa klawiszy
            document.addEventListener('keydown', (e) => {
                keys[e.key] = true;
            });
            
            document.addEventListener('keyup', (e) => {
                keys[e.key] = false;
            });
            
            // Obsługa przycisku restart
            restartButton.addEventListener('click', resetGame);
            
            // Rysowanie pieska
            function drawPlayer() {
                ctx.save();
                
                // Miganie podczas nietykalności
                if (player.invulnerable && Math.floor(Date.now() / 100) % 2 === 0) {
                    ctx.globalAlpha = 0.5;
                }
                
                // Ciało (brązowe)
                ctx.fillStyle = '#8B4513';
                ctx.fillRect(player.x + 5, player.y + 10, 30, 30);
                
                // Głowa
                ctx.beginPath();
                ctx.arc(player.x + 20, player.y + 15, 15, 0, Math.PI * 2);
                ctx.fill();
                
                // Uszy
                ctx.beginPath();
                ctx.moveTo(player.x + 10, player.y + 10);
                ctx.lineTo(player.x + 5, player.y - 5);
                ctx.lineTo(player.x + 15, player.y + 5);
                ctx.fill();
                
                ctx.beginPath();
                ctx.moveTo(player.x + 30, player.y + 5);
                ctx.lineTo(player.x + 35, player.y - 5);
                ctx.lineTo(player.x + 30, player.y + 10);
                ctx.fill();
                
                // Oczy
                ctx.fillStyle = 'black';
                ctx.beginPath();
                ctx.arc(player.x + 15, player.y + 12, 3, 0, Math.PI * 2);
                ctx.arc(player.x + 25, player.y + 12, 3, 0, Math.PI * 2);
                ctx.fill();
                
                // Nos
                ctx.beginPath();
                ctx.arc(player.x + 20, player.y + 18, 4, 0, Math.PI * 2);
                ctx.fill();
                
                // Ogon
                ctx.beginPath();
                ctx.moveTo(player.x + 35, player.y + 25);
                ctx.quadraticCurveTo(player.x + 50, player.y + 15, player.x + 45, player.y + 5);
                ctx.lineWidth = 4;
                ctx.stroke();
                
                // Łapy
                ctx.fillRect(player.x + 8, player.y + 35, 5, 15);
                ctx.fillRect(player.x + 27, player.y + 35, 5, 15);
                
                ctx.restore();
            }
            
            // Rysowanie kota
            function drawCat(cat) {
                // Ciało (pomarańczowe)
                ctx.fillStyle = '#FF6B35';
                ctx.fillRect(cat.x + 5, cat.y + 10, 30, 25);
                
                // Głowa
                ctx.beginPath();
                ctx.arc(cat.x + 20, cat.y + 15, 12, 0, Math.PI * 2);
                ctx.fill();
                
                // Uszy (trójkątne)
                ctx.beginPath();
                ctx.moveTo(cat.x + 10, cat.y + 10);
                ctx.lineTo(cat.x + 5, cat.y - 2);
                ctx.lineTo(cat.x + 15, cat.y + 7);
                ctx.fill();
                
                ctx.beginPath();
                ctx.moveTo(cat.x + 25, cat.y + 7);
                ctx.lineTo(cat.x + 35, cat.y - 2);
                ctx.lineTo(cat.x + 30, cat.y + 10);
                ctx.fill();
                
                // Oczy (zielone)
                ctx.fillStyle = '#00FF00';
                ctx.beginPath();
                ctx.arc(cat.x + 15, cat.y + 12, 3, 0, Math.PI * 2);
                ctx.arc(cat.x + 25, cat.y + 12, 3, 0, Math.PI * 2);
                ctx.fill();
                
                // Nos
                ctx.fillStyle = 'pink';
                ctx.beginPath();
                ctx.arc(cat.x + 20, cat.y + 16, 3, 0, Math.PI * 2);
                ctx.fill();
                
                // Wąsy
                ctx.strokeStyle = 'white';
                ctx.lineWidth = 1;
                ctx.beginPath();
                ctx.moveTo(cat.x + 20, cat.y + 16);
                ctx.lineTo(cat.x + 10, cat.y + 14);
                ctx.moveTo(cat.x + 20, cat.y + 16);
                ctx.lineTo(cat.x + 10, cat.y + 18);
                ctx.moveTo(cat.x + 20, cat.y + 16);
                ctx.lineTo(cat.x + 30, cat.y + 14);
                ctx.moveTo(cat.x + 20, cat.y + 16);
                ctx.lineTo(cat.x + 30, cat.y + 18);
                ctx.stroke();
                
                // Łapy
                ctx.fillStyle = '#FF6B35';
                ctx.fillRect(cat.x + 5, cat.y + 30, 8, 10);
                ctx.fillRect(cat.x + 27, cat.y + 30, 8, 10);
            }
            
            // Rysowanie kości
            function drawBone(bone) {
                if (!bone.collected) {
                    ctx.fillStyle = '#F0E68C';
                    ctx.fillRect(bone.x, bone.y, bone.width, bone.height);
                    
                    // Zaokrąglone końce
                    ctx.beginPath();
                    ctx.arc(bone.x, bone.y + bone.height/2, bone.height/2, Math.PI/2, Math.PI*1.5);
                    ctx.arc(bone.x + bone.width, bone.y + bone.height/2, bone.height/2, Math.PI*1.5, Math.PI/2);
                    ctx.fill();
                    
                    // Detale
                    ctx.fillStyle = '#DAA520';
                    ctx.fillRect(bone.x + 5, bone.y + 2, 5, 2);
                    ctx.fillRect(bone.x + 15, bone.y + 2, 5, 2);
                    ctx.fillRect(bone.x + 5, bone.y + 11, 5, 2);
                    ctx.fillRect(bone.x + 15, bone.y + 11, 5, 2);
                }
            }
            
            // Rysowanie platform
            function drawPlatforms() {
                ctx.fillStyle = '#27ae60';
                platforms.forEach(platform => {
                    ctx.fillRect(platform.x, platform.y, platform.width, platform.height);
                    
                    // Trawa na górze
                    ctx.fillStyle = '#2ecc71';
                    ctx.fillRect(platform.x, platform.y, platform.width, 5);
                    
                    // Wzór na platformie
                    ctx.fillStyle = '#229954';
                    for (let i = platform.x + 5; i < platform.x + platform.width; i += 15) {
                        ctx.fillRect(i, platform.y + 7, 8, 3);
                    }
                    
                    ctx.fillStyle = '#27ae60';
                });
            }
            
            // Fizyka i ruch gracza
            function updatePlayer() {
                // Reset velocity
                player.velX = 0;
                
                // Ruch poziomy
                if (keys['ArrowLeft'] || keys['a']) {
                    player.velX = -player.speed;
                }
                if (keys['ArrowRight'] || keys['d']) {
                    player.velX = player.speed;
                }
                
                // Skok
                if ((keys[' '] || keys['ArrowUp'] || keys['w']) && player.grounded) {
                    player.velY = -16;
                    player.grounded = false;
                }
                
                // Grawitacja
                player.velY += gravity;
                player.y += player.velY;
                player.x += player.velX;
                
                // Kolizje z platformami
                player.grounded = false;
                platforms.forEach(platform => {
                    // Kolizje w pionie
                    if (player.x < platform.x + platform.width &&
                        player.x + player.width > platform.x &&
                        player.y + player.height > platform.y &&
                        player.y < platform.y + platform.height &&
                        player.velY >= 0) {
                        
                        player.y = platform.y - player.height;
                        player.velY = 0;
                        player.grounded = true;
                    }
                    
                    // Kolizje w poziomie
                    if (player.y < platform.y + platform.height &&
                        player.y + player.height > platform.y &&
                        player.x + player.width > platform.x &&
                        player.x < platform.x + platform.width) {
                        
                        if (player.velX > 0) {
                            player.x = platform.x - player.width;
                        } else if (player.velX < 0) {
                            player.x = platform.x + platform.width;
                        }
                    }
                });
                
                // Granice ekranu
                if (player.x < 0) player.x = 0;
                if (player.x > canvas.width - player.width) player.x = canvas.width - player.width;
                
                // Spadnięcie poza mapę
                if (player.y > canvas.height) {
                    loseLife();
                }
                
                // Aktualizacja nietykalności
                if (player.invulnerable) {
                    player.invulnerableTime--;
                    if (player.invulnerableTime <= 0) {
                        player.invulnerable = false;
                    }
                }
            }
            
            // Ruch kotów
            function updateCats() {
                cats.forEach(cat => {
                    cat.x += cat.speed * cat.direction;
                    
                    // Odbicie od krawędzi platform
                    let onPlatform = false;
                    platforms.forEach(platform => {
                        if (cat.x >= platform.x - 20 && 
                            cat.x <= platform.x + platform.width &&
                            Math.abs(cat.y + cat.height - platform.y) < 5) {
                            onPlatform = true;
                            
                            if (cat.x <= platform.x || cat.x + cat.width >= platform.x + platform.width) {
                                cat.direction *= -1;
                            }
                        }
                    });
                    
                    // Jeśli kot nie jest na platformie, spada
                    if (!onPlatform) {
                        cat.y += 5;
                    }
                });
            }
            
            // Sprawdzanie kolizji z kotami
            function checkCatCollisions() {
                if (!player.invulnerable) {
                    for (let i = 0; i < cats.length; i++) {
                        const cat = cats[i];
                        if (player.x < cat.x + cat.width &&
                            player.x + player.width > cat.x &&
                            player.y < cat.y + cat.height &&
                            player.y + player.height > cat.y) {
                            loseLife();
                            return;
                        }
                    }
                }
            }
            
            // Sprawdzanie kolizji z kośćmi
            function checkBoneCollisions() {
                for (let i = 0; i < bones.length; i++) {
                    const bone = bones[i];
                    if (!bone.collected &&
                        player.x < bone.x + bone.width &&
                        player.x + player.width > bone.x &&
                        player.y < bone.y + bone.height &&
                        player.y + player.height > bone.y) {
                        bone.collected = true;
                        score += 20;
                        updateScore();
                    }
                }
            }
            
            // Utrata życia
            function loseLife() {
                player.lives--;
                updateScore();
                
                if (player.lives <= 0) {
                    gameOver();
                } else {
                    // Reset pozycji i nietykalność
                    player.x = 100;
                    player.y = 350;
                    player.velY = 0;
                    player.invulnerable = true;
                    player.invulnerableTime = 120; // 2 sekundy
                }
            }
            
            // Koniec gry
            function gameOver() {
                gameRunning = false;
                gameOverDisplay.style.display = 'block';
                restartButton.style.display = 'block';
            }
            
            // Reset gry
            function resetGame() {
                player.x = 100;
                player.y = 350;
                player.velY = 0;
                player.lives = 3;
                player.invulnerable = false;
                score = 0;
                
                // Reset kości
                bones.forEach(bone => bone.collected = false);
                
                // Reset kotów
                cats = [
                    {x: 300, y: 360, width: 40, height: 40, speed: 2, direction: 1},
                    {x: 500, y: 210, width: 40, height: 40, speed: 3, direction: -1},
                    {x: 650, y: 210, width: 40, height: 40, speed: 2, direction: 1}
                ];
                
                gameRunning = true;
                gameOverDisplay.style.display = 'none';
                restartButton.style.display = 'none';
                updateScore();
            }
            
            // Aktualizacja wyniku
            function updateScore() {
                scoreDisplay.textContent = `Punkty: ${score} | Życia: ${player.lives}`;
            }
            
            // Rysowanie tła
            function drawBackground() {
                // Niebo
                ctx.fillStyle = '#87CEEB';
                ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                // Słońce
                ctx.fillStyle = '#FFD700';
                ctx.beginPath();
                ctx.arc(700, 80, 50, 0, Math.PI * 2);
                ctx.fill();
                
                // Chmury
                ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';
                drawCloud(100, 70);
                drawCloud(300, 100);
                drawCloud(500, 60);
            }
            
            // Rysowanie chmury
            function drawCloud(x, y) {
                ctx.beginPath();
                ctx.arc(x, y, 25, 0, Math.PI * 2);
                ctx.arc(x + 25, y - 15, 20, 0, Math.PI * 2);
                ctx.arc(x + 50, y, 25, 0, Math.PI * 2);
                ctx.arc(x + 25, y + 15, 20, 0, Math.PI * 2);
                ctx.fill();
            }
            
            // Główna pętla gry
            function gameLoop() {
                if (!gameRunning) {
                    requestAnimationFrame(gameLoop);
                    return;
                }
                
                // Czyszczenie
                ctx.clearRect(0, 0, canvas.width, canvas.height);
                
                // Rysowanie
                drawBackground();
                drawPlatforms();
                bones.forEach(bone => drawBone(bone));
                cats.forEach(cat => drawCat(cat));
                drawPlayer();
                
                // Aktualizacje
                updatePlayer();
                updateCats();
                checkCatCollisions();
                checkBoneCollisions();
                
                requestAnimationFrame(gameLoop);
            }
            
            // Start gry
            resetGame();
            gameLoop();
        </script>
    </body>
    </html>
    

    Poprawiłem wszystkie błędy i dodałem kilka ulepszeń:

    1. Działająca fizyka - poprawione kolizje z platformami
    2. Lepsze sterowanie - możesz używać klawiszy WASD lub strzałek, spacja do skoku
    3. Atrakcyjna grafika - piesek, koty i kości mają teraz lepsze sprite'y
    4. Animacje i efekty wizualne - pulsujący tekst końca gry, gradienty, cienie
    5. Poprawione mechaniki gry - koty odbijają się od krawędzi platform, gracz ma czasową nietykalność po trafieniu
    6. Responsywny interfejs - przycisk restartu działa poprawnie

    Aby zagrać:

    1. Skopiuj cały kod do pliku HTML
    2. Otwórz plik w przeglądarce
    3. Steruj pieskiem za pomocą strzałek lub klawiszy WASD
    4. Skacz spacją
    5. Zbieraj kości i unikaj kotów

    Gra zawiera 3 życia, punkty za zbieranie kości i system nietykalności po utracie życia. Jeśli napotkasz jakieś problemy, daj znać!

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