Models 44

Gemini 3.1 Flash Lite

by GoogleReasoningClean
Open in new window

Running live in a sandboxed frame. Click inside it before using the keyboard.

How it went

Total time
6.6 s
Cost
$0.0039
Output tokens
2,520
Spent thinking
127 tokens
Speed
439 tok/s
Console errors
0
First token after
892 ms
First visible text after
892 ms
Prompt tokens
363
Code size
7.0 KB
Finish reason
stop
Served by
Google
Model id
google/gemini-3.1-flash-lite
Reasoning sent
{"effort":"low"}
Max output
65,536 tokens
Generated
Nov 12, 2026

What it was asked

The prompt
“i want a breakout game where the paddle is a hamburger and every brick you break explodes into tons of little hearts”
System prompt, sent with every prompt
You are generating a self-contained web demo. It will be rendered automatically in a sandboxed iframe and compared side by side with the output of other AI models given the exact same task.

Output rules:
- Reply with exactly ONE fenced code block containing the complete file: ```html (or ```svg when the task asks for an SVG). No text before or after the code block.
- Everything must be inline: CSS in <style>, JavaScript in <script>. No external files, images, fonts or network requests, except the CDN URLs explicitly allowed by the task.
- Do not use localStorage, sessionStorage, cookies, IndexedDB, alert(), confirm(), prompt() or window.open(): they are blocked in the sandbox and will throw.
- The page must look right in a 1280×800 viewport and adapt gracefully down to 375px wide. No horizontal scrollbar.
- Something meaningful must be visible on first paint: a screenshot is taken automatically about 3 seconds after load, without any interaction.
- Everything that makes the demo interesting must be visible within the first seconds: nothing hidden behind a high score, a later level or a long play session.
- Games must start in a self-playing demo mode (a simple AI plays) behind a "Click or press a key to start" message, so the game can be judged in action without playing.
- The iframe only receives keyboard events after the user clicks it: if the demo uses the keyboard, display a clear "Click or press a key to start" message.
- The code must run with zero errors in the console of the latest Chrome.

Code run-1.html · 255 lines

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Burger Breakout!</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #1a1a2e;
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            overflow: hidden;
            color: white;
            user-select: none;
        }

        #game-container {
            position: relative;
            width: 100%;
            max-width: 800px;
            aspect-ratio: 4/3;
            background: #0f3460;
            border: 4px solid #e94560;
            box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
            overflow: hidden;
        }

        canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        #overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: rgba(0,0,0,0.7);
            cursor: pointer;
        }

        h1 { font-size: 3rem; margin-bottom: 0.5rem; text-shadow: 2px 2px #e94560; }
        p { font-size: 1.2rem; }
    </style>
</head>
<body>

<div id="game-container">
    <canvas id="gameCanvas"></canvas>
    <div id="overlay">
        <h1>BURGER BREAKOUT</h1>
        <p>Click or press any key to start!</p>
    </div>
</div>

<script>
    const canvas = document.getElementById('gameCanvas');
    const ctx = canvas.getContext('2d');
    const overlay = document.getElementById('overlay');
    
    // Set internal canvas resolution
    canvas.width = 800;
    canvas.height = 600;

    let gameStarted = false;
    let autoPlay = true;

    // Game Objects
    const paddle = { x: 350, y: 550, w: 100, h: 40 };
    const ball = { x: 400, y: 530, dx: 4, dy: -4, radius: 8 };
    const bricks = [];
    const particles = [];
    const colors = ['#FF6B6B', '#4ECDC4', '#FFE66D', '#FF9F1C', '#A8D5BA'];

    function initBricks() {
        bricks.length = 0;
        for (let r = 0; r < 5; r++) {
            for (let c = 0; c < 8; c++) {
                bricks.push({
                    x: 50 + c * 90,
                    y: 50 + r * 40,
                    w: 80,
                    h: 30,
                    color: colors[r % colors.length],
                    active: true
                });
            }
        }
    }

    initBricks();

    function createExplosion(x, y, color) {
        for (let i = 0; i < 15; i++) {
            particles.push({
                x, y,
                dx: (Math.random() - 0.5) * 8,
                dy: (Math.random() - 0.5) * 8,
                life: 1.0,
                color
            });
        }
    }

    function drawBurgerPaddle() {
        // Bun bottom
        ctx.fillStyle = '#D2691E';
        ctx.beginPath();
        ctx.roundRect(paddle.x, paddle.y + 20, paddle.w, 20, [0, 0, 10, 10]);
        ctx.fill();
        // Patty
        ctx.fillStyle = '#5D4037';
        ctx.fillRect(paddle.x + 5, paddle.y + 10, paddle.w - 10, 15);
        // Bun top
        ctx.fillStyle = '#FFB347';
        ctx.beginPath();
        ctx.roundRect(paddle.x, paddle.y, paddle.w, 20, [15, 15, 0, 0]);
        ctx.fill();
    }

    function drawHearts() {
        ctx.save();
        particles.forEach((p, index) => {
            p.x += p.dx;
            p.y += p.dy;
            p.life -= 0.02;
            
            ctx.fillStyle = p.color;
            ctx.globalAlpha = p.life;
            // Draw heart
            ctx.beginPath();
            const s = 6;
            ctx.moveTo(p.x, p.y + s/2);
            ctx.bezierCurveTo(p.x, p.y, p.x - s, p.y, p.x - s, p.y + s/2);
            ctx.bezierCurveTo(p.x - s, p.y + s, p.x, p.y + s * 1.5, p.x + s/2, p.y + s * 1.8);
            ctx.bezierCurveTo(p.x + s, p.y + s * 1.5, p.x + s * 2, p.y + s, p.x + s * 2, p.y + s/2);
            ctx.bezierCurveTo(p.x + s * 2, p.y, p.x + s, p.y, p.x + s, p.y + s/2);
            ctx.fill();
        });
        
        // Remove dead particles
        for(let i = particles.length - 1; i >= 0; i--) {
            if(particles[i].life <= 0) particles.splice(i, 1);
        }
        ctx.restore();
    }

    function update() {
        if (!gameStarted) return;

        // Auto play logic
        if (autoPlay) {
            const targetX = ball.x - paddle.w / 2;
            paddle.x += (targetX - paddle.x) * 0.15;
        }

        // Clamp paddle
        paddle.x = Math.max(0, Math.min(canvas.width - paddle.w, paddle.x));

        // Ball movement
        ball.x += ball.dx;
        ball.y += ball.dy;

        // Wall collisions
        if (ball.x < 0 || ball.x > canvas.width) ball.dx *= -1;
        if (ball.y < 0) ball.dy *= -1;
        
        // Paddle collision
        if (ball.y + ball.radius > paddle.y && 
            ball.x > paddle.x && 
            ball.x < paddle.x + paddle.w) {
            ball.dy = -Math.abs(ball.dy);
            // Add spin
            ball.dx += (ball.x - (paddle.x + paddle.w/2)) * 0.1;
        }

        // Floor collision
        if (ball.y > canvas.height) {
            ball.x = 400; ball.y = 530; ball.dy = -4; ball.dx = 4;
        }

        // Brick collision
        bricks.forEach(b => {
            if (b.active && 
                ball.x > b.x && ball.x < b.x + b.w &&
                ball.y > b.y && ball.y < b.y + b.h) {
                b.active = false;
                ball.dy *= -1;
                createExplosion(b.x + b.w/2, b.y + b.h/2, b.color);
            }
        });
    }

    function draw() {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        
        // Draw bricks
        bricks.forEach(b => {
            if (b.active) {
                ctx.fillStyle = b.color;
                ctx.fillRect(b.x + 2, b.y + 2, b.w - 4, b.h - 4);
            }
        });

        drawBurgerPaddle();
        
        // Draw Ball
        ctx.fillStyle = 'white';
        ctx.beginPath();
        ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
        ctx.fill();

        drawHearts();
        
        requestAnimationFrame(() => {
            update();
            draw();
        });
    }

    function startGame() {
        if (!gameStarted) {
            gameStarted = true;
            autoPlay = false; // Player takes control
            overlay.style.display = 'none';
        }
    }

    // Controls
    window.addEventListener('keydown', () => startGame());
    canvas.addEventListener('mousedown', () => startGame());
    canvas.addEventListener('mousemove', (e) => {
        if (gameStarted) {
            const rect = canvas.getBoundingClientRect();
            const scaleX = canvas.width / rect.width;
            paddle.x = (e.clientX - rect.left) * scaleX - paddle.w / 2;
        }
    });

    // Kickoff
    draw();
</script>
</body>
</html>