Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def computer_random_number():
- random_number = random.randint(1, 3)
- return move_options.get(random_number)
- def moves_input():
- player_input = input("Rock, Paper or Scissors: ").lower()
- if player_input not in move_options.values():
- print("Are you crazy? That's an invalid move..")
- player_input = input("CHOOSE ROCK, PAPER OR SCISSORS' YOU IMBECILE: ")
- return player_input
- def game():
- if player_move == comp_move:
- print("tie")
- elif (player_move, comp_move) in winning_moves_index:
- print("Well Done!")
- else:
- print("computer wins")
- print(f'\n Player Chose: {player_move}, Computer Chose: {comp_move}\n')
- print(f'Computer Score: {computer_score}, \nPlayer Score: {player_score}')
- move_options = {1: "rock", 2: "paper", 3: "scissors"}
- winning_moves_index = ("rock", "scissors"), ("paper", "rock"), ("scissors", "paper")
- player_score = 0
- computer_score = 0
- max_score = 5
- while True:
- comp_move = computer_random_number()
- player_move = moves_input()
- moves_index = (player_move, comp_move)
- game()
- if player_move == "rock" and comp_move == "scissors":
- player_score = player_score + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement