Skip to content

planet0104/android-pathfinding

Repository files navigation

android-pathfinding

Android pathfinding

dependencies {
        implementation 'com.github.planet0104:android-pathfinding:1.0.0'
}
int[][] grid = new int[][]{
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,1,0,0,1,1,1,1,1,1,1,0,0,1},
        {1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1},
        {1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1},
        {1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1},
        {1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1},
        {1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1},
        {1,0,0,1,0,0,1,0,0,1,1,1,1,0,0,1},
        {1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1},
        {1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1},
        {1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1},
        {1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0},
        {1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0},
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};

PathFinding.loadMap(grid);

int[] points = PathFinding.findPath(0, 1, 15, 14);

Image