def Planetary_Object(planet_type, slot): # Values for calculating Planetary Data dia_base = [0, 400, 400, 2500, 12500, 50000, 25000] dia_mod = [0, 100, 100, 1000, 1000, 10000, 5000] dia_die_num = [0, 3, 3, 2, 1, 2, 1] den_base = [0, 0, 0, 2.5, 2, 0.5, 1] den_die_num = [0, 1, 1, 1, 1, 2, 2] den_exp = [1, 1.15, 1, 0.75, 1, 1, 1] den_die_div = [1, 1, 1, 1, 1, 10, 10] day_die_num = [0, 2, 3, 3, 4, 4, 4] day_die_base = [0, 0, 12, 12, 0, 0, 0] # Actual Calculations diameter = dia_base[planet_type] + dia_mod[planet_type] * rolldice( dia_die_num[planet_type], 6) density = den_base[planet_type] + ( rolldice(den_die_num[planet_type], 6) / den_die_div[planet_type])**den_exp[planet_type] day_length = rolldice(day_die_num[planet_type], 6) + day_die_base[planet_type] gravity = (diameter / 12742) * (density / 5.5153) esc_velocity = 11186 * (diameter / 12742) * math.sqrt( density / 5.5153) # escape velocity in m/s yearlength = float(math.sqrt((orbital_locations[slot]**3) / float(mass))) return diameter, density, day_length, gravity, esc_velocity, yearlength
def atmosphere(planet_type, slot): pressure_options = { 0: "Vacuum", 1: "Vacuum", 2: "Vacuum", 3: "Vacuum", 4: "Trace", 5: "Low", 6: "Low", 7: "Normal", 8: "Normal", 9: "High", 10: "High", 11: "Very High", 12: "Very High", 13: "Very High", 14: "Very High", 15: "Very High", 16: "Very High", 17: "Very High", 18: "Very High", 19: "Very High", 20: "Very High" } pressure_roll = rolldice(2, 6) - (2 * lifezone_check[slot]) esc_velo_mod = (esc_velocity_list[slot] / 11186) pressure_roll = round(pressure_roll * esc_velo_mod) pressure = pressure_options[pressure_roll] # Calculate Habitability if pressure_roll < 5 or pressure_roll > 10: habitable = False else: if 10 >= pressure_roll >= 9 or 6 >= pressure_roll >= 5: lowhigh_press_check = 1 else: lowhigh_press_check = 0 if planet_type == 4: giant_terra = 1 else: giant_terra = 0 habit_roll = rolldice(3, 6) print("Habitability roll is: " + str(habit_roll) + " - " + str(lowhigh_press_check) + " - (2 * " + str(giant_terra) + ") + " + str(habit_mod)) habit_roll = habit_roll - lowhigh_press_check - ( 2 * giant_terra) + int(habit_mod) if habit_roll >= 9: habitable = True else: habitable = False # Calculate Surface temperatures if pressure_roll < 5: r_mod = 1.0 elif 4 < pressure_roll < 7: r_mod = 0.95 elif 6 < pressure_roll < 9: r_mod = 0.9 elif 8 < pressure_roll < 11: r_mod = 0.8 elif pressure_roll > 10: r_mod = 0.5 surf_temp = 277 * float(lum)**0.25 * math.sqrt( 1 / (orbital_locations[slot] * r_mod)) # Determine Habitable planet features if habitable: # Percent Water Calculation water_roll = round(rolldice(2, 6) * lifezone_mod[slot] * esc_velo_mod) + (3 * giant_terra) print("Water Roll modified by life zone (" + str(lifezone_mod[slot]) + "), escape velocity mod (" + str(esc_velo_mod) + ") + giant terrestrial mod (3 * " + str(giant_terra) + ")") if water_roll < 0: percent_water = 0 elif water_roll == 0: percent_water = 5 elif water_roll == 1: percent_water = 10 elif water_roll == 2: percent_water = 20 elif water_roll == 3: percent_water = 30 elif 5 >= water_roll >= 4: percent_water = 40 elif 7 >= water_roll >= 6: percent_water = 50 elif water_roll == 8: percent_water = 60 elif water_roll == 9: percent_water = 70 elif water_roll == 10: percent_water = 80 elif water_roll == 11: percent_water = 90 elif water_roll >= 12: percent_water = 100 # atmospheric condition atmosphere_roll = rolldice(2, 6) - (2 * giant_terra) if atmosphere_roll < 2: atmos_condition = "Toxic" elif 7 > atmosphere_roll > 1: atmos_condition = "Tainted" elif atmosphere_roll > 6: atmos_condition = "Breathable" # Highest Life Form lifeform_roll = rolldice(2, 6) + int(habit_mod) if lifeform_roll <= 0: lifeform = "Microbe" elif lifeform_roll == 1: lifeform = "Plants" elif lifeform_roll == 2: lifeform = "Insects" elif 5 > lifeform_roll > 2: lifeform = "Fish" elif 7 > lifeform_roll > 4: lifeform = "Amphibians" elif 9 > lifeform_roll > 6: lifeform = "Reptiles" elif 11 > lifeform_roll > 8: lifeform = "Birds" elif lifeform_roll > 10: lifeform = "Mammals" elif not habitable: percent_water = 0 atmos_condition = "Toxic" lifeform = "None" return pressure, habitable, surf_temp, percent_water, atmos_condition, lifeform
def Moons(planet_type): # Initializing Data small_moon = 0 medium_moon = 0 large_moon = 0 giant_moon = 0 rings = False moonroll = rolldice(1, 6) if planet_type == 0 or planet_type == 1: small_moon = 0 medium_moon = 0 large_moon = 0 giant_moon = 0 rings = False else: if moonroll < 3: if planet_type == 2: small_moon = rolldice(1, 6) - 3 medium_moon = rolldice(1, 6) - 5 elif planet_type == 3: large_moon = rolldice(1, 6) - 5 elif planet_type == 4: small_moon = rolldice(1, 6) - 3 giant_moon = rolldice(1, 6) - 5 elif planet_type == 5: small_moon = rolldice(5, 6) medium_moon = rolldice(1, 6) - 2 large_moon = rolldice(1, 6) - 1 giant_moon = rolldice(1, 6) - 4 if rolldice(1, 6) < 4: rings = True else: rings = False elif planet_type == 6: small_moon = rolldice(2, 6) large_moon = rolldice(1, 6) - 3 giant_moon = rolldice(1, 6) - 4 elif 5 > moonroll > 2: if planet_type == 2: small_moon = rolldice(1, 6) - 2 elif planet_type == 3: small_moon = rolldice(1, 6) - 3 medium_moon = rolldice(1, 6) - 3 elif planet_type == 4: small_moon = rolldice(1, 6) - 2 medium_moon = rolldice(1, 6) - 3 large_moon = rolldice(1, 6) - 4 elif planet_type == 5: small_moon = rolldice(5, 6) medium_moon = rolldice(1, 6) - 2 large_moon = rolldice(1, 6) - 3 if rolldice(1, 6) < 5: rings = True else: rings = False elif planet_type == 6: small_moon = rolldice(2, 6) medium_moon = rolldice(1, 6) - 2 large_moon = rolldice(1, 6) - 3 if rolldice(1, 6) < 4: rings = True else: rings = False elif moonroll > 4: if planet_type == 3: small_moon = rolldice(2, 6) - 4 if rolldice(1, 6) < 2: rings = True else: rings = False elif planet_type == 4: small_moon = rolldice(2, 6) medium_moon = rolldice(1, 6) - 3 if rolldice(1, 6) < 3: rings = True else: rings = False elif planet_type == 5: small_moon = rolldice(5, 6) medium_moon = rolldice(1, 6) - 3 large_moon = rolldice(1, 6) - 4 if rolldice(1, 6) < 5: rings = True else: rings = False elif planet_type == 6: small_moon = rolldice(2, 6) medium_moon = rolldice(1, 6) - 3 large_moon = rolldice(1, 6) - 4 if rolldice(1, 6) < 4: rings = True else: rings = False small_moon = int((abs(small_moon) + small_moon) / 2) medium_moon = int((abs(medium_moon) + medium_moon) / 2) large_moon = int((abs(large_moon) + large_moon) / 2) giant_moon = int((abs(giant_moon) + giant_moon) / 2) return small_moon, medium_moon, large_moon, giant_moon, rings
def ice_giant(): ice_giant_diameter = 25000 + 5000 * rolldice(1, 6) ice_giant_density = 1 + rolldice(2, 6) / 10 ice_giant_day_length = rolldice(4, 6) return ice_giant_day_length, ice_giant_density, ice_giant_diameter
"\nERROR: Enter 1, 2, 3 or 4 for the star generation style\n") star_style = -1 continue elif star_style == 4: star_style = random.randint(1, 3) break else: break except ValueError: continue starname = input("Enter a name for your star: ") # Determine star type and subtype with open("Primary Star Generation Table.csv") as file: star_select = rolldice(2, 6) star_search = { star_select: tuple(stars) for star_select, *stars in csv.reader(file) } real, life, hot = star_search[str(star_select)] star_style_list = {1: real, 2: life, 3: hot} star_subtype = rolldice(1, 10) - 1 star_type = (star_style_list[star_style], star_subtype) print("Your star type is " + str(star_type[0]) + str(star_type[1]) + "V.") # Store data about the given star type with open("Primary Solar Stats Table.csv") as file: star_stats = {(star_type, star_subtype): tuple(stats) for star_type, star_subtype, *stats in csv.reader(file)} charge, transit_time, safe_jump_distance, mass, lum, radius, temp, lifetime, habit_mod, ILZ_dist_km, ILZ_dist_au, ILZ_temp, OLZ_dist_km, OLZ_dist_au, OLZ_temp = \
def Asteroid_Belt(): ast_diameter = 400 + 100 * rolldice(3, 6) ast_density = rolldice(1, 6)**1.15 ast_day_length = rolldice(2, 6) return ast_diameter, ast_density, ast_day_length
def gas_giant(): gas_giant_diameter = 50000 + 10000 * rolldice(2, 6) gas_giant_density = 0.5 + rolldice(2, 6) / 10 gas_giant_day_length = rolldice(4, 6) return gas_giant_day_length, gas_giant_density, gas_giant_diameter
def Giant_Terrestrial(): g_terra_diameter = 12500 + 1000 * rolldice(1, 6) g_terra_density = 2 + rolldice(1, 6) g_terra_day_length = rolldice(4, 6) return g_terra_day_length, g_terra_density, g_terra_diameter
def Terrestrial(): terra_diameter = 2500 + 1000 * rolldice(2, 6) terra_density = 2.5 + rolldice(1, 6)**0.75 terra_day_length = rolldice(3, 6) + 12 return terra_day_length, terra_density, terra_diameter
def Dwarf_Terrestrial(): d_terra_diameter = 400 + 100 * rolldice(3, 6) d_terra_density = rolldice(1, 6) d_terra_day_length = rolldice(3, 6) + 12 return d_terra_day_length, d_terra_diameter, d_terra_density