From 93133d2b37b02e700e742539083b2963dcd0e0c4 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 8 Jul 2015 00:12:08 +0200 Subject: [PATCH] see previous commit --- .idea/.name | 1 + .idea/dictionaries/andreas.xml | 8 + .idea/misc.xml | 14 + .idea/modules.xml | 8 + .idea/tamagotchi.iml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 434 +++++++++++++++++++++++ README.md | 8 +- __pycache__/pet_functions.cpython-34.pyc | Bin 3352 -> 3852 bytes __pycache__/pet_variables.cpython-34.pyc | Bin 470 -> 504 bytes pet_variables.py | 5 +- tamagotchi.py | 19 +- 12 files changed, 497 insertions(+), 14 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/dictionaries/andreas.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/tamagotchi.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0cb2ba5 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +tamagotchi \ No newline at end of file diff --git a/.idea/dictionaries/andreas.xml b/.idea/dictionaries/andreas.xml new file mode 100644 index 0000000..2c9b1f9 --- /dev/null +++ b/.idea/dictionaries/andreas.xml @@ -0,0 +1,8 @@ + + + + ingame + youngling + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9e0d244 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0ee58d6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/tamagotchi.iml b/.idea/tamagotchi.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/tamagotchi.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..fe225e7 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1436214313937 + + + 1436215250134 + + + 1436215589527 + + + 1436215655220 + + + 1436215954426 + + + 1436217085679 + + + 1436306976727 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index b3f7e05..b8facd0 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,7 @@ tamagotchi programme which shouldn't be too hard: * add a function let the user exit the game * safe the stats in a text file -##30.6.2015 - +## 30.6.2015 Time function has to be implemented otherwise the decrease.* functions won't work. It seems to work however the import time part has to go into the pet_functions.py file. Maybe I should move all the imports to that file otherwise it's not clear why they are needed. @@ -38,9 +37,10 @@ And added the time import. Things are working now like intended. However the pet doesn't get updated automatically. I currently don't know how to achieve that. I'll have to ask reddit how to do it. -##6.7.2015 - +## 06.07.2015 I've written a function to decrease the stats in the background. Means the tamagotchi can now get hungry etc. However it currently doesn't work. I don't know why atm. If you call it independently it works just fine. In addition I've cleaned up the code a bit and made sure that the stats variables don't fall under 0 because that might cause some problems in the future. + +## 07.07.2015 diff --git a/__pycache__/pet_functions.cpython-34.pyc b/__pycache__/pet_functions.cpython-34.pyc index 123e342ff064851aacefa2881d2baed25e75cd9f..82e9bea24ee693ff61ace51a2275a86d2659ab13 100644 GIT binary patch del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yZS4{9$7T6)jyM8 z0SY6iGp&nGVduqsMS`hQ5-i^o7Lq= z2$yVSVE49OVmtJCyqqLc&xWVc8JO zg+MLV?~6VPBan!19~sGNB|0+Waun5s%?g?l5G5vqOc)DMP(+@|=H&jVe0_$lF+&EZ zqlbBPG#kZvx-YVjKMrruo}wK;B9h{UNwZy)bdj-Q6Rs#ef1z*tuAwV zF;5HkycblsbsaTYPoLa4{C+QPXGV_ diff --git a/__pycache__/pet_variables.cpython-34.pyc b/__pycache__/pet_variables.cpython-34.pyc index 54a506e7dd0e7a52554c30175163380c2fee0464..06222b2628dba59c1abd9390644925b352e5e73a 100644 GIT binary patch delta 267 zcmcb{{DWEf9S<)To9LX-Dn;^Mf8%2AwAd<-dE48fY*6B~T$-TXB9 zqc{puOXBkqb5o-@L9Bv|{F3}AE)cW0B(bEl7{bm-P0T6Dh++qcC#I)D1xxeNQ;VW_ zL4p~H1qGRTsl`C`xrr6=Q1uWtR2f(tu8cX^EU_etH8;PsI5mnTEweZyiaEbL=ax`X zYIi%SwqN{b=vjMT)Ol8jsIAo0ZXRH$HSUV3WLEnbjdMq)uh zW?pJBPZ}EoKno`CU{qj~ntYQ{762mpQEdPK diff --git a/pet_variables.py b/pet_variables.py index d52c3dc..318a17f 100644 --- a/pet_variables.py +++ b/pet_variables.py @@ -12,8 +12,11 @@ max_health = 5 max_hunger = 5 max_happiness = 10 -# Pictures and symboles used ingame +# Pictures and symbols used ingame cat = "(=^o.o^=)__" mouse = "<:3 )~~~~" fish = "<`)))><" owl = "(^0M0^)" + +# programme variables +beginning_finished = False diff --git a/tamagotchi.py b/tamagotchi.py index f22c559..a232490 100644 --- a/tamagotchi.py +++ b/tamagotchi.py @@ -1,21 +1,22 @@ # import the threading module import threading -# import custom modules -# A function to nicely print out the pets stats +# import the pets_variables +import pet_variables +# a module which includes various custom functions import pet_functions -# Variable needed to skip the beginning when finished -beginning_finished = False # Beginning of the main routine which makes up the actual game. + +# thread which runs in the background to cause hunger, etc +t = threading.Thread(target=pet_functions.decrease_stats) +t.start() # Only starts if the pet is still alive. while pet_functions.is_alive(): - t = threading.Thread(target=pet_functions.decrease_stats) - t.start() - if not beginning_finished: + if not pet_variables.beginning_finished: # Let the player choose his pet and skip the beginning from then on. pet_functions.beginning() - beginning_finished = True + pet_variables.beginning_finished = True print() print() print("Your pet is currently a youngling which means it's needs a lot of attention.") @@ -32,7 +33,7 @@ while pet_functions.is_alive(): # Start the chosen activity and go back to the activity selector. chosen_activity = int(input("Choose the desired activity:")) if chosen_activity == 1: - pet_functions.feading() + pet_functions.feeding() elif chosen_activity == 2: pet_functions.playing() elif chosen_activity == 3: