← back to Model Arena
data/artifacts/035b7009e366/hf-qwen-coder-32b.html
233 lines
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Designer Wallcoverings</title>
<style>
:root {
--bg: #faf8f4;
--surface: #ffffff;
--ink: #1c1a17;
--muted: #9b948a;
--accent-light: #b0472e;
--accent-dark: #2f4c39;
--line: 1px solid #e0dedd;
--shadow: 0 8px 24px rgba(0,0,0,.12);
--ease: cubic-bezier(.22,1,.36,1);
}
body {
margin: 0;
font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
background-color: var(--bg);
color: var(--ink);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
}
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: var(--surface);
box-shadow: var(--shadow);
padding: 16px 24px;
z-index: 100;
}
header h1 {
font-family: 'Playfair Display', Georgia, serif;
font-size: 38px;
margin: 0;
letter-spacing: .18em;
color: var(--accent-light);
}
canvas {
display: block;
background-color: var(--bg);
}
.overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(255,255,255,.9);
padding: 32px;
border-radius: 14px;
box-shadow: var(--shadow);
text-align: center;
font-size: 28px;
}
button {
margin-top: 16px;
padding: 8px 16px;
background-color: var(--accent-light);
color: var(--surface);
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
text-transform: uppercase;
letter-spacing: .15em;
}
button:hover {
background-color: var(--accent-dark);
}
</style>
</head>
<body>
<header><h1>DESIGNER WALLCOVERINGS</h1></header>
<canvas id="gameCanvas"></canvas>
<div class="overlay" id="gameOverOverlay" style="display:none;">
<p>GAME OVER</p>
<p>Score: <span id="finalScore">0</span></p>
<p>Best: <span id="bestScore">0</span></p>
<button onclick="restartGame()">RESTART</button>
</div>
<script>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let score = 0;
let bestScore = localStorage.getItem('bestScore') || 0;
let gameRunning = true;
const gravity = .5;
const playerSpeed = 10;
const obstacleSpeed = 7;
let playerY = canvas.height - 100;
let playerVelocity = 0;
const obstacles = [];
const wallpaperRolls = [];
class Obstacle {
constructor(x) {
this.x = x;
this.y = canvas.height - 50;
this.width = 40;
this.height = 30;
}
draw() {
ctx.fillStyle = var(--muted);
ctx.fillRect(this.x, this.y, this.width, this.height);
}
}
class WallpaperRoll {
constructor(x) {
this.x = x;
this.y = canvas.height - 70;
this.width = 20;
this.height = 40;
this.color = ['#c9a961', '#7d6a45'][Math.floor(Math.random() * 2)];
}
draw() {
ctx.fillStyle = this.color;
ctx.fillRect(this.x, this.y, this.width, this.height);
}
}
function createObstacle() {
const x = canvas.width + Math.random() * 300;
obstacles.push(new Obstacle(x));
}
function createWallpaperRoll() {
const x = canvas.width + Math.random() * 600;
wallpaperRolls.push(new WallpaperRoll(x));
}
function updateGame() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
playerVelocity += gravity;
playerY += playerVelocity;
if (playerY > canvas.height - 100) {
playerY = canvas.height - 100;
playerVelocity = 0;
}
ctx.fillStyle = '#f5f2ea';
ctx.fillRect(0, playerY, 30, 50);
obstacles.forEach((obstacle, index) => {
obstacle.x -= obstacleSpeed;
obstacle.draw();
if (playerX < obstacle.x + obstacle.width &&
playerX + 30 > obstacle.x &&
playerY < obstacle.y + obstacle.height &&
playerY + 50 > obstacle.y) {
gameRunning = false;
}
if (obstacle.x < -40) {
obstacles.splice(index, 1);
}
});
wallpaperRolls.forEach((roll, index) => {
roll.x -= obstacleSpeed;
roll.draw();
if (playerX < roll.x + roll.width &&
playerX + 30 > roll.x &&
playerY < roll.y + roll.height &&
playerY + 50 > roll.y) {
score++;
wallpaperRolls.splice(index, 1);
}
if (roll.x < -20) {
wallpaperRolls.splice(index, 1);
}
});
ctx.font = '32px Arial';
ctx.fillStyle = var(--accent-light);
ctx.fillText(`Score: ${score}`, 16, 48);
if (!gameRunning) {
bestScore = Math.max(score, bestScore);
localStorage.setItem('bestScore', bestScore);
document.getElementById('finalScore').textContent = score;
document.getElementById('bestScore').textContent = bestScore;
document.getElementById('gameOverOverlay').style.display = 'block';
}
requestAnimationFrame(updateGame);
}
function jump() {
if (playerY === canvas.height - 100) {
playerVelocity = -playerSpeed;
}
}
let playerX = 30;
canvas.addEventListener('click', jump);
document.addEventListener('keydown', e => { if (e.code === 'Space') jump(); });
createObstacle();
setInterval(createObstacle, 2000);
createWallpaperRoll();
setInterval(createWallpaperRoll, 1500);
updateGame();
function restartGame() {
gameRunning = true;
score = 0;
playerY = canvas.height - 100;
playerVelocity = 0;
obstacles.length = 0;
wallpaperRolls.length = 0;
document.getElementById('gameOverOverlay').style.display = 'none';
updateGame();
}
</script>
</body>
</html>