Ejemplo n.º 1
0
 def test_a_star_long_obstacles(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10funnel.txt")
     start = m.tile_matrix[8][1]
     end = m.tile_matrix[1][6]
     path = m.a_star(start, end, CONST.jets, limit=20)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 2
0
 def test_a_star_long_obstacles(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10funnel.txt")
     start = m.tile_matrix[8][1]
     end = m.tile_matrix[1][6]
     path = m.a_star(start, end, CONST.jets, limit=20)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 3
0
 def test_a_star_long_blocked_by_friendly(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10funnel.txt")
     start = m.tile_matrix[4][1]
     end = m.tile_matrix[4][7]
     g = GreaserUnit(4, 4, m, CONST.jets)
     path = m.a_star(start, end, CONST.jets, limit=20)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 4
0
 def test_a_star_short_unobstructed(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     start = m.tile_matrix[5][5]
     end = m.tile_matrix[4][4]
     path = m.a_star(start, end, CONST.jets)
     assert (len(path) == 3)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 5
0
 def test_a_star_long_blocked_by_friendly(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10funnel.txt")
     start = m.tile_matrix[4][1]
     end = m.tile_matrix[4][7]
     g = GreaserUnit(4, 4, m, CONST.jets)
     path = m.a_star(start, end, CONST.jets, limit=20)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 6
0
 def test_a_star_short_unobstructed(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     start = m.tile_matrix[5][5]
     end = m.tile_matrix[4][4]
     path = m.a_star(start, end, CONST.jets)
     assert (len(path) == 3)
     for tile in path:
         assert (m.can_go_through(tile.x, tile.y, CONST.jets))
     assert (path[0] == start)
     assert (path[len(path) - 1] == end)
Ejemplo n.º 7
0
 def test_can_go_out_of_bounds(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     m.can_go_through(-1, 0, CONST.jets)
     m.can_go_through(8, 0, CONST.jets)
     m.can_go_through(0, 8, CONST.jets)
     m.can_go_through(0, -1, CONST.jets)
Ejemplo n.º 8
0
 def test_can_go_out_of_bounds(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     m.can_go_through(-1, 0, CONST.jets)
     m.can_go_through(8, 0, CONST.jets)
     m.can_go_through(0, 8, CONST.jets)
     m.can_go_through(0, -1, CONST.jets)
Ejemplo n.º 9
0
 def test_can_go_through_unit(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     g = GreaserUnit(4, 5, m, CONST.jets)
     assert (m.can_go_through(4, 5, CONST.jets))
     assert (not m.can_go_through(4, 5, CONST.sharks))
Ejemplo n.º 10
0
 def test_can_go_inaccessible(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     assert (not m.can_go_through(0, 0, CONST.jets))
     assert (m.can_go_through(4, 5, CONST.jets))
Ejemplo n.º 11
0
 def test_can_go_through_unit(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     g = GreaserUnit(4, 5, m, CONST.jets)
     assert (m.can_go_through(4, 5, CONST.jets))
     assert (not m.can_go_through(4, 5, CONST.sharks))
Ejemplo n.º 12
0
 def test_can_go_inaccessible(self):
     m = Map(10, 10)
     m.generate_from_ascii("models/maps/10by10.txt")
     assert (not m.can_go_through(0, 0, CONST.jets))
     assert ( m.can_go_through(4, 5, CONST.jets))