tomecarr
New Coder
#rock paper scissors gmae python
import random
import time
rock=1
paper=2
scissors=2
name ={rock: "Rock", paper: "Paper", scissors: "Scissors"}
rules ={ rock: scissors, paper: rock, scissors: paper }
player_score=0
computer_score=0
def start():
print("Let's play the game of rocks scissors paper")
while game():
pass
scores()
def game():
player=move()
computer = random.randint(1,3)
result=(player, computer)
return play_again()
def move():
while True:
print
player = input("Rock=1\Ppaer=2\Scissors=3\Make a move:")
try:
player=int(player)
if player in (1,2,3):
return player
except ValueError:
pass
print ("Opss! Please enter 1, 2 or 3")
def reslut(player, compputer):
print("1...")
time.sleep(1)
print("2...")
time.sleep(1)
print("3!")
time.sleep(0.5)
print("Computer threw {0}!").format(names[computer])
global player_score, computer_score
if player_score==computer_score:
print("Tie game!")
else:
if rules[player] == computer:
print("Your victory has been assured")
player_score +=1
else:
print("Loser")
computer_score +=1
def play_again():
answer= input("Queres jogar outra vez? y/n:")
if answer in ("y", "Y", "Yes", "sim", "claro"):
return answer
else:
print("thank you for playing out game")
def scores():
global player_score, computer_score
print("High Scores")
print("player:",player_score)
print("computer:",computer_score)
if name == '_main_':
start()
import random
import time
rock=1
paper=2
scissors=2
name ={rock: "Rock", paper: "Paper", scissors: "Scissors"}
rules ={ rock: scissors, paper: rock, scissors: paper }
player_score=0
computer_score=0
def start():
print("Let's play the game of rocks scissors paper")
while game():
pass
scores()
def game():
player=move()
computer = random.randint(1,3)
result=(player, computer)
return play_again()
def move():
while True:
player = input("Rock=1\Ppaer=2\Scissors=3\Make a move:")
try:
player=int(player)
if player in (1,2,3):
return player
except ValueError:
pass
print ("Opss! Please enter 1, 2 or 3")
def reslut(player, compputer):
print("1...")
time.sleep(1)
print("2...")
time.sleep(1)
print("3!")
time.sleep(0.5)
print("Computer threw {0}!").format(names[computer])
global player_score, computer_score
if player_score==computer_score:
print("Tie game!")
else:
if rules[player] == computer:
print("Your victory has been assured")
player_score +=1
else:
print("Loser")
computer_score +=1
def play_again():
answer= input("Queres jogar outra vez? y/n:")
if answer in ("y", "Y", "Yes", "sim", "claro"):
return answer
else:
print("thank you for playing out game")
def scores():
global player_score, computer_score
print("High Scores")
print("player:",player_score)
print("computer:",computer_score)
if name == '_main_':
start()