Advertisement
Ridz112

tamagatichi oo

Jun 16th, 2021
44
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import *
  2. class tamagotchi:
  3.     def __init__(self,name):
  4.         self.boredom = 0
  5.         self.hunger = 0
  6.         self.hygiene = 0
  7.         self.name = name
  8.  
  9.     def getboredom(self):
  10.         return(self.boredom)
  11.  
  12.     def gethunger(self):
  13.         return(self.hunger)
  14.  
  15.     def gethygiene(self):
  16.         return (self.hygiene)
  17.  
  18.     def getname(self):
  19.         return self.name
  20.  
  21.     def feed(self,tamagotchi):
  22.         print("")
  23.         print(tamagotchi.getname() + " has eaten")
  24.         self.hunger -= 5
  25.         self.hygiene += 5
  26.         self.hunger += randint(1,10)
  27.         self.boredom += randint(1,10)
  28.         if tamagotchi.gethunger() < 0:
  29.             tamagotchi.hunger = 0
  30.         print("Your Tamagotchi's stats are:")
  31.         print("boredom: " + str(tamagotchi.getboredom()))
  32.         print("hunger: " + str(tamagotchi.gethunger()))
  33.         print("hygiene: " + str(tamagotchi.gethygiene()))
  34.  
  35.  
  36.     def play(self,tamagotchi):
  37.         print("")
  38.         print(tamagotchi.getname() + " has played with you")
  39.         self.boredome -= 5
  40.         self.hygiene += 10
  41.         self.hunger += randint(1, 10)
  42.         self.boredom += randint(1, 10)
  43.         if tamagotchi.getboredom() < 0:
  44.             tamagotchi.boredom = 0
  45.         print("Your Tamagotchi's stats are:")
  46.         print("boredom: " + str(tamagotchi.getboredom()))
  47.         print("hunger: " + str(tamagotchi.gethunger()))
  48.         print("hygiene: " + str(tamagotchi.gethygiene()))
  49.  
  50.     def clean(self,tamagotchi):
  51.         print("")
  52.         print(tamagotchi.getname() + " is cleaner")
  53.         self.hygiene -= 10
  54.         self.hunger += randint(1, 10)
  55.         self.boredom += randint(1, 10)
  56.         if tamagotchi.gethygiene() < 0:
  57.             tamagotchi.hygiene = 0
  58.         print("Your Tamagotchi's stats are:")
  59.         print("boredom: " + str(tamagotchi.getboredom()))
  60.         print("hunger: " + str(tamagotchi.gethunger()))
  61.         print("hygiene: " + str(tamagotchi.gethygiene()))
  62.  
  63.  
  64.  
  65. tamagotchi1 = tamagotchi("Ainsley")
  66.  
  67. while tamagotchi1.getboredom() <=100 and tamagotchi1.gethunger() <=100 and tamagotchi1.gethygiene() <=100:
  68.     action = input("What do you wanna do with your tamagotchi? ")
  69.     if action == "feed":
  70.         tamagotchi1.feed(tamagotchi1)
  71.     elif action == "play":
  72.         tamagotchi1.play(tamagotchi1)
  73.     elif action == "clean":
  74.         tamagotchi1.clean(tamagotchi1)
  75.     else:
  76.         print("What do you wanna do with your tamagotchi? ")
  77. print("oh no, your pet is dead, you're a terrible owner")
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement