コード例 #1
0
 def ShowAnimals(self, p):
     ToolBox.WriteLineBlue(
         "----------------------------------------------------------------------------------------------"
     )
     ToolBox.WriteLineBlue("Current Population:")
     for habs in p.arkOne.GetHabitats():
         habs.SumAnimals()
         print(habs.HabitatName.PadRight(18))
         for x in habs.AnimalDict:
             tempString: str = x.Key.PadRight(11) + " " + x.Value
             print(tempString.PadRight(17))
         print()
コード例 #2
0
 def ShowRequiredResources(self, p):
     ToolBox.WriteLineBlue(
         "---------------------------------------------------------------------------------------------"
     )
     ToolBox.WriteLineBlue("Required Resources:")
     ToolBox.WriteLineBlue(
         "Zone                  Energy(kW)   Heat(kJ)   Food(unit)   Water(m3)   Oxigen(m3)"
     )
     for member in p.arkOne.GetHabitats():
         print(member.HabitatName.ToString().PadRight(19))
         print(member.SumReqEnergy.ToString().PadLeft(9))
         print(member.SumReqHeat.ToString().PadLeft(11))
         print(member.SumReqFood.ToString().PadLeft(11))
         print(member.SumReqWater.ToString().PadLeft(14))
         print(member.SumReqOxigen.ToString().PadLeft(13))
コード例 #3
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def SubChoiceStatistics(self, p):
     choice: str = ""
     choice = ToolBox.InputAny("Choose an option: ")
     print()
     if choice == "1":
         for habitat in p.arkOne.GetHabitats():
             habitat.SumAnimals()
             ToolBox.WriteBlue(habitat.HabitatName)
             count: int = 0
             for items in habitat.AnimalDict:
                 count += items.Value
             print(" has " + count + " amimals")
         print()
         ToolBox.InputAny("Press any key to continue...")
     elif choice == "2":
         for habitat in p.arkOne.GetHabitats():
             habitat.SumAnimals()
             ToolBox.WriteLineBlue(habitat.HabitatName.ToUpper() + ":")
             for items in habitat.AnimalDict:
                 print(items.Keys + " : ")
                 print(items.Value)
         ToolBox.InputAny("Press any key to continue...")
     elif choice == "0":
         return False
     else:
         ToolBox.WriteLineRed("Wrong option!")
     return True
コード例 #4
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def SubMenuStatistics(self):
     os.system("clear")
     ToolBox.WriteLineBlue("Statistics panel (please choose a number)")
     print()
     print("(1) Information about the Habitats")
     print("(2) Information about the animals")
     print("(0) Back to the main panel")
     print()
コード例 #5
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def SubMenuHabitat(self):
     os.system("clear")
     ToolBox.WriteLineBlue("Habitat panel (please choose a number)")
     print()
     print("(1) Building a new Habitat zone")
     print("(2) Information about the current zones")
     print("(3) Recalibrating the zones")
     print("(4) Demolish a zone")
     print("(0) Back to the main panel")
     print()
コード例 #6
0
 def ShowResourceGenerators(self, p):
     ToolBox.WriteLineBlue(
         "---------------------------------------------------------------------------------------------"
     )
     ToolBox.WriteLineBlue("Running Facilities:")
     print("Heatcollectors".PadRight(19) + p.arkOne.HeatCollectors.Count +
           " block, Load: " + p.arkOne.HeatLoad + " %")
     print("Solarpanels".PadRight(19) + p.arkOne.SolarPanels.Count +
           " block, Load: " + p.arkOne.EnergyLoad + " %")
     print("Foodreplicators".PadRight(19) + p.arkOne.FoodReplicators.Count +
           " block, Load: " + p.arkOne.FoodLoad + " %")
     print("Oxigen generators".PadRight(19) +
           p.arkOne.OxigenGenerators.Count + " block, Load: " +
           p.arkOne.OxigenLoad + " %")
     print("Water filters: ".PadRight(19) + p.arkOne.WaterFilters.Count +
           " block, Load: " + p.arkOne.WaterLoad + " %")
     ToolBox.WriteLineBlue(
         "---------------------------------------------------------------------------------------------"
     )
     ToolBox.WriteLineBlue("Messages:")
コード例 #7
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def SubMenuAnimal(self):
     os.system("clear")
     ToolBox.WriteLineBlue("Animals panel (please choose a number)")
     print()
     print("(1) New animals has arrived")
     print("(2) Informations about an animal")
     print("(3) Informations about all animal")
     print("(4) Update the informations of the animal")
     print("(5) Relocating an animal")
     print("(0) Back to the main panel")
     print()
コード例 #8
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def Menu(self):  # main menu
     os.system("clear")
     ToolBox.WriteLineBlue(
         "Welcome to SANCTUARY, the last hope of the animals!")
     print()
     print("Hibernation status    ")
     if os.path.Exists("sanctuary.xml") == False:
         ToolBox.WriteLineRed("Not available")
     else:
         ToolBox.WriteLineGreen("Available")
     print()
     print("(1) Managing Habitat zones")
     print("(2) Managing life forms")
     print("(3) Live Monitoring")
     print("(4) Hibernating process")
     print("(5) Awakening process")
     print("(6) Statistics panel")
     print("(7) About US")
     print("(0) Exit Program")
     print()
コード例 #9
0
ファイル: UI.py プロジェクト: Jazo74/Wildlife_SIM_Python
 def SubChoiceAnimal(self, p):
     choice = ToolBox.InputAny("Choose an option: ")
     print()
     if choice == "1":  # Adding new animals
         typeo: str = ""
         speciesName = ToolBox.InputAny("What is the species?: ")
         habitatName = ToolBox.InputAny(
             "What is the optimal habitat zone?: ")
         while True:
             typeo = ToolBox.InputAny(
                 "What kind of animal is this? (herbivore, carnivore, omnivore): "
             )
             if typeo.ToLower() == "herbivore" or typeo.ToLower(
             ) == "carnivore" or typeo.ToLower() == "omnivore":
                 break
         specimen: int = ToolBox.InputInt("How many animals arrived?: ")
         try:
             for count in range(specimen):
                 p.arkOne.AddNewAnimal(speciesName, type, habitatName)
         except HabitatNotExistException:
             ToolBox.WriteLineRed(
                 "This Habitat is not exist. You should build it first!")
             time.Sleep(1500)
     elif choice == "2":  #Listing an animal
         animaL: Animal
         try:
             animaL = p.arkOne.FindAnimal(
                 ToolBox.InputAny("What is the ID of the animal?: "))
             print("The animal ID is: " + animaL.OwnName)
             print("The animal species is: " + animaL.SpeciesName)
             print("Required energy: " + animaL.ReqEnergyUnit)
             print("Required heat: " + animaL.ReqHeatUnit)
             print("Required oxigen: " + animaL.ReqOxigenUnit)
             print("Required water: " + animaL.ReqWaterUnit)
             print("Required food: " + animaL.ReqFoodUnit)
         except AnimalNotExistException:
             ToolBox.WriteLineRed("There is no such animal...")
         ToolBox.InputAny("Press any key to continue...")
     elif choice == "3":  #Listing all animal
         for habitat in p.arkOne.GetHabitats():
             ToolBox.WriteLineBlue(habitat.HabitatName)
             for animal in habitat.AnimalList:
                 print("ID: " + animal.OwnName.PadRight(4))
                 print(" " + animal.SpeciesName.PadRight(15))
                 print(" RE: " + animal.ReqEnergyUnit)
                 print(" RH: " + animal.ReqHeatUnit)
                 print(" RO: " + animal.ReqOxigenUnit)
                 print(" RW: " + animal.ReqWaterUnit)
                 print(" RF: " + animal.ReqFoodUnit)
         print("Press any key to continue...")
         ToolBox.InputAny()
     elif choice == "4":  #Update an animal
         try:
             animaL = p.arkOne.FindAnimal(
                 ToolBox.InputAny("What is the ID of the animal?: "))
             print("The animal ID is: " + animaL.OwnName)
             print("The animal species is: " + animaL.SpeciesName)
             print("Required energy: " + animaL.ReqEnergyUnit)
             print("Required heat: " + animaL.ReqHeatUnit)
             print("Required oxigen: " + animaL.ReqOxigenUnit)
             print("Required water: " + animaL.ReqWaterUnit)
             print("Required food: " + animaL.ReqFoodUnit)
             print()
             ToolBox.WriteLineRed(
                 "The parameters should be between 1 and 4")
             print()
             animaL.ReqEnergyUnit = ToolBox.InputIntBetween(
                 "New required energy?: ", 1, 4)
             animaL.ReqHeatUnit = ToolBox.InputIntBetween(
                 "New required heat ?: ", 1, 4)
             animaL.ReqOxigenUnit = ToolBox.InputIntBetween(
                 "New required oxigen?: ", 1, 4)
             animaL.ReqWaterUnit = ToolBox.InputIntBetween(
                 "New required water?: ", 1, 4)
             animaL.ReqFoodUnit = ToolBox.InputIntBetween(
                 "New required food?: ", 1, 4)
             print("The parameters of this animal has updated")
         except AnimalNotExistException:
             ToolBox.WriteLineRed("There is no such animal...")
         time.Sleep(1500)
     elif choice == "5":  #Removing an animal
         try:
             p.arkOne.RelocateAnimal(
                 ToolBox.InputAny(
                     "What is the ID of the animal you want to relocate?: ")
             )
             ToolBox.WriteLineGreen("The animal has relocated.")
         except AnimalNotExistException:
             ToolBox.WriteLineRed("There is no such animal...")
         time.Sleep(1500)
     elif choice == "0":
         return False
     else:
         ToolBox.WriteLineRed("Wrong option!")
     return True