apparently a comment starts with "# " not just with "#"

This commit is contained in:
Andreas Zweili 2015-07-06 22:46:29 +02:00
parent 6bbd3c3a32
commit 395d072d0f
2 changed files with 45 additions and 35 deletions

View File

@ -10,6 +10,7 @@ owl = "(^0M0^)"
# variables needed for the guessing game
secret = randint(1, 10)
def pet_stats():
print(pet_variables.pet_name)
print(pet_variables.pet_photo)
@ -19,6 +20,7 @@ def pet_stats():
print("Hunger: " + pet_variables.pet_hunger * "*")
print("Happines: " + pet_variables.pet_happiness * "")
# A function which checks if the pet is still alive
def is_alive():
if pet_variables.pet_health > 0:
@ -26,6 +28,7 @@ def is_alive():
else:
return False
# A function which let's the player choose his pet.
def beginning():
print("Which pet do you want to look after?")
@ -40,6 +43,7 @@ def beginning():
elif chosen_pet == 4:
pet_variables.pet_photo = owl
# A cunction which changes the status of the pet depending of the age value.
# Each status has it's own characteristics.
def aging():
@ -62,24 +66,28 @@ def aging():
print("Congratulation your pet has become an elderly it needs now less food.")
print("However it's health is worse and it's grumpier than an adult.")
def decrease_hunger():
pet_variables.pet_hunger = pet_variables.pet_hunger - 1
def decrease_happiness():
pet_variables.pet_happiness = pet_variables.pet_happiness - 1
def decrease_health():
pet_variables.pet_health = pet_variables.pet_health - 1
def decrease_stats():
while True:
time.sleep(15)
if not pet_variables.pet_hunger == 0:
decrease_hunger()
else:
if pet_variables.pet_hunger <= 0:
decrease_health()
decrease_happiness()
# Increases the pets hungriness by +1 unless the hunger is bigger than
# the pet's maximum hunger. In this case the pet womits and looses hunger
# and health.
@ -90,6 +98,7 @@ def feading():
if feading_confirmed in ("Y", "y"):
pet_variables.pet_hunger = pet_variables.pet_hunger + 1
# A simple guessing game which increases the pet's happiness
def playing():
pet_variables.pet_happiness

View File

@ -20,9 +20,10 @@ while pet_functions.is_alive():
print()
print("Your pet is currently a youngling which means it's needs a lot of attention.")
print("Take good care of it or it will die very soon.")
#Each round print the pets stats so that the player can see them.
# checks if the pet has reached a new life stage and updates it accordingly
pet_functions.aging()
print()
# Each round print the pets stats so that the player can see them.
pet_functions.pet_stats()
print()
# Present the player with activities to choose from