LATTHE EDUCATION SOCITY’S POLYTECHNIC,
SANGLI
DEPARTMENT OF COMPUTER ENGINEERING
MICRO PROJECT REPORT
SUBJECT: PYTHON
TITLE:
SNAKE-WATER-GUN GAME
SUBMITTED BY:
Roll Name Enrollment Number
Number
243301 Atharva Mahesh Mane 2200430362
MICRO-PROJECT INDEX
Sr. No. Content
Rationale
1
Aims/Benefits of the Micro-Project
2
Course Outcome Achieved
3
Actual Methodology Followed
4
Actual Resources Used
5
Flow chart
6
Source code
7
Outputs of Micro-Project
8
Skill developed / Learning out of this Micro-Project
9
Applications of this Micro-Project
10
Future Scope
11
Micro-Project Presentation (.ppts)
12
RATIONALE
The Snake-Water-Gun game is a simple console-based program that simulates a
decision-based game similar to Rock-Paper-Scissors. This project helps beginners
understand fundamental programming concepts such as:
Conditional statements (if-else)
Loops (while)
Functions (def)
Random number generation (random.randint)
Error handling (try-except)
The project serves as an engaging way to develop logic-building skills while
reinforcing basic programming principles
AIMS/BENEFITS OF THE MICRO-PROJECT
To develop an interactive Python-based Snake-Water-Gun game that
allows users to play against the computer.
To apply fundamental programming concepts such as conditional
statements, loops, functions, and error handling.
To implement an automated decision-making system using logic-based
rules.
To introduce randomization techniques using the random module for
generating computer choices.
To ensure user input validation and prevent invalid entries using exception
handling.
To improve logical thinking and problem-solving skills through structured
coding practices.
Benefits :
Hands-on Python programming experience by implementing an interactive
console-based game.
Enhancement of problem-solving and logical reasoning abilities.
Understanding of user interaction handling through input validation
techniques.
Development of structured and modular code using functions.
Learning of fundamental game development concepts applicable to larger
projects.
Encouragement of creativity and critical thinking in algorithm design.
INTENTED COURSE OUTCOMES
CO1 : Display message on screen using Python script on IDE
CO2 : Develop Python program to demonstrate use of operators
CO3 : Perform operations on data structures in python.
CO4 : Develop functions for given problem
CO5 : Handle exceptions
ACTUAL METHODOLOGY FOLLOWED
The step-by-step methodology followed to develop the Snake-Water-Gun
game:
Step 1: Understanding the Game Rules
The game consists of three choices: Snake (0), Water (1), and Gun (2).
The winning logic follows:
1. Snake wins against Water (Snake drinks water).
2. Water wins against Gun (Water rusts the gun).
3. Gun wins against Snake (Gun shoots the snake).
Step 2: Designing the Algorithm
A function was created to compare the choices of the user and the
computer.
A win_combinations list was used to store winning conditions.
Step 3: Implementing the Code in Python
Used random.randint(0,2) for random computer choices.
Implemented if-elif-else conditions to determine the winner.
Created a loop to enable repeated gameplay until the user exits.
Step 4: Testing and Debugging
Several test cases were run to ensure proper functioning.
try-except block was added to handle invalid inputs gracefully.
RESOURCES REQUIRE
Sr. No Name of Resource / Specification
Material
1. Computer System Intel Core I5 and
with later RAM 8GB,
broad specifications. Windows 7 and
later versions.
2. Software. PythonIDE
Pycharm
3. Any other resource Printer
used.
FLOW CHART
SOURCE CODE
import random
def check(comp, user):
win_combinations = [(0, 1), (1, 2), (2, 0)]
if comp == user:
return 0 # Draw
elif (user, comp) in win_combinations:
return 1
else:
return -1
choices = ["Snake", "Water", "Gun"]
while (True):
try:
user = int(input("Enter 0 for Snake, 1 for Water, and 2 for Gun, 3 for exit :\
n"))
if user == 3:
break
else :
if user not in [0, 1, 2]:
raise ValueError("Invalid choice. Please choose 0, 1, or 2.")
comp = random.randint(0, 2)
score = check(comp, user)
print(f"You chose: {choices[user]}")
print(f"Computer chose: {choices[comp]}")
if score == 0:
print("It's a draw!")
elif score == 1:
print("You win!")
else:
print("You lose!")
except ValueError as e:
print(e)
OUTPUTS OF MICRO-PROJECT
SKILLS DEVELOPED
Programming Skills
Gained practical experience in Python programming.
Applied loops (while), conditional statements (if-else), and functions (def)
effectively.
Implemented randomization using the random module for generating
computer choices.
Used exception handling (try-except) to prevent crashes and handle user
input errors.
Logical Thinking & Algorithm Development
Understood game logic and decision-making processes.
Developed an algorithm that compares user and computer choices to
determine the winner.
Enhanced problem-solving skills through structured programming.
User Interaction & Error Handling
Learned how to take user input and validate it.
Implemented measures to prevent invalid inputs and ensure smooth
gameplay.
Game Development Fundamentals
Understood the basics of game logic and rule implementation.
Gained experience in developing an interactive console-based game.
Built a foundation for more advanced game development projects.
APPLICATIONS OF MICROPROJECT
Game Development
Forms the basic structure of decision-based games like Rock-Paper-
Scissors.
Can be extended into a more complex game with additional features.
Artificial Intelligence (AI) & Machine Learning
Can integrate AI to make smarter computer decisions.
Helps in understanding decision-making algorithms.
Python Learning & Education
Ideal for beginners learning Python programming.
Used in coding bootcamps, schools, and universities to teach logic-
building.
Mobile & Web-Based Gaming
Can be converted into a mobile app for Android/iOS.
Can be integrated into websites as a fun mini-game.
Logic-Based Simulations
Can be applied in decision-based simulations for training and learning.
FUTURE SCOPE
Graphical User Interface (GUI) Enhancement
The game can be converted into a GUI-based version using Tkinter or Pygame for
better user experience.
Multiplayer Mode
Can be upgraded to allow two-player mode for competitive gaming.
Integration with AI & Machine Learning
AI can be added to learn from previous games and make intelligent moves.
Mobile App Development
The game can be converted into a fully functional mobile application for Android and
iOS.
Voice-Recognition Based Gameplay
Can integrate speech recognition to allow voice commands for user input.
Online Multiplayer Version
Can be developed into an online game where players can compete with each other
over the internet.
CONCLUSION
This micro-project successfully developed an interactive Snake-Water-
Gun game using Python. It helped reinforce programming concepts and
logical thinking. Future improvements can enhance its usability and
make it more engaging.