0% found this document useful (0 votes)
11 views13 pages

Project Report

The document is a project report for a Rock, Paper, Scissors game developed in Python by students at SRM Institute of Science & Technology. It outlines the project's objectives, technical details, code implementation, and example usage, highlighting user input handling and random choice generation. The report also suggests future improvements such as GUI implementation and enhanced validation.

Uploaded by

as7426
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)
11 views13 pages

Project Report

The document is a project report for a Rock, Paper, Scissors game developed in Python by students at SRM Institute of Science & Technology. It outlines the project's objectives, technical details, code implementation, and example usage, highlighting user input handling and random choice generation. The report also suggests future improvements such as GUI implementation and enhanced validation.

Uploaded by

as7426
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/ 13

Rock, Paper, Scissors Game

A PROJECT REPORT

Submitted by

ABHINAV SINGH [RA2311026030068]


AMRIT SINHA [RA2311026030097]
ASHWIN MISHRA [ RA2311026030101]
LAKSHYA GUPTA [RA2311026030106]

Under the guidance of

Ms. Swati Sheoran


Assistant Professor Computer Science & Engineering
SRM INSTITUTE OF SCIENCE & TECHNOLOGY, NCR CAMPUS
October 2024

SRM INSTITUTE OF SCIENCE & TECHNOLOGY


