Merge the last Dijkstra classes #7

Merged
antograb merged 18 commits from lastDijsktraClasses into master 2017-12-10 16:51:59 +00:00
Showing only changes of commit eb1e7a8bc0 - Show all commits
+8 -13
View File
@@ -25,17 +25,8 @@ public class Maze
Box startBox = (Box) start ;
Box endBox = (Box) end ;
if (startBox.getNeighbourList().contains(endBox)) {
if (startBox.isWalkable() && endBox.isWalkable()) {
return 1 ;
}
else {
return 0 ;
}
}
return 0 ;
return startBox.getNeighbourList().contains(endBox) ? 1 : 0 ;
}
public int getVertexNumber() {
@@ -60,7 +51,12 @@ public class Maze
int x = box.getX() ;
int y = box.getY() ;
ArrayList<VertexInterface> neighbourList = new ArrayList<VertexInterface>() ;
// Always returns an empty list if the departure box is a wall
if (! box.isWalkable()) {
return neighbourList ;
}
if (x > 0 && maze[x-1][y].isWalkable()) {
neighbourList.add(maze[x-1][y]) ;
}
@@ -180,7 +176,6 @@ public class Maze
} finally {
try { pw.close();} catch(Exception e) {}
}
}
public int getDimensionX() {