def prob_add_room(self, x, y, room_count): if random.random() < self.room_prob: new_room = Room(id=room_count, title="Room", description="room desc.") new_room.save() self.grid[y][x] = new_room return True return False
def generate_rooms(self, size_x, size_y, num_rooms): self.grid = [None] * size_y self.width = size_x self.height = size_y for i in range(len(self.grid)): self.grid[i] = [None] * size_x x = -1 y = 0 room_count = 0 direction = 1 previous_room = None while room_count < num_rooms: if direction > 0 and x < size_x - 1: room_direction = "e" x += 1 elif direction < 0 and x > 0: room_direction = "w" x -= 1 else: room_direction = "n" y += 1 direction *= -1 room = Room(title=room_title[room_count], description=room_descriptions[room_count], x=x, y=y) room.save() self.grid[y][x] = room if previous_room is not None: previous_room.connectRooms(room, room_direction) previous_room = room room_count += 1
def make_save_room(room_name, room_desc, x, y, items={}): new_room = Room(name=room_name, description=room_desc, x=x, y=y, items=items) new_room.save()
def generate_rooms(self, size_x, size_y, num_rooms): ''' Fill up the grid, bottom to top, in a zig-zag pattern ''' # Initialize the grid self.grid = [None] * size_y self.width = size_x self.height = size_y for i in range(len(self.grid)): self.grid[i] = [None] * size_x # Start from lower-left corner (0,0) x = -1 # (this will become 0 on the first step) y = 0 room_count = 0 # Start generating rooms to the east direction = 1 # 1: east, -1: west # While there are rooms to be created... previous_room = None while room_count < num_rooms: # Calculate the direction of the room to be created if direction > 0 and x < size_x - 1: room_direction = "e" x += 1 elif direction < 0 and x > 0: room_direction = "w" x -= 1 else: # If we hit a wall, turn north and reverse direction room_direction = "n" y += 1 direction *= -1 # Create a room in the given direction #room = Room(room_count, title="A Generic Room", description="This is a generic room.") # Note that in Django, you'll need to save the room after you create it pepper = random.choice(spicy_choices) pepper_description = "This room is listed at {} on the scoville scale, your discretion is advised".format( spicy_dict[pepper]) room = Room(room_count, title="{} Room".format(pepper), description=pepper_description) # SAVE ROOMS room.save() # Save the room in the World grid self.grid[y][x] = room # Connect the new room to the previous room if previous_room is not None: previous_room.connectRooms(room, room_direction) # Update iteration variables previous_room = room room_count += 1
def addRoom(x, y): # generate random title and description (title, description) = generateRoomDescription() # create room in database newRoom = Room(title=title, description=description, x=x, y=y) # store it newRoom.save() # return it return newRoom
def generate_rooms(self, size_x, size_y, num_rooms): ''' Fill up the grid, bottom to top, in a zig-zag pattern ''' # Initialize the grid self.grid = [None] * size_y self.width = size_x self.height = size_y rooms = generateRooms() for i in range(len(self.grid)): self.grid[i] = [None] * size_x # Start from lower-left corner (0,0) x = -1 # (this will become 0 on the first step) y = 0 room_count = 0 # Start generating rooms to the east direction = 1 # 1: east, -1: west # While there are rooms to be created... previous_room = None while room_count < num_rooms: # Calculate the direction of the room to be created if direction > 0 and x < size_x - 1: room_direction = "e" x += 1 elif direction < 0 and x > 0: room_direction = "w" x -= 1 else: # If we hit a wall, turn north and reverse direction room_direction = "n" y += 1 direction *= -1 # Create a room in the given direction room = Room(room_count, rooms[room_count]["name"], rooms[room_count]["description"], x, y) room.save() # Note that in Django, you'll need to save the room after you create it # Save the room in the World grid self.grid[y][x] = room # Connect the new room to the previous room if previous_room is not None: # print(previous_room) previous_room.connect_rooms(room, room_direction) # Update iteration variables previous_room = room room_count += 1
def generate_rooms(self, titles, descriptions): rooms_list = [] for x in range(0, self.maze_width): for y in range(0, self.maze_height): if self.maze[x][y] == 'X': self.num_rooms += 1 rooms_list.append([x, y]) """ Make a list of all the room Objects with titles and descriptions """ room_objects = [] for room in enumerate(rooms_list): r = Room(title=titles[room[0]], description=descriptions[room[0]], x=room[1][0], y=room[1][1]) r.save() room_objects.append(r) """ Cycle through the room objects and connect them """ for a_room in room_objects: starting_room = a_room starting_point = starting_room.x, starting_room.y surroundings = [] """ get the points around the coordinates """ surroundings = around_list(starting_point) connections = [] """ check if the point around it is a room """ for value in rooms_list: if value in surroundings: connections.append(value) """ add the direction to the connections """ connections_and_direction = [] for items in enumerate(surroundings): if items[1] in connections: if items[0] == 0: connections_and_direction.append([items[1], 'n']) if items[0] == 1: connections_and_direction.append([items[1], 's']) if items[0] == 2: connections_and_direction.append([items[1], 'w']) if items[0] == 3: connections_and_direction.append([items[1], 'e']) """ loop through the connection-direction pairs and connect the objects """ for pointz in connections_and_direction: for outer_room in room_objects: outer_point = [outer_room.x, outer_room.y] if outer_point == pointz[0]: if pointz[1] == 'n': starting_room.connectRooms(outer_room, 'n') if pointz[1] == 's': starting_room.connectRooms(outer_room, 's') if pointz[1] == 's': starting_room.connectRooms(outer_room, 'e') if pointz[1] == 'e': starting_room.connectRooms(outer_room, 'w') """ add the room ID to the maze """ self.maze[starting_room.x][starting_room.y] = starting_room.id return room_objects
def create_django_rooms(self): # get each room # turn into a django room # save to DB for row in self.grid: for room in row: if room: django_room = DjangoRoom() django_room.title = room.name django_room.description = room.description if room.n_to: django_room.n_to = room.n_to.id if room.s_to: django_room.s_to = room.s_to.id if room.e_to: django_room.e_to = room.e_to.id if room.w_to: django_room.w_to = room.w_to.id django_room.save() # This is what to run in the manage.py python shell: # # from room_gen import RoomGenerator # rg = RoomGenerator() # rg.generate_rooms() # rg.create_django_rooms()
def create_room(self, x, y): # generate a random title and description gen_title = util.name.gen(4, 6) gen_desc = util.desc.gen(gen_title) # generate a new room with the django Room model room = Room(self.room_id, title=gen_title, description=gen_desc) # set our room coordinates room.setCoords(x, y) self.room_id += 1 return room
def dfs_backtracker(world): w = world.width h = world.height id = world.id # create empty grid grid = [[None] * w for y in range(0, h)] # track visited cells stack = [] # choose an initial cell, create a Room in that cell start_coords = {'row': h // 2, 'col': w // 2} # create first room start_room = grid[start_coords['row']][start_coords['col']] = Room( title='', description='', row=start_coords['row'], col=start_coords['col'], world=world) start_room.save() # push cell to stack stack.append(start_room) # while the stack is not empty: while len(stack): # pop a cell from the stack and make it the current_room current_room = stack.pop() # check for the existence of neighbors on each side of the current_room. empty_neighbors = get_neighbor_cells( grid, current_room) # if no empty neighbors restart loop else make new rooms if len(empty_neighbors): # push current_room to stack stack.append(current_room) # randomly select one of the empty neighbors empty_cell = empty_neighbors[random.randint( 0, len(empty_neighbors) - 1)] # create a Room in empty_cell new_room = grid[empty_cell['row']][empty_cell['col']] = Room( title='', description='', col=empty_cell['col'], row=empty_cell['row'], world=world) # save new room to db new_room.save() # connect the current room to the new room current_room.connectRooms(new_room, empty_cell['dir']) # push the new room to the stack. stack.append(new_room) # set room tile number for row in grid: for room in row: room.set_tile_num() return start_room
def generate_rooms(num_rooms=100): # delete existing rooms and start fresh Room.objects.all().delete() # get data from json file with open("./util/shuffled.json", "r") as json_file: data = json.load(json_file) keys_list = list(data.keys()) vals_list = list(data.values()) # rooms array holds the rooms that will be output to the json file and count keeps track of created rooms. We'll use the queue to keep track of rooms that might still need neighbors # rooms = [] count = 0 q = Queue() # I wanted a square area to start with, but if it one side is the square of the number of the rooms, we'll end up with a boring square grid. random_grid_size = math.floor(math.sqrt(num_rooms) * 1.5) # Get our visited array ready. The visited array exists to help with room collisions. If I want to put a room north of the room I am looking at, how can I tell if there is already a room there? Visited keeps track of that. visited = [[None for i in range(random_grid_size + 1)] for j in range(random_grid_size + 1)] # random start position of first room random_start_x = random.randint(0, random_grid_size) random_start_y = random.randint(0, random_grid_size) # create first room, increment count new_room = Room( title=keys_list[count], description=vals_list[count]["description"], items=vals_list[count]["items"], x=random_start_x, y=random_start_y, ) new_room.save() count += 1 # add the new room to the queue to be evaluated q.enqueue(new_room) visited[random_start_y][random_start_x] = new_room while count < num_rooms: current = q.dequeue() holder, count = get_neighbors( current, visited, count, num_rooms, keys_list, vals_list, random_grid_size, ) # shuffle our neighbors for more variance random.shuffle(holder) for item in holder: if item is not None: q.enqueue(item)
def geck(self, num_rooms): room_count = 0 direction = None prev_room = None curr_room = None while room_count < num_rooms: room_attacher = randrange(4) direction = randrange(12) if direction <= 3 and room_attacher % 2 == 0: room_dir = "n" elif 3 < direction <= 6: room_dir = "e" elif 6 < direction <= 9: room_dir = "s" else: room_dir = "w" room = Room(room_count, "A room", "run through lambhog") if prev_room is not None: prev_room.connectRooms(curr_room, room_dir) prev_room = curr_room room_count += 1
def create_world(w, room_amount): full_map = [] map_row = [] ra = room_amount map_row_size = 0 full_map_height = 0 while ra > 0: title = 'adv' description = 'des' r = Room(title=fun_room_titles(), description=fun_room_descriptions()) r.save() if map_row_size == w: full_map.append(map_row) map_row_size = 0 full_map_height += 1 map_row = [] map_row.append(r) r.x = map_row_size r.y = full_map_height map_row_size += 1 ra -= 1 print(f'{r.title} + {r.description} + x = {r.x} + y = {r.y}') elif map_row_size < w: map_row.append(r) r.x = map_row_size r.y = full_map_height map_row_size += 1 ra -= 1 print(f'{r.title} + {r.description} + x = {r.x} + y = {r.y}') print(full_map) for row in full_map: for node in row: y = node.y x = node.x # North if y > 0: if full_map[y - 1][x]: node.connectRooms(full_map[y - 1][x], "n") y = node.y # East if x < len(row) - 1: if full_map[y][x + 1]: print(full_map[y][x + 1].id) node.connectRooms(full_map[y][x + 1], "e") x = node.x #South if y < len(full_map) - 1: if full_map[y + 1][x]: node.connectRooms(full_map[y + 1][x], "s") y = node.y #West if x > 0: if full_map[y][x - 1]: node.connectRooms(full_map[y][x - 1], "w") x = node.x node.save() return full_map
def room_generator(id): room_population = random.choice(population) room_ambiance = random.choice(ambiance) room_function = random.choice(funct) room_desc_begin = random.choice(description_beginners) title = f"{room_population.capitalize()} {room_function}" description = f"{room_desc_begin} a {room_population} {room_function}. {pop_desc[room_population]} {ambiance_desc[room_ambiance]} {functional_desc[room_function]}" return Room(id=id, title=title, description=description)
def place_maze_with_validation(self, rooms_created): x = 0 y = 0 if rooms_created == 1: room = Room(rooms_created, f"This is room {rooms_created}", f"This is a generic room called {rooms_created}.", x, y) room.save() self.get_edges(room) self.grid_view[(x, y)] = True return max = len(self.open_spaces) rand = secrets.randbelow(max) rev_dir = {"n": "s", "e": "w", "s": "n", "w": "e"} dir_val = {"n": 1, "e": 1, "s": -1, "w": -1} if self.open_spaces[rand] is not None: rm_id = self.open_spaces[rand][0] curr_rm = Room.objects.filter(id=rm_id)[0] rm_dir = self.open_spaces[rand][1] x = getattr(curr_rm, "x", 0) y = getattr(curr_rm, "y", 0) if rm_dir == "n" or rm_dir == "s": y += dir_val[rm_dir] if rm_dir == "w" or rm_dir == "e": x += dir_val[rm_dir] if (x, y) in self.grid_view: # print("can't place recurse") del self.open_spaces[rand] self.place_maze_with_validation(rooms_created) else: # print("place in space") room = Room(rooms_created, f"This is room {rooms_created}", f"This is a generic room called {rooms_created}.", x, y) room.save() rev_rm_dir = rev_dir[self.open_spaces[rand][1]] curr_rm.connectRooms(room, rm_dir) room.connectRooms(curr_rm, rev_rm_dir) del self.open_spaces[rand] self.grid_view[(x, y)] = True self.get_edges(room) else: self.place_maze_with_validation(rooms_created)
def __init__(self, number_rows, number_columns, ix=0, iy=0): self.number_rows, self.number_columns = number_rows, number_columns self.ix, self.iy = ix, iy Room.objects.all().delete() self.maze_map = [[ Room(row=x, column=y) for y in range(number_columns) ] for x in range(number_rows)] for x in range(self.number_rows): for y in range(self.number_columns): self.maze_map[x][y].save()
def grid_populator(): grid = [[None] * 10 for x in range(10)] room_count = 0 for row in range(len(grid)): for room in range(len(grid[row])): grid[row][room] = Room( title=ROOMS[room_count]['title'], description=ROOMS[room_count]['description']) grid[row][room].save() room_count += 1 return grid
def createAndSaveRooms(self): for y in range(0, self.dimensions): for x in range(0, self.dimensions): if not self.grid[y][x] == 0: # Create and Save the room HERE self.grid[y][x] = Room(title=titleGenerator(), description=descGenerator(), x_coor=x, y_coor=y) currentRoom = self.grid[y][x] currentRoom.save()
def create_django_rooms(self): # get each room # turn into a django room # save to DB for row in self.rooms: for room in row: if room: django_room = DjangoRoom() django_room.room_id = room.id django_room.title = room.title django_room.description = room.description if room.n_to: django_room.n_to = room.n_to if room.s_to: django_room.s_to = room.s_to if room.e_to: django_room.e_to = room.e_to if room.w_to: django_room.w_to = room.w_to django_room.save()
def generate_rooms(): num_rooms = 115 room_count = 0 previous_room = None while room_count < num_rooms: if 0 <= room_count <= 9: room_direction = "n" elif 10 <= room_count <= 25: if room_count % 2 != 0: room_direction = "n" else: room_direction = "e" elif 26 <= room_count <= 40: if room_count % 2 != 0: room_direction = "s" else: room_direction = "e" elif 40 <= room_count <= 42: if room_count % 2 != 0: room_direction = "s" else: room_direction = "e" elif 42 <= room_count <= 57: if room_count % 2 != 0: room_direction = "n" else: room_direction = "e" elif 58 <= room_count <= 75: if room_count % 2 != 0: room_direction = "s" else: room_direction = "e" elif 76 <= room_count <= 83: room_direction = "s" elif 83 <= room_count <= 116: room_direction = "w" # Create a room in the given direction # room = Room(room_count, "A Generic Room", "This is a generic room.", x, y) #maybe add room_count as the first field to determine id????? room = Room(title=f'Room {room_count}', description=f'This is room # {room_count}') # Note that in Django, you'll need to save the room after you create it # Saving the room room.save() # Connect the new room to the previous room if previous_room is not None: previous_room.connectRooms(room, room_direction) prev_dir = room_direction reverse_dirs = {"n": "s", "s": "n", "e": "w", "w": "e"} reverse_dir = reverse_dirs[prev_dir] room.connectRooms(previous_room,reverse_dir) # Updating iteration variables and prev direction previous_room = room room_count += 1
def get_neighbors( current, visited, count, num_rooms, keys_list, vals_list, random_grid_size, ): holder = [None] * 4 i = 0 directions = ["n_to", "s_to", "e_to", "w_to"] opposites = {"n_to": "s_to", "s_to": "n_to", "e_to": "w_to", "w_to": "e_to"} for direction in directions: # look through our available directions, if this room has that direction available, look to see if there is a room already in that position. If so link these two up, if not create a new room. if getattr(current, direction) is 0: look_y = None look_x = None # For each check we have to see if we stil even have anymore rooms to create, and we have to check the bounds. For example, if the current y is already 0, we cannot place a room north of that! if direction == "n_to" and count < num_rooms and current.y > 0: look_x = current.x look_y = current.y - 1 if ( direction == "e_to" and count < num_rooms and current.x < random_grid_size ): look_x = current.x + 1 look_y = current.y if ( direction == "s_to" and count < num_rooms and current.y < random_grid_size ): look_x = current.x look_y = current.y + 1 if direction == "w_to" and count < num_rooms and current.x > 0: look_x = current.x - 1 look_y = current.y # If look_y or look_x is still None, we don't want to put at room in this direction, continue the loop and start at the next direction if not look_y or not look_x: continue # If there is a room in that direction link these two if visited[look_y][look_x] is not None: another_room = visited[look_y][look_x] current.connectRooms(another_room, direction) another_room.connectRooms(current, opposites[direction]) # otherwise create a new room, increment count, link the two rooms else: another_room = Room( title=keys_list[count], description=vals_list[count]["description"], x=look_x, y=look_y, items=vals_list[count]["items"], ) another_room.save() count += 1 current.connectRooms(another_room, direction) another_room.connectRooms(current, opposites[direction]) visited[look_y][look_x] = another_room # add the linked room to the holder, holder holds all our neighbors, and will be added to the queue holder[i] = another_room i += 1 return [holder, count]
def place_maze_with_validation(self, rooms_created): if rooms_created == 1: room = Room(rooms_created, f"This is room {rooms_created}", f"This is a generic room called {rooms_created}.", 0, 0) room.save() self.get_edges(room) return max = len(self.grid_view) rand = secrets.randbelow(max) rev_dir = {"n":"s", "e":"w", "s":"n", "w":"e"} dir_val = {"n":1, "e":1, "s":-1, "w":-1} if self.grid_view[rand] is not None: x=0; y=0 rm_id = self.grid_view[rand][0] curr_rm = Room.objects.filter(id=rm_id)[0] rm_dir = self.grid_view[rand][1] x = curr_rm["x"] y = curr_rm["y"] if rm_dir = "n" or rm_dir = "s": y += dir_val[rm_dir] if rm_dir = "w" or rm_dir = "e": x += dir_val[rm_dir]
def make_world(self): """ Creates a world based on initial parameters using dfs algorithm """ # Total num of rooms for xi in range(self.width): for yj in range(self.height): newRoom = Room(x=xi, y=yj) newRoom.save() self.grid[xi][yj] = newRoom # Stack for depth first search current_room = self.room_at(self.width // 2, self.height // 2) room_stack = deque([current_room]) while len(room_stack): print(len(room_stack)) neighbours = self.find_valid_neighbours(current_room) if len(neighbours): print(neighbours) # if there are valid neighbours, choose a random one, connect them, direction, next_room = choice(neighbours) current_room.connectRooms(next_room, direction) room_stack.append(current_room) current_room = next_room else: # Reached a dead end, go back current_room = room_stack.pop()
class CreateWorld: def __init__(self, num_rooms): self.num_rooms = num_rooms self.grid_view = [] self.create_rooms() def get_edges(self, room): print(f"ROOM: {room.id}") if getattr(room, f"n_to", 0) == 0: self.grid_view.append((room.id, "n")) if getattr(room, f"e_to", 0) == 0: self.grid_view.append((room.id, "e")) if getattr(room, f"s_to", 0) == 0: self.grid_view.append((room.id, "s")) if getattr(room, f"w_to", 0) == 0: self.grid_view.append((room.id, "w")) def place_maze_with_validation(self, rooms_created): if rooms_created == 1: room = Room(rooms_created, f"This is room {rooms_created}", f"This is a generic room called {rooms_created}.", 0, 0) room.save() self.get_edges(room) return max = len(self.grid_view) rand = secrets.randbelow(max) rev_dir = {"n":"s", "e":"w", "s":"n", "w":"e"} dir_val = {"n":1, "e":1, "s":-1, "w":-1} if self.grid_view[rand] is not None: x=0; y=0 rm_id = self.grid_view[rand][0] curr_rm = Room.objects.filter(id=rm_id)[0] rm_dir = self.grid_view[rand][1] x = curr_rm["x"] y = curr_rm["y"] if rm_dir = "n" or rm_dir = "s": y += dir_val[rm_dir] if rm_dir = "w" or rm_dir = "e": x += dir_val[rm_dir] room = Room(rooms_created, f"This is room {rooms_created}", f"This is a generic room called {rooms_created}.") room.save() rev_rm_dir = rev_dir[self.grid_view[rand][1]] curr_rm.connectRooms(room, rm_dir) room.connectRooms(curr_rm, rev_rm_dir) del self.grid_view[rand] self.get_edges(room)
def generate_map(self, width, height): if width < 1 or height < 1: return False from adventure.models import Room import random from util.descriptions import descriptions Room.objects.all().delete() self.width = width self.height = height self.grid = [[Room(x=x, y=y) for y in range(self.height)] for x in range(self.width)] room = None for x in range(0, self.width): for y in range(0, self.height): room = self.grid[x][y] if room: room.save() n = self.width * self.height # random starting place ix, iy = random.randrange(0, self.width - 1), random.randrange( 0, self.height - 1) room_stack = [] current = self.grid[ix][iy] nv = 1 reverse_direction = {'n': 's', 's': 'n', 'w': 'e', 'e': 'w'} backtracked = False while nv < n: neighbors = self.find_neighbors(current) if not neighbors: if len(descriptions) and not backtracked: self.generate_description(current, True, descriptions) else: self.generate_description(current) current = room_stack.pop() backtracked = True continue backtracked = False direction, next_room = random.choice(neighbors) current.connectRooms(next_room, direction) next_room.connectRooms(current, reverse_direction[direction]) # setup title and description self.generate_description(current) # other params are defaulted room_stack.append(current) current = next_room nv += 1
def fillGrid(): grid = [[None] * 10 for x in range(10)] counter = 0 for i in range(len(grid)): for j in range(len(grid[i])): count_string = f'{counter}th' if counter == 1: count_string = '1st' if counter == 2: count_string = '2nd' if counter == 3: count_string = '3rd' grid[i][j] = Room( title=f"The {count_string} Room", description= f"""This is the description for the {count_string} room, the {count_string} description written.""" ) grid[i][j].save() counter += 1 # Update description generator once map generator is tested and proves working return grid
def __init__(self, nx, ny, ix=0, iy=0): """Initialize the maze grid. The maze consists of nx x ny rooms and will be constructed starting at the room indexed at (ix, iy). """ self.nx, self.ny = nx, ny self.ix, self.iy = ix, iy self.maze_map = [[Room.create(x, y) for y in range(ny)] for x in range(nx)] for row in self.maze_map: for room in row: r_info = ALL_ROOMS.pop(0) room.title = r_info[0] room.description = r_info[1] room.save()
def make_planet(title, num_rows): rooms = [[] for row in range(num_rows)] for i in range(num_rows): for j in range(num_rows): rooms[i].append(Room()) for i in range(num_rows): for j in range(num_rows): if i == num_rows-1 or i == 0: rooms[i][j] = 0 elif j == num_rows-1 or j==0: rooms[i][j] = 0 else: pass for row in rooms: print(row) return
def make_rooms(new_map, genre): # make first room (0,0) entrance = Room( map_id=new_map, name='Entrance' ) ###TODO: change Room to have coordinates (maybe, also sorta done?) entrance.save() rooms = {(0, 0): entrance} new_map.save() # create branches (recursion) entrance.north = make_room('south', new_map, coords=(0, 1), rooms=rooms, recursion=1, prev_room=entrance, genre=genre) entrance.save() return rooms
def createAndSaveRooms(self): names = [ "anteroom", "armory", "assembly room", "attic", "backroom", "ballroom", "basement", "bathroom", "bedroom", "boardroom", "boiler room", "boudoir", "breakfast nook", "breakfast room", "cabin, cell", "cellar", "chamber", "changing room", "chapel", "classroom", "clean room", "cloakroom", "cold room", "common room", "conference room", "conservatory", "control room", "courtroom", "cubby", "darkroom", "den", "dining room", "dormitory", "drawing room", "dressing room", "dungeon", "emergency room", "engine room", "entry", "family room", "fitting room", "formal dining room", "foyer", "front room", "game room", "garage", "garret", "great room", "green room", "grotto", "guest room", "gym", "hall", "hallway", 'homeroom', "hospital room", "hotel room", "inglenook", "jail cell", "keep", "kitchen", 'kitchenette', "ladies room", "larder", "laundry room", "library", "living room", "lobby", "locker", "room loft", "lounge", "lunchroom", "maids room", "mailroom", "mens room", "morning room", "motel room", "mud room", "newsroom", 'nursery', 'office', "operating room", "panic room", "pantry", "parlor", 'playroom', "pool room", "powder room", "prison cell", "rec room", "recovery room", "restroom", "rumpus room", "salesroom", "salon", 'schoolroom', "screen porch", "scullery", "showroom", "sick room", "sitting room", "solarium", "staff room", "stateroom", "stockroom", "storeroom", "studio", "study", "suite", "sunroom", "tack room", "utility room", "vestibule", "visitors room", "waiting room", "wardroom", "washroom", "water closet", "weight room", "wine cellar", "womens room", "workroom" ] descriptions = ["So quiet", "So cold", "So hot"] for y in range(0, self.dimensions): for x in range(0, self.dimensions): if not self.grid[y][x] == 0: # Create and Save the room HERE self.grid[y][x] = Room( title=random.choice(names), description=random.choice(descriptions), x_coor=x, y_coor=y) currentRoom = self.grid[y][x] currentRoom.save()