Skip to content

Files

Latest commit

 

History

History

Snake Game (GUI)

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Snake Game (GUI)

Snake game is an Arcade Maze Game which has been developed by Gremlin Industries. The player’s objective in the game is to achieve maximum points as possible by collecting food or fruits. The player loses once the snake hits the wall or hits itself.

Dependencies

In order to run this script, You just need the following 3 modules -

  • Pygame: It is a set of Python modules designed for writing video games.
  • Time: This function is used to count the number of seconds elapsed since the epoch.
  • Random: This function is used to generate random numbers in Python by using random module.

How To Play?

  • The snake is represented by a black rectangle on the game screen.
  • The objective of the game is to eat the green food that appears randomly on the screen.
  • By eating the food, the snake grows longer.
  • The game ends if the snake hits the boundaries of the game screen or if it collides with its own body.
  • The player's score is displayed on the screen.
  • After losing, the player can press 'C' to play again or 'Q' to quit the game.

How to Run the game?

  • To run the game, execute the Python script snake_game.py using a Python interpreter.

Controls

  • Use the arrow keys (UP, DOWN, LEFT, RIGHT) to control the snake's movement.
  • Press 'C' to play again after losing.
  • Press 'Q' to quit the game.

Notes

  • Make sure to replace snake_game.py with the actual name of your Python file if it's different.

Output

game.png

Author

Charvy Jain

Editor

Subhradip Bodhak