forked from TinkerYpsi/WS_IntroPython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntroPy2.py
86 lines (78 loc) · 2.93 KB
/
IntroPy2.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
75
76
77
78
79
80
81
82
83
84
85
86
import random
print("Welcome to my game!\n")
userName = input("What is your name? ")
print("\nWelcome, " + userName + "!")
print("\nLet's select some character stats for you...")
randomSeed = input("Pick a number from 1 to 1000: ")
randomSeed = int(randomSeed)
random.seed(randomSeed)
# Starting ranges for character traits
minInitialHealth = 10
maxInitialHealth = 30
minInitialTrait = 1
maxInitialTrait = 10
# Select random character traits
health = random.randint(minInitialHealth, maxInitialHealth)
charisma = random.randint(minInitialTrait, maxInitialTrait)
strength = random.randint(minInitialTrait, maxInitialTrait)
dexterity = random.randint(minInitialTrait, maxInitialTrait)
intelligence = random.randint(minInitialTrait, maxInitialTrait)
print("Here's how you turned out:")
print("Health: " + str(health))
print("Charisma: " + str(charisma))
print("Strength: " + str(strength))
print("Dexterity: " + str(dexterity))
print("Intelligence: " + str(intelligence))
move = input("Would you like to attack, charm, manipulate, or run away?")
print("Heads or tails?")
guess = input("H or T:")
if guess is "H":
guess = int(1)
else:
guess = int(0)
chance = random.randomint(0, 1)
if guess == 1:
if chance == 1:
print("Heads! You guessed correctly!")
else:
print("Oof! It was tails.")
else if guess == 0:
if chance == 0:
print("Tails! You guessed correctly!")
else:
print("Oof! It was heads.")
randomNum = random.randomint(1, 10)
if move == "run away":
if dexterity > oppDexterity:
if guess == chance:
if randomNum > 3:
print("With your clearly superior dexterity, you managed to outmaneuver your opponent")
print("+2 dexterity")
print("+2 health")
dexterity += 2
health += 2
else:
print("Even with your greater dexterity and luck, you managed to trip and fall :(")
print("-2 health")
health -= 2
else:
if randomNum > 7:
print("You defied the odds! Even with your terrible luck, you outran your opponent")
print("+1 dexterity")
dexterity += 1
else:
print("Today is not your lucky day. While running away, you slipped and hit your head on the table")
print("-15 health")
health -= 15
else:
if guess == chance:
if randomNum > 7:
print("Today is clearly your lucky day. Even though your opponent has the legs of a cheetah, you managed to outmaneuver him. Well done!")
print("+2 dexterity")
print("+5 health")
dexterity += 2
health += 5
else:
print("It almost looked like you were getting away, but then you tripped on a cord and now you have a black eye :(")
print("-5 health")
health -= 5