Beispiel #1
0
 def test_is_obstacle_higher_than_start_y_axis_pos_direction_false(self):
     elevations = {
         Point(0, 0): 0,
         Point(1, 0): 2,
         Point(2, 0): 0,
         Point(0, 1): 0,
         Point(1, 1): 0,
         Point(2, 1): 0,
         Point(0, 2): 0,
         Point(1, 2): 2,
         Point(2, 2): 0,
         Point(0, 3): 0,
         Point(1, 3): 2,
         Point(2, 3): 0
     }
     tiles = [
         Tile(point=point, elevation=elevation)
         for point, elevation in elevations.items()
     ]
     map_ = Map(3, 4, tiles)
     sighting_tool = LineOfSight(map_)
     start = Point(1, 3)
     finish = Point(1, 0)
     self.assertFalse(
         sighting_tool.is_obstacle_higher_than_start(start, finish))
Beispiel #2
0
 def test_is_obstacle_higher_than_start_slope_lt_neg_one_true(self):
     elevations = {
         Point(0, 0): 1,
         Point(1, 0): 0,
         Point(2, 0): 0,
         Point(0, 1): 0,
         Point(1, 1): 3,
         Point(2, 1): 0,
         Point(0, 2): 0,
         Point(1, 2): 1,
         Point(2, 2): 1,
         Point(0, 3): 2,
         Point(1, 3): 0,
         Point(2, 3): 0
     }
     tiles = [
         Tile(point=point, elevation=elevation)
         for point, elevation in elevations.items()
     ]
     map_ = Map(3, 4, tiles)
     sighting_tool = LineOfSight(map_)
     start = Point(0, 3)
     finish = Point(1, 0)
     self.assertTrue(
         sighting_tool.is_obstacle_higher_than_start(start, finish))