Ejemplo n.º 1
0
    def closest_neighbors(self):
        """Find the average position of the closest neighbors.

        @rtype: C{tuple} of C{(x, y)}.
        """
        hood = (self.x, self.y, self.personal_radius)
        n = collide_single(hood, self.others)
        return n
Ejemplo n.º 2
0
    def neighbors(self):
        """Find the other boids in my neighborhood.

        @rtype: C{list} of L{Boid}s.
        """
        hood = (self.x, self.y, self.neighborhood_radius)  # neighborhood
        n = collide_single(hood, self.others)
        return n
Ejemplo n.º 3
0
    def closest_neighbors(self):
        """Find the average position of the closest neighbors.

        @rtype: C{tuple} of C{(x, y)}.
        """
        hood = (self.x, self.y, self.personal_radius)
        n = collide_single(hood, self.others)
        return n
Ejemplo n.º 4
0
    def neighbors(self):
        """Find the other boids in my neighborhood.

        @rtype: C{list} of L{Boid}s.
        """
        hood = (self.x, self.y, self.neighborhood_radius) # neighborhood
        n = collide_single(hood, self.others)
        return n
Ejemplo n.º 5
0
 def test_sanity(self):
     self.assertEqual(c.collide_single((0,0,10), [(15,0,10), (20,20,1)]), 
             [(15,0,10)])
Ejemplo n.º 6
0
 def test_adjacent(self):
     self.assertEqual(c.collide_single((20,0,5), [(0,0,15)]), [(0,0,15)])
     self.assertEqual(c.collide_single((0,0,15), [(20,0,5)]), [(20,0,5)])