Professional Documents
Culture Documents
18ECE3201J Python and Scientific Python
18ECE3201J Python and Scientific Python
Name :
Register No. :
Venue :
Project Title :
Team Members 1) S.sivaranjani ( RA2011004010435 )
2) A.Yogadharshini ( RA2011004010399 )
Max. Marks
Particulars Marks
Obtained
Pre Lab 05
Program 10
Post Lab 5
Output verification
15
Viva 05
Total 40
REPORT VERIFICATION
Staff Name :
Signature :
ROCK PAPER SCISSOR
OBJECTIVE:
The object of the rock-paper-scissor python project is to build a game for a single player
that plays with a computer, anywhere, and anytime.
ABSTRACT:
● Creating a game with the help of Tkinter, random module in python.
● .In this game, user gets the first chance to pick the option among Rock, paper and scissor.
After that computer select from remaining two choices(randomly), then winner is decided
as per the rules.
● Rock blunts the scissor,so point is going on Rock.
● Scissor cut the paper,so point is going on Scissor
● Then,Paper catch the rock ,so point is going on paper
INTRODUCTION:
It is a hand game that is usually played between 2 people, each player can randomly form
any one of three from their hand.
A player who chooses rock will win by another player who chooses scissors but loose by the
player who chooses paper; a player with paper will loose by the player with the scissors.
If both players choose the same then the game is tied. Rock paper scissors game is mainly
played among kids.
SOFTWARE REQUIREMENTS:
CONCEPTS/WORKING PRINCIPLE
● Tkinter is the standard GUI library for Python. Python when combined with
Tkinter provides a fast and easy way to create GUI applications. Tkinter
provides a powerful object-oriented interface to the Tk GUI toolkit. Using
this concept only, I have prepared a user-friendly receipt form. The user can
view and fill the form easily.
● Random refers to the collection of data or information that can be available in any
order. The random module in python is used to generate random strings. The
random string is consisting of numbers, characters and punctuation series that can
contain any pattern.
APPROACH/METHODOLOGY/PROGRAMS:
def choice_to_number(choice):
rps = {'Rock':0,'Paper':1,'Scissor':2}
return rps[choice]
def number_to_choice(number):
rps = {0:'Rock',1:'Paper',2:'Scissor'}
return rps[number]
def random_computer_choice():
return random.choice(['Rock','Paper','Scissor'])
#final result
def result(human_choice,comp_choice):
global user_score
global comp_score
user = choice_to_number(human_choice)
comp = choice_to_number(comp_choice)
if(user==comp):
print("Tie")
elif((user-comp)%3==1):
print("you win")
user_score+=1
else:
print("computer wins")
comp_score = comp_score+1
text_area = Text(master = rps,font = ("arial",15,"italic bold"),relief = RIDGE,bg =
"#033642",fg = "white",width = 26)
text_area.grid(column=0,row=4)
answer = "your choice : {uc} \ncomputer's choice : {cc} \nyour score : {u} \ncomputer
score : {c}".format(uc=user_choice,cc=comp_choice,u=user_score,c=comp_score)
text_area.insert(END,answer)
def rock():
global user_choice
global comp_choice
user_choice = "Rock"
comp_choice = random_computer_choice()
result(user_choice,comp_choice)
def paper():
global user_choice
global comp_choice
user_choice = "Paper"
comp_choice = random_computer_choice()
result(user_choice,comp_choice)
def scissor():
global user_choice
global comp_choice
user_choice = "Scissor"
comp_choice = random_computer_choice()
result(user_choice,comp_choice)
rps.mainloop()
FLOWCHART:
OUTPUT:
CONCLUSIONS:
We have successfully made this with the help of python and its modules. It is running perfectly
without any error and printing the accurate output with its calculated score.
REFERENCES:
Eli Ben-Sasson, Alessandro Chiesa, Daniel Genkin, Eran Tromer, and Madars
Virza.
Snarks for c: Verifying program executions succinctly and in zero knowledge.
Cryptology
ePrint Archive, Report 2013/507, 2013. http://eprint.iacr.org/.