📄 maze.java
字号:
public class Maze {
private MazeElement[][] element = new MazeElement[10][10];
public Maze(){
}
public Maze(String[] s){
for(int y = 0; y < 10; y++){
for(int x = 0; x < 10; x++){
element[y][x] = new MazeElement(s[y].charAt(x)=='1');
}
}
}
public MazeElement GetElement(int x, int y){
return element[y][x];
}
public void FoodPrint(int x, int y){
element[y][x].visited = true;
}
public void reset(){
for(int y = 0; y < 10; y++){
for(int x = 0; x < 10; x++){
element[y][x].visited = false;
}
}
}
}
class MazeElement{
public boolean visited = false;
public boolean iswall;
public MazeElement(){
iswall = false;
}
public MazeElement(boolean w){
iswall = w;
}
public void FoodPrint(){
visited = true;
}
}
class Posetion{
public int x;
public int y;
public Posetion(){
x = 0;
y = 0;
}
public Posetion(int a, int b){
x = a;
y = b;
}
public String toString(){
return "("+x+","+y+")";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -