Avancement sur l'implémentation des méthodes des interfaces. Penser à
continuer l'idée du neighbourList
This commit is contained in:
1 parent
f7646c48f6
commit
36dd8ff805
3 files changed
+17
-7
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Box
|
||||
implements VertexInterface {
|
||||
@@ -6,12 +7,16 @@ public abstract class Box
|
||||
private int y ;
|
||||
private String label ;
|
||||
private Maze maze ;
|
||||
private List<Box> neighbourList ;
|
||||
|
||||
public Box (String label, int x, int y, Maze maze) {
|
||||
this.label = label ;
|
||||
this.x = x ;
|
||||
this.y = y ;
|
||||
this.maze = maze ;
|
||||
if (x != 0 && y != 0 && x != maze.getDimensionX() && y != maze.getDimensionY()) {
|
||||
this.neighbourList.add(maze.getMaze()[x+1][y]) ;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean compareTo(VertexInterface vertex) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Maze
|
||||
implements GraphInterface{
|
||||
@@ -5,18 +7,20 @@ public class Maze
|
||||
int dimensionX ;
|
||||
int dimensionY ;
|
||||
int[][] maze ;
|
||||
int[][] adjMatrix ;
|
||||
|
||||
public Maze(int dimensionX, int dimensionY, int[][] adjmatrix) {
|
||||
public Maze(int dimensionX, int dimensionY, int[][] maze) {
|
||||
|
||||
this.dimensionX = dimensionX ;
|
||||
this.dimensionY = dimensionY ;
|
||||
this.maze = new int[dimensionX][dimensionY] ;
|
||||
this.adjMatrix = adjMatrix ;
|
||||
this.maze = maze ;
|
||||
this.dimensionX = maze.length ;
|
||||
this.dimensionY = maze[0].length ;
|
||||
|
||||
}
|
||||
|
||||
public int getCost(VertexInterface start, VertexInterface end) {
|
||||
public int getCost(Box start, Box end) {
|
||||
|
||||
}
|
||||
|
||||
public int getVertexNumber() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user