0% found this document useful (0 votes)
17 views

Prajwal P Shankar

Uploaded by

Prajwal Shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Prajwal P Shankar

Uploaded by

Prajwal Shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

CONTENTS

1.CHAPTER 1
INTRODUCTION 1-2
2.CHAPTER 2
LITERATURE SURVEY 3-4
3.CHAPTER 3
SYSTEM DESIGN 5
4.CHAPTER 4
SYSTEM AND HARDWARE REQUIREMENTS 6
5.CHAPTER 5
FUNCTIONAL REQUIREMENTS 7
6.CHAPTER 6
NON-FUNCTIONAL REQUIREMENTS 8
6.1 ROBUSTNESS 8
6.2 RELIABILITY 8
6.3 AVAILABILITY 8
6.4 RESUABILITY 8
6.5 EFFECTIVENESS 8
7.CHAPTER 7
WORKING ALGORITHM 9
8.CHAPTER 8
SAMPLE OUTPUT 10
9.CHAPTER 9
CONCLUSION 11
10.CHAPTER 10
FUTURE SCOPE 12
11.CHAPTER 11
REFERENCES 13
SNAKE GAME PYTHON 2023-24

CHAPTER 1
INTRODUCTION

Playing games is fun and exciting it gives us relief from stress and unwind from our stressful works. Many
of us spend our vacant time or others that use most of their time in playing and exploring new games. Today,
with the rapid development of technology we have, games that are rising up together with it. Nowadays with
the technology we have many games that are developing for computer most specifically for windows. With
the high technology equipped with these computers, computer games become robust and attract many people
to buy or have this gadget for them to experience what’s inside it which makes it a trend for the new
generation of gadget. Snake game is a computer action game; whose goal is to control a snake to move and
collect food in a map. It has been around since the earliest days of home computing and has re-emerged in
recent years on mobile phones. It isn’t the world’s greatest game, but it does give you an idea of what you
can achieve with a simple python program, and perhaps the basis by which to extend the principles and
create more interesting games on your own. To move the snake, use ‘up arrow’ for up, ‘down arrow’ for
down, ‘left arrow’ for left and ‘right arrow’ for right. Press ‘Q’ to exit the game at any time, press ‘C’ to
continue the game. The aim of the game is to collect the dots (food) and avoid the obstacles (crosses borders).
As you collect the food, the snake gets longer. The score also increases. There is no concept of lives. Once
You hit an obstacle, that’s it, game over.

Python is a dynamic, interpreted (bytecode-compiled) language. There are no type declarations of variables,
parameters, functions, or methods in source code. This makes the code short and flexible, and you lose the
compile-time type checking of the source code. The game involves controlling a snake to eat food and grow
longer while avoiding collisions with walls and its own tail. It's a great beginner project for learning about
game development concepts, basic Python programming, and working with user input and graphics. It has
been around since the earliest days of home computing and has re-emerged in recent years on mobile phones.
It isn’t the world’s greatest game, but it does give you an idea of what you can achieve with a simple python
program, and perhaps the basis by which to extend the principles and create more interesting games on your
own. To move the snake, use ‘up arrow’ for up, ‘down arrow’ for down, ‘left arrow’ for left and ‘right arrow’
for right. Press ‘Q’ to exit the game at any time, press ‘C’ to continue the game. The aim of the game is to
collect the dots (food) and avoid the obstacles (crosses borders). As you collect the food, the snake gets
longer. The score also increases. There is no concept of lives. Once You hit an obstacle, that’s it, game over.

DEPARTMENT OF CSE MYCEM, MYSURU Page 1


SNAKE GAME PYTHON
2023-24
playing games is fun and exciting it gives us relief from stress and unwind from our stressful works. Many
of us spend our vacant time or others that use most of their time in playing and exploring new games. Today,
with the rapid development of technology we have, games that are rising up together with it. Nowadays with
the technology we have many games that are developing for computer most specifically for windows. With
the high technology equipped with these computers, computer games become robust and attract many people
to buy or have this gadget for them to experience what’s inside it which makes it a trend for the new
generation of gadget. Snake game is a computer action game; whose goal is to control a snake to move and
collect food in a map. It has been around since the earliest days of home computing and has re-emerged in
recent years on mobile phones. It isn’t the world’s greatest game, but it does give you an idea of what you
can achieve with a simple python program, and perhaps the basis by which to extend the principles and
create more interesting games on your own. To move the snake, use ‘up arrow’ for up, ‘down arrow’ for
down, ‘left arrow’ for left and ‘right arrow’ for right. Press ‘Q’ to exit the game at any time, press ‘C’ to
continue the game. The aim of the game is to collect the dots (food) and avoid the obstacles (crosses borders).

DEPARTMENT OF CSE, MYCEM, MYSURU Page 2


SNAKE GAME PYTHON 2023-24

CHAPTER-02
LITERATURE SURVEY

The history of the Snake game goes back to the 1970's, the concept originated in the 1976 arcade game
Blockade, and its simplicity has led to many implementations. However, it was the 1980'swhen the game
took on the look that we will be using. It was sold under numerous names and many platforms but probably
gained widespread recognition when it was shipped as standard on Nokia mobile phones in the late 1990's.
The first published Nokia, for monochrome phones. It was programmed in 1997 by Taneli Armanto of Nokia
and introduced on the Nokia 6110.The game involves controlling a single block or snakehead by turning
only left or right by ninety degrees until you manage to eat an block. When you get the block, the Snake
grows an extra block or body segment. If, or rather when, he snake bumps into the edge of the screen or
accidentally eats himself the game is over. The more blocks the snake eats the higher the score.

It was programmed in 1997 by Taneli Armanto of Nokia and introduced on the Nokia 6110.The game
involves controlling a single block or snakehead by turning only left or right by ninety degrees until you
manage to eat an block. When you get the block, the Snake grows an extra block or body segment. If, or
rather when, he snake bumps into the edge of the screen or accidentally eats himself the game is over. The
more blocks the snake eats the higher the score.

It was sold under numerous names and many platforms but probably gained widespread recognition when it
was shipped as standard on Nokia mobile phones in the late 1990's. The first published Nokia, for
monochrome phones. It was programmed in 1997 by Taneli Armanto of Nokia and introduced on the Nokia
6110.The game involves controlling a single block or snakehead by turning only left or right by ninety
degrees until you manage to eat an block. When you get the block, the Snake grows an extra block or body
segment. If, or rather when, he snake bumps into the edge of the screen or accidentally eats himself the game
is over. The more blocks the snake eats the higher the score. The history of the Snake game goes back to the
1970's, the concept originated in the 1976 arcade game Blockade, and its simplicity has led to many
implementations. However, it was the 1980'swhen the game took on the look that we will be using. It was
sold under numerous names and many platforms but probably gained widespread recognition when it was
shipped as standard on Nokia mobile phones in the late 1990's. The first published Nokia, for monochrome
phones. . When you get the block, the Snake grows an extra block or body segment. If, or rather when, he
snake bumps into the edge of the screen or accidentally eats himself the game is over. The more blocks the
snake eats the higher the score.

DEPARTMENT OF CSE MYCEM, MYSURU Page 3


SNAKE GAME PYTHON
2023-24
The history of the Snake game goes back to the 1970's, the concept originated in the 1976 arcade game
Blockade, and its simplicity has led to many implementations. However, it was the 1980'swhen the game
took on the look that we will be using. It was sold under numerous names and many platforms but probably
gained widespread recognition when it was shipped as standard on Nokia mobile phones in the late 1990's.
The first published Nokia, for monochrome phones. It was programmed in 1997 by Taneli Armanto of Nokia
and introduced on the Nokia 6110.The game involves controlling a single block or snakehead by turning
only left or right by ninety degrees until you manage to eat an block. When you get the block, the Snake
grows an extra block or body segment. If, or rather when, he snake bumps into the edge of the screen or
accidentally eats himself the game is over. The more blocks the snake eats the higher the score. It was sold
under numerous names and many platforms but probably gained widespread recognition when it was
shipped as standard on Nokia mobile phones in the late 1990's. The first published Nokia, for monochrome
phones. It was programmed in 1997 by Taneli Armanto of Nokia and introduced on the Nokia 6110.

The game involves controlling a single block or snakehead by turning only left or right by ninety degrees
until you manage to eat an block. When you get the block, the Snake grows an extra block or body segment.
If, or rather when, he snake bumps into the edge of the screen or accidentally eats himself the game is over.
The more blocks the snake eats the higher the score. The history of the Snake game goes back to the 1970's,
the concept originated in the 1976 arcade game Blockade, and its simplicity has led to many
implementations. However, it was the 1980'swhen the game took on the look that we will be using. It was
sold under numerous names and many platforms but probably gained widespread recognition when it was
shipped as standard on Nokia mobile phones in the late 1990's. The first published Nokia, for monochrome
phones. . When you get the block, the Snake grows an extra block or body segment. If, or rather when, he
snake bumps into the edge of the screen or accidentally eats himself the game is over. The more blocks the
snake eats the higher the score.

DEPARTMENT OF CSE, MYCEM, MYSURU Page 4


SNAKE GAME PYTHON 2023-24

CHAPTER-03
SYSTEM DESIGN

we are going to create a Snake game that allows users to control the movement of a snake on a screen, to
get points for eating food and avoiding running into the walls or the growing tail of the snake itself. In this
problem, we want to write a game where a graphical representation of a snake moves across The screen.
When it encounters a piece of food, the snake grows longer and we gain a point. If it hits the wall we die.
To write this program need:

● A way of representing the snake

● A way of representing the food

● A way to display the score,

● a way for our instructions to reach the snake,

● and a way to know when we’ve run into something and died Our system is going to involve working with
both hardware and software, and so we will need to understand what we have available in hardware that can
assist us. we are going to To create a Snake game that allows users to control the movement of a snake on a
screen, to get points for eating food and avoiding running into the walls or the growing tail of the snake
itself. In this problem, we want to write a game where a graphical representation of a snake moves across
The screen. When it encounters a piece of food, the snake grows longer and we gain a point. we are going
to To create a Snake game that allows users to control the movement of a snake on a screen, to get points
for eating food and avoiding running into the walls or the growing tail of the snake itself. In this problem,
we want to write a game where a graphical representation of a snake moves across The screen. When it
encounters a piece of food, the snake grows longer and we gain a point.we are going to To create a Snake
game that allows users to control the movement of a snake on a screen, to get points for eating food and
avoiding running into the walls or the growing tail of the snake itself. In this problem, we want to write a
game where a graphical representation of a snake moves across The screen. When it encounters a piece of
food, the snake grows longer and we gain a point.

When it encounters a piece of food, the snake grows longer and we gain a point.we are going to To create a
Snake game that allows users to control the movement of a snake on a screen, to get points for eating food
and avoiding running into the walls or the growing tail of the snake itself. In this problem, we want to write
a game where a graphical representation of a snake moves across.

DEPARTMENT OF CSE MYCEM, MYSURU Page 5


SNAKE GAME PYTHON
2023-24

CHAPTER-04

SYSTEM AND HARDWARE REQUIREMENTS

4.1 SYSTEM REQUIREMENTS:

OPERATING SYSTEM : WINDOWS XP or Higher

IDE : VisualStudio.NET 2005/2008

FRONT END : WINDOWS

LANGUAGE : Python

4.2 HARDWARE REQUIREMENTS:


Intel P4 1.5GHz or above

512MB RAM

80GB HDD Minimum

DEPARTMENT OF CSE, MYCEM, MYSURU Page 6


SNAKE GAME PYTHON 2023-24

