rps/rps.py
2024-01-12 08:49:33 -05:00

51 lines
1.2 KiB
Python

import random
print('Rock Paper Scissors\n------------------------')
moves = ['Rock!', 'Paper!', 'Scissors!']
player_input = input('Your move, sir?\n')
computer_move = random.choice(moves)
match (player_input[0].lower()):
case 'r':
player_move = moves[0]
case 'p':
player_move = moves[1]
case 's':
player_move = moves[2]
case _:
player_move = 'Invalid'
print('You threw:', player_move)
print('Computer threw:', computer_move)
if player_move == computer_move:
print('Tie!')
elif player_move == moves[0] and computer_move == moves[1]:
print('Paper covers rock, Computer wins!')
elif player_move == moves[1] and computer_move == moves[0]:
print('Paper covers rock, You win!')
elif player_move == moves[0] and computer_move == moves[2]:
print('Rock smashes scissors, You win!')
elif player_move == moves[2] and computer_move == moves[0]:
print('Rock smashes scissors, Computer wins!')
elif player_move == moves[1] and computer_move == moves[2]:
print('Scissors cut paper, Computer wins!')
elif player_move == moves[2] and computer_move == moves[1]:
print('Scissors cut paper, You win!')
else:
print('Error')