示例#1
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
示例#2
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
示例#3
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)
示例#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 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)
示例#6
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
示例#7
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
示例#8
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
示例#9
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
示例#10
0
class Snow(Model):
    flakes = Model.child_property(Snowflakes)

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

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Water
示例#12
0
class GlobalItem(Model):
    universe = Model.child_property(unknown.Model)

    class ChildrenGenerator(Model.ChildrenGenerator):
        def children_classes(self):
            yield Universe