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

Pwp Mic Final

The document is a micro project report on creating a Snake Game using the Pygame library, submitted for a Diploma in Information Technology. It outlines the project's rationale, aims, outcomes, and the skills developed through its execution, emphasizing the importance of programming fundamentals and game development concepts. The report also includes acknowledgments, a program code, and references for further learning.

Uploaded by

prachitinavale50
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)
6 views

Pwp Mic Final

The document is a micro project report on creating a Snake Game using the Pygame library, submitted for a Diploma in Information Technology. It outlines the project's rationale, aims, outcomes, and the skills developed through its execution, emphasizing the importance of programming fundamentals and game development concepts. The report also includes acknowledgments, a program code, and references for further learning.

Uploaded by

prachitinavale50
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

A

Micro project report On

“ Snake Game Using pygame Library ”

SUBMITTED TO M.S.B.T.E., Mumbai

For the Award of

DIPLOMA IN INFORMATION TECHNOLOGY

Roll no Name of Student Enrollment no


24 Kazi Ziyan Jakilali 23212470464
30 Pawar Girish Nagesh 23212470470
23 Davale Vaibhav Abhangrao 23212470463
34 Amankhan Khalil Pathan 23212470474

UNDER THE GUIDANCE OF


Ms. A. M. SAWANT
DEPARTMENT OF INFORMATION TECHNOLOGY
NBA ACCREDIATED

SVERI’s College of Engineering (Polytechnic),


Gopalpur Pandharpur-413304
2024-25
AFFILIATED TO

M.S.B.T.E.

1
Evolution sheet for Micro Project
Academic Year:- 2024-25 Name of Faculty:- Ms. A. M. SAWANT

Course: Information Technology Course Code:- IF4K


Subject:- Python Programming Subject Code:- 314004
Semester: 4 Scheme:- K

Title of Project:- Snake Game Using pygame Library

Major Learning Outcomes achieved by students by doing the Project:


Develop program to evaluate expressions using various operators and Input/output
(a)Practical functions.
Outcomes:

(b) Unit Outcomes 1. Application: Apply strategic to make ourself digitialise.


2. Analysis: To analyze an electronics component shop's operations, market
in presence, and customer engagement.
Cognitive domain:

(c) Outcomes in a. Team Spirit: Foster collaboration and camaraderie in group work.
b. Resilience: Build persistence in problem-solving despite challenges.
Affective Domain: c. Empathy: Enhance appreciation for peers’ strategies and experiences.

Comments/Suggestions about teamwork/leadership/interpersonal communication (if any)

Marks out of 4
Marks out of 6 Total
for
for mars
Roll No Name of students performance
performance in out of
in oral/
group activity 10
Presentation
24 Kazi Ziyan Jakilali
30 Pawar Girish Nagesh
23 Davale Vaibhav Abhangrao
34 Amankhan Khalil Pathan

Guide Ms. A. M. SAWANT

2
SVERI'S COLLEGE OF ENGINEERING (POLYTECHNIC), PANDHARPUR.

CERTIFICATE

This is to certify that the Project report entitled


“ Snake Game Using pygame Library ”
Submitted by

Roll no Name of Student Enrollment no

24 Kazi Ziyan Jakilali 23212470464


30 Pawar Girish Nagesh 23212470470
23 Davale Vaibhav Abhangrao 23212470463
34 Amankhan Khalil Pathan 23212470474

is a bonafide work carried out by above students, under the guidance of Ms. A. M. SAWANT
and it is submitted towards the fulfillment of requirements of MSBTE, Mumbai for the award of
Diploma in Information Technology at SVERI’s COE (Polytechnic), Pandharpur during the academic
year 2024-2025 .

(Ms. A. M. SAWANT)
Guide
(Mrs. R. K. Malgonde) (Dr. N. D. Misal)
HOD Principal

Place: Pandharpur

Date: / /

3
INDEX :

Sr.No. Title Page No.

1. Rationale 6

2. Aim/Benefit’s Of The Project 6

