forked from 1337w0rm/BVEC-Hacktoberfest-2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.py
57 lines (50 loc) · 1.52 KB
/
game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Simple Game of Rock, Paper, Scissors...
from random import randint
player_wins = 0
AI_wins = 0
print("Hello Player!")
win_score = int(input("Enter the winning score (e.g. 3): "))
while player_wins < win_score and AI_wins < win_score:
print(f"Your Score: {player_wins} AI Score: {AI_wins}")
player = input("\n(Choose Rock, Paper or Scissors...or Enter q to exit...): ").lower()
if player == "quit" or player == "q":
break
random_num = randint(0, 2)
if (random_num == 0):
computer = "rock"
elif (random_num == 1):
computer = "paper"
else:
computer = "scissors"
print(f"The AI plays: {computer}")
if player == computer:
print("It's a tie!")
elif player == "rock":
if computer == "paper":
print("AI wins!")
AI_wins += 1
else:
print("YOU win!")
player_wins += 1
elif player == "paper":
if computer == "rock":
print("YOU win!")
player_wins += 1
else:
print("AI wins!")
AI_wins += 1
elif (player == "scissors"):
if (computer == "rock"):
print("AI wins!")
AI_wins += 1
else:
print("You win!")
player_wins += 1
else:
print("Invalid Entry!")
if player_wins > AI_wins:
print("CONGRATS, YOU BEAT THE AI!")
elif player_wins == AI_wins:
print("YOU'VE MADE FRIENDS WITH THE AI!")
else:
print("YOU LOST AGAINST THE AI! Prepare for World Domination :(")