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

Rock Paper Scissors Game Project

The document describes a Rock Paper Scissors game created using Python. It includes an introduction to the game and its rules. It then discusses the working environment used, including hardware and software specifications. The source code for the game is provided, which uses random number generation and conditional statements to determine a winner between the user and computer selections. On each round, the user and computer make a selection, a winner is determined, and the user is asked if they want to play again.
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)
176 views13 pages

Rock Paper Scissors Game Project

The document describes a Rock Paper Scissors game created using Python. It includes an introduction to the game and its rules. It then discusses the working environment used, including hardware and software specifications. The source code for the game is provided, which uses random number generation and conditional statements to determine a winner between the user and computer selections. On each round, the user and computer make a selection, a winner is determined, and the user is asked if they want to play again.
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

INVESTIGATORY PROJECT IN COMPUTER SCIENCE

ROCK PAPER SCISSOR

SUBMITTED TO: SUBMITTED BY:

Mrs. Lydia Sumana Varun Kommalapati

Senior Secondary teacher 11-B(Sci.)

Computer Science Department Session: 2022-23


NATIONAL PUBLIC SCHOOL
ITPL, BENGALURU

DEPARTMENT OF COMPUTER SCIENCE


CERTIFICATE
Certified that the work in this file is the bonafide
work of _________________________________ of Grade
XI ______________
Roll Number _______________________recorded in the
school laboratory during the academic year 2022-
2023.
Date: 24/1/2023
Teacher in charge: Mrs. Lydia Sumana
External --------
Examiner :
School Seal
ACKNOWLEDGEMENT
In the accomplishment of this project, many people
have provided me with heart pledged support and I
want to thank all the people who have been
concerned with this project. I would like to thank my
Physics teacher Dr. Jaya who guided me to complete
the project.
Last but not least, I would like to thank my parents
and friends for their help and suggestions.
INDEX
• Introduction
o Working Environment
o Functions and modules
■ Hardware and Software Specifications
• Source Code
o Output
• Bibliography
INTRODUCTION OF THE PROJECT

In this project, I’ve made a Rock, Paper and Scissors


game in which you can play against the computer.
Rules: You and the computer both choose rock, paper or
scissors. The winner is decided by these rules:
o Rock blunts scissors
o Paper covers rock

o Scissors cut paper


WORKING
ENVIRONMENT
I’ve used a Dell laptop with an Intel i7 processor
by connecting it to another monitor and creating
an ergonomically supporting perfect environment
and also maintaining a proper sitting posture, an
appropriate eye-monitor distance and many other
conditions.

FUNCTIONS USED:
Input()

MODULES USED:
random module
HARDWARE AND SOFTWARE
SPECIFICATIONS
Hardware specifications: Intel core i7 processor,
8GB RAM, x64 based

Software specifications: Windows 11, Pycharm


community edition.
SOURCE CODE

# import random module

import random

# Print multiline instruction

# performstring concatenation of string

print("Winning Rules of the Rock paper scissor game as follows: \n"

+ "Rock vs paper->paper wins \n"

+ "Rock vs scissor->Rock wins \n"

+ "paper vs scissor->scissor wins \n")

while True:

print("Enter choice \n 1 for Rock, \n 2 for paper, and \n 3 for scissor \n")

# take the input from user

choice = int(input("User turn: "))

# OR is the short-circuit operator

# if any one of the condition is true

# then it return True value


# looping until user enter invalid input

while choice > 3 or choice < 1:

choice = int(input("enter valid input: "))

# initialize value of choice_name variable

# corresponding to the choice value

if choice == 1:

choice_name = 'Rock'

elif choice == 2:

choice_name = 'paper'

else:

choice_name = 'scissor'

# print user choice

print("user choice is: " + choice_name)

print("\nNow its computer turn.......")

# Computer chooses randomly any number

# among 1 , 2 and 3. Using randint method

# of random module
comp_choice = [Link](1, 3)

# looping until comp_choice value

# is equal to the choice value

while comp_choice == choice:

comp_choice = [Link](1, 3)

# initialize value of comp_choice_name

# variable corresponding to the choice value

if comp_choice == 1:

comp_choice_name = 'Rock'

elif comp_choice == 2:

comp_choice_name = 'paper'

else:

comp_choice_name = 'scissor'

print("Computer choice is: " + comp_choice_name)

print(choice_name + " V/s " + comp_choice_name)

# we need to check of a draw

if choice == comp_choice:
print("Draw=> ", end="")

result = Draw

# condition for winning

if ((choice == 1 and comp_choice == 2) or

(choice == 2 and comp_choice == 1)):

print("paper wins => ", end="")

result = "paper"

elif ((choice == 1 and comp_choice == 3) or

(choice == 3 and comp_choice == 1)):

print("Rock wins =>", end="")

result = "Rock"

else:

print("scissor wins =>", end="")

result = "scissor"

# Printing either user or computer wins or draw

if result == Draw:

print("<== Its a tie ==>")

if result == choice_name:
print("<== User wins ==>")

else:

print("<== Computer wins ==>")

print("Do you want to play again? (Y/N)")

ans = input().lower

# if user input n or N then condition is True

if ans == 'n':

break

# after coming out of the while loop

# print thanks for playing

print("\nThanks for playing")


OUTPUT

BIBLIOGRAPHY
[Link]

Common questions

Powered by AI

The 'random' module is used to simulate the computer's choice by generating a random number among 1, 2, or 3, which corresponds to Rock, Paper, or Scissors, respectively. This randomization is crucial to ensure that each game result is unpredictable and fair .

The rule 'Rock blunts scissors' is part of the traditional game mechanics that determine how matches are won. In the source code, it is implemented using conditional statements that check if the user's choice is Rock and the computer's choice is Scissors, thereby declaring Rock as the winner .

The program determines a winner by comparing the user's choice and the computer's randomly generated choice using conditional statements. If both choices are the same, it is declared a 'Draw'. Otherwise, the winner is decided based on the traditional game rules: Rock beats Scissors, Scissors beat Paper, and Paper beats Rock .

The loop allows the game to be replayed multiple times without restarting the program, enhancing user experience by providing convenience and ease of use. This design encourages engagement by enabling users to immediately try again or improve their strategy in subsequent rounds .

The acknowledgment section recognizes and appreciates the support and contributions that facilitated the project's completion. It maintains academic integrity and expresses gratitude, nurturing goodwill and establishing a professional network which may be beneficial for future collaborations .

The development was done on a Dell laptop with an Intel i7 processor and 8GB RAM, using Windows 11 and Pycharm Community Edition as the software environment .

The program outputs the choices made by both the user and the computer and then announces the result, whether it is a win for the user, a win for the computer, or a draw. It keeps users informed through clear textual feedback and asks if they would like to play again, thus engaging them in the decision-making process for continuing or ending the game .

User input validation ensures that only valid inputs are processed, thereby preventing errors and maintaining the integrity of the game's logic. By prompting users to enter a valid choice if an invalid one is attempted, it enhances the program's robustness and user-friendliness, reducing crash possibilities and maintaining expected functionality .

Using Pycharm Community Edition aids development efficiency by providing an integrated development environment with features such as code inspection, debugging tools, and code completion. These utilities enhance productivity, simplify complex coding tasks, and encourage best practices in programming .

Maintaining an appropriate eye-monitor distance and proper posture is important to reduce the risk of eye strain, musculoskeletal discomfort, and injuries that could arise from prolonged computer use. Ergonomics promotes better health and increases productivity by ensuring a more comfortable working environment .

You might also like