Add UI to the project #29

Manually merged
regar42 merged 45 commits from mvc into master 2018-01-03 11:03:09 +00:00
2 changed files with 36 additions and 8 deletions
Showing only changes of commit 97f9aa4ba0 - Show all commits

No files matched your search

+35 -7
View File
@@ -84,16 +84,44 @@ public class Maze
return copy; return copy;
} }
public static Maze emptySquareMaze() { public static Maze emptyMaze(int dimension) {
int dimensionX = 10; Box[][] maze = new Box[dimension][dimension];
int dimensionY = 10; for (int line = 0; line < dimension; line++) {
Box[][] maze = new Box[dimensionY][dimensionX]; for (int row = 0; row < dimension; row++) {
for (int line = 0; line < dimensionY; line++) {
for (int row = 0; row < dimensionX; row++) {
maze[line][row] = new EBox("E", line, row, null); maze[line][row] = new EBox("E", line, row, null);
} }
} }
return new Maze(dimensionY, dimensionX, maze); return new Maze(dimension, dimension, maze);
}
public static Maze emptyMaze(int numberOfLines, int numberOfRows) {
Box[][] maze = new Box[numberOfLines][numberOfRows];
for (int line = 0; line < numberOfLines; line++) {
for (int row = 0; row < numberOfRows; row++) {
maze[line][row] = new EBox("E", line, row, null);
}
}
return new Maze(numberOfLines, numberOfRows, maze);
}
public static Maze wallMaze(int dimension) {
Box[][] maze = new Box[dimension][dimension];
for (int line = 0; line < dimension; line++) {
for (int row = 0; row < dimension; row++) {
maze[line][row] = new WBox("W", line, row, null);
}
}
return new Maze(dimension, dimension, maze);
}
public static Maze wallMaze(int numberOfLines, int numberOfRows) {
Box[][] maze = new Box[numberOfLines][numberOfRows];
for (int line = 0; line < numberOfLines; line++) {
for (int row = 0; row < numberOfRows; row++) {
maze[line][row] = new WBox("W", line, row, null);
}
}
return new Maze(numberOfLines, numberOfRows, maze);
} }
public int getCost(VertexInterface start, VertexInterface end) { public int getCost(VertexInterface start, VertexInterface end) {
+1 -1
View File
@@ -24,7 +24,7 @@ public class MazeAppModel extends Observable {
private Boolean modified = false; private Boolean modified = false;
public MazeAppModel() { public MazeAppModel() {
maze = new Maze(Maze.emptySquareMaze()); maze = new Maze(Maze.emptyMaze(10));
departure = maze.getDeparture(); departure = maze.getDeparture();
arrival = maze.getArrival(); arrival = maze.getArrival();
boxList = maze.getVertexes(); boxList = maze.getVertexes();