This project is a simple implementation of the classic Snake game using JavaScript, HTML, and CSS.
- The player controls a square (the snake), which can move in four directions: up, down, left, and right.
- A piece of food appears randomly on the grid.
- The goal of the game is to eat as much food as possible. Each time the snake eats a piece of food, its length grows by one unit, and the player's score increases.
- The game ends if the snake collides with the wall or with its own body.
- The game features a scoring system. Each piece of food eaten increases the score by one point.
- The game speed increases each time the snake eats a piece of food, making the game progressively more difficult.
- The game can be restarted at any time by clicking the "Restart" button.
The game is implemented using JavaScript for the game logic, HTML for the game structure, and CSS for the game styling.
- The JavaScript code controls the game logic (such as the snake's movement, collision detection, and food consumption) and updates the HTML elements on the page.
- The game uses an object-oriented approach to organize the game configuration and state, making the code easier to read and maintain.
- Access the game directly through this link.
- Alternatively, you can clone the repository or download the files to your local machine and open
index.html
in your web browser. - Use the arrow keys to control the snake and eat the food.
Contributions are welcome and appreciated! If you have a feature request, bug report, or improvement to the code, please open an issue or submit a pull request. Whether you're a seasoned developer or someone who's just starting out, your contributions are valuable. So feel free to dive in!
This project is licensed under the MIT License. See LICENSE
for more details.
Thanks goes to these wonderful people (emoji key):
Achraf Labidi 📆 |
This project follows the all-contributors specification. Contributions of any kind welcome!