Skip to content

anishpatill7/SnakeGame

Repository files navigation

SnakeGame

Python Mini Project 2021

Introduction:

Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, developed and published by Gremlin, and the ease of implementing Snake has led to hundreds of versions across many platforms. There are over 420 Snake-like games for iOS alone. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience.

Specifications:

The following program runs on Python Idle environment system.
We will need Pygame which is a pip python package to run the program.
Minimum system requirements:
1. OS: 64-bit Windows 7 or later or OS X 10.11 or later.
2. Processor: 1.5GHz or faster.
3. Memory: 4GB (4,096MB) RAM.
4. Free HDD space: 3GB.
5. Hardware: keyboard and mouse.

Working:

1. The game starts when the player presses any arrow key on the keyboard.
2. The game then generates a random coordinate on the playable area for the food to spawn and it also generates a random position of the snake.
3. The player can maneuver the position of the sanke using the arrow keys.
i. Up Arrow Key to move Forward.
ii. Down Arrow Key to move Backward.
iii. Left Arrow Key to move Left.
iv. Right Arrow Key to move Right.
4. The main aim of the game is to collect as many food points as possible while actively avoiding the walls and the snake body itself.
5. As the player collects food the score is incremented by one point and the length of the snake is also increased by one position.
6. The player should take care that the snake does not collide with the playable boundary lines as it will lead to game over with the highest score displayed as the score to beat.
7. If the game end an end terminal message will pop up.(GAME OVER! PRESS P TO PLAY OR Q TO QUIT)
i. If Key P is Pressed, the game will begin form the start.
ii. If Key Q or anyother key is pressed the game will end.

Code Flowchart:

START

PRESS ARROW KEY TO BEGIN

GAME RUNS

IF SNAKE HITS WALL OR ITSELF

GAME OVER! PRESS P TO PLAY OR Q TO QUIT

IF KEY P PRESSED? (IF YES THEN START THE GAME AGAIN)

(ELSE) END

Outcome:

A fun and entertaining game can be programmed with simple python programming and pip python package. This game is not the greatest but it is a timeless classic and but it does give you an idea of what you can achieve with a relatively simple python program and perhaps the basis by which to extend the principles and create more interesting games.



Thank You!

Releases

No releases published

Packages

No packages published