Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- class tamagotchi:
- def __init__(self,name):
- self.boredom = 0
- self.hunger = 0
- self.hygiene = 0
- self.name = name
- def getboredom(self):
- return(self.boredom)
- def gethunger(self):
- return(self.hunger)
- def gethygiene(self):
- return (self.hygiene)
- def getname(self):
- return self.name
- def feed(self,tamagotchi):
- print("")
- print(tamagotchi.getname() + " has eaten")
- self.hunger -= 5
- self.hygiene += 5
- self.hunger += randint(1,10)
- self.boredom += randint(1,10)
- if tamagotchi.gethunger() < 0:
- tamagotchi.hunger = 0
- print("Your Tamagotchi's stats are:")
- print("boredom: " + str(tamagotchi.getboredom()))
- print("hunger: " + str(tamagotchi.gethunger()))
- print("hygiene: " + str(tamagotchi.gethygiene()))
- def play(self,tamagotchi):
- print("")
- print(tamagotchi.getname() + " has played with you")
- self.boredome -= 5
- self.hygiene += 10
- self.hunger += randint(1, 10)
- self.boredom += randint(1, 10)
- if tamagotchi.getboredom() < 0:
- tamagotchi.boredom = 0
- print("Your Tamagotchi's stats are:")
- print("boredom: " + str(tamagotchi.getboredom()))
- print("hunger: " + str(tamagotchi.gethunger()))
- print("hygiene: " + str(tamagotchi.gethygiene()))
- def clean(self,tamagotchi):
- print("")
- print(tamagotchi.getname() + " is cleaner")
- self.hygiene -= 10
- self.hunger += randint(1, 10)
- self.boredom += randint(1, 10)
- if tamagotchi.gethygiene() < 0:
- tamagotchi.hygiene = 0
- print("Your Tamagotchi's stats are:")
- print("boredom: " + str(tamagotchi.getboredom()))
- print("hunger: " + str(tamagotchi.gethunger()))
- print("hygiene: " + str(tamagotchi.gethygiene()))
- tamagotchi1 = tamagotchi("Ainsley")
- while tamagotchi1.getboredom() <=100 and tamagotchi1.gethunger() <=100 and tamagotchi1.gethygiene() <=100:
- action = input("What do you wanna do with your tamagotchi? ")
- if action == "feed":
- tamagotchi1.feed(tamagotchi1)
- elif action == "play":
- tamagotchi1.play(tamagotchi1)
- elif action == "clean":
- tamagotchi1.clean(tamagotchi1)
- else:
- print("What do you wanna do with your tamagotchi? ")
- print("oh no, your pet is dead, you're a terrible owner")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement