def upp_stringer(input_list): #input a characteristics list """ converts a characteristics list to a UPP string """ output_list = [] for item in input_list: output_list.append(str(stellagama.pseudo_hex(item))) return ''.join(output_list) #output a string
def __init__(self, hex): self.name = stellagama.random_line(os.path.join('data', 'worlds.txt')) self.hex = hex self.uwp_dict = { "starport": "X", "size": stellagama.dice(2, 6) - 2, "atmosphere": 0, "hydrographics": 0, "population": 0, "government": 0, "law": 0, "tl": 0 } self.uwp_dict["atmosphere"] = atmo_gen(self.uwp_dict["size"]) self.uwp_dict["hydrographics"] = hydro_gen(self.uwp_dict["size"], self.uwp_dict["atmosphere"]) self.uwp_dict["population"] = pop_gen(self.uwp_dict["atmosphere"], self.uwp_dict["hydrographics"]) self.uwp_dict["government"] = gov_gen(self.uwp_dict["population"]) self.uwp_dict["law"] = law_gen(self.uwp_dict["government"]) self.uwp_dict["starport"] = starport_gen(self.uwp_dict["population"]) self.uwp_dict["tl"] = tech_gen(self.uwp_dict) self.hex_uwp = { "starport": self.uwp_dict["starport"], "size": stellagama.pseudo_hex(self.uwp_dict["size"]), "atmosphere": stellagama.pseudo_hex(self.uwp_dict["atmosphere"]), "hydrographics": stellagama.pseudo_hex(self.uwp_dict["hydrographics"]), "population": stellagama.pseudo_hex(self.uwp_dict["population"]), "government": stellagama.pseudo_hex(self.uwp_dict["government"]), "law": stellagama.pseudo_hex(self.uwp_dict["law"]), "tl": stellagama.pseudo_hex(self.uwp_dict["tl"]) } self.zone = zone_gen(self.uwp_dict) self.pbg = pbg_gen(self.uwp_dict["population"]) self.pbg_list = self.pbg.split() if int(self.pbg_list[0]) > 0: self.gas_giant = "G" self.base = base_gen(self.uwp_dict["starport"]) self.trade_list = trade_gen(self.uwp_dict) self.trade_string = " ".join(self.trade_list) self.allegiance = "Na" self.ix = "" self.ex = "" self.cx = "" self.noble = "" self.w = "" self.stellar = ""
def uwp_hex(uwp_list): #input UWP list """ convert the UWP list to a pseudo-hex UWP string """ uwp = [] uwp.append(uwp_list[0]) uwp.append(stellagama.pseudo_hex(uwp_list[1])) uwp.append(stellagama.pseudo_hex(uwp_list[2])) uwp.append(stellagama.pseudo_hex(uwp_list[3])) uwp.append(stellagama.pseudo_hex(uwp_list[4])) uwp.append(stellagama.pseudo_hex(uwp_list[5])) uwp.append(stellagama.pseudo_hex(uwp_list[6])) uwp.append(stellagama.pseudo_hex(uwp_list[7])) uwp_string = "%s%s%s%s%s%s%s-%s " % (uwp[0], uwp[1], uwp[2], uwp[3], uwp[4], uwp[5], uwp[6], uwp[7]) return uwp_string #output Cepheus-style UWP string
def upp_stringer(upp_dict): output_list = [] for value in upp_dict.values(): output_list.append(str(stellagama.pseudo_hex(value))) return ''.join(output_list)