123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import random
- print("Wellcome to the Rock-Paper-Scissors Game")
- rock = '''
- _______
- ---' ____)
- (_____)
- (_____)
- (____)
- ---.__(___)
- '''
- paper = '''
- _______
- ---' ____)____
- ______)
- _______)
- _______)
- ---.__________)
- '''
- scissors = '''
- _______
- ---' ____)____
- ______)
- __________)
- (____)
- ---.__(___)
- '''
- signs = [rock, paper, scissors]
- def res_print(res):
- if res == "win":
- print("==== You win! ====\n")
- elif res == "lose":
- print("==== Computer wins ====\n")
- elif res == "draw":
- print("==== It's a draw ====\n")
- else:
- print("Something went wrong! End of the game")
- def game():
- comp_choise = random.randint(0, 2)
- while True:
- your_choise = int(input("Choose you destiny. Rock - 0, papper - 1, scissors - 2: "))
- if your_choise >= 0 and your_choise <= 2:
- break
- print("Your chose: \n" + signs[your_choise])
- print("Computer chose: \n" + signs[comp_choise])
- if comp_choise == your_choise:
- res_print("draw")
- else:
- if comp_choise == 0:
- if your_choise == 1:
- res_print("win")
- else:
- res_print("lose")
- elif comp_choise == 1:
- if your_choise == 0:
- res_print("lose")
- else:
- res_print("win")
- else:
- if your_choise == 0:
- res_print("win")
- else:
- res_print("lose")
- game()
- while True:
- if input("Play again? Y/N: ").lower() == "y":
- game()
- else:
- break
|