Example #1
0
def lifegen(p) -> list:
    """p of type Planet"""
    if not ishab(p) or istox(p):
        # see https://en.wikipedia.org/wiki/Drake_equation#Fraction_of_the_above_that_actually_go_on_to_develop_life,_fl
        return []
    # only 50/50 for when it is hab
    # t1
    i = 0
    while 1:
        if random() < .5:
            return [rlife() for _ in range(randint(6 * i + 1, 6 * i + 6))]
        i += 1  # this represents "Tier n-1" sporelike worlds
Example #2
0
def gettype(p: Planet) -> float:
    if not p.atmosphere:
        return 2
    if p.mass > m_gg:
        if p.mass < m_ig:
            return -3
        return -2
    state = statemap[chemstate(water, p)]
    if ishab(p):
        return .1 if istox(p) else 0
    if state == 1:
        return .5
    if state == 0:
        return -1
    return 1
Example #3
0
def poi(p: Planet) -> str:
	"""See if planet contains an oddity!"""
	# Gas giants
	if m_gg < p.mass:
		# Hot Jupiter/Neptune
		if t_earth < p.temp:
			if p.mass > m_ig:
				return 'Hot Jupiter'
			return 'Hot Neptune'
		# Mini-Neptune
		if p.mass < 8.681e25:
			return 'Mini-Neptune'
		# Super-Jupiter
		if m_j < p.mass:
			return 'Super-Jupiter'
		return ''
	# otherwise, MUST be terrestrial
	# Helium Planet
	atm = p.atmosphere
	if 'He' in atm and m_earth < p.mass:
		if max(p.atmosphere.items(), key=lambda x: x[1])[0] == 'He':
			return 'Helium Planet'
	# "Habitables"
	if ishab(p):
		# Superhabitable https://en.wikipedia.org/wiki/Superhabitable_planet
		# "... superhabitable worlds would likely be larger, warmer,
		# and older than Earth, and orbiting K-type main-sequence stars."
		if p.mass > m_earth and p.temp > t_earth:
			return 'Superhabitable'
		# Toxics
		if istox(p):
			return 'Toxic'
	# Mesoplanet
	if p.mass < 3.3011e23:
		return 'Mesoplanet'
	return ''
Example #4
0
def planet(p: Planet) -> Color:
	return colorMap[ishab(p)]
Example #5
0
def main(system: System) -> Color:
	for _, p in system.bodies:
		if ishab(p):
			return colorMap[True]
	return colorMap[False]