ROCK PAPER SCISSORS GAME Program in Python

 

 ROCK PAPER SCISSORS GAME Program in Python



Program:

# Prorgam developed by ARUN
# Copyrights owned by DATA DEMONS
name = input("Enter you name")
name = name.title()
print("Hi", name, ", you are welcome to this game 'ROCK PAPER SCISSORS' created by 'JASS'.")
print("So let's start.")
print("""Rules :
1) Rock = 1
2) Paper = 2
3) Scissors = 3
4) You shoild enter the numbers accordingly
5) No empty Enters.
6) You can set the point limit of the game.""")
game_limit = int(input("Enter the point limit of the game."))
computer = 0
player = 0
import random as rdm
List1 = ["Rock", "Paper", "Scissors"]
List2 = [1, 2, 3]
while (player < game_limit) and (computer < game_limit):
    pinp = eval(input("Your turn :"))
    if pinp in List2:
        cinp = rdm.choice(List1)
        print("My turn :", cinp)
        if ((pinp == 1) ) and (cinp == List1[2]):# p - Rock, c - Scissors
            print("You got a point")
            player += 1
        elif ((pinp == 2)) and (cinp == List1[0]):#  p - Paper, c - Rock
            print("You got a point")
            player += 1
        elif ((pinp == 3)) and (cinp == List1[1]):# p - Scissors, c - Paper
            print("You got a point")
            player += 1
        elif ((cinp == List1[0]) and (pinp == 3)):# c - Rock, p - Scissors
            print("I got a point")
            computer += 1
        elif ((cinp == List1[1]) and (pinp == 1)):# c - Paper, p - Rock
            print("I got a point")
            computer += 1
        elif ((cinp == List1[2]) and (pinp == 2)):# c - Scissors, p - Paper
            print("I got a point")
            computer += 1
        else:
            print("Same Let's roll again")
    else:
        print("Sorry you broke the rules, read it and try again")
else:
    print("GAME OVER")
    print("My score \t Your score")
    print(computer,'\t\t', player)
if computer > player:
    print("I won the game with", (computer - player), "points leading")
elif computer < player:
    print("You won the game with", (player - computer), "points leading")

Programmer details : Arun Meyyappan PL
Software used: Visual studio CODE
Version : 1.74

Documents and files download link

Python File(.py)


Text File(.txt)

0 Comments