gpt-4o-mini-2024-07-18· openai
from WildChat-4.8M
give me a javascript code of snake game
- User
give me a javascript code of snake game
- Assistant
Sure! Here's a simple implementation of the classic Snake game using JavaScript, HTML, and CSS. Just create an HTML file and copy the following code into it.
HTML (index.html)
html<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Snake Game</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; margin: 0; } canvas { border: 1px solid #000; } </style> </head> <body> <canvas id="gameCanvas" width="400" height="400"></canvas> <script src="snake.js"></script> </body> </html>JavaScript (snake.js)
javascript
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.