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

📄 test.java

📁 九宫问题(八数码)的一个小软件
💻 JAVA
字号:
/*
 * Test.java
 *
 * Created on February 12, 2006, 7:24 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.ray.ninegrid;

/**
 *
 * @author Ray#
 */
public class Test {
    
    /** Creates a new instance of Test */
    public Test() {
    }
    
    public static void main(String[] args){
        //int[] temp=new int[]{1,2,3,4,5,0,7,8,6,6};
        int[] temp=new int[]{1,2,3,4,0,5,7,8,6,5};
        System.out.println("Simple test:");
        test1(temp);
        test2(temp);
        test3(temp);
        temp=new int[]{3,6,0,2,5,8,1,4,7,3};
        System.out.println("Middle test:");
        test1(temp);
        test2(temp);
        test3(temp);
        temp=new int[]{6,4,7,8,5,0,3,2,1,6};
        System.out.println("Hard test:");
        test1(temp);
        test2(temp);
        test3(temp);
    }
    
    public static void test1(int[] t){
        long cur=System.currentTimeMillis();
        EightBFS ebfs=EightBFS.getInstance(t);
        System.out.println(ebfs.search());
        System.out.println("BFS - time : "+(System.currentTimeMillis()-cur)+"\n");
    }
    
    public static void test2(int[] t){
        long cur=System.currentTimeMillis();
        EightDTBFS ebfs=EightDTBFS.getInstance(t);
        System.out.println(ebfs.search());
        System.out.println("DTBFS - time : "+(System.currentTimeMillis()-cur)+"\n");
    }
    
    public static void test3(int[] t){
        long cur=System.currentTimeMillis();
        EightAStar ebfs=EightAStar.getInstance(t);
        System.out.println(ebfs.search());
        System.out.println("A*Search - time : "+(System.currentTimeMillis()-cur)+"\n");
    }
    
}

⌨️ 快捷键说明

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