def gen_random_map(size, num_s, num_x, max_c, max_i, max_r): map_state = np.random.randint(1, 10, size=size).astype('<U1') site_dict = {"S": num_s, "X": num_x} for site_name in site_dict: for site in range(site_dict[site_name]): done = False new_pos = () while not done: new_pos = (np.random.randint(0, size[0]), np.random.randint(0, size[1])) if map_state[new_pos[0], new_pos[1]] not in ["S", "X"]: done = True map_state[new_pos[0], new_pos[1]] = site_name return Rules.Map(map_state, max_i, max_c, max_r)