Run details
- Model
- nvidia/nemotron-3.5-lightning:free
- Route
- OpenRouter API
- Served by
- Nvidia
- Effort
- model default
- Limits
- 60 min · 65,536 output tokens (model max)
- Date
- 24 Oct 2026
- Time
- 2 min 54 s
- Size
- 9.3 kB
- Tokens
- 94 in, 15,841 out (13,060 thinking)
- List price
- $0.003 at today's price ($0.06 in / $0.16 out per M)
- Paid
- $0 (free route)
Prompt
Make a Breakout game I can play right now with the keyboard or the mouse. Give it several levels, a score and some juice. It must be one complete, self-contained HTML file: inline all CSS and JavaScript, and make no network requests of any kind (no CDNs, web fonts or remote images). Reply with the file in a single ```html code block.
Source
9.3 kB 350 lines Raw
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Breakout Juice</title>
<style>
body {
background: #0d0d0d;
color: #e0e0e0;
font-family: Arial, sans-serif;
margin: 0;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
#ui {
background: #1a1a1a;
padding: 1rem 2rem;
border-radius: 8px;
margin-bottom: 1rem;
backdrop-filter: blur(4px);
border: 1px solid #333;
}
#status {
margin-bottom: 0.5rem;
font-size: 1.2rem;
}
canvas {
background: #000;
box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<div id="ui">
<div id="status">Press SPACE to start</div>
<div>Score: <span id="score">0</span></div>
<div>Level: <span id="level">1</span></div>
</div>
<canvas id="game"></canvas>
<script>
// ----- Configuration -----
const COLORS = {
1: '#ff6b6b',
2: '#ff8c42',
3: '#4ecdc4',
4: '#ffe66d',
5: '#a855f7'
};
const LEVELS = [
{ rows: 5, cols: 8, speed: 2 },
{ rows: 6, cols: 9, speed: 2.5 },
{ rows: 7, cols: 10, speed: 3 }
];
// ----- Game State -----
let canvas, ctx;
let score = 0;
let level = 0;
let gameOver = false;
let paused = true;
let paddle = { x: 0, y: 0, width: 100, height: 14 };
let ball = { x: 0, y: 0, radius: 8, vx: 0, vy: 0 };
let bricks = [];
let particles = [];
let screenShake = { magnitude: 0 };
let audioContext = null;
// ----- Init -----
function init() {
canvas = document.getElementById('game');
ctx = canvas.getContext('2d');
// canvas is 800x600 from HTML attribute
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
document.addEventListener('keydown', handleKeyDown);
document.addEventListener('mousemove', handleMouseMove);
document.getElementById('status').textContent = 'Press SPACE to start';
document.addEventListener('keydown', (e) => {
if (e.code === 'Space') {
startGame();
}
});
}
function resizeCanvas() {
// keep drawing buffer fixed, just re-layout if needed
}
// ----- Audio -----
function startAudio() {
try {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
} catch (e) {
console.warn('No audio context');
}
}
function playBeep(freq, duration) {
if (!audioContext) return;
try {
const osc = audioContext.createOscillator();
const gain = audioContext.createGain();
osc.connect(gain);
gain.connect(audioContext.destination);
osc.frequency.value = freq;
osc.type = 'square';
gain.gain.value = 0.15;
osc.start();
setTimeout(() => { osc.stop(); }, duration);
} catch (e) {}
}
// ----- Game Logic -----
function startGame() {
paused = false;
level = 0;
score = 0;
updateUI();
startAudio();
loadLevel();
gameLoop();
}
function loadLevel() {
level++;
if (level > LEVELS.length) {
alert('Congratulations! You completed all levels!\nFinal Score: ' + score);
resetGame();
return;
}
const lvl = LEVELS[level - 1];
bricks = [];
const brickWidth = (canvas.width - 40) / lvl.cols - 4;
const brickHeight = 20;
const offsetX = 20;
const offsetY = 50;
for (let r = 0; r < lvl.rows; r++) {
for (let c = 0; c < lvl.cols; c++) {
bricks.push({
x: offsetX + c * (brickWidth + 4),
y: offsetY + r * (brickHeight + 4),
width: brickWidth,
height: brickHeight,
hits: 1,
color: COLORS[(r + c) % 5 + 1] || '#fff'
});
}
}
// Ball reset
ball.x = canvas.width / 2;
ball.y = canvas.height / 2;
const angle = (Math.random() - 0.5) * Math.PI / 3;
ball.vx = Math.cos(angle) * lvl.speed;
ball.vy = -Math.sin(angle) * lvl.speed;
paddle.x = canvas.width / 2 - paddle.width / 2;
paddle.y = canvas.height - 30;
particles = [];
screenShake.magnitude = 0;
updateUI();
}
function resetGame() {
paused = true;
document.getElementById('status').textContent = 'Press SPACE to restart';
document.getElementById('score').textContent = '0';
document.getElementById('level').textContent = '1';
}
function updateUI() {
document.getElementById('score').textContent = score;
document.getElementById('level').textContent = level;
}
// ----- Input -----
function handleKeyDown(e) {
if (paused) return;
if (e.key === 'Right' || e.key === 'ArrowRight' || e.key === 'd' || e.key === 'D') {
paddle.x += 30;
} else if (e.key === 'Left' || e.key === 'ArrowLeft' || e.key === 'a' || e.key === 'A') {
paddle.x -= 30;
}
if (paddle.x < 0) paddle.x = 0;
if (paddle.x + paddle.width > canvas.width) paddle.x = canvas.width - paddle.width;
}
function handleMouseMove(e) {
if (paused) return;
const rect = canvas.getBoundingClientRect();
const mouseX = e.clientX - rect.left;
paddle.x = mouseX - paddle.width / 2;
if (paddle.x < 0) paddle.x = 0;
if (paddle.x + paddle.width > canvas.width) paddle.x = canvas.width - paddle.width;
}
// ----- Utilities -----
function shakeScreen(amt) {
screenShake.magnitude = amt;
}
// ----- Particle System -----
function createParticles(x, y, color) {
for (let i = 0; i < 12; i++) {
const angle = (Math.PI * 2 / 12) * i + Math.random() * 0.5;
const speed = 2 + Math.random() * 3;
particles.push({
x: x,
y: y,
vx: Math.cos(angle) * speed,
vy: Math.sin(angle) * speed + (Math.random() - 0.5),
color: color,
life: 1,
decay: 0.01 + Math.random() * 0.01
});
}
}
// ----- Collision Detection -----
function checkBrickCollision() {
for (let i = bricks.length - 1; i >= 0; i--) {
const brick = bricks[i];
if (ball.x + ball.radius > brick.x &&
ball.x - ball.radius < brick.x + brick.width &&
ball.y + ball.radius > brick.y &&
ball.y - ball.radius < brick.y + brick.height) {
brick.hits--;
if (brick.hits <= 0) {
createParticles(brick.x + brick.width / 2, brick.y + brick.height / 2, brick.color);
score += 10;
shakeScreen(3);
playBeep(440, 50);
bricks.splice(i, 1);
} else {
playBeep(330, 30);
}
ball.vy = -ball.vy;
updateUI();
}
}
}
function checkPaddleCollision() {
if (ball.y + ball.radius > paddle.y &&
ball.x > paddle.x && ball.x < paddle.x + paddle.width) {
const hitPos = (ball.x - paddle.x) / paddle.width - 0.5;
ball.vx = hitPos * 5;
ball.vy = -Math.abs(ball.vy) * 1.05;
shakeScreen(2);
playBeep(520, 40);
}
}
// ----- Game Loop -----
function gameLoop() {
if (paused) return;
if (screenShake.magnitude > 0) screenShake.magnitude -= 0.1;
const shakeX = (Math.random() - 0.5) * screenShake.magnitude * 2;
const shakeY = (Math.random() - 0.5) * screenShake.magnitude * 2;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.save();
ctx.translate(shakeX, shakeY);
// Draw bricks
bricks.forEach(b => {
ctx.fillStyle = b.color;
ctx.fillRect(b.x, b.y, b.width, b.height);
});
// Move ball
ball.x += ball.vx;
ball.y += ball.vy;
// Wall collisions (left/right)
if (ball.x - ball.radius < 0 || ball.x + ball.radius > canvas.width) {
ball.vx = -ball.vx;
ball.x = Math.max(ball.radius, Math.min(canvas.width - ball.radius, ball.x));
}
// Wall collision (top)
if (ball.y - ball.radius < 0) {
ball.vy = -ball.vy;
ball.y = ball.radius;
}
// Floor - game over
if (ball.y + ball.radius > canvas.height) {
resetGame();
ctx.restore();
return;
}
// Paddle collision
checkPaddleCollision();
// Brick collision
checkBrickCollision();
// Draw paddle
ctx.fillStyle = '#fff';
ctx.fillRect(paddle.x, paddle.y, paddle.width, paddle.height);
// Draw ball
ctx.beginPath();
ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
ctx.fillStyle = '#ffd700';
ctx.fill();
ctx.closePath();
// Draw particles
particles.forEach(p => {
p.vy += 0.05;
p.x += p.vx;
p.y += p.vy;
p.life -= p.decay;
ctx.fillStyle = p.color;
ctx.globalAlpha = Math.max(0, p.life);
ctx.fillRect(p.x - 2, p.y - 2, 4, 4);
});
ctx.globalAlpha = 1;
// Level complete
if (bricks.length === 0) {
setTimeout(() => { loadLevel(); }, 500);
}
ctx.restore();
requestAnimationFrame(gameLoop);
}
// ----- Start -----
init();
</script>
</body>
</html>

