Code is finished, program complete. Maybe just some visual enhancements.
This commit is contained in:
@@ -7,13 +7,25 @@
|
|||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
os.system('cls')
|
||||||
|
else:
|
||||||
|
os.system('clear')
|
||||||
losses = 0
|
losses = 0
|
||||||
wins = 0
|
wins = 0
|
||||||
ties = 0
|
ties = 0
|
||||||
|
|
||||||
while True:
|
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!
|
print(f'''We are going to play a game of Rock, Paper, Scissors!
|
||||||
losses: {losses} wins: {wins} ties: {ties}''')
|
losses: {losses} wins: {wins} ties: {ties}''')
|
||||||
|
|
||||||
@@ -45,26 +57,84 @@ losses: {losses} wins: {wins} ties: {ties}''')
|
|||||||
if computer_choice == player_choice:
|
if computer_choice == player_choice:
|
||||||
print('It is a tie!')
|
print('It is a tie!')
|
||||||
ties += 1
|
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':
|
elif computer_choice == 'Rock':
|
||||||
if player_choice == 'Scissors':
|
if player_choice == 'Scissors':
|
||||||
print('You lost, you chose Scissors and the computer chose rock!')
|
print('You lost, you chose Scissors and the computer chose rock!')
|
||||||
losses += 1
|
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':
|
elif player_choice == 'Paper':
|
||||||
print('You won, you chose scissors and the computer chose rock!')
|
print('You won, you chose scissors and the computer chose rock!')
|
||||||
wins += 1
|
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':
|
elif computer_choice == 'Paper':
|
||||||
if player_choice == 'Scissors':
|
if player_choice == 'Scissors':
|
||||||
print('You won, you chose Scissors and the computer chose paper!')
|
print('You won, you chose Scissors and the computer chose paper!')
|
||||||
wins += 1
|
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':
|
elif player_choice == 'Rock':
|
||||||
print('You lost, you chose rock and the computer chose paper!')
|
print('You lost, you chose rock and the computer chose paper!')
|
||||||
losses += 1
|
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':
|
elif computer_choice == 'Scissors':
|
||||||
if player_choice == 'Paper':
|
if player_choice == 'Paper':
|
||||||
print('You lost, computer chose scissors and you chose paper!')
|
print('You lost, computer chose scissors and you chose paper!')
|
||||||
losses += 1
|
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':
|
elif player_choice == 'Rock':
|
||||||
print('You won, computer chose scissors and you chose rock!')
|
print('You won, computer chose scissors and you chose rock!')
|
||||||
wins += 1
|
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()
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user