Exemplo n.º 1
0
        #
        # pygame.draw.circle(screen, (0, 255, 0), (int(new_room.get_dest()[0] * scale), int(new_room.get_dest()[1] * scale)), int(0.2 * scale))
        # # Flip the display
        # draw_pedestrians(screen)
        new_simulation.step_pedestians(new_simulation.get_list_pedestrians(),
                                       [], new_room.get_dest())
        # pygame.display.flip()
        # time.sleep(0.00000001)


#new_room = Room(15, 15, [0, 15/ 2])
#new_simulation = Simulation(1,new_room,False)
#screen = pygame.display.set_mode([new_room.get_length() * scale, new_room.get_width() * scale])
#ex_1_a(running)

new_room = Room(15, 15, [0, 15 / 2])
screen = pygame.display.set_mode(
    [new_room.get_length() * scale,
     new_room.get_width() * scale])
escape_intervals = list(
)  #list that holds all of the times that the last pedestrian escaped in each simulation
for i in range(200):
    new_simulation = Simulation(1, new_room, True)
    ex_1_b(running)
plt.show()
print("The longest time to escape: {} seconds.".format(max(escape_intervals)))
print("The median time to escape: {} ".format(
    sum(escape_intervals) / len(escape_intervals)))

pygame.quit()