(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified to be the bonafide record of work done by ABHINAV SINGH


[RA2311026030068] of 3rd semester
2nd year B.TECH degree course in SRM INSTITUTE OF SCIENCE AND
TECHNOLOGY, NCR Campus of Department of Computer Science &
Engineering with Specialization in Artificial Intelligence and Machine
Learning, during the academic year 2024-2025.

SIGNATURE SIGNATURE

Ms. Swati Sheoran Dr. Avneesh Vashistha


Assistant Professor Head of the Department
Computer Science & Engineering Computer Science & Engineering
SRM INSTITUTE OF SCIENCE & TECHNOLOGY, NCR CAMPUS
October 2024

SRM INSTITUTE OF SCIENCE & TECHNOLOGY


(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified to be the bonafide record of work done by AMRIT SINHA


[RA2311026030097] of 3rd semester
2nd year B.TECH degree course in SRM INSTITUTE OF SCIENCE AND
TECHNOLOGY, NCR Campus of Department of Computer Science &
Engineering with Specialization in Artificial Intelligence and Machine
Learning, during the academic year 2024-2025.

SIGNATURE SIGNATURE

Ms. Swati Sheoran Dr. Avneesh Vashistha


Assistant Professor Head of the Department
Computer Science & Engineering Computer Science & Engineering
SRM INSTITUTE OF SCIENCE & TECHNOLOGY, NCR CAMPUS
October 2024

SRM INSTITUTE OF SCIENCE & TECHNOLOGY


(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified to be the bonafide record of work done by ASHWIN MISHRA


[RA2311026030101] of 3rd semester
2nd year B.TECH degree course in SRM INSTITUTE OF SCIENCE AND
TECHNOLOGY, NCR Campus of Department of Computer Science &
Engineering with Specialization in Artificial Intelligence and Machine
Learning, during the academic year 2024-2025.

SIGNATURE SIGNATURE

Ms. Swati Sheoran Dr. Avneesh Vashistha


Assistant Professor Head of the Department
Computer Science & Engineering Computer Science & Engineering
SRM INSTITUTE OF SCIENCE & TECHNOLOGY, NCR CAMPUS
October 2024

SRM INSTITUTE OF SCIENCE & TECHNOLOGY


(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified to be the bonafide record of work done by LAKSHYA GUPTA


[RA2311026030106] of 3rd semester
2nd year B.TECH degree course in SRM INSTITUTE OF SCIENCE AND
TECHNOLOGY, NCR Campus of Department of Computer Science &
Engineering with Specialization in Artificial Intelligence and Machine
Learning, during the academic year 2024-2025.

SIGNATURE SIGNATURE

Ms. Swati Sheoran Dr. Avneesh Vashistha


Assistant Professor Head of the Department
Computer Science & Engineering Computer Science & Engineering
Table of Contents

S.N. Topics Page No

1 Project Overview 7

2 7
Objectives

3 7-8
Technical Details

4 Code 9-10

5 11
Example Usage

6 11
Conclusions and Future Improvements

7 References 12
Project Report: Rock, Paper, Scissors
Game
### Project Overview

The Rock, Paper, Scissors game is a classic hand game that is played between two people.
Each player simultaneously forms one of three shapes with their hand. The possible shapes
are rock, paper, and scissors. The game is a simple example of a decision-making process
based on predefined rules.

### Objectives

- Develop a Rock, Paper, Scissors game in Python.

- Allow the user to play against the computer.


- Implement functionality to:
- Accept and validate user input.
- Generate a random choice for the computer.
- Determine the winner based on game rules.

- Provide feedback to the user.

### Technical Details

Programming Language
Python: The game is implemented using Python 3. The simplicity of the language and its
readability make it ideal for this task.

Key Components
1. get_computer_choice()
- Purpose: To randomly select one of the three choices (rock, paper, or scissors) for the
computer.
- Implementation: Utilizes the `random.choice()` method from Python's `random` module
to make a random selection from a list of choices.

2. get_user_choice()
- Purpose: To capture and validate the user's input.
- Implementation: Prompts the user to enter their choice, ensures it is one of the valid
options (rock, paper, or scissors), and keeps asking until a valid choice is provided.

3. determine_winner(user_choice, computer_choice)
- Purpose: To determine the winner of the game based on the choices made by the user
and the computer.
- Implementation: Compares the user's choice and the computer's choice using conditional
statements to determine the result (win, lose, or tie).

4. play_game()
- Purpose: To manage the game flow.

- Implementation: Calls other functions to get the user and computer choices, displays the
choices, determines the result, and prints the outcome.

Code Execution
- get_computer_choice(): Selects a random choice for the computer.
- get_user_choice(): Ensures that the user's input is valid.
- determine_winner(user_choice, computer_choice): Evaluates the result of the game based
on the rules of Rock, Paper, Scissors.
- play_game(): Orchestrates the game, handles user interaction, and displays the results.
### Code

import random

def get_user_choice():

"""Get the user's choice."""

choices = ["rock", "paper", "scissors"]

choice = input("Enter rock, paper, or scissors: ").lower()

while choice not in choices:

print("Invalid choice. Please try again.")

choice = input("Enter rock, paper, or scissors: ").lower()

return choice

def get_computer_choice():

"""Get the computer's choice."""

choices = ["rock", "paper", "scissors"]

return random.choice(choices)

def determine_winner(user_choice, computer_choice):

"""Determine the winner of the game."""

if user_choice == computer_choice:

return "It's a tie!"

if (user_choice == "rock" and computer_choice == "scissors") or \

(user_choice == "scissors" and computer_choice == "paper") or \

(user_choice == "paper" and computer_choice == "rock"):

return "You win!"

return "Computer wins!"


def play_game():

"""Play a game of Rock, Paper, Scissors."""

print("Welcome to Rock, Paper, Scissors!")

user_choice = get_user_choice()

computer_choice = get_computer_choice()

print(f"\nYou chose: {user_choice}")

print(f"The computer chose: {computer_choice}")

result = determine_winner(user_choice, computer_choice)

print(result)

if __name__ == "__main__":

play_game()
### Example Usage

When the game is executed, it prompts the user to enter their choice. After the user inputs
their choice, the computer's choice is randomly generated. The results of the game (win,
lose, or tie) are then displayed based on the rules.

Sample Output

### Conclusion

The Rock, Paper, Scissors game successfully demonstrates basic programming concepts such
as user input handling, random number generation, and conditional logic. The project
showcases how to create an interactive console-based game using Python, making it a
valuable exercise for beginners to understand fundamental programming techniques.

### Future Improvements

- GUI Implementation: Develop a graphical user interface for a more interactive experience.

- Extended Features: Introduce additional game modes or options such as best-of-three or


player statistics.

- Enhanced Validation: Improve input validation to handle edge cases or unexpected inputs
more gracefully.
### References

- Python Documentation: https://docs.python.org/3/


- random module documentation: https://docs.python.org/3/library/random.html

You might also like