class GalaxyPart(Model, EncounteredMixin): stars = Model.children_property(star.StarSystem) nebulas = Model.children_property(Nebula) black_holes = Model.children_property(BlackHole) class ChildrenGenerator(Model.ChildrenGenerator): life_probability = 0 dyson_sphere_probabilities = 4, 2 min_star_systems = 20 max_star_systems = 20 min_nebula = 20 max_nebula = 50 def black_holes(self): yield None def children_classes(self): yield unknown.GalacticLife.probable(self.life_probability) yield from [ star.DysonSphere.probable(probability) for probability in self.dyson_sphere_probabilities ] yield from star.StarSystem.multiple(self.min_star_systems, self.max_star_systems) yield from Nebula.multiple(self.min_nebula, self.max_nebula) yield from self.black_holes()
class OrganicMatter(Matter): proteins = Model.children_property(Proteins) lipids = Model.children_property(Lipids) glucids = Model.children_property(Glucids) salt = Model.children_property(Salt) class ChildrenGenerator(Model.ChildrenGenerator): components = [ [ Proteins, Lipids, Glucids, ], [ Proteins, Lipids, Glucids, None, ], ] def children_classes(self): for component in self.components: yield from Model.BaseGenerator(component).next() yield Salt.probable(30)
class StarSystem(Model): star = Model.child_property(Star) stars = Model.children_property(Star) planets = Model.children_property(planet.Planet) asteroid_belts = Model.children_property(planet.AsteroidBelt) dyson_surfaces = Model.children_property(unknown.DysonSurface) orbits = Model.children_property(planet.Planet, planet.AsteroidBelt, unknown.DysonSurface) class ChildrenGenerator(Model.ChildrenGenerator): @classmethod def _generate_inhabited(cls): yield planet.VisitorPlanet.probable(5) yield planet.FuturePlanet.probable(10) yield planet.TerraformedPlanet.probable(50) yield planet.TerraformedPlanet.probable(20) yield planet.TerraformedPlanet.probable(10) yield planet.MedievalPlanet.probable(30) yield planet.MedievalPlanet.probable(20) yield planet.AncientPlanet.probable(50) yield planet.AncientPlanet.probable(30) yield planet.AncientPlanet.probable(10) def children_classes(self): yield Star yield Star.probable(3) yield from self._generate_inhabited() yield planet.BarrenPlanet.probable(60) yield planet.BarrenPlanet.probable(40) yield planet.BarrenPlanet.probable(20) yield planet.GasGiant.probable(60) yield planet.GasGiant.probable(40) yield planet.GasGiant.probable(20) yield planet.GasGiant.probable(10) yield from planet.AsteroidBelt.multiple(0, 2)
class TerraformedMixin: continents = Model.children_property(unknown.Continent) oceans = Model.children_property(unknown.Ocean) sky = Model.child_property(unknown.Sky) @property def children(self): raise NotImplementedError()
class PlanetLike(Orbit): atmosphere = Model.child_property(Atmosphere) core = Model.child_property(PlanetCore) land = Model.children_property(materials.Rock, unknown.Continent) water = Model.children_property(materials.Ice, unknown.Ocean) visited = Model.children_property(unknown.VisitorCity, unknown.VisitorInstallation) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield PlanetCore
class Nebula(Model, EncounteredMixin): stars = Model.children_property(star.StarSystem) clouds = Model.children_property(InterstellarCloud) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield unknown.GalacticLife.probable(15) yield star.SingleStar.probable(2) yield star.SingleStar.probable(2) yield star.SingleStar.probable(2) yield from InterstellarCloud.multiple(1, 6)
class Ash(Matter): contents = Model.children_property(OrganicMatter, particles.Atom) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield OrganicMatter yield elements['C']
class AsteroidBelt(Orbit, EncounteredMixin): asteroids = Model.children_property(Asteroid) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield unknown.GalacticLife.probable(20) yield from Asteroid.multiple(10, 30)
class Galaxy(Model): center = Model.child_property(GalaxyCenter) arm = Model.children_property(GalaxyArm) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield GalaxyCenter yield from GalaxyArm.multiple(2, 6)
class Planet(PlanetLike): moons = Model.children_property(Moon) class ChildrenGenerator(PlanetLike.ChildrenGenerator): def children_classes(self): yield from PlanetLike.ChildrenGenerator.children_classes(self) yield Moon.probable(40) yield Moon.probable(20) yield Moon.probable(10)
class Supercluster(Model): galaxies = Model.children_property(Galaxy) class NameGenerator(Model.NameGenerator): default = 'galactic supercluster' class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield from Galaxy.multiple(10, 30)
class Particle(Model): quarks = Model.children_property(Quark) class ChildrenGenerator(Model.ChildrenGenerator): up_quarks = 1 down_quarks = 1 def children_classes(self): yield from UpQuark.multiple(self.up_quarks) yield from DownQuark.multiple(self.down_quarks)
class Rock(Matter): contents = Model.children_property(Silica, particles.Atom) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield Silica yield elements['Al'].probable(30) yield elements['Fe'].probable(20) yield elements['K'].probable(20) yield elements['Na'].probable(50) yield elements['Ca'].probable(50)
class Atmosphere(Model, EncounteredMixin): contents = Model.children_property( elements.Helium, elements.Hydrogen, materials.Water, materials.Ammonia, materials.Methane, ) class NameGenerator(Model.NameGenerator): default = 'atmosphere'
class Star(Model, EncounteredMixin): contents = Model.children_property(elements.Hydrogen, elements.Helium) class BaseGenerator(Model.BaseGenerator): default = lookups.stars class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield unknown.Ghost.probable(0.1) yield unknown.SpaceMonster.probable(0.2) yield elements.Hydrogen yield elements.Helium
class Multiverse(Model): universes = Model.children_property(Universe) class NameGenerator(Model.NameGenerator): default = None class BaseGenerator(Model.BaseGenerator): default = lookups.multiverses.values class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield from Universe.multiple(10, 30)
class EndOfUniverseNote(Model): contents = Model.children_property(unknown.Model) class BaseGenerator(Model.BaseGenerator): default = lookups.end_of_universe_notes class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield unknown.Pasta.probable(0.1) def read(self): return self.BaseGenerator.next()
class EncounteredMixin: encounters = Model.children_property( unknown.Crustacean, unknown.GalacticLife, unknown.Ghost, unknown.SpaceAnimal, unknown.SpaceMonster, ) @property def children(self): raise NotImplementedError()
class Atom(Model): particles = Model.children_property(Particle) class NameGenerator(Model.NameGenerator): default = 'atoms' class ChildrenGenerator(Model.ChildrenGenerator): has_neutron = True def children_classes(self): yield Proton if self.has_neutron: yield Neutron yield Electron
class InterstellarCloud(Model): contents = Model.children_property(Model) class BaseGenerator(Model.BaseGenerator): default = lookups.interstellar_clouds class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield elements.Helium yield elements.Hydrogen yield elements.Carbon.probable(80) yield materials.Water.probable(5) yield materials.Ammonia.probable(5) yield elements.Nitrogen.probable(5) yield elements.Iron.probable(5) yield elements.Sulfur.probable(5) yield elements.Oxygen.probable(15)
class PlanetCore(Model, EncounteredMixin): contents = Model.children_property( elements.Iron, materials.Rock, materials.Diamond, materials.Magma, ) class NameGenerator(Model.NameGenerator): default = 'core' class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): # Encounters yield unknown.SpaceMonster.probable(0.5) # Contents yield elements.Iron yield materials.Rock yield materials.Diamond.probable(2) yield materials.Magma
class Universe(Model): clusters = Model.children_property(Supercluster) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield from Supercluster.multiple(10, 30)
class Polymeric(OrganicMatter): polymers = Model.children_property(Polymers) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield Polymers
class Matter(Model): contents = Model.children_property(particles.Atom)
class OrganicMolecule(Molecule): atoms = Model.children_property(particles.Atom) class ChildrenGenerator(Model.ChildrenGenerator): def children_classes(self): yield from reaction('C', 'H', 'O')