def test_a_star_blocked_by_environment(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10divided.txt") start = m.tile_matrix[1][1] end = m.tile_matrix[1][7] path = m.a_star(start, end, CONST.jets, limit=20) assert (len(path) == 0)
def test_a_star_blocked_by_environment(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10divided.txt") start = m.tile_matrix[1][1] end = m.tile_matrix[1][7] path = m.a_star(start, end, CONST.jets, limit=20) assert (len(path) == 0)
def test_a_star_long_blocked_by_enemy(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.sharks) #shark blocking the path path = m.a_star(start, end, CONST.jets, limit=20) assert (len(path) == 0)
def test_a_star_long_blocked_by_enemy(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.sharks) #shark blocking the path path = m.a_star(start, end, CONST.jets, limit=20) assert (len(path) == 0)
def test_a_star_zero_length(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") start = m.tile_matrix[1][1] end = m.tile_matrix[1][1] path = m.a_star(start, end, CONST.jets) assert (len(path) == 1) assert (path[0] == start) assert (path[len(path) - 1] == end)
def test_a_star_zero_length(self): m = Map(10, 10) m.generate_from_ascii("models/maps/10by10.txt") start = m.tile_matrix[1][1] end = m.tile_matrix[1][1] path = m.a_star(start, end, CONST.jets) assert (len(path) == 1) assert (path[0] == start) assert (path[len(path) - 1] == end)
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)
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)
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)
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)
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)
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)