⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runmaze.java

📁 Maze solving using java
💻 JAVA
字号:
package maze;import java.io.FileNotFoundException;import javax.swing.JFileChooser;import javax.swing.JOptionPane;public class RunMaze {	/**	 * @param args	 */	public static void main(String[] args) throws FileNotFoundException {            //Maze maze = new Maze(10, 10);            JOptionPane.showMessageDialog(null, "Hello, welcome to Maze Solver by Trinh Hoang Nhu IT060086\n" +                                                "After this dialog, you must select a maze file to solve\n" +                                                "Maze file format:\n"+                                                "width height\n"+                                                "startx starty goalx goaly\n" +                                                "0 1 0 1 0 0\n"+                                                "1 0 0 0 1 0\n"+                                                "0 0 0 0 0 0\n" +                                                "for example." +                                                "0 is free, 1 is wall");            JFileChooser fc = new JFileChooser();            fc.setDialogTitle("Selecct maze file");            fc.showOpenDialog(null);            if(fc.getSelectedFile()==null){                JOptionPane.showMessageDialog(null, "Mission abort, No maze file input");                System.exit(0);            }            String heu = JOptionPane.showInputDialog("Now select heuristic to solve: E for Euclidean distance and M for Manhattan distance (Faster)", "M");            if(heu.equals("E")){                Global.heuristics=0;            }else{                Global.heuristics=1;            }            Maze maze = new Maze(fc.getSelectedFile().getAbsolutePath());            maze.draw();            maze.findBestPath();            JOptionPane.showMessageDialog(null, maze.output.toString());	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -