SlideShare a Scribd company logo
2
Most read
3
Most read
6
Most read
MuhammadAziz
FINAL PROJECT
REPORT
Department of Computer System Engineering
Universityof Engineering & Technology Peshawar
FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 1
Final Project Report Overall Status: Complete
Project Name: Snake Game in Python
1/2/2019
Snake Game:
Snake is a game where its body grows in length. There is no standard version of
the game. The concept originated in the 1976 arcade game Blockade, and its simplicity
has led to many implementations (some of which have the word snake or worm in the
title). 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.
Figure 1-Snake–Thefirstpublished byNokia,for monochromephones.Itwasprogrammedin1997byTaneliArmantoof
Nokia and introduced ontheNokia 6110.
Py-Game
Pygame is a cross-platform set of
Pythonmodules designed for
writing video games. It includes
computer graphicsand sound
libraries designed to beused with
thePythonprogramming
language.
Pythonis an interpreted,high-level,general-purpose programming
language. Created by Guido van Rossum and first released in 1991,
Pythonhas a design philosophythat emphasizescodereadability,
notablyusing significant whitespace.It provides constructs that
enable clear programming on both small and large scales.
Game Algorithm: All movement rating functionsand evolutionary algorithm-based optimization. Abstract:Snake
game is a computeraction game; whosegoal is to controla snake to move andcollect foodin a map.
FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 2
Summery  Using Object Oriented Programing Language to approach the game implementation.
 Adding Colors and visual view tothe gaming window.
 Snake is the common name for a video game concept where the player maneuvers a line whichgrows in
length, withthe line itself being a primary obstacle.
Flow Chart  The flow chart of game is givenin below fig.
Mainfunction  Snake game is a computer action game, whose goal is to control a snake to move and collect food in a
map. Inthis game we developa controller based on movement rating functions considering smoothness,
space, and food
 This simply imports the maingame class that we’ll create momentarily, makes a new instance, and calls
the game.
FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 3
Snake Movement  We will once againutilize PyGame’s event handlers, this time to respond to the arrow keys toguide our
snake. Inside the Game.py file, add the followingbefore our game loop inside the loop () function.
Game Area  The Whole game window is set to 500pixels.
 There are rows and columns in early console
 Later all the game window is modified toPlane display of multi-colors.
Colliding withthe Wall  Let’s think talk this. Soour original window, assumingyou have kept the same settings, is 500 x500, but there
is now a 35 pixel border on all four edges, effectively reducing our play area to 440 x440. Sothese will be the
dimensions we need to check for.
Creating food  Our snake can’t grow without having a steady supply of apples to eat. Let’s breakdown the requirements for
our apple.
 We will needan X and Y position at which to draw the apple
 A randomize function that will generate random coordinates on the playable game area as needed
 A draw function to display the apple
Eating Food  We will be utilizing the build in collisiondetection for PyGame rectangles to determine whenan
apple has been eaten. We need to revise a few pieces of code to make this happen.
Increasing Size of Snake  The system we are going to use to keeptrack of the various body segments of the snake is going to
work by storing the last position of the head in anarray, pushing to the top, each time the move
method of Snake is called.
Snake Colliding
withItself
 Tocheck if we have collided withourselves, we do a cut and dry check where we iterate over each
body element and see if it has the same X and Y coordinate positions of the head.
 If so, this causes an error and restarts the game. This alsoworks for trying to move the snake
backwards.
Conclusion  Our basic snake game is now playable and I hope you feel a lot more comfortable withPyGame and
game programming then youdid before youread this article.
Colors, Config, and Magic
Numbers
 In game programming, it can be very easy for our code to begin to lose clarity. There are often
shapes or sprites being drawn at arbitrary X and Y coordinates, and those sprites often have
movement, colors, and animations. Next thing you know, you’ve got magicnumbers and repeated
values spread out everywhere.
Initialization and the Game
Loop
 Now that we know everything is working successfully sofar, let’s next add the code to bootstrap
PyGame and start our game loop. Let’s first add a bit of code to give our window a size and a title.
Issues  Installing IDE
 Implementation 1st time
 Adding graphics and level togame
FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 4
Movement toward food
UpwardMotion
Movement only at Positive Y-axis
Figure2-Up
LeftwardMotion
Movement only at negative X-axis
Figure3-Left
Downward Motion
Movement at Negative Y-axis
Figure4-Down
Rightward Motion
Movement only at positive X-axis
Figure5-Right
FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 5
Figure8-Level 3
Snake Bodyenlargement
Aftereating mean getting the foodthe length ofsnake increases.
Level 1 Snake length
Figure6-Level 1
Level 2
Figure7-Level 2
Level 3
The end.

More Related Content

