Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def getName():
- pass
- def playGame(str1, str2):
- pass
- #Main Program
- #Input
- player_1 = input("Enter the first’s player name: ")
- player_2 = input("Enter the first’s player name: ")
- #Start
- print("Start Game")
- count = 1
- player_1_score = 0
- player_2_score = 0
- mylist = ["Rock", "Paper", "Scissor"]
- while True:
- #Print Round
- print(" Round %s:"%count)
- #Random Hand
- hand_1 = random.choice(mylist)
- hand_2 = random.choice(mylist)
- if hand_1 == "Rock":
- if hand_2 == "Scissor":
- player_1_score += 1
- elif hand_2 == "Paper":
- player_2_score += 1
- elif hand_2 == "Rock":
- pass
- elif hand_1 == "Scissor":
- if hand_2 == "Paper":
- player_1_score += 1
- elif hand_2 == "Rock":
- player_2_score += 1
- elif hand_2 == "Scissor":
- pass
- elif hand_1 == "Paper":
- if hand_2 == "Rock":
- player_1_score += 1
- elif hand_2 == "Scissor":
- player_2_score += 1
- elif hand_2 == "Paper":
- pass
- #Printer
- print(" -- %s -> %s"%(player_1,hand_1))
- print(" -- %s -> %s"%(player_2,hand_2))
- print(" %s:%s = %d:%d"%(player_1,player_2,player_1_score,player_2_score))
- #End Loop
- count += 1
- if count > 5 and (player_1_score >= 3 or player_2_score >= 3):
- break
- if player_1_score > player_2_score:
- winner = player_1
- else:
- winner = player_2
- print(" %s is the winner of the game."%winner)
- print("End Game")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement