示例#1
0
 def __init__(self):
     # parent class 'Settings' set up simulation and graphics details
     Settings.__init__(self)
     # 'win' and 'screen_ants' are instance data
     self.win = GraphWin(self.title,
                         self.win_size_x,
                         self.win_size_y,
                         autoflush=False)
     self.win.setBackground(self.background)
     self.screen_ants = [None] * self.num_ants
示例#2
0
 def __init__(self):
     # parent class 'Settings' set up simulation details
     Settings.__init__(self)
     # initialize: zero starting pheromone, all ants have state [0 0 0] """
     ants = []
     for i in range(0, self.num_ants):
         # create initial ant swarm data structure [x, y, n] for each ant
         ants.append([0, 0, 0])
     self.ants = ants
     # initialize pheromone array sigma to zero everywhere
     self.sigma = np.zeros((self.lat_size_x, self.lat_size_y))