-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkmn_rps.py
74 lines (64 loc) · 2.18 KB
/
pkmn_rps.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Players 1 and 2 enter pokemon types and whosever type is supereffective wins!
# import random for AI
import random
# Currently, only options are fire, water, grass.
pokemon_types = ["fire", "water", "grass"]
# initialize game tracker and scores
tracker = 1
score1 = 0
score2 = 0
while tracker < 6 and score1 < 3 and score2 < 3:
print(f"Game {tracker}")
# Player 1 chooses valid type
player1 = input("Player 1, choose your starter type! \n").lower()
while player1 not in pokemon_types:
player1 = input("Player 1, choose a valid starter type! \n").lower()
# no cheating space
print("\n" * 100)
# Player 2 chooses valid type or AI
player2 = input("Player 2, choose your starter type or AI! \n").lower()
while player2 not in pokemon_types and not "ai":
player2 = input("Player 2, choose a valid option! \n").lower()
if player2 == "ai":
player2 = random.choice(pokemon_types)
print(f"Player 2 chose {player2}")
print("...")
# outcome determined
# Player1 choose fire
if player1 == "fire":
if player2 == "fire":
print("A tie! Explosive!")
elif player2 == "water":
print("Washed away! Player 2 wins!")
score2 += 1
else:
print("Brunt to a crisp! Player 1 wins")
score1 += 1
# Player 1 chooses water
elif player1 == "water":
if player2 == "fire":
print("Washed away! Player 1 wins!")
score1 += 1
elif player2 == "water":
print("A Tie! Blub blub!")
else:
print("Soaked up! Player 2 wins!")
score2 += 1
# Player 1 chooses grass
else:
if player2 == "fire":
print("Brunt to a crisp! Player 2 wins")
score2 += 1
elif player2 == "water":
print("Soaked up! Player 1 wins!")
score1 += 1
else:
print("A tie! The grass is always greener!")
print(f"Scores: \n Player 1: {score1} \n Player 2: {score2}")
tracker += 1
if score1 > score2:
print("And the winner is Player 1!")
elif score1 < score2:
print("And the winner is Player 2!")
else:
print("It's a draw!")