Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A way to generate planetary/system names from numbers.
lookup = ['Aleph', 'Alpha', 'Antares', 'Beta', 'Bootes', 'Barum', 'Ceres', 'Charion', 'Chardibus', 'Chalupa', 'Delta', 'Darion', 'Doolan', 'Echo', 'Eres', 'Eribus', 'Encephalus', 'Ender', 'Foxtrot', 'Famicom', 'Gamma', 'Gregorio', 'Grace', 'Gaea', 'Gaia', 'Howzer', 'Hera', 'Hosio', 'Ignus', 'Io', 'Ionus', 'Ibus', 'Jax', 'Jovia', 'Jolo', 'Keras', 'Kodia', 'Li', 'Libra', 'Lol', 'Orphius', 'Orchid', 'Odyssus', 'Persephone', 'Pax', 'Qualude', 'Qi', 'Ra', 'Rez', 'Radium', 'Tia', 'Tori', 'Uso', 'Ura', 'Varia', 'Verit', 'Wex', 'Woolio', 'X', 'Yota', 'Yttrius', 'Zoe', 'Zee', 'Zae', 'Zeebs']
def from_int(num):
base = len(lookup) # Base whatever.
name = list()
while num > 0:
digit = num%base
num = num//base
name.append(lookup[digit])
string = ""
string += "{} supercluster. ".format(name.pop())
string += "{} group. ".format(name.pop())
string += "{} system. ".format(name.pop())
string += "-".join(name)
return string
#Examples:
#In [30]: from_int(15620)
#Out[30]: 'Beta supercluster. Qualude group. Gamma system. '
#In [31]: from_int(156200185)
#Out[31]: 'Chardibus supercluster. Rez group. Tia system. Tia-Io'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.