def checkPlanetConstructor(self): print("Checking Planet constructor...") xxPos = 1.0 yyPos = 2.0 xxVel = 3.0 yyVel = 4.0 mass = 5.0 imgFileName = "jupiter.gif" p = Planet(xxPos, yyPos, xxVel, yyVel, mass, imgFileName) self.checkEquals(xxPos, p.xxPos, "x") self.checkEquals(yyPos, p.yyPos, "y") self.checkEquals(xxVel, p.xxVel, "xVelocity") self.checkEquals(yyVel, p.yyVel, "yVelocity") self.checkEquals(mass, p.mass, "mass") self.checkStringEquals(imgFileName, p.imgFileName, "path to image") pCopy = Planet().PlanetCopy(p) self.checkEquals(p.xxPos, pCopy.xxPos, "x") self.checkEquals(p.yyPos, pCopy.yyPos, "y") self.checkEquals(p.xxVel, pCopy.xxVel, "xVelocity") self.checkEquals(p.yyVel, pCopy.yyVel, "yVelocity") self.checkEquals(p.mass, pCopy.mass, "mass") self.checkStringEquals(p.imgFileName, pCopy.imgFileName, "path to image")
def calcNetForceExertedByXY(self): print("Checking setNetForce...") p1 = Planet(1.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p2 = Planet(2.0, 1.0, 3.0, 4.0, 4e11, "jupiter.gif") p3 = Planet(4.0, 5.0, 3.0, 4.0, 5.0, "jupiter.gif") p4 = Planet(3.0, 2.0, 3.0, 4.0, 5.0, "jupiter.gif") planets = [p2, p3, p4] xNetForce = p1.calcNetForceExertedByX(planets) yNetForce = p1.calcNetForceExertedByY(planets) print(xNetForce, yNetForce) self.checkEquals(133.4, self.round(xNetForce, '.01'), "calcNetForceExertedByX()") self.checkEquals(0.0, self.round(yNetForce, '.01'), "calcNetForceExertedByY()") print( "Running test again, but with array that contains the target planet." ) planets = [p1, p2, p3, p4] xNetForce = p1.calcNetForceExertedByX(planets) yNetForce = p1.calcNetForceExertedByY(planets) self.checkEquals(133.4, self.round(xNetForce, '.01'), "calcNetForceExertedByX()") self.checkEquals(0.0, self.round(yNetForce, '.01'), "calcNetForceExertedByY()")
def createAndAnimate(): ss = SolarSystem(2, 2) sun = Sun("SUN", 10) ss.addSun(sun) m = Planet("Mercury", 1000, 0.2, 1, 0, 2, "orange") ss.addPlanet(m) e = Planet("Earth", 5000, 0.3, 1.3, 0, 2, "blue") ss.addPlanet(e) ma = Planet("Mars", 9000, 0.5, 1.2, 0, 1.63, "red") ss.addPlanet(ma) p = Planet("Pluto", 500, 0.9, .5, 0, .5, "gray") ss.addPlanet(p) # a = Planet("Asteroid", 500, 1.0, 0, .75, "cyan") # ss.addPlanet(a) numCycles = 10000 for i in range(numCycles): ss.movePlanets() # while True: # ss.movePlanets() # # You can add functionality to break away from the loop given some condition # # use the keyword break # break ss.freeze()
def checkCalcDistance(self): print("Checking calcDistance...") p1 = Planet(1.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p2 = Planet(2.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p3 = Planet(4.0, 5.0, 3.0, 4.0, 5.0, "jupiter.gif") self.checkEquals(p1.calcDistance(p2), 1.0, "calcDistance()", 0.01) self.checkEquals(p1.calcDistance(p3), 5.0, "calcDistance()", 0.01)
def makePlanets(self): self.mars = Planet(self.width / 5, self.height / 5, "mars") self.marsGroup = pygame.sprite.Group(self.mars) self.collPlanet = None self.neptune = Planet(4 * self.width / 5, self.height / 5, "neptune") self.neptunegroup = pygame.sprite.Group(self.neptune) self.uranus = Planet(self.width / 5, 4 * self.height / 5, "uranus") self.uranusgroup = pygame.sprite.Group(self.uranus) self.mercury = Planet(4 * self.width / 5, 4 * self.height / 5, "mercury") self.mercurygroup = pygame.sprite.Group(self.mercury)
def checkCalcForceExertedBy(self): print("Checking calcForceExertedBy...") p1 = Planet(1.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p2 = Planet(2.0, 1.0, 3.0, 4.0, 4e11, "jupiter.gif") p3 = Planet(4.0, 5.0, 3.0, 4.0, 5.0, "jupiter.gif") print(Planet.G) self.checkEquals(p1.calcForceExertedBy(p2), 133.4, "calcForceExertedBy()", 0.01) self.checkEquals(p1.calcForceExertedBy(p3), 6.67e-11, "calcForceExertedBy()", 0.01)
def main(): # < x = -9, y = 10, z = -1 > # < x = -14, y = -8, z = 14 > # < x = 1, y = 5, z = 6 > # < x = -19, y = 7, z = 8 > io = Planet(pos_x=-9, pos_y=10, pos_z=-1) europa = Planet(pos_x=-14, pos_y=-8, pos_z=14) ganymede = Planet(pos_x=1, pos_y=5, pos_z=6) callisto = Planet(pos_x=-19, pos_y=7, pos_z=8) # < x = -1, y = 0, z = 2 > # < x = 2, y = -10, z = -7 > # < x = 4, y = -8, z = 8 > # < x = 3, y = 5, z = -1 > # io = Planet(pos_x=-1, pos_y=0, pos_z=2) # europa = Planet(pos_x=2, pos_y=-10, pos_z=-7) # ganymede = Planet(pos_x=4, pos_y=-8, pos_z=8) # callisto = Planet(pos_x=3, pos_y=5, pos_z=-1) # < x = -8, y = -10, z = 0 > # < x = 5, y = 5, z = 10 > # < x = 2, y = -7, z = 3 > # < x = 9, y = -8, z = -3 > # io = Planet(pos_x=-8, pos_y=-10, pos_z=0) # europa = Planet(pos_x=5, pos_y=5, pos_z=10) # ganymede = Planet(pos_x=2, pos_y=-7, pos_z=3) # callisto = Planet(pos_x=9, pos_y=-8, pos_z=-3) planets = [io, europa, ganymede, callisto] for i in range(1000): print() print('Step ', i) for base_planet in planets: print('pos=', base_planet.position, ' vel=', base_planet.velocity) for planet in planets: if planet == base_planet: continue base_planet.add_gravity_for_planet(planet) for planet in planets: planet.apply_velocity_to_position() total_energy = 0 for planet in planets: total_energy += planet.calculate_total_energy() print(total_energy) exit(1)
def checkCalcForceExertedByXY(self): print("Checking calcForceExertedByX and calcForceExertedByY...") p1 = Planet(1.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p2 = Planet(2.0, 1.0, 3.0, 4.0, 4e11, "jupiter.gif") p3 = Planet(4.0, 5.0, 3.0, 4.0, 5.0, "jupiter.gif") self.checkEquals(p1.calcForceExertedByX(p2), 133.4, "calcForceExertedByX()", 0.01) self.checkEquals(p1.calcForceExertedByX(p3), 4.002e-11, "calcForceExertedByX()", 0.01) self.checkEquals(p1.calcForceExertedByY(p2), 0.0, "calcForceExertedByY()", 0.01) self.checkEquals(p1.calcForceExertedByY(p3), 5.336e-11, "calcForceExertedByY()", 0.01)
def create_planet(self, description: str, x_position:float, y_position:float, x_speed:float, y_speed:float, mass: float): """Creates a planet and appends it to the list planetary_objects.""" if self.validate_position(x_position, y_position) == False: raise ValueError("There is already a planet in this position!") new_planet = Planet(description, x_position, y_position, x_speed, y_speed, mass) self.planetary_objects.append(new_planet) return new_planet
def extractInfos(self, request=None, darkMatter=False, planets=True): if request == None: request = self.lastRequest if (request.response != None): content = request.content soup = BeautifulSoup(content, "html.parser") if darkMatter: self.darkMatter = int( soup.find(id="current_darkmatter").attrs['data-real']) self.lastExtracedInfosDate = time.time() if planets: ps = soup.find(id="planetSelector").find_all("option") self.planets = [] for p in ps: planet = self.ia.planetNameParser.findall(str(p)) id = int(p.attrs['value']) name = planet[0][0] position = [int(x) for x in planet[0][1].split(":")] if "Lune" in name: position.append(3) else: position.append(1) pl = Planet(id, name, position, self) self.planets.append(pl) pl.scan()
def level3init(self): self.win = False self.screen3 = True self.bgColor = (0, 0, 0) Ship.init() ship = Ship(self.width / 2, self.height / 2) self.shipGroup = pygame.sprite.GroupSingle(ship) self.earthStage = 1 planet = Planet(self.width / 2, self.height - 100, "earth") self.planetGroup = pygame.sprite.Group(planet) self.asteroids = pygame.sprite.Group() self.missiles = pygame.sprite.Group() self.hitCount = 1 self.score3 = 0 self.earthFlag = False self.counter = 0 self.lost = False self.bgImage = pygame.transform.rotate( pygame.transform.scale( pygame.image.load('images/Lev3.png').convert_alpha(), (self.width, self.height)), 0) self.closeImage = pygame.transform.rotate( pygame.transform.scale( pygame.image.load('images/finish.jpg').convert_alpha(), (self.width, self.height)), 0)
def readPlanets(fname): data = open(fname) numPlanets = int(data.readline()) radius = float(data.readline()) planetsList = [ Planet(*data.readline().split()) for planet in range(numPlanets) ] return planetsList
def init1(self): moon = Moon(self.planetx + self.radCurve, self.planety + self.radCurve) planet = Planet(self.planetx, self.planety, "earth", 100) ship = Ship(self.planetx + self.r * cos(self.theta), self.planety + self.r * sin(self.theta)) self.planetGroup = pygame.sprite.Group(planet) #c self.shipGroup = pygame.sprite.Group(ship) #c self.moonGroup = pygame.sprite.Group(moon) #c
def create(self): self.planets = [] self.planets.append(Planet("Mercury", 3031, 32548000, 0)) self.planets.append(Planet("Venus", 7521, 66871000, 0)) self.planets.append(Planet("Earth", 7917, 92009000, 1)) self.planets.append(Planet("Mars", 4222, 142120000, 2)) self.planets.append(Planet("Jupiter", 86881, 484260000, 67)) self.planets.append(Planet("Saturn", 72367, 930450000, 62)) self.planets.append(Planet("Uranus", 31518, 1841600000, 27)) self.planets.append(Planet("Neptune", 30599, 2781900000, 14))
def __systemInit(self): self.__bodies = [] randNum = random.choices([1, 2, 3], weights=(90, 9, 1))[0] n = 0 for s in range(1): self.__bodies.append(Star(self, n)) n += 1 for p in range(random.randint(self.__minBodies, self.__maxBodies)): self.__bodies.append(Planet(self, n)) n += 1
def checkUpdate(self): print("Checking update...") p1 = Planet(1.0, 1.0, 3.0, 4.0, 5.0, "jupiter.gif") p1.update(2.0, 1.0, -0.5) self.checkEquals(7.8, p1.xxPos, "update()", 0.01) self.checkEquals(8.6, p1.yyPos, "update()", 0.01) self.checkEquals(3.4, p1.xxVel, "update()", 0.01) self.checkEquals(3.8, p1.yyVel, "update()", 0.01)
def __load_positions(self): for data in self.level_data: name, x, y = self.__break_data(data) if name == 'earth': self.earth = Planet(x, y) if name == 'black_hole': self.black_hole = Black_Hole(x, y) if name == 'star': self.stars.append(Star(x, y)) if name == 'neutron_star': self.neutron_stars.append(Neutron_Star(x, y))
def generate_planet(self): array_len = len(self.planet_names) index = random.randint(0, array_len - 1) planet_name = self.planet_names[index] del self.planet_names[index] # Removes the used name from the pool biome_generator = BiomeGen() number_of_biomes = random.randint(1, 5) biomes = [] while number_of_biomes >= 1: biomes.append(biome_generator.generate_biome()) # Adds another biome to the array number_of_biomes -= 1 planet = Planet(planet_name, biomes) return planet
def update_coords(self, t_struct): self.last_update_time_Ms = time.mktime(t_struct) p = Planet(planet_enum.SUN, res[planet_enum.SUN][0], res[planet_enum.SUN][1], res[planet_enum.SUN][2]) self.sun_coords = get_instance(t_struct=t_struct, planet=p) ra_dec = radec_get_instance(earth_coord=self.sun_coords, planet=self.planet, time=t_struct) self.current_coords.update_from_ra_dec(ra_dec.ra, ra_dec.dec) for imgsrc in self.image_sources: imgsrc.set_up_vector(self.sun_coords)
def create_planets(): """ This functions creates mock planets. Returns: list: List of mock planets. """ planets = [] earth = Planet("Earth", BLUE, 10, 1, (width // 2, 200), velocity=(1, 0)) sun = Planet("Sun", (255, 255, 0), int(696340 // SCALE), 1000, (width // 2, height // 2)) mars = Planet("MARS", RED, int(300000 // SCALE), 10, (width // 3, height // 2), velocity=(0, 1)) planets.append(earth) planets.append(mars) planets.append(sun) return planets
def get_planets_list(): planetas = [] for planet in planets: new_planet = planets[planet] planetas.append( Planet(name=planet, epsilon=new_planet['epsilon'], period=new_planet['p'], semimajor_axis=new_planet['a'], i=new_planet['i'], capital_omega=new_planet['capital_omega'], omega_bar=new_planet['omega_bar'])) return planetas
def initialize_list(dist_max, nbr_planetes, masse_moyenne, vitesse_moyenne, moment_ang_moyen, masse_terre=5.9722 * (10)**24, rayon_terre=6378.137 * (10)**3): densitee_terre = (masse_terre) / ((4 * np.pi * rayon_terre**3) / 3) ######################################### # Définition de la liste de planètes # ######################################### # 1) Masse: masse = np.array( abs_liste( np.random.normal(masse_moyenne, masse_moyenne / 3, nbr_planetes))) masse = masse * (masse_moyenne / masse.mean()) # 2) Rayon: rayon = [(((3 * m) / (densitee_terre * 4 * np.pi))**(1 / 3)) / 150 for m in masse] # 3) Position dist = np.random.rand(nbr_planetes) * dist_max angle = np.random.rand(nbr_planetes) * 2 * np.pi x = [d * np.cos(theta) for d, theta in zip(dist, angle)] y = [d * np.sin(theta) for d, theta in zip(dist, angle)] # 4) Vitesse vitesse = np.random.normal(vitesse_moyenne, vitesse_moyenne / 3, nbr_planetes) vitesse = vitesse * (vitesse_moyenne / vitesse.mean()) angle2 = np.random.rand(nbr_planetes) * 2 * np.pi #Définir les vitesse associées vx = [v * np.cos(theta2) for v, theta2 in zip(vitesse, angle2)] vy = [v * np.sin(theta2) for v, theta2 in zip(vitesse, angle2)] # 6) Création des planètes liste_planetes = [ Planet(masse, rayon, x, y, vx, vy, '{}'.format(i)) for masse, rayon, x, y, vx, vy, i in zip(masse, rayon, x, y, vx, vy, range(1, len(masse) + 1)) ] return liste_planetes
def generate(self): #creates a planet planet = Planet() #adds a random number of humans and robots to the planet object for index in range(random.randint(1, 10)): robot = Robot(f"Robot{index}") planet.add_robot(robot) for index in range(random.randint(1, 10)): human = Human(f"Human{index}") planet.add_human(human) # add to list of planets self.planets.append(planet)
def __init__(self, PlanetModel=Planet('Mars'), VehicleModel=EntryVehicle(), Coriolis=False, Powered=False): self.planet = PlanetModel self.vehicle = VehicleModel self.powered = Powered self.drag_ratio = 1 self.lift_ratio = 1 if Coriolis: self.dyn_model = self.__entry_vinhs else: self.dyn_model = self.__entry_3dof
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.setPalette(QtGui.QPalette(QtGui.QColor(100, 100, 100))) self.setAutoFillBackground(True) self.oImage = QtGui.QImage("background.jpg") sImage = self.oImage.scaled(QtCore.QSize(self.width(),self.height())) palette = QtGui.QPalette() palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(sImage)) self.setPalette(palette) self.planets =[] self.planets.append(Planet('Mercury', 57909175, 56671636.48, 11907903.61, 0.20563069, 0, 4.147727272727273, QtGui.QColor.fromRgb(217, 197, 180), 10)) self.planets.append(Planet('Venus', 108208930, 108206447.8, 732923.9709, 0.00677323, 0, 1.622222222222222, QtGui.QColor.fromRgb(186, 187, 188), 10)) self.planets.append(Planet('Earth', 149597890, 149577002.3, 2499813.6534358, 0.01671022, 0, 0.9993428978206111, QtGui.QColor.fromRgb(2, 0, 254), 10)) self.planets.append(Planet('Mars', 227936640, 226939989.1, 21292092.63, 0.09341233, 0, 0.5312954876273654, QtGui.QColor.fromRgb(255, 0, 0), 10)) self.planets.append(Planet('Jupiter', 778412020, 777500023.9, 37669428.22, 0.04839266, 0, 0.0843150843150843, QtGui.QColor.fromRgb(204, 153, 102), 20)) self.planets.append(Planet('Saturn', 1426725400, 1424632080, 77258036.45, 0.05415060, 0, 0.0339503302018417365, QtGui.QColor.fromRgb(229,183,59), 20)) self.planets.append(Planet('Uranus', 2870972200, 2867776762, 135417184.1, 0.04716771, 0, 0.0119032089746935, QtGui.QColor.fromRgb(31,117,254), 15)) self.planets.append(Planet('Neptun', 4498252900, 4498087098, 38621414.63, 0.00858587, 0, 0.00606836470040575, QtGui.QColor.fromRgb(0,72,186), 15))
def run(self, InitialState, Controllers, InputSample=None, FullEDL=False, AeroRatios=(1, 1)): """ Runs the simulation from a given a initial state, with the specified controllers in each phase, and using a chosen sample of the uncertainty space """ self.reset() if InputSample is None: InputSample = np.zeros(4) CD, CL, rho0, sh = InputSample self.sample = InputSample self.fullEDL = FullEDL if self.fullEDL: self.edlModel = System( InputSample=InputSample ) # Need to eventually pass knowledge error here else: self.edlModel = Entry(PlanetModel=Planet(rho0=rho0, scaleHeight=sh), VehicleModel=EntryVehicle(CD=CD, CL=CL)) self.edlModel.update_ratios(LR=AeroRatios[0], DR=AeroRatios[1]) self.update(np.asarray(InitialState), 0.0, None) self.control = Controllers while not self.is_Complete(): temp = self.advance() self.history = np.vstack( self.history ) # So that we can work with the data more easily than a list of arrays self.control_history.append( self.u ) # So that the control history has the same length as the data; self.control_history = np.vstack(self.control_history) return self.postProcess()
def level1init(self): self.marsHit = False self.screen1 = True self.playing = True self.onScreen = True self.marsx = self.width * 3 / 5 - 50 self.marsy = self.height / 2 self.mars = Planet(self.marsx, self.marsy, "mars", 100, 30) self.marsGroup = pygame.sprite.Group(self.mars) Ship.init() Moon.init() self.planetx, self.planety = self.width / 5, self.height - self.height / 3, self.r = 120 self.radCurve = 550 self.moonAngle = 80 self.moonx, self.moony = self.width, self.height self.init1() self.m = 0 self.gameDisplay = pygame.display.set_mode((self.width, self.height)) self.starImage = pygame.transform.rotate( pygame.transform.scale( pygame.image.load('images/stars.png').convert_alpha(), (self.width, self.height)), 0)
def initialize_list(dist_max, nbr_planetes, masse_moyenne, vitesse_moyenne, moment_ang_moyen, masse_terre=5.9722 * (10)**24, rayon_terre=6378.137 * (10)**3): densitee_terre = (masse_terre) / ((4 * np.pi * rayon_terre**3) / 3) ######################################### # Définition de la liste de planètes # ######################################### # 1) Masse: masse = np.array( abs_liste( np.random.normal(masse_moyenne, masse_moyenne / 3, nbr_planetes))) masse = masse * (masse_moyenne / masse.mean()) # 2) Rayon: rayon = [(((3 * m) / (densitee_terre * 4 * np.pi))**(1 / 3)) / 150 for m in masse] # 3) Position dist = np.random.rand(nbr_planetes) * dist_max angle = np.random.rand(nbr_planetes) * 2 * np.pi x = [d * np.cos(theta) for d, theta in zip(dist, angle)] y = [d * np.sin(theta) for d, theta in zip(dist, angle)] # 4) Vitesse vitesse = np.random.normal(vitesse_moyenne, vitesse_moyenne / 3, nbr_planetes) vitesse = vitesse * (vitesse_moyenne / vitesse.mean()) # 5) Moment angulaire selon z #Selon le vecteur vitesse, définir le moment angulaire maximal et le moment angulaire maximal pour chaque planète lz_max = 0 lz_max_liste = [] for v, m, x1, y1 in zip(vitesse, masse, x, y): lz_max += v * m * np.sqrt(x1**2 + y1**2) lz_max_liste.append(v * m * np.sqrt(x1**2 + y1**2)) lz_max = lz_max / nbr_planetes lz_max_liste = np.array(lz_max_liste) print('lz_max: {}'.format(lz_max)) #Si le moment angulaire demandé est suprérieur au moment angulaire maximal, avertir et définir de nouveau if lz_max < moment_ang_moyen: print( "Attention!!! Moment angulaire demandé supérieur au moment angulaire maximal" ) moment_ang_moyen = lz_max #Définir le multiple moyen requis multiple_moyen = moment_ang_moyen * nbr_planetes / lz_max_liste.sum( ) if moment_ang_moyen * nbr_planetes / lz_max_liste.sum() < 1 else 1 #Boucle sur tous les mutliples jusqu'à obtention d'une liste convenable multiple2 = [2] index = 0 while not all(i <= 1 and i >= -1 for i in multiple2): multiple2 = [] #Définition d'une liste aléatoire de multiple moyen selon le multiple moyen multiple = np.random.normal(multiple_moyen, 2 * (np.e**(-multiple_moyen + 1) - 1), nbr_planetes) #Définition d'une nouvelle liste de multiple de manière à ce qu'ils soient tous entre 0 et 1 multiple2 = [] for m in multiple: if m > 1 or m < -1: multiple2.append(2 * np.random.rand() - 1) else: multiple2.append(m) multiple2 = np.array(multiple2) #Normalisation de la deuxième liste de multiple correction = moment_ang_moyen / ( sum([l * m for l, m in zip(lz_max_liste, multiple2)]) / nbr_planetes) multiple2 = multiple2 * correction index += 1 #Si incapable de définir liste de planètes, sortir de la boucle if index > 200: print('Incapable de définir le système') raise SystemExit #Définir les angles associé pour chaque multiple angle2 = [] for m in multiple2: a = np.random.rand() if a >= 0.5: angle2.append(np.arcsin(m)) else: angle2.append(np.pi - np.arcsin(m)) #Définir les vitesse associées vx = [ v * np.cos(theta1 + theta2) for v, theta1, theta2 in zip(vitesse, angle, angle2) ] vy = [ v * np.sin(theta1 + theta2) for v, theta1, theta2 in zip(vitesse, angle, angle2) ] # 5) Moment angulaire selon z (2e façon) #moment_ang = np.random.normal(moment_ang_moyen,abs(moment_ang_moyen/3),nbr_planetes) #moment_ang = moment_ang * (moment_ang_moyen / moment_ang.mean()) #angle3 = np.random.rand(nbr_planetes)* 2 *np.pi #V = [lz/(m*d*np.sin(theta)) for lz,m,d,theta in zip(moment_ang,masse,dist,angle3)] #vx = [v*np.cos(theta1+theta2) for v,theta1,theta2 in zip(V,angle,angle3)] #vy = [v*np.sin(theta1+theta2) for v,theta1,theta2 in zip(V,angle,angle3)] # 6) Création des planètes liste_planetes = [ Planet(masse, rayon, x, y, vx, vy, '{}'.format(i)) for masse, rayon, x, y, vx, vy, i in zip(masse, rayon, x, y, vx, vy, range(1, len(masse) + 1)) ] return liste_planetes
def setUp(self): self.mock_planet1 = Planet("Test1", (0, 0, 0), 5, 1, (0, 0)) self.mock_planet2 = Planet("Test2", (0, 0, 0), 5, 1, (0, 0))
Question("The sun is made of ______ gases. ", "Farting", "Helium and neon", "Neon", "Hydrogen and Helium"), Question("What is the sun?", "Planet", "Giant planet", "Asteroid", "Star"), Question("Which celestial body has the most gravitational pull?", "Earth", "Moon", "Asteroid", "Sun"), Question("What two forces keep Earth in orbit with the sun?", "Heat and pressure", "Gravity and magnetic", "Magnetic and inertia", "Inertia and Gravity"), Question("Where does the light on the moon come from?", "Earth", "The moon gives off its own light", "Space", "Sun"), Question("What object do the planets of our solar system orbit around", "Earth", "The Moon", "Jupiter", "The Sun"), Question("The temperature of the sun is around _________ degrees Fahrenheit.", "10", "100", "1,000", "10,000"), Question("Why does the sun have a strong gravitational pull? ", "Color", "Smell", "Because NASA says it does", "Size"), Question("The sun makes up 98 percent of __________ in the solar system. ", "The Cotten Candy", "The Legos", "Pancake Batter", "Matter"), ] mercury = Planet( questions[0], questions[1], questions[2], questions[3],questions[4], questions[5],questions[6], questions[7],questions[8], questions[9]) venus = Planet( questions[10], questions[11], questions[12], questions[13], questions[14], questions[15], questions[16], questions[17], questions[18], questions[19]) earth = Planet( questions[20], questions[21], questions[22], questions[23], questions[24], questions[25], questions[26], questions[27], questions[28], questions[29]) mars = Planet( questions[30], questions[31], questions[32], questions[33], questions[34], questions[35], questions[36], questions[37], questions[38], questions[39]) #jupiter = Planet( questions[40], questions[41], questions[42], questions[43], questions[44], questions[45], questions[46], questions[47], questions[48], questions[49]) #saturn = Planet( questions[50], questions[51], questions[52], questions[53], questions[54], questions[55], questions[56], questions[57], questions[58], questions[59]) #uranus = Planet( questions[60], questions[61], questions[62], questions[63], questions[64], questions[65], questions[66], questions[67], questions[68], questions[69]) #neptune = Planet( questions[70], questions[71], questions[72], questions[73], questions[74], questions[75], questions[76], questions[77], questions[78], questions[79]) #y = 0 #x = 0 #mercury.displayAllQuestions("Mercury", "Venus") #venus.displayAllQuestions("Venus", "Earth") #earth.displayAllQuestions("Earth", "Mars") #mars.displayAllQuestions("Mars", "Jupiter") #jupiter.displayAllQuestions("Jupiter", "Saturn")