You are on page 1of 6

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

College of Engineering and Technology Department of Electronics and


Communication Engineering
18ECE3201J Python and Scientific Python

V Semester, 2022-23 (ODD Semester)

Mini Project Report

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:

● IDE Used: Anaconda (Jupyter notebook)


● Language Used: Python
● Environment Used - Windows 10 (64-bit)
● Modules Used: Tkinter, Random

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:

>> Creating our program


from tkinter import *
import random
import tkinter
rps =Tk()
rps.geometry("300x300")
rps.title(" ROCK PAPER SCISSOR ")
user_score = 0
comp_score = 0
user_choice = ""
comp_choice = ""

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)

#first we will create label and buttons

button_rock = Button(text = " ROCK ",bg = "#808487",font = ("arial",15,"italic


bold"),relief = RIDGE,activebackground = "#059451",activeforeground = "white",width =
24,command = rock)
button_rock.grid(column = 0,row=1)
button_paper = Button(text = " PAPER ",bg = "#808487",font = ("arial",15,"italic
bold"),relief = RIDGE,activebackground = "#059451",activeforeground = "white",width =
24,command = paper)
button_paper.grid(column = 0,row=2)
button_scissor = Button(text = " SCISSOR ",bg = "#808487",font = ("arial",15,"italic
bold"),relief = RIDGE,activebackground = "#059451",activeforeground = "white",width =
24,command = scissor)
button_scissor.grid(column = 0,row=3)

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/.

Yuval Ishai, Rafail Ostrovsky, and Vassilis Zikas. Secure multi-party


computation with
identifiable abort. Cryptology ePrint Archive, Report 2015/325, 2015. http://eprint.
iacr.org/
.
Thofmann. Rock paper scissors protocol secure.
https://github.com/thofmann/rockpaper-scissors-protocol-secure, 2015.

You might also like