-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMazeAdapter.java
executable file
·50 lines (42 loc) · 1.17 KB
/
MazeAdapter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.*;
public class MazeAdapter implements RectMaze{
Square[][] newMaze = new Square[10][10];
Maze maze;
public MazeAdapter(MazeGenerator generator, PathFinder finder){
maze = new Maze(10, 10, newMaze);
maze.setGenerator( generator );
maze.setFinder( finder );
maze.init();
System.out.println("Init completed");
}
public Thing getThing(int x, int y) {
Square[][] mazeArray = maze.getMaze();
return mazeArray[y][x].getThing();
}
public Maze getMaze() {
return maze;
}
public List<DirType> getDirections(int x, int y){
List<DirType> lst = new ArrayList<DirType>();
Square[][] mazeArray = maze.getMaze();
if (mazeArray[y][x].n == false){
lst.add(DirType.North);
}
if (mazeArray[y][x].s == false){
lst.add(DirType.South);
}
if (mazeArray[y][x].w == false){
lst.add(DirType.West);
}
if (mazeArray[y][x].e == false){
lst.add(DirType.East);
}
return lst;
}
public int getMaxX(){
return maze.getRows();
}
public int getMaxY(){
return maze.getColumns();
}
}