ai-22 / src / am / aua / npuzzle / BFTS_Demo.java
BFTS_Demo.java
Raw
package am.aua.npuzzle;

import am.aua.search.*;

public class BFTS_Demo {
	public static void main(String[] args) {
		Tiles initialConfiguration = new Tiles(new int[][] {
			{ 7, 4, 2 },
			{ 8, 1, 3 },
			{ 5, 0, 6 }
		});

		GoalTest goalTest = new TilesGoalTest();
		BreadthFirstFrontier frontier = new BreadthFirstFrontier();
		TreeSearch search = new TreeSearch(frontier);
		Node solution = search.search(initialConfiguration, goalTest);

		if (args.length == 0) {
			System.out.println("This is a demonstration of best-first graph search on 8-puzzle");
			System.out.println();
			new NPuzzlePrinting().printSolution(solution);
		} else if (args[0].equals("-s")) {
			new NPuzzlePrinting().printStatistics(search);
		}
	}
}