def __init__(self, my_map, starts, goals, paths, predictions):
    self.my_map = np.flip(np.transpose(my_map), 1)
    self.predictions = predictions
    self.starts = []
    for start in starts:
        self.starts.append((start[1], ((len(self.my_map[0]) - 1) - start[0])))
    self.goals = []
    for goal in goals:
        self.goals.append((goal[1], ((len(self.my_map[0]) - 1) - goal[0])))
    self.paths = []
    if paths:
        for path in paths:
            self.paths.append([])
            for loc in path:
                self.paths[(- 1)].append((loc[1], ((len(self.my_map[0]) - 1) - loc[0])))
    aspect = (len(self.my_map) / len(self.my_map[0]))
    self.fig = plt.figure(frameon=False, figsize=((4 * aspect), 4))
    self.ax = self.fig.add_subplot(111, aspect='equal')
    self.fig.subplots_adjust(left=0, right=1, bottom=0, top=1, wspace=None, hspace=None)
    self.patches = []
    self.artists = []
    self.agents = dict()
    self.agent_names = dict()
    self.goal_predictions = dict()
    self.agent_goal_connections = dict()
    x_min = (- 0.5)
    y_min = (- 0.5)
    x_max = (len(self.my_map) - 0.5)
    y_max = (len(self.my_map[0]) - 0.5)
    plt.xlim(x_min, x_max)
    plt.ylim(y_min, y_max)
    plt.xticks(np.arange(x_min, x_max, 1))
    plt.yticks(np.arange(y_min, y_max, 1))
    plt.grid(color='0.85')
    self.patches.append(Rectangle((x_min, y_min), (x_max - x_min), (y_max - y_min), facecolor='none', edgecolor='gray'))
    for i in range(len(self.my_map)):
        for j in range(len(self.my_map[0])):
            if self.my_map[i][j]:
                self.patches.append(Rectangle(((i - 0.5), (j - 0.5)), 1, 1, facecolor='gray', edgecolor='gray'))
    self.T = 0
    for (i, goal) in enumerate(self.goals):
        goal_color = Colors[(i % len(Colors))]
        self.patches.append(Rectangle(((goal[0] - 0.25), (goal[1] - 0.25)), 0.5, 0.5, facecolor=goal_color, edgecolor='black', alpha=0.5))
    for a in range(len(self.paths)):
        name = str(a)
        self.agents[a] = Circle((starts[a][0], starts[a][1]), 0.3, facecolor=Colors[(a % len(Colors))], edgecolor='black')
        self.agents[a].original_face_color = Colors[(a % len(Colors))]
        self.patches.append(self.agents[a])
        self.T = max(self.T, (len(paths[a]) - 1))
        self.agent_names[a] = self.ax.text(starts[a][0], (starts[a][1] + 0.25), name)
        self.agent_names[a].set_horizontalalignment('center')
        self.agent_names[a].set_verticalalignment('center')
        self.artists.append(self.agent_names[a])
        self.goal_predictions[a] = dict()
        self.agent_goal_connections[a] = dict()
        for (i, goal) in enumerate(self.goals):
            goal_color = Colors[(i % len(Colors))]
            self.goal_predictions[a][i] = self.ax.text(goal[0], goal[1], str(i))
            self.goal_predictions[a][i].set_horizontalalignment('center')
            self.goal_predictions[a][i].set_verticalalignment('center')
            self.artists.append(self.goal_predictions[a][i])
            self.agent_goal_connections[a][i] = plt.Line2D((start[1], goal[0]), (((len(self.my_map[0]) - 1) - start[0]), goal[1]), lw=2.5, color=goal_color)
            self.artists.append(self.agent_goal_connections[a][i])
    self.animation = animation.FuncAnimation(self.fig, self.animate_func, init_func=self.init_func, frames=(int((self.T + 1)) * 10), interval=100, blit=True)
def __init__(self, my_map, starts, goals, paths, predictions):
    self.my_map = np.flip(np.transpose(my_map), 1)
    self.predictions = predictions
    self.starts = []
    for start in starts:
        self.starts.append((start[1], ((len(self.my_map[0]) - 1) - start[0])))
    self.goals = []
    for goal in goals:
        self.goals.append((goal[1], ((len(self.my_map[0]) - 1) - goal[0])))
    self.paths = []
    if paths:
        for path in paths:
            self.paths.append([])
            for loc in path:
                self.paths[(- 1)].append((loc[1], ((len(self.my_map[0]) - 1) - loc[0])))
    aspect = (len(self.my_map) / len(self.my_map[0]))
    self.fig = plt.figure(frameon=False, figsize=((4 * aspect), 4))
    self.ax = self.fig.add_subplot(111, aspect='equal')
    self.fig.subplots_adjust(left=0, right=1, bottom=0, top=1, wspace=None, hspace=None)
    self.patches = []
    self.artists = []
    self.agents = dict()
    self.agent_names = dict()
    self.goal_predictions = dict()
    self.agent_goal_connections = dict()
    x_min = (- 0.5)
    y_min = (- 0.5)
    x_max = (len(self.my_map) - 0.5)
    y_max = (len(self.my_map[0]) - 0.5)
    plt.xlim(x_min, x_max)
    plt.ylim(y_min, y_max)
    plt.xticks(np.arange(x_min, x_max, 1))
    plt.yticks(np.arange(y_min, y_max, 1))
    plt.grid(color='0.85')
    self.patches.append(Rectangle((x_min, y_min), (x_max - x_min), (y_max - y_min), facecolor='none', edgecolor='gray'))
    for i in range(len(self.my_map)):
        for j in range(len(self.my_map[0])):
            if self.my_map[i][j]:
                self.patches.append(Rectangle(((i - 0.5), (j - 0.5)), 1, 1, facecolor='gray', edgecolor='gray'))
    self.T = 0
    for (i, goal) in enumerate(self.goals):
        goal_color = Colors[(i % len(Colors))]
        self.patches.append(Rectangle(((goal[0] - 0.25), (goal[1] - 0.25)), 0.5, 0.5, facecolor=goal_color, edgecolor='black', alpha=0.5))
    for a in range(len(self.paths)):
        name = str(a)
        self.agents[a] = Circle((starts[a][0], starts[a][1]), 0.3, facecolor=Colors[(a % len(Colors))], edgecolor='black')
        self.agents[a].original_face_color = Colors[(a % len(Colors))]
        self.patches.append(self.agents[a])
        self.T = max(self.T, (len(paths[a]) - 1))
        self.agent_names[a] = self.ax.text(starts[a][0], (starts[a][1] + 0.25), name)
        self.agent_names[a].set_horizontalalignment('center')
        self.agent_names[a].set_verticalalignment('center')
        self.artists.append(self.agent_names[a])
        self.goal_predictions[a] = dict()
        self.agent_goal_connections[a] = dict()
        for (i, goal) in enumerate(self.goals):
            goal_color = Colors[(i % len(Colors))]
            self.goal_predictions[a][i] = self.ax.text(goal[0], goal[1], str(i))
            self.goal_predictions[a][i].set_horizontalalignment('center')
            self.goal_predictions[a][i].set_verticalalignment('center')
            self.artists.append(self.goal_predictions[a][i])
            self.agent_goal_connections[a][i] = plt.Line2D((start[1], goal[0]), (((len(self.my_map[0]) - 1) - start[0]), goal[1]), lw=2.5, color=goal_color)
            self.artists.append(self.agent_goal_connections[a][i])
    self.animation = animation.FuncAnimation(self.fig, self.animate_func, init_func=self.init_func, frames=(int((self.T + 1)) * 10), interval=100, blit=True)