gpt-4.1-mini-2025-04-14· OpenAI
LMArena Human Preference 140K
write me a simple code game in html
- User
write me a simple code game in html
- Assistant
Sure! Here's a simple click-the-button game in HTML with a bit of JavaScript. The goal is to click the button as many times as possible within 10 seconds.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Click Game</title> <style> body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; } #clickBtn { padding: 20px 40px; font-size: 24px; cursor: pointer; } #score, #time { font-size: 20px; margin: 20px; } </style> </head> <body> <h1>Click the Button Game</h1> <button id="clickBtn">Click me!</button> <div id="score">Score: 0</div> <div id="time">Time left: 10s</div> <script> let score = 0; let timeLeft = 10; const scoreDisplay = document.getElementById('score'); const timeDisplay = document.getElementById('time'); const button = document.getElementById('clickBtn'); button.addEventListener('click', () => { if (timeLeft > 0) { score++; scoreDisplay.textContent = 'Score: ' + score; } }); const timer = setInterval(() => { timeLeft--; timeDisplay.textContent = 'Time left: ' + timeLeft + 's'; if (timeLeft <= 0) { clearInterval(timer); button.disabled = true; alert('Time is up! Your final score is: ' + score); } }, 1000); </script> </body> </html>How it works:
- You have 10 seconds to click the button as many times as possible.
- The score updates with each click.
- When time runs out, the button disables and an alert shows your final score.
You can copy-paste this into a
.htmlfile and open it in any browser to play. Let me know if you want it more complex or with different features!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.