From 17e3432c350f602c789f3955f16519f1cf82b8ec Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 14 Jul 2015 23:12:32 +0200 Subject: [PATCH 1/2] commiting changes --- __pycache__/pet_functions.cpython-34.pyc | Bin 5386 -> 6113 bytes pet_functions.py | 41 +++++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/__pycache__/pet_functions.cpython-34.pyc b/__pycache__/pet_functions.cpython-34.pyc index 4a96bb7f7df09adec16da486dd1291ff706bd81a..431919a929c7628b240e6578021662afdab966e3 100644 GIT binary patch delta 1767 zcmb7EO>Y}T7@o0r*K2#6b?h`GO+vSEzBVDTlQ=0Pq)nrO5E2H2P@yVBR(DAg8{3`T z04axnQgPsfGDidwhl(pGCy=O+xF9Ni14W#ApsM%)D7ca7)H&|By^Vr-o=KcS5T^OM?0GM~{_qb5z-cHai12s}e( z)laD@^^bjOBn+bUo%VKXqq*7ISP!Fm6fV=A&>~zM&wW&=%ltpa?~;9`ZcqkIKakCxnDmAJkWPa1 z^$GG)JGbJd>W*&3?KHIC)UCDR*7BN{I#FOZlF(HaVT}O_ir9y;G627B@5|(VRIK2F z%PH{gcE}s^(mWdpCKr$A870{s4I?rz**zXxhPGOZhf$`EYBJx_8B*rvQB>+E%8sK* zHIPQSCOzW4V%7}| z$!Qd&R?{n10fCtM1bz%UJ=Pj|K3Y~^iT>FH+cI(Z8k|W|h!uC6T1|Q1NHY4ntec#u zNlsCotsaQJ{5+Xb_hbQ96p!FnEhSJa&2@fmg1shs-yP(s@zixg;(-ryhy76naPUUFAQhnOz^A=v8|3y=STHN zVU%A&!hBPmDY~^o;hJoV^huav1HQo;29q@wkt!+kh;A;@Ea|(IVR)dHLhMPlMaqvg ztUGF}o#OB=jy$A7pL-W>&cEH>mTo7A+z;E0z}@b+?*#$wG?$KE6!>nv<-40Lx9)DV z+rIlg!OYFxqoC{cPzSasaz@gH&Ahb4jVaRrUH5UZxYJUH=X+HQRqU`C1RY}gomN5| z9Si~|qL;>zOVBuQ-FQ#OXX~7*_LO!nkVp0co&uZ&j05z6n}jt5mdFILHkY4~HUgMI@DXMcAkTuIV9i7Vd_xNc_@)+2 z@GUJ6Cc#g_eFS7FrKQGMHZoIMGd%%6quq%qjw2@AWQw_mV=DU}RW_yq@PU#P7uGFG z@Um6+7w00$@_L#fMX+>Qy~%W`6PaI5N@htRa}2IJne0JZ-QBUX&#F&OHztQj9d-}^ zdYIW5Hah>UWJQ&-BdXJBSFeSgUu;YU@;nD7bfBz~dC|GJP18%7R`o7BirxG&RTKqp zob9HL$fNAr@EFD>^(VQTh&{Zl^4V^ca!;zVQ}HIY{5_O4?a#Iqr&mw~Hn}|YJljD* zQ{MD8CCUK`=u$7;cI?q9e0H0i277EIJ;;R1XGn8?M@bC{yx(UgaE9lm-WlLt8VAjP)s3M08NOWnN3 zLADNZ$l0bLkEk!X)#OojKBk^GRj{f)HTAbV-tJmLK|>C$xcM%`K6R+jjZf9p!X6w} z%Z2aQrskUuVyAl1d_LF1O#BWh7<$#8=FV)K3$OKN(#ab-pI7Q!%U&GelyO`=YAFpx z2FzH{?i(;`f*b-WIo%+>EDc*PsN(U>nMrM4BVF2*`rXpm!^daI9pkFfc1yPw}Sy3?PqC#LHGGEOGg;^s>xx75r$LLxvoKu e6A5ADc$%Iigh-1fQ4l5#>)%KUS7b$o^o74huHF;? diff --git a/pet_functions.py b/pet_functions.py index c0ebe50..da04fd7 100644 --- a/pet_functions.py +++ b/pet_functions.py @@ -55,19 +55,36 @@ def beginning(): # A function which changes the status of the pet depending of the age value. # Each status has it's own characteristics. + +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 + pet_variables.max_hunger = 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 + pet_variables.pet_hunger = pet_variables.max_hunger + def aging(): if pet_variables.pet_age == 5: pet_variables.pet_status = "adult" - pet_variables.max_health = 10 - pet_variables.max_happiness = 8 - pet_variables.max_hunger = 7 + set_adult_stats() print("Congratulation your pet has become an adult. It needs less food now") print("and it's health has improved however it's grumpier than a youngling.") elif pet_variables.pet_age == 15: pet_variables.pet_status = "elderly" - pet_variables.max_health = 7 - pet_variables.max_happiness = 5 - pet_variables.max_hunger = 10 + set_elderly_stats() 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.") @@ -75,7 +92,8 @@ def aging(): ### Functions to increase and decrease stats ### def increase_hunger(): - pet_variables.pet_hunger = pet_variables.pet_hunger + 1 + if pet_variables.pet_hunger < pet_variables.max_hunger: + pet_variables.pet_hunger = pet_variables.pet_hunger + 1 def increase_poke_count(): @@ -117,7 +135,6 @@ def decrease_stats(): while True: time.sleep(pet_variables.day) decrease_hunger() - decrease_poke_count() if pet_variables.pet_hunger <= 0: decrease_health() decrease_happiness() @@ -168,7 +185,7 @@ def playing(): # if you poke it more than 3 times it will get angry at you def poking(): os.system('clear') - if pet_variables.poke_count < 4: + if pet_variables.poke_count < 3: print("You poke " + pet_variables.pet_name + " and it starts to speak.") increase_poke_count() mixer.init() @@ -188,8 +205,10 @@ def poking(): def sleeping(): os.system('clear') print("Your pet is sleeping now.") + time.sleep(10) if pet_variables.max_hunger / pet_variables.pet_hunger > 0.5: - print("Sleeping works") + reset_stats() + print("Your pet woke up feeling rested and in a good mood.") else: - print("Something is broken") + print("Your pet has woken up.") time.sleep(3) From f75423fb3745191e75fc848072dd7ce93bb3d018 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 14 Jul 2015 23:14:44 +0200 Subject: [PATCH 2/2] owncloud sync error --- README_conflict-20150712-220614.md | 58 ------------------ ...ns.cpython-34_conflict-20150712-140611.pyc | Bin 4110 -> 0 bytes ...es.cpython-34_conflict-20150712-140611.pyc | Bin 525 -> 0 bytes 3 files changed, 58 deletions(-) delete mode 100644 README_conflict-20150712-220614.md 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_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__/pet_functions.cpython-34_conflict-20150712-140611.pyc b/__pycache__/pet_functions.cpython-34_conflict-20150712-140611.pyc deleted file mode 100644 index abf2279947e0804f7bf0756bf318b7a2f5a85fb6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4110 zcmcIn&5zsG5g$??)XLh=I9}(&?OP{~&2+Kr#4TC~{%EtQ?FP*j#ilW$09LqqT!~(a zlpiUtmq>f4+n#!Cf#lF*5B(Q<>HooFd)iC?fcDbg3`I$6uYmwXMCoZbZ{EyszWMLg zV)Gw={>!iaxI*+Vn)_4${}{jIzgRTB7KKEeDQr>461+{JO~VRxDr9N=RY_N=QzKoY zPMvg}Iu7|2(hlhcJ+rCPAiY4kNxuU-0Ov@z1a6XEB)udskjtc31a6UDCA}sv2wow5 zUf?CtuadqXFo@SlUle$S^lPMF7Z?ZMApNGmYosrc{*J(4@?FwO;Pa$6NM9Bh4BsOC zw!jzonfKf)Coll*x>oKOFVaDjX6LTmdKhoT4{y2MZnki2z{gJ1G{EGfPgJ+kSUMb_k|QrIM}#K=cmYm5caOmAswNF;TsbqoV({P>}HL<)Jw-nTV=JM^nLs_?)zSt4%%wW z!SK(o{|d}F>iedxa_il!dEXn2g2=~-g5ayayUn~dGB8oTIP%l(6VC+Re&{E8gKr~m z=;sRzjRtWV=S>C^5t>($)Z`8$yuM%T3`F__7P$r2!9;BGH!_IYV)@Sp+k<%MZ^J{z z_mb`SDB20*vECk;_>tdBlkL%QI*6m~)Ej#JIPDFBZI*U0j(TYjN6FUcxX_IiN|x9= zypXksYt>q}Ud3hBfH~z#8whdb8vx+FM@R~b4y$AkVm9p|Blg6=)m_8E@X1}*HVy!@ z$jem!0$K$wZv;u#3xg;AYq(45Sjbwosx~;z31?>P77_k600@WVS(pff@UaOx;0E7c z6MYG)DjnKnZc~b&sZzH_(S5 zazTk8o5a@J4+cSR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s?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