PPTX
Snake game powerpoint presentation by rohit malav
DOC
Snake project report
DOC
Snake game implementation in c
PPTX
report on snake game
PPT
project on snake game in c language
PDF
Snake Game Report
PDF
snake game
DOCX
SRS REPORT ON A ANDROID GAME
Snake game powerpoint presentation by rohit malav
Snake project report
Snake game implementation in c
report on snake game
project on snake game in c language
Snake Game Report
snake game
SRS REPORT ON A ANDROID GAME

What's hot (20)

PPTX
Snake PY Game.pptx
PPTX
Final year project presentation in android application
DOCX
Final project report of a game
PPT
Breakout Ball project presentation
PDF
Snake Game in Python Progress report
DOCX
The complete srs documentation of our developed game.
PPTX
Tic tac toe
PDF
COMPUTER GRAPHICS PROJECT REPORT
DOCX
Online grocery store
DOC
Tic tac toe game code
PPTX
Proposal of 3d GAME Final Year Project
PDF
Telephone directory using c language
DOCX
Minor project Report for "Quiz Application"
PPT
Web Development on Web Project Presentation
PDF
Training report on web developing
PDF
online quiz application project presentation
DOCX
BSCS FINAL PROJECT PROPOSAL
PPTX
Android Project Presentation
DOCX
Report on car racing game for android
PDF
Python final ppt
Snake PY Game.pptx
Final year project presentation in android application
Final project report of a game
Breakout Ball project presentation
Snake Game in Python Progress report
The complete srs documentation of our developed game.
Tic tac toe
COMPUTER GRAPHICS PROJECT REPORT
Online grocery store
Tic tac toe game code
Proposal of 3d GAME Final Year Project
Telephone directory using c language
Minor project Report for "Quiz Application"
Web Development on Web Project Presentation
Training report on web developing
online quiz application project presentation
BSCS FINAL PROJECT PROPOSAL
Android Project Presentation
Report on car racing game for android
Python final ppt
Ad

Similar to Final project report Snake Game in Python (20)

PPTX
Snake_game.pptx introduction to snake game
PPTX
Snake Game using computer graphics in c and c++
PPTX
classic Snake Game with python and pygame.pptx
PDF
Pygame presentation
PPTX
Presentation OF Manisha gupta mam 2.pptx
PPTX
Snake game with c++ and the tools are codeblocks(IDE) and windows operating s...
PPTX
Snake_game presentation-1.pptx in whitho to
PPTX
DSA_project_ppt.pptx_from Sumit sahoo143
PDF
Python lecture 10
PDF
Introduction to Pygame (Lecture 7 Python Game Development)
PPT
"Pemrograman Python untuk Pemula dan Ahli"
PPT
Pygame : créer des jeux interactifs en Python.
PDF
learning_Pygame_Basics_Part _1f_for_beginner.pdf
ODP
Python Games
PDF
Entering the world of Serious Games with Python
PDF
Game Development With Python and Pygame
PDF
Snake Games Project Presentation (5).pdf
PPTX
Rage_Runner_Presentation: A 2D platformer Game
PDF
Object-Oriented Python 1st Edition Irv Kalb
PPTX
Presentation 8.pptx
Snake_game.pptx introduction to snake game
Snake Game using computer graphics in c and c++
classic Snake Game with python and pygame.pptx
Pygame presentation
Presentation OF Manisha gupta mam 2.pptx
Snake game with c++ and the tools are codeblocks(IDE) and windows operating s...
Snake_game presentation-1.pptx in whitho to
DSA_project_ppt.pptx_from Sumit sahoo143
Python lecture 10
Introduction to Pygame (Lecture 7 Python Game Development)
"Pemrograman Python untuk Pemula dan Ahli"
Pygame : créer des jeux interactifs en Python.
learning_Pygame_Basics_Part _1f_for_beginner.pdf
Python Games
Entering the world of Serious Games with Python
Game Development With Python and Pygame
Snake Games Project Presentation (5).pdf
Rage_Runner_Presentation: A 2D platformer Game
Object-Oriented Python 1st Edition Irv Kalb
Presentation 8.pptx
Ad

Recently uploaded (20)

PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPT
Mechanical Engineering MATERIALS Selection
PDF
composite construction of structures.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
DOCX
573137875-Attendance-Management-System-original
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
PPT on Performance Review to get promotions
PPTX
Sustainable Sites - Green Building Construction
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Welding lecture in detail for understanding
PDF
Digital Logic Computer Design lecture notes
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Geodesy 1.pptx...............................................
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Lecture Notes Electrical Wiring System Components
Mechanical Engineering MATERIALS Selection
composite construction of structures.pdf
Construction Project Organization Group 2.pptx
bas. eng. economics group 4 presentation 1.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
573137875-Attendance-Management-System-original
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT on Performance Review to get promotions
Sustainable Sites - Green Building Construction
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Welding lecture in detail for understanding
Digital Logic Computer Design lecture notes
UNIT 4 Total Quality Management .pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Geodesy 1.pptx...............................................
Operating System & Kernel Study Guide-1 - converted.pdf
CH1 Production IntroductoryConcepts.pptx

