A classic Snake Game built using HTML, CSS, and JavaScript.
The game uses grid-based rendering, event-driven input handling, and dynamic speed scaling to provide a smooth and challenging gameplay experience.
Move the snake around the board, eat food to grow longer, and try to beat your high score!
- ✅ Smooth real-time movement system using a JavaScript game loop (setInterval)
- ✅ Supports Arrow keys and WASD for flexible player controls
- ✅ Progressive difficulty – snake speed dynamically increases as it eats food
- ✅ Collision detection for walls and self-body (game over handling)
- ✅ High Score persistence with localStorage across sessions
- ✅ Dynamic rendering of snake and food using DOM manipulation on a 20×20 grid
- ✅ Event-driven input handling for instant and responsive controls
- ✅ Algorithmic complexity in movement, growth, collision logic, and adaptive speed scaling
- ✅ Retro-themed pixel-style design with layered borders
- Press Spacebar to start the game.
- Use Arrow keys or WASD to move the snake:
- ⬆️ / W → Up
- ⬇️ / S → Down
- ⬅️ / A → Left
- ➡️ / D → Right
- Eat food ⬜ to grow longer.
- Avoid colliding with walls or yourself.
- Try to beat your High Score!
Check out the live Snake Game here 👉 Play Snake Game
# Clone the repository:
git clone https://github.com/your-username/snake-game.git
# Open index.html in your browser.Enjoy the game! 🎉
- HTML5 – Game structure
- CSS3 – Styling and layout
- JavaScript – Game logic, rendering and interactions
⭐ Feel free to contribute, fork, or open issues to improve this project.
