示例#1
0
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()
示例#2
0
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)
示例#3
0
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)
示例#4
0
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()
示例#5
0
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)
示例#6
0
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
示例#7
0
class D2emon(Model):
    body = Model.child_property(Body)
    psyche = Model.child_property(D2emonPsyche)
    clothes = Model.child_property(ClothingSet)
    computer = Model.child_property(unknown.Computer)

    class NameGenerator(Model.NameGenerator):
        default = 'psyche'

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Body
            yield D2emonPsyche
            yield ClothingSet
            yield unknown.Computer
示例#8
0
class Ash(Matter):
    contents = Model.children_property(OrganicMatter, particles.Atom)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield OrganicMatter
            yield elements['C']
示例#9
0
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)
示例#10
0
class Molecule(Model):
    atoms = Model.child_property(particles.Atom)

    class NameGenerator(Model.NameGenerator):
        default = 'molecules'

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield particles.Atom
示例#11
0
class D2emonPsyche(Model):
    thoughts = Model.child_property(unknown.Thoughts)

    class NameGenerator(Model.NameGenerator):
        default = 'psyche'

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield D2emonThoughts
示例#12
0
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)
示例#13
0
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)
示例#14
0
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)
示例#15
0
class Atmosphere(Model, EncounteredMixin):
    contents = Model.children_property(
        elements.Helium,
        elements.Hydrogen,
        materials.Water,
        materials.Ammonia,
        materials.Methane,
    )

    class NameGenerator(Model.NameGenerator):
        default = 'atmosphere'
示例#16
0
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)
示例#17
0
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
示例#18
0
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)
示例#19
0
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()
示例#20
0
class EncounteredMixin:
    encounters = Model.children_property(
        unknown.Crustacean,
        unknown.GalacticLife,
        unknown.Ghost,
        unknown.SpaceAnimal,
        unknown.SpaceMonster,
    )

    @property
    def children(self):
        raise NotImplementedError()
示例#21
0
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)
示例#22
0
class GalaxyCenter(GalaxyPart):
    central_black_hole = Model.child_property(BlackHole)

    class NameGenerator(GalaxyPart.NameGenerator):
        default = 'galactic center'

    class ChildrenGenerator(GalaxyPart.ChildrenGenerator):
        life_probability = 10
        min_nebula = 0
        max_nebula = 12

        def black_holes(self):
            yield BlackHole
示例#23
0
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
示例#24
0
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)
示例#25
0
class BlackHole(Portal, EncounteredMixin):
    white_hole = Model.child_property(WhiteHole)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield EndOfUniverseNote.probable(0.5)
            yield unknown.Crustacean.probable(0.2)
            yield WhiteHole

    @property
    def universe(self):
        return self.white_hole and self.white_hole.universe

    def inside(self):
        return self.children

    def enter(self):
        return self.white_hole
示例#26
0
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
示例#27
0
class Snow(Model):
    flakes = Model.child_property(Snowflakes)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Snowflakes
示例#28
0
class Snowflakes(Model):
    contents = Model.child_property(Water)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Water
示例#29
0
class Polymeric(OrganicMatter):
    polymers = Model.children_property(Polymers)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Polymers
示例#30
0
class Matter(Model):
    contents = Model.children_property(particles.Atom)