Skip to content

WebSnake is a modern and accessible browser-based implementation of the classic Snake game.

License

Notifications You must be signed in to change notification settings

GravityDarkLab/WebSnake

Repository files navigation

WebSnake

All Contributors

This project is a simple implementation of the classic Snake game using JavaScript, HTML, and CSS.

Game Rules

  1. The player controls a square (the snake), which can move in four directions: up, down, left, and right.
  2. A piece of food appears randomly on the grid.
  3. 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.
  4. The game ends if the snake collides with the wall or with its own body.

Features

  • 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.

Implementation

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.

How to Play

  1. Access the game directly through this link.
  2. Alternatively, you can clone the repository or download the files to your local machine and open index.html in your web browser.
  3. Use the arrow keys to control the snake and eat the food.

Contributing

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!

License

This project is licensed under the MIT License. See LICENSE for more details.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Achraf Labidi
Achraf Labidi

📆

This project follows the all-contributors specification. Contributions of any kind welcome!

About

WebSnake is a modern and accessible browser-based implementation of the classic Snake game.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •