def Autogen(self): self.OrbitDistance = utils.truncSignificatif( rd.uniform(0, self.MaxRange), 2) # Distance de l'orbite self.Zone = DetermineZone( self.Parent, self.OrbitDistance) # Determine la zone où se situe l'orbite if self.Zone == "Inner": self.Contain = choice(InnerZone) elif self.Zone == "Habitable": self.Contain = choice(HabitableZone) elif self.Zone == "Outer": self.Contain = choice(OuterZone) else: self.Contain = None self.rollSatellites()
def MoonAsPlanet(MoonType, Zone): Type = str() if MoonType in ["HugeMoon"]: # Liste des type de planete que peut devenir la lune AvailableList = [ "Terrestrial", "Geoactive", "Ultra Hostile", "Desert", "Oceanic", "Glaciated", "Exotic", "Protoplanet", "Ice World" ] # Choix prédéfinie if Zone in ["Inner"]: Type = choice(utils.getFromDict(InnerZone, AvailableList)) if Zone in ["Habitable"]: Type = choice(utils.getFromDict(HabitableZone, AvailableList)) if Zone in ["Outer"]: Type = choice(utils.getFromDict(OuterZone, AvailableList)) if MoonType in ["LargeMoon"]: AvailableList = [ "Small Terrestrial", "Geoactive", "Ultra Hostile", "Dirty SnowBall", "Ice World", "Exotic", "Protoplanet" ] if Zone in ["Inner"]: Type = choice(utils.getFromDict(InnerZone, AvailableList)) if Zone in ["Habitable"]: Type = choice(utils.getFromDict(HabitableZone, AvailableList)) if Zone in ["Outer"]: Type = choice(utils.getFromDict(OuterZone, AvailableList)) if MoonType in ["MediumMoon"]: AvailableList = ["Mesoplanet", "Protoplanet"] if Zone in ["Inner"]: Type = choice(utils.getFromDict(InnerZone, AvailableList)) if Zone in ["Habitable"]: Type = choice(utils.getFromDict(HabitableZone, AvailableList)) if Zone in ["Outer"]: Type = choice(utils.getFromDict(OuterZone, AvailableList)) return Type
def Show(self): if not self.haveOrbit: Parent = "n Unknow" else: Parent = " " + str(self.Parent) txt = """+++ NO NAMED +++: {} planet around a{} star Segmentum: +++ NO ENTRY +++ Sector: +++ NO ENTRY +++ Sub-Sector: +++ NO ENTRY +++ Global Survey: in {} zone ({} orbit-distance) Diameter: {} km ({} Terra radium) Surface: {} km² Gravity on surface: {}g Satellites: {} Imperial classification: {}world Approximate Population: +++ NO ENTRY +++ Atmosphere: {} atmosphere Main Composition: {} Hydrosphere: {} % Cryosphere: {} % Land cover: {} % Mean Temperature: {}°C Global Climate: {} Day Duration: {} H Moons: {} Moons """.format(self.Type, Parent, self.Zone, self.Distance, self.Size, utils.truncSignificatif(self.SizeInEarthRadius, 3), utils.truncSignificatif(np.pi * self.Size**2 / 4, 5), utils.truncSignificatif(self.Gravity, 3), self.nbSatellites, self.ImperialClassification, self.AtmDensity, self.AtmosphereComposition, utils.truncSignificatif(self.Hydroshpere, 2), utils.truncSignificatif(self.Cryosphere, 2), utils.truncSignificatif(self.Land, 2), round(self.MeanTemp), self.Climate, int(self.Day), self.nbSatellites) txtSat = "" for thisSat in self.Satellites: currentLine = str(thisSat) txtSat += " +-- {} \n".format(currentLine) print(txt) print(txtSat)
def __repr__(self): txt = "(size: {} earth radius)".format( utils.truncSignificatif(self.SizeInEarthRadius, 3)) if self.IsHabitable: txt = "{} world ".format(self.Type) + txt else: txt = "{} planet ".format(self.Type) + txt return txt