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

📄 main.java

📁 Maze solving using java
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package maze;import java.io.FileNotFoundException;import java.util.Random;import javax.swing.JOptionPane;/** * * @author James Bond 007 */public class main {    @SuppressWarnings("static-access")    public static void main(String[] args) throws FileNotFoundException {        String mazew = JOptionPane.showInputDialog("Input maze width","10");    String mazeh = JOptionPane.showInputDialog("Input maze height","10");    int w = new Integer(mazew);    int h = new Integer(mazeh);    int[][] map = new int[h][w];    int startx = 0;    int starty = 0;    int goalx = 0;    int goaly = 0;    while (goalx == 0 && goaly == 0) {        goalx = new Random().nextInt(h);        goaly = new Random().nextInt(w);    }    for (int i = 0; i < h; i++)        for (int j = 0; j < w; j++) {            map[i][j]=new Random().nextInt(1);        }    Maze maze = new Maze(h, w, map, startx, starty, goalx, goaly);                if(JOptionPane.showInputDialog("Select mode to start: G for Graphic, C for console mode (Text mode)", "G").equals("G")){                java.awt.EventQueue.invokeLater(new Runnable() {                    public void run() {                        new frmmaze().setVisible(true);                    }                });            }else{                new RunMaze().main(args);            }	}}

⌨️ 快捷键说明

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