Final project report Snake Game in Python

  • 1. MuhammadAziz FINAL PROJECT REPORT Department of Computer System Engineering Universityof Engineering & Technology Peshawar
  • 2. FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 1 Final Project Report Overall Status: Complete Project Name: Snake Game in Python 1/2/2019 Snake Game: Snake is a game where its body grows in length. There is no standard version of the game. The concept originated in the 1976 arcade game Blockade, and its simplicity has led to many implementations (some of which have the word snake or worm in the title). 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. Figure 1-Snake–Thefirstpublished byNokia,for monochromephones.Itwasprogrammedin1997byTaneliArmantoof Nokia and introduced ontheNokia 6110. Py-Game Pygame is a cross-platform set of Pythonmodules designed for writing video games. It includes computer graphicsand sound libraries designed to beused with thePythonprogramming language. Pythonis an interpreted,high-level,general-purpose programming language. Created by Guido van Rossum and first released in 1991, Pythonhas a design philosophythat emphasizescodereadability, notablyusing significant whitespace.It provides constructs that enable clear programming on both small and large scales. Game Algorithm: All movement rating functionsand evolutionary algorithm-based optimization. Abstract:Snake game is a computeraction game; whosegoal is to controla snake to move andcollect foodin a map.
  • 3. FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 2 Summery  Using Object Oriented Programing Language to approach the game implementation.  Adding Colors and visual view tothe gaming window.  Snake is the common name for a video game concept where the player maneuvers a line whichgrows in length, withthe line itself being a primary obstacle. Flow Chart  The flow chart of game is givenin below fig. Mainfunction  Snake game is a computer action game, whose goal is to control a snake to move and collect food in a map. Inthis game we developa controller based on movement rating functions considering smoothness, space, and food  This simply imports the maingame class that we’ll create momentarily, makes a new instance, and calls the game.
  • 4. FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 3 Snake Movement  We will once againutilize PyGame’s event handlers, this time to respond to the arrow keys toguide our snake. Inside the Game.py file, add the followingbefore our game loop inside the loop () function. Game Area  The Whole game window is set to 500pixels.  There are rows and columns in early console  Later all the game window is modified toPlane display of multi-colors. Colliding withthe Wall  Let’s think talk this. Soour original window, assumingyou have kept the same settings, is 500 x500, but there is now a 35 pixel border on all four edges, effectively reducing our play area to 440 x440. Sothese will be the dimensions we need to check for. Creating food  Our snake can’t grow without having a steady supply of apples to eat. Let’s breakdown the requirements for our apple.  We will needan X and Y position at which to draw the apple  A randomize function that will generate random coordinates on the playable game area as needed  A draw function to display the apple Eating Food  We will be utilizing the build in collisiondetection for PyGame rectangles to determine whenan apple has been eaten. We need to revise a few pieces of code to make this happen. Increasing Size of Snake  The system we are going to use to keeptrack of the various body segments of the snake is going to work by storing the last position of the head in anarray, pushing to the top, each time the move method of Snake is called. Snake Colliding withItself  Tocheck if we have collided withourselves, we do a cut and dry check where we iterate over each body element and see if it has the same X and Y coordinate positions of the head.  If so, this causes an error and restarts the game. This alsoworks for trying to move the snake backwards. Conclusion  Our basic snake game is now playable and I hope you feel a lot more comfortable withPyGame and game programming then youdid before youread this article. Colors, Config, and Magic Numbers  In game programming, it can be very easy for our code to begin to lose clarity. There are often shapes or sprites being drawn at arbitrary X and Y coordinates, and those sprites often have movement, colors, and animations. Next thing you know, you’ve got magicnumbers and repeated values spread out everywhere. Initialization and the Game Loop  Now that we know everything is working successfully sofar, let’s next add the code to bootstrap PyGame and start our game loop. Let’s first add a bit of code to give our window a size and a title. Issues  Installing IDE  Implementation 1st time  Adding graphics and level togame
  • 5. FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 4 Movement toward food UpwardMotion Movement only at Positive Y-axis Figure2-Up LeftwardMotion Movement only at negative X-axis Figure3-Left Downward Motion Movement at Negative Y-axis Figure4-Down Rightward Motion Movement only at positive X-axis Figure5-Right
  • 6. FINAL PROGRESS REPORT SNAKE GAME IN PYHTON MUHAMMADAZIZ 5 Figure8-Level 3 Snake Bodyenlargement Aftereating mean getting the foodthe length ofsnake increases. Level 1 Snake length Figure6-Level 1 Level 2 Figure7-Level 2 Level 3 The end.