CHAPTER-05

FUNCTIONAL REQUIREMENTS
Here are the requirements (functional requirements) for how the snake moves.

1. The snake must appear to move around the screen.

2. The snake must turn in response to user input.

3. The snake will increase in length if it eats food.

4. The snake will die if it runs into the walls.

5. The snake never stops moving.

DEPARTMENT OF CSE MYCEM, MYSURU Page 7


SNAKE GAME PYTHON
2023-24

CHAPTER-06

NON-FUNCTIONAL REQUIREMENTS
The primary features of IT projects involve implementing like an application, a piece of infrastructure, a
patch. In this specific context functional requirements tells us about what project does when interacted,
whereas non-functional requirements describe about the bounds of performance should be.

6.1 ROBUSTNESS:

Robustness is nothing but its ability that it can tolerate the affects of system functional body. And it can also
be defined as its systems ability that it can withstand to change without transforming its initial stable
configuration.

6.2 RELIABILITY:

The system is trustworthy and it is consistently good in performance. It can also be stated as the system
performs the function without any failure under certain conditions and specified period of time.

6.3 AVAILABILITY:

The system is available 24*7. Availability and Reliability are directly proportional as reliability increase
availability also increases. The user can have access to the system all the time.

6.4 REUSEABILITY:

The system can be used any number of times by the specific user. And the reusability is consistent, adaptable
and stable.

6.5 EFFECTIVENESS:

The algorithm is capable of producing desired result or it has the ability to provide better results.

DEPARTMENT OF CSE, MYCEM, MYSURU Page 8


SNAKE GAME PYTHON 2023-24

CHAPTER-07

WORKING ALGORITHM

Let's look at how a program to run the whole game might look:

1. Draw the playing area with bounding rectangle, set the counter to zero and display it.

2. Draw the snake in a starting position.

3. Draw the food in a starting location.

4. On user input, change snake direction.

5. Move the snake one move

6. If the snake is over food, eat it, increase the score, grow, move the food,

7. else if the snake is over in a wall, die.

8. Go back to 4.

9. Until the snake die

DEPARTMENT OF CSE MYCEM, MYSURU Page 9


SNAKE GAME PYTHON
2023-24

CHAPTER-08

SAMPLE OUTPUT

DEPARTMENT OF CSE, MYCEM, MYSURU Page 10


SNAKE GAME PYTHON 2023-24

CHAPTER-09

CONCLUSION
The project in python programming of Snake Game is a simple console application with very simple
graphics. In this project, you can play the popular “Snake Game” just like you played it elsewhere. You have
to use the up, down, right, or left arrows to move the snake. Foods are provided at the several co-ordinates
of the screen for the snake to eat. Every time the snake eats the food, its length will increased by one element
along with the score. It isn’t the world’s greatest game, but it does give you an idea of what you can achieve
with a relatively simple python programming, and perhaps the basis by which to extend the principles and
create more interesting games on your own.

DEPARTMENT OF CSE MYCEM, MYSURU Page 11


SNAKE GAME PYTHON
2023-24

CHAPTER-10

FUTURE SCOPE
In this project, I have used simple application, this project will be able to implement in future after making
some changes and modifications as I made this project at low level. The modifications that can be done in
this project are:

1. It can be made with good graphics.

2. We can add more options like Top scores and Player Profile.

3. We can add multiplayer option.

DEPARTMENT OF CSE, MYCEM, MYSURU Page 12


SNAKE GAME PYTHON 2023-24

CHAPTER-11

REFERENCES
https://www.youtube.com/watch?v=rFFVyNn9_8A

http://www.c-sharpcorner.com/UploadFile/udeshikah/snakegame-application-in-C-Sharp/

http://www.dreamincode.net/forums/topic/243537-control-issuewith-snake-game-in-c%23/

http://csharp.net-informations.com/communications/csharpchat-client.htm

DEPARTMENT OF CSE MYCEM, MYSURU Page 13

You might also like