diff --git a/wip_rock-paper-scissors.py b/wip_rock-paper-scissors.py index c1950f1..dab8b6b 100644 --- a/wip_rock-paper-scissors.py +++ b/wip_rock-paper-scissors.py @@ -7,13 +7,25 @@ import random import sys import time +import os +import platform +if platform.system() == "Windows": + os.system('cls') +else: + os.system('clear') losses = 0 wins = 0 ties = 0 while True: + if platform.system() == "Windows": + os.system('cls') + else: + os.system('clear') + + print(f'''We are going to play a game of Rock, Paper, Scissors! losses: {losses} wins: {wins} ties: {ties}''') @@ -45,26 +57,84 @@ losses: {losses} wins: {wins} ties: {ties}''') if computer_choice == player_choice: print('It is a tie!') ties += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() elif computer_choice == 'Rock': if player_choice == 'Scissors': print('You lost, you chose Scissors and the computer chose rock!') losses += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() elif player_choice == 'Paper': print('You won, you chose scissors and the computer chose rock!') wins += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() + + + elif computer_choice == 'Paper': if player_choice == 'Scissors': print('You won, you chose Scissors and the computer chose paper!') wins += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() + + elif player_choice == 'Rock': print('You lost, you chose rock and the computer chose paper!') losses += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() + + elif computer_choice == 'Scissors': if player_choice == 'Paper': print('You lost, computer chose scissors and you chose paper!') losses += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() + + elif player_choice == 'Rock': print('You won, computer chose scissors and you chose rock!') wins += 1 + rematch = input('Would you like to play another game? (Y/N)\n>') + if rematch == 'y' or rematch == 'Y': + continue + elif rematch == 'n' or rematch == 'N': + print(f'''OK, thanks for playing! The final score: +wins: {wins}, losses: {losses}, ties: {ties}''') + sys.exit() \ No newline at end of file