java写的一个迷宫小游戏 (累死我了)
public class TestDemo2 {
public static void main(String[] args) {
Maze maze =new Maze(3,3);
maze.goMaze();
}
}
import java.util.*;
public class Maze {
private static Scanner scanner = new Scanner(System.in);
private MazeNode[][] mazenodes;
private int row;
private int colum;
private Stack<MazeNode> stack;
public Maze( int row, int colum) {
stack= new Stack<>();
this.mazenodes =new MazeNode[row][colum];
this.row = row;
this.colum = colum;
}
public void setMaze() {
System.out.println("请输入迷宫路径");
for (int i = 0; i < row; i++) {
for (int j = 0; j < colum; j++) {
mazenodes[i][j] = new MazeNode(scanner.nextInt(),i,j);
}
}
}
public void initWaystate() {
for (int i = 0; i < row; i++) {
for (int j = 0; j < colum; j++) {
if (mazenodes[i][j].getValue()