Exemplo n.º 1
0
    def move(self, ants, ant_list):
      "Assigns ants order, and manipulates destination array in place"
      #l.log_on = False
      for ant in ant_list:
	if self.ant_lookup[ant] != None:
	  directions = pathfind.move_directions(ant, self.ant_lookup[ant])
	  if directions != None:
	    for d in directions:
	      dest = ants.destination(ant, d)
	      if dest not in self.destinations and ants.unoccupied(dest) and self.will_live(dest):
		#l.log("ant:order ", (ant, d))
		ants.issue_order((ant, d))
		self.destinations.append(dest)
		break
	self.destinations.append(ant)
Exemplo n.º 2
0
def test_move_direction():
  return pathfind.move_directions((6, 6), guide)