adding various comments to explain what the functions are doing

This commit is contained in:
Andreas Zweili 2015-07-12 22:02:49 +02:00
parent dd97541335
commit 6c58cdd9c4
2 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,6 @@
Some interesting things I could add to the Some interesting things I could add to the
tamagotchi programme which shouldn't be too hard: tamagotchi programme which shouldn't be too hard:
* poke it to make it speak, pokes let it loose a happiness point
* sleeping with all values with over 50% full heals the pet if it has lost health * sleeping with all values with over 50% full heals the pet if it has lost health
* add pooping and cleaning function * add pooping and cleaning function
* let it get sick if it's health is low, by random chance or if there's too much poop * let it get sick if it's health is low, by random chance or if there's too much poop
@ -56,3 +55,6 @@ The feature to the pet the pet will be so that it only prints a message.
It wouldn't be fun if it would increase happiness because that would be It wouldn't be fun if it would increase happiness because that would be
too easy. too easy.
## 12.07.2015
Added the function to poke the pet and it will speak.
If you poke to many times it will get angry.

View File

@ -15,7 +15,9 @@ from pygame import mixer
# variables needed for the guessing game # variables needed for the guessing game
secret = randint(1, 10) secret = randint(1, 10)
### Functions providing the basic function of the programm
# a function which displays the pet's stats in a nice way.'
def pet_stats(): def pet_stats():
os.system('clear') os.system('clear')
print(pet_variables.pet_name) print(pet_variables.pet_name)
@ -69,6 +71,7 @@ def aging():
print("Congratulation your pet has become an elderly it needs now less food.") 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.") print("However it's health is worse and it's grumpier than an adult.")
### Functions to increase and decrease stats ###
def increase_hunger(): def increase_hunger():
pet_variables.pet_hunger = pet_variables.pet_hunger + 1 pet_variables.pet_hunger = pet_variables.pet_hunger + 1
@ -117,10 +120,8 @@ def decrease_stats():
### Activities ### ### Activities ###
# Increases the pets hungriness by +1 unless the hunger is bigger than # A function which simulates stroking it doesn't have any
# the pet's maximum hunger. In this case the pet will vomit and looses hunger # effect on the pet.
# and health.
def stroking(): def stroking():
os.system('clear') os.system('clear')
print() print()
@ -128,6 +129,9 @@ def stroking():
print("It makes comforting noises and leans against your hand.") print("It makes comforting noises and leans against your hand.")
time.sleep(1) time.sleep(1)
# Increases the pets hungriness by +1 unless the hunger is bigger than
# the pet's maximum hunger. In this case the pet will vomit and looses hunger
# and health.
def feeding(): def feeding():
os.system('clear') os.system('clear')
print("Hungriness of " + pet_variables.pet_name + ": " + pet_variables.pet_hunger * "*") print("Hungriness of " + pet_variables.pet_name + ": " + pet_variables.pet_hunger * "*")