3. Course Outcomes Achieved 6

4. Literature View 6

5. Program 7, 8, 9,10

6. Output 11

7. Actual Resource Used 12

8. Skill Development/Learning Outcome Of Micro-Project 12

9. Application Of Micro project 12

10. Conclusion 13

11. References 13

4
Acknowledgement

“Snake Game Using pygame Library ” has been developed successfully


with a great contribution of four students in a period of two months. We like to
appreciate their guidance, encouragement and willingness since without their support
the project would not have been a success. We would like to give our heartfelt
gratitude to Principal Dr. N.D. Misal, HOD Mrs. R. K. Malgonde & Guide
Ms. A. M. Sawant who is the supervisor of our project for helping and encouraging
us in many ways to make our project a success. We would never be able to finish our
work without great support and enthusiasm from friends and support from our
family. We would like to thank the department of Information Technology, for
giving us permission to initiate this project and successfully finish it.

5
“ Snake Game Using pygame Library ”

1. Rationale:
The Python Snake Game microproject is a great way to learn programming by
applying fundamental concepts such as loops, conditionals, and data structures in a
practical setting. It helps build essential skills in game development, like handling
user input, managing real-time graphics with libraries like Pygame, and implementing
game logic (e.g., movement, collision detection). This project encourages modular
code design and problem-solving, while also providing a tangible, interactive result,
boosting confidence and motivation. Additionally, it lays the groundwork for more
advanced game development projects by introducing concepts like animation, speed
control, and code optimization.

2. Aim/Benefits of the Micro-project:


The aim of the Python Snake Game microproject is to provide learners with hands-on
experience in programming by building a simple, interactive game. The benefits include
developing a deeper understanding of programming fundamentals, such as loops,
conditionals, and data structures, while also gaining practical experience in game
development. The project fosters problem-solving skills, teaches how to handle real-time
user input and graphics, and emphasizes clean, modular code design. It also boosts
confidence by delivering a tangible and engaging result, offering a solid foundation for
further exploration into more complex programming and game development projects.

3. Course Outcomes Achieved:


The Python Snake Game microproject helps students achieve key programming outcomes
by reinforcing core concepts like loops, conditionals, and data structures, while introducing
game development basics such as game loops and user input handling. It encourages
problem-solving, code optimization, and debugging, while also providing experience with
Python libraries like Pygame. Ultimately, it boosts confidence in programming and lays the
foundation for more advanced projects.

4. Literature Review :
The Snake game project is widely used in programming education to teach core concepts
like loops, conditionals, data structures, and algorithm design. Studies highlight its
effectiveness in helping beginners understand basic programming principles and game
development, especially when using libraries like Pygame. The project encourages
problem-solving, modular code design, and debugging skills, making it an ideal tool for
learning and practicing programming in an engaging, hands-on way.

6
5. Program:

import pygame
import time
import random

pygame.init() #Initialize pygame

# Define colors
white = (255, 255,255)
yellow = (255, 255, 102)
black = (0, 0, 0)
red = (213, 50, 80)
green = (0, 255, 0)
blue = (50, 153, 213)

# Set screen dimensions


width = 600
height = 400

# Create the screen object


screen = pygame.display.set_mode((width, height))

# Set window title


pygame.display.set_caption('Snake Game')

# Set clock object to control the frame rate


clock = pygame.time.Clock()

# Snake block size


block_size = 10
snake_speed = 15

# Font for displaying score


font_style = pygame.font.SysFont("bahnschrift", 25)
score_font = pygame.font.SysFont("comicsansms", 35)

# Function to display the current score


def Your_score(score):
value = score_font.render("Your Score: " + str(score), True, white)
creen.blit(value, [0, 0])

7
# Function to draw the snake on the screen
def our_snake(block_size, snake_body):
for x in snake_body:
pygame.draw.rect(screen, green, [x[0], x[1], block_size, block_size])

# Function to display messages


def message(msg, color):
mesg = font_style.render(msg, True, color)
screen.blit(mesg, [width / 6, height / 3])

