Skip to content

swift1719/snakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Quest

It is a snake game made using React and basic linked list functionalities.

The entire game consists of the following three main components: Game Board, Snake, and Food Cells.

The game is created around the following points:

  1. Create the Game Board using a Matrix
  2. Each cell in-board is identified using a unique id
  3. Snake is handled using a Singly Linked List
  4. Food is randomly generated using a utility function.
  5. Initializing snake movement and food cell
  6. Handling snake movements through arrow keys by attaching an event listener to the board
  7. Whenever a snake consumes food, then handling the growth of snake.There are two kinds of food available to a snake, an apple or a frog.
    • In the case of an apple, the snake will consume it and grow in size by one cell. The score will be incremented by one.
    • In the case of a frog, the snake will consume it and grow in size by one cell. And the score will be incremented by two. Also, the snake will reverse its direction.
  8. If the snake collides with itself or the boundary of the board then the game is over
  9. Displaying score
  10. Reset when game is over