Beispiel #1
0
 def test_sectors_in_circle_off_map(self):
     from gravita.map import Map
     map = Map(5, 5)
     sectors = map.sectors_in_circle((-1, -1), 2)
     self.assertEqual(sectors,
         [map[0,0], map[1,0],
          map[0,1]], sectors)
Beispiel #2
0
 def test_sectors_in_circle_small(self):
     from gravita.map import Map
     map = Map(7, 7)
     sectors = map.sectors_in_circle((3, 3), 1)
     self.assertEqual(sectors,
         [map[2,2], map[3,2], map[4,2],
          map[2,3], map[3,3], map[4,3],
          map[2,4], map[3,4], map[4,4]], sectors)
Beispiel #3
0
 def test_sectors_in_circle_larger(self):
     from gravita.map import Map
     map = Map(15, 15)
     sectors = map.sectors_in_circle((5, 5), 3)
     self.assertEqual(sectors,
                            [map[4,2], map[5,2], map[6,2], 
                   map[3,3], map[4,3], map[5,3], map[6,3], map[7,3],
         map[2,4], map[3,4], map[4,4], map[5,4], map[6,4], map[7,4], map[8,4],
         map[2,5], map[3,5], map[4,5], map[5,5], map[6,5], map[7,5], map[8,5],
         map[2,6], map[3,6], map[4,6], map[5,6], map[6,6], map[7,6], map[8,6],
                   map[3,7], map[4,7], map[5,7], map[6,7], map[7,7],
                             map[4,8], map[5,8], map[6,8]])