-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import random | ||
|
||
print("Welcome to ---> Rock Paper Scissor Game <--- ") | ||
print("---------> H U M A N vs C O M P U T E R <---------") | ||
print() | ||
print("***** WINING GAME RULES *****") | ||
print("ROCK vs PAPER --> PAPER WINS\n" | ||
+"ROCK vs SCISSOR--> ROCK WINS\n" | ||
+"PAPER vs SCISSOR --> SCISSOR WINS\n") | ||
|
||
rounds = int(input("Enter Number of Rounds : ")) | ||
userChoice = "" | ||
computerChoice = "" | ||
while(rounds): | ||
rounds = rounds -1 | ||
|
||
choices = ['ROCK', 'PAPER', 'SCISSOR'] | ||
for index, val in enumerate(choices): | ||
print(index+1,"-", val) | ||
|
||
print() | ||
userInput = int(input("Enter your Choice : ")) -1 | ||
match userInput: | ||
case userInput : | ||
userChoice = choices[userInput] | ||
print("Your Choice is : ", userChoice) | ||
|
||
print() | ||
computerInput = random.randint(0, 2) | ||
match computerInput: | ||
case computerInput : | ||
computerChoice = choices[computerInput] | ||
print("Computer Choice is : ", computerChoice) | ||
|
||
print() | ||
if(userChoice == "ROCK" and computerChoice == "PAPER"): | ||
print(f'Computer Choice : {computerChoice} - COMPUTER WINS') | ||
print("Try! Next Time") | ||
|
||
elif(userChoice == "PAPER" and computerChoice == "ROCK"): | ||
print(f'Your Choice : {userChoice} - YOU WIN') | ||
print("Congratulations") | ||
|
||
elif(userChoice == "ROCK" and computerChoice == "SCISSOR"): | ||
print(f'Your Choice : {userChoice} - YOU WIN') | ||
print("Congratulations") | ||
|
||
elif(userChoice == "SCISSOR" and computerChoice == "ROCK"): | ||
print(f'Computer Choice : {computerChoice} - COMPUTER WINS') | ||
print("Try! Next Time") | ||
|
||
elif(userChoice == "SCISSOR" and computerChoice == "PAPER"): | ||
print(f'Your Choice : {userChoice} - You WIN') | ||
print("Congratulations") | ||
|
||
elif(userChoice == "PAPER" and computerChoice == "SCISSOR"): | ||
print(f'Computer Choice : {computerChoice} - COMPUTER WINS') | ||
print("Try! Next Time") | ||
|
||
else: | ||
print("ooooooohh - GAME DRAW") | ||
|
||
again = input("You want to play again yes/no: ") | ||
match again: | ||
case 'yes': | ||
rounds += 1 | ||
case 'no' : | ||
rounds += 0 | ||
print("ROUNDS OVER") | ||
exit() | ||
|
||
|
||
|
||
|
||
|