From 88969757c48409323366a3f723f6d92c38c2527b Mon Sep 17 00:00:00 2001 From: Nebucatnetzer Date: Wed, 15 Jul 2015 12:30:34 +0200 Subject: [PATCH] refactoring a bit and adding the .idea and __pycache__ folder to ignore --- .README.md.swp | Bin 0 -> 12288 bytes .idea/.gitignore | 0 .pet_functions.py.swp | Bin 0 -> 16384 bytes README.md | 2 +- README_conflict-20150712-220614.md | 58 ------------------ __pycache__/.gitignore | 0 ...ns.cpython-34_conflict-20150712-140611.pyc | Bin 4110 -> 0 bytes ...es.cpython-34_conflict-20150712-140611.pyc | Bin 525 -> 0 bytes pet_functions.py | 27 ++++---- 9 files changed, 13 insertions(+), 74 deletions(-) create mode 100644 .README.md.swp create mode 100644 .idea/.gitignore create mode 100644 .pet_functions.py.swp delete mode 100644 README_conflict-20150712-220614.md create mode 100644 __pycache__/.gitignore delete mode 100644 __pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc delete mode 100644 __pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc diff --git a/.README.md.swp b/.README.md.swp new file mode 100644 index 0000000000000000000000000000000000000000..7ee7870862f72dbd0be8ea4ff53c683a9bbb638e GIT binary patch literal 12288 zcmeHN&x;&I6t0L-qejIX^dgi7Srd}k$?p(RNHEb62ZC9D;3d>_S9e#oyQ-Qa7PSuzBqpVAUk#P#F*?3Kl3y{^!OWh zC7xjQs$-3+xAO9%Sr2;3_Z%etnp+pMbZ4w}4lH{lHfbG1dW>fQ!H(;Kv6U z`xJ1%6nG7I5%}u>_5eNv3P1u+0Y5*$*!RG9z?VP=Yy!9LXY4cJ9pFje3E%*5^FGFQ z0Sz?3b>Il_C-VLlp!`234$@CzATf{__&*tVg?`Lj?nujpZ@BV2H`3`1&*#Q&bK$ts zUg})tBR1h8$1ikoF6){LUUWM1%4p8#mC7nUSGZhD&wV9%i%(Ze*}}5m3)At|Y)kG9 zZ-icOuNn#O*ocfuEEc-7ixImRHX#p7_pph!y<5EAwX}4t6x$FQZq_B(FrG=FAQ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K=VzH7ry4n3T*fWV@(9al!|xC?}z!U52HXK!EGDUDLKL3oYm(dyyicSi0|P zhK1+mvFn9)7$hnagH!yV94()63Q4uyH^g>7&2W%HauvfKQNgF_BXS(RiPzbdqTCVl zOWm+d>6{NOWH=k^L1IMBRv!5v74hplik%7F2}~tre(gaq=R9n=Wu4|T(}lsq|I)z) z`SGyjMFG|_;@@iJcx9SZdKH{&sdvMLvP8>W#Uu-r%ntuH$zrrmM^x+rq%oX{)^-`= z4vHpAnLEgiP$;DXOqaC^X;;x_cS=SXqlc!jS$IJjFfFylmgv9(lWXAFhApO-(y9!w zsz?qp4>1x~x(cK%nP(x{4Cs4ip!FV`nqz6GGQZTY82}oodu@82Kr7cwRL<|s6?P(c z&Va9=RV3YUyh-#%sY#_{X?|tK+gr~rHT^|mqH+9}vp~-+l z(7Ao=L5bh99!uBMT^XZiD^4p~v|9KhWQL~&M#&?Sf3RnIsDR$v+T^mDQpDjTJziL) z2MhQ!WjbWfEgCk!+H#HMgl^0hP(fc`2BF;ZUcak?H7Q&mtvws6Ji& zM%3M$jNE(`Wi@$ED@{9sV^NAoh^#V`l}kcIX=qN`YC75xoxMqK$1p+mBubl!t*msb z(-JiMWEoc7tU~Fiig^-~NbARo`I+pI7u!xx0}CDN?@2VH{ph1OK>B8qVM+w)X|zUl n1}V#!*)d%Alf!kIu`Z8|XvyANcR+gf*J()?8qtigjs@r6CTFqB literal 0 HcmV?d00001 diff --git a/README.md b/README.md index dc7b0ed..530d9d4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ funciton more readable * add a function which lets the tamagotchi age (one week as a youngling, three weeks as an adult and two weeks as an elderly) ## 30.6.2015 -Time function has to be implemented otherwise the decrease.* functions +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. diff --git a/README_conflict-20150712-220614.md b/README_conflict-20150712-220614.md deleted file mode 100644 index 4ad6fd9..0000000 --- a/README_conflict-20150712-220614.md +++ /dev/null @@ -1,58 +0,0 @@ -# tamagotchi - -## Todo -* adding a function to decrease the health - -## Possible things to add -Some interesting things I could add to the -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 -* 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 -* decrease the hunger value after x seconds -* add sleep function, you have to switch the lights off otherwise it will have nightmare and loose one health point. -* add the possibility to get sick. Maybe compare two random numbers. -* add a function to restart the game or exit it after the pet died. -* add a function let the user exit the game -* safe the stats in a text file -* make a seperate function for each age because it makes the aging -funciton more readable -* add a function which lets the tamagotchi age (one week as a youngling, three weeks as an adult and two weeks as an elderly) - -## 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. - -Moved all the imports to there relevant place -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. - -## 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 -I've fixed the decrease_stats function. However I wanted that it only -starts after the beginning is finished. So that the pet doesn't start -with a disadvantage. I currently don't know how to fix this. For the -moment it will work like this. I could add a function to the beginning -which resets the stats back to the default values. Might be a good work- -around however for the future I would like how to do it properly. - -## 08.07.2015 -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 -too easy. - diff --git a/__pycache__/.gitignore b/__pycache__/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc b/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc deleted file mode 100644 index abf2279947e0804f7bf0756bf318b7a2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OZ_ZWk?-q7p++R?Ada<) z;-l zoA5aM={HksLJsB=&7jXryRGaNB5NjnqF#`wqu3xSr+Po9R{6lLQ^Z#bsu^wzd2{GJ z?M^D)qQGT!n`}wplUSXLH7Oesa5WF{)_)(Yk~gt%rC69;O%$&AJ97p5X9wJQ?7;Iy z@ml8?klw!M+PjipWzFJ>c%~Z5LDb{A>vspD@D2zQj%TvWJ6O*a>td%6%d1U?;C|%= zMWRXImAX_48?t-NTfCfAMAv2tl?J^B+JwWEkd5Xl{=WsSq^e&A?=!WUGm|v8pM!9w z(zTbW#3r2jhnvgg^46w{g}X{CRf<0I4c(^wQ*Qg^OrK@TuzSun(f_HBxb94^&Gad~ z_US2=-u<>zdTBRao~a}*`}~wX-+QS(cd+yHN2Qx4jTu88q7Qu+6CEo0p+)c$<~hM) zpu^_l3gP=e8Yg_oZA1nK*U77CfB~wOguXu#=M;$`Ny&;Bw$7Pxw={hSnQrz$mv9Xt ztAZlopiDTH*~0zV?&dazD0^YNm?)WTeio0f8ed_Ciw{wbP>g-G@AVE(Dx!heJ_ZTv^b91uD4w4kH-t;VHByZY*fn)rb4I}R1Yv8K7(S6ls6em zg2^eWSGIC*%(mn>+8qz~eUmj1W9le~HnIzVjOq&kI&T`sY7q1Xnez#t5aUDh9$qvQ zW(Bk1*7AD7H7+$`!*x7nVPUTSuHC5#pWN!dV8l`A9mCA92qhP=kX1*X6jR)y-Le+# zCC-{3FrW1z6E^{O>im`%4-K2v@Ca{S=Y`)747X@=gBO00kbz#tKxxh5VChSSJ3*1* zlG2jgoSqWU;zf}=r}JzgXxtpen9Tg!9PbIAXPs9nb?A@FUaqvxwHmEeT-8=>ayhMK H+%^6OyRs?Z diff --git a/__pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc b/__pycache__/pet_variables.cpython-34_conflict-20150712-140611.pyc deleted file mode 100644 index 4456677c5c8a834e8c4c3c4f80a45650ab67ab72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 525 zcmY+9u};G<5QZ;Jn=~l}!~-BkvJfOTR4N2gH&_tM4GpGt^uY`1FuxE zF?Hbqm~h+*!CCj|zhAoZ-Pcw>{CIo4eQ^Lj;ZK+v&P^(6U=j@-KnG|Gum#iwbb+=3 z+g5ihJ?r>ZcP#^;9l#K%2iODZ18&(leV|>yZJ+_*4$u&8q8@sqyq-?y3x9AIMbU78 z!CclN%`=g%I%bWPNmzvji{9bcSRTpoS(GG;U~qbJ5Ivh%_=n@;tK)Grx{h|STQZ#p zQZNh}RdT5%hK*F3=vu8cXC&7g{l+IL+nDBGR$;#}IVsCbFr~1!?v(|Za10Cblx&*U zdedY5-yU~DG diff --git a/pet_functions.py b/pet_functions.py index 71818ae..37f29f3 100644 --- a/pet_functions.py +++ b/pet_functions.py @@ -31,11 +31,8 @@ def pet_stats(): # A function which checks if the pet is still alive def is_alive(): - if pet_variables.pet_health > 0: - return True - else: - return False - + return pet_variables.pet_health > 0: + # A function which let's the player choose his pet. def beginning(): @@ -60,7 +57,7 @@ def set_youngling_stats(): pet_variables.max_health = 10 pet_variables.max_happiness = 8 pet_variables.max_hunger = 7 - + def set_adult_stats(): pet_variables.max_health = 10 pet_variables.max_happiness = 8 @@ -70,7 +67,7 @@ def set_elderly_stats(): pet_variables.max_health = 7 pet_variables.max_happiness = 5 pet_variables.max_hunger = 10 - + def reset_stats(): pet_variables.pet_health = pet_variables.max_health pet_variables.pet_happiness = pet_variables.max_happiness @@ -93,40 +90,40 @@ def aging(): def increase_hunger(): if pet_variables.pet_hunger < pet_variables.max_hunger: - pet_variables.pet_hunger = pet_variables.pet_hunger + 1 + pet_variables.pet_hunger += 1 def increase_poke_count(): - pet_variables.poke_count = pet_variables.poke_count + 1 + pet_variables.poke_count += 1 def increase_happiness(): if pet_variables.pet_happiness < pet_variables.max_happiness: - pet_variables.pet_happiness = pet_variables.pet_happiness + 1 + pet_variables.pet_happiness += 1 def increase_health(): if pet_variables.pet_health < pet_variables.max_health: - pet_variables.pet_health = pet_variables.pet_health + 1 + pet_variables.pet_health += 1 def decrease_hunger(): if pet_variables.pet_hunger > 0: - pet_variables.pet_hunger = pet_variables.pet_hunger - 1 + pet_variables.pet_hunger -= 1 def decrease_happiness(): if pet_variables.pet_happiness > 0: - pet_variables.pet_happiness = pet_variables.pet_happiness - 1 + pet_variables.pet_happiness -= 1 def decrease_health(): if pet_variables.pet_health > 0: - pet_variables.pet_health = pet_variables.pet_health - 1 + pet_variables.pet_health -= 1 def decrease_poke_count(): - pet_variables.poke_count = pet_variables.poke_count - 1 + pet_variables.poke_count -= 1 # The function to decrease the stats and make the pet "live" needs to