def gen_station(self): s = self.gen_a(GeneratedStation, "disabled_access", "has_rail", "music", "architecture", "size", "cleanliness") name = gibberish.generate_word() + random.choice( EntityProperties["surname"]) s.p["name"] = name.title() return s
def test_generate_words(): word_list = gibberish.generate_word() assert len(word_list) for word in word_list: assert len(word) assert word.isalpha()
def generate_sea(self): random.seed(self.name) island_count = random.randint(5, 8) island_names = [] for i in range(0, island_count): island_names.append(gibberish.generate_word(random.randint(1, 3))) Debug.print("Islands of the " + self.name + " Sea: " + str(island_names)) for i in range(0, island_count): x = random.randint(0, 6) y = random.randint(0, 6) pos = pygame.math.Vector2(x, y) name = island_names[i].capitalize() self.islands[str(pos)] = Island(pos, name) generation(self.islands[str(pos)])
def __init__(self, game, gen=True, test=False): super().__init__(game) self.test = test self.gen = gen if gen: self.game.sea = Sea("Test" if test else gibberish.generate_word( random.randint(1, 3)).capitalize()) self.selected_tile = pygame.Vector2(3, 3) self.name_font = pygame.font.SysFont("Consolas", 30) self.island_placeholder = pygame.image.load( "res/island-placeholder.png") self.sea_bg = pygame.Surface(pygame.math.Vector2(7 * 64, 7 * 64)) for ix in range(0, 7): for iy in range(0, 7): tile = -1 if ix == 0: if iy == 0: tile = 0 elif iy == 6: tile = 6 else: tile = 3 elif ix == 6: if iy == 0: tile = 2 elif iy == 6: tile = 8 else: tile = 5 else: if iy == 0: tile = 1 elif iy == 6: tile = 7 else: tile = 4 spr = Drawing.Sprite(water_tex) spr.subrect = pygame.Rect(tile % 3 * 16, int(tile / 3) * 16, 16, 16) spr.scale = pygame.math.Vector2(4, 4) spr.pos = pygame.math.Vector2(ix * 64, iy * 64) spr.draw(self.sea_bg)
def gen_line(self): l = self.gen_a(GeneratedLine, "color", "stroke", "built", "has_aircon") name = l.p["color"] + " " + gibberish.generate_word() l.p["name"] = name.title() return l
def test_generate_word(): word = gibberish.generate_word() assert len(word) assert word.isalpha()
lines = int(sys.argv[1]) streets = [ 'RD', 'ROAD', 'DR', 'DRIVE', 'AVE', 'AVENUE', 'CIR', 'CIRCLE', 'WAY', 'ST', 'STREET', 'ALY', 'ALLEY', 'BROOK', 'BRK', 'PARKWAY', 'PKWY' ] states = [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" ] for x in range(lines): secure_random = random.SystemRandom() string = "\"" + gibberish.generate_word( ) + " " + gibberish.generate_word() + "\",\"" + '{:03d}'.format( random.randint(1, 999) ) + "-" + '{:02d}'.format(random.randint(1, 99)) + "-" + '{:04d}'.format( random.randint(1, 9999)) + "\",\"" '{:03d}'.format( random.randint(1, 999) ) + " " + gibberish.generate_word() + " " + secure_random.choice( streets) + " " + gibberish.generate_word( ) + ", " + secure_random.choice(states) + " " + '{:05d}'.format( random.randint(1, 99999)) + "\"" string = string.upper() print(string)
def gen_station(self): s = self.gen_a(GeneratedStation, StationProperties) name = gibberish.generate_word() + random.choice( OtherProperties["surname"]) s.p["name"] = name.title() return s
def gen_line(self): l = self.gen_a(GeneratedLine, LineProperties) name = l.p["color"] + " " + gibberish.generate_word() l.p["name"] = name.title() return l