# Main game loop function


def gameLoop():
game_over = False
game_close = False

# Initial position of the snake


x1 = width / 2
y1 = height / 2

x1_change = 0
y1_change = 0

snake_body = ->
length_of_snake = 1

# Position of the food


foodx = round(random.randrange(0, width - block_size) / 10.0) * 10.0
foody = round(random.randrange(0, height - block_size) / 10.0) * 10.0

while not game_over:


while game_close:
screen.fill(blue)
message("You Lost! Press Q-Quit or C-Play Again", red)
Your_score(length_of_snake - 1)
pygame.display.update()

for event in pygame.event.get():


if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
game_over = True
game_close = False
if event.key == pygame.K_c:
8
gameLoop()

# Handling keypresses
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x1_change = -block_size
y1_change = 0
elif event.key == pygame.K_RIGHT:
x1_change = block_size
y1_change = 0
elif event.key == pygame.K_UP:
y1_change = -block_size
x1_change = 0
elif event.key == pygame.K_DOWN:
y1_change = block_size
x1_change = 0

# Game over if the snake hits the wall


if x1 >= width or x1 < 0 or y1 >= height or y1 < 0:
game_close = True
x1 += x1_change
y1 += y1_change
screen.fill(blue)

# Draw food and snake


pygame.draw.rect(screen, yellow, [foodx, foody, block_size, block_size])
snake_head = []
snake_head.append(x1)
snake_head.append(y1)
snake_body.append(snake_head)

if len(snake_body) > length_of_snake:


del snake_body[0]

# Check if the snake eats itself


for x in snake_body[:-1]:
if x == snake_head:
game_close = True
our_snake(block_size, snake_body)
9
Your_score(length_of_snake - 1)

pygame.display.update()

# If snake eats food, generate new food and increase length


if x1 == foodx and y1 == foody:
foodx = round(random.randrange(0, width - block_size) / 10.0) * 10.0
foody = round(random.randrange(0, height - block_size) / 10.0) * 10.0
length_of_snake += 1

clock.tick(snake_speed)

pygame.quit()
quit()

gameLoop() # Start the game loop

10
6. Output :

11
7. Actual Resource Used:

Sr. No Name of Specification Qty Remark


Recourse
RAM: 16GB
1 Computer System Processor: i5 1
SSD: 1TB
Graphic: 4GB
2
Vs code Version 1.85.2 1

8. Skill Developed/Learning outcome of Micro-Project:


The Python Snake Game microproject develops skills in programming fundamentals,
problem-solving, game development basics, and data structures. It enhances debugging,
optimization, and modular code design, while providing hands-on experience with libraries
like Pygame. The project boosts confidence in programming and encourages further learning
through the creation of an interactive game.

9. Application of this Micro-Project:


● Game Development: It serves as an introductory project for learning game design and
development concepts.
● Skill Development for Beginners: Ideal for beginners to practice core programming skills
such as loops, conditionals, and functions.
● Educational Tool: Used in computer science education to teach algorithmic thinking, real-
time user input handling, and data structure manipulation.
● Foundation for Advanced Projects: Acts as a stepping stone for more complex game
development projects or applications involving Python libraries like Pygame or Turtle.
● Problem-Solving & Debugging Practice: Helps learners develop skills in debugging,
optimization, and troubleshooting within interactive environments.

12
10. Conclusion:

In conclusion, the Python Snake Game microproject serves as an effective and


engaging way to develop key programming skills, such as problem-solving, algorithm
design, and real-time input handling. It provides a strong foundation in game
development and reinforces core concepts like loops, conditionals, and data
structures. The project also offers practical experience with Python libraries like
Pygame, boosting confidence and encouraging further learning. The skills gained from
this project are directly applicable to real-world scenarios, including game
development, interactive applications, simulations, and even robotics, making it a
valuable learning experience for beginners and aspiring developers.

11. References:

https://www.geeksforgeeks.org/
https://www.javatpoint.com/
https://chatgpt.com/

13
14

You might also like