def __init__(self, parent, control="RANDOM"): self.parent = parent if (control == "LUNA"): self.initluna() return if (control == "PHOBOS"): self.initphobos() return if (control == "DEIMOS"): self.initdeimos() return if (control == "IO"): self.initio() return if (control == "EUROPA"): self.initeuropa() return if (control == "GANYMEDE"): self.initganymede() return if (control == "CALLISTO"): self.initcallisto() return if (control == "TITAN"): self.inittitan() return if (control == "TRITON"): self.inittriton() return if (control == "CHARON"): self.initcharon() return self.index = random.randint( 0, 2147483647 ) #I want these to be indicies but here I can assure they're unique which is a start self.resources = [ random.randint(0, 255), random.randint(0, 255), random.randint(0, 255) ] self.size = random.lognormvariate(math.log(1.5), 0.3) self.culture = OnlineMarkov() for i in range(-1, int(self.size * 2 / 2)): cultureString = self.culture.randomString(int(self.size * 2 / 2)) #print(cultureString) self.culture.contribute(cultureString) self.radius = random.lognormvariate(math.log(parent.size * 2), 0.125) #print(self.radius) self.inclination = random.normalvariate(0, 15) self.longitudeAscendingNode = random.uniform(0, 360) self.trueAnomaly = random.uniform(0, 360) self.period = Planet.getPeriodFromRadius(self.radius, self.parent.size) self.rotationMatrix = Planet.eulerAngles2Matrix( self.inclination, self.longitudeAscendingNode) self.position = self.getPosition()
def __init__(self, control = "RANDOM"): if(control=="SUN"): self.initsun() return if(control=="MERCURY"): self.initmercury() return if(control=="VENUS"): self.initvenus() return if(control=="EARTH"): self.initearth() return if(control=="MARS"): self.initmars() return if(control=="CERES"): self.initceres() return if(control=="JUPITER"): self.initjupiter() return if(control=="SATURN"): self.initsaturn() return if(control=="URANUS"): self.inituranus() return if(control=="NEPTUNE"): self.initneptune() return if(control=="PLUTO"): self.initpluto() return if(control=="HAUMEA"): self.inithaumea() return self.index = random.randint(0,2147483647)#I want these to be indicies but here I can assure they're unique which is a start self.resources = [random.randint(0,255),random.randint(0,255),random.randint(0,255)] self.size = random.lognormvariate(math.log(3),0.3) self.culture = OnlineMarkov() for i in range(-1,int(self.size*2/2)): cultureString = self.culture.randomString(int(self.size*2/2)) #print(cultureString) self.culture.contribute(cultureString) self.radius = random.lognormvariate(math.log(300),0.125) #print(self.radius) self.inclination = random.normalvariate(0,15) self.longitudeAscendingNode = random.uniform(0,360) self.trueAnomaly = random.uniform(0,360) self.period = Planet.getPeriodFromRadius(self.radius) self.rotationMatrix = Planet.eulerAngles2Matrix(self.inclination,self.longitudeAscendingNode) self.position = self.getPosition()
def initpluto(self): self.size = 5 self.radius = 1200 self.resources = [40.0,30.0,40.0] self.culture = OnlineMarkov() for i in range(-1,int(self.size*2/2)): cultureString = self.culture.randomString(int(self.size*2/2)) #print(cultureString) self.culture.contribute(cultureString) self.trueAnomaly = 59 self.period = Planet.getPeriodFromRadius(self.radius) self.inclination = 30 self.longitudeAscendingNode = 60 self.rotationMatrix = Planet.eulerAngles2Matrix(self.inclination,self.longitudeAscendingNode) self.position = self.getPosition()
def initneptune(self): self.size = 20 self.radius = 800 self.resources = [0.0,0.0,225.0] self.culture = OnlineMarkov() for i in range(-1,int(self.size*2/2)): cultureString = self.culture.randomString(int(self.size*2/2)) #print(cultureString) self.culture.contribute(cultureString) self.trueAnomaly = 25 self.period = Planet.getPeriodFromRadius(self.radius) self.inclination = 15 self.longitudeAscendingNode = 150 self.rotationMatrix = Planet.eulerAngles2Matrix(self.inclination,self.longitudeAscendingNode) self.position = self.getPosition()
def initsun(self): self.size = 40 self.radius = 0 self.position = [0.0,0.0,0.0] self.resources = [225.0,225.0,225.0] self.culture = OnlineMarkov() self.culture.erase()#clear out the dictionary on sun for a suntutorial for tutorialLine in suntutorial: self.culture.contribute(tutorialLine) #the suntutorial dictionary is committed twice to help it to speak more cogently. self.culture.contribute(tutorialLine) #self.culture.print() self.trueAnomaly = 0 self.period = 22 self.rotationMatrix = [[1,0,0],[0,1,0],[0,0,1]]
def initphobos(self): self.size = 2 self.radius = 10 self.resources = [64.0, 64.0, 64.0] self.culture = OnlineMarkov() for i in range(-1, int(self.size * 2 / 2)): cultureString = self.culture.randomString(int(self.size * 2 / 2)) #print(cultureString) self.culture.contribute(cultureString) self.trueAnomaly = 151 self.period = Planet.getPeriodFromRadius(self.radius, self.parent.size) self.inclination = 5 self.longitudeAscendingNode = 110 self.rotationMatrix = Planet.eulerAngles2Matrix( self.inclination, self.longitudeAscendingNode) self.position = self.getPosition()
def initcallisto(self): self.resources = [ random.randint(0, 255), random.randint(0, 255), random.randint(0, 255) ] self.size = 4 self.culture = OnlineMarkov() for i in range(-1, int(self.size * 2 / 2)): cultureString = self.culture.randomString(int(self.size * 2 / 2)) #print(cultureString) self.culture.contribute(cultureString) self.radius = 81 #print(self.radius) self.inclination = random.normalvariate(0, 15) self.longitudeAscendingNode = random.uniform(0, 360) self.trueAnomaly = random.uniform(0, 360) self.period = Planet.getPeriodFromRadius(self.radius, self.parent.size) self.rotationMatrix = Planet.eulerAngles2Matrix( self.inclination, self.longitudeAscendingNode) self.position = self.getPosition()