예제 #1
0
 public solve(int dim)
 {
     visited   = new Dictionary <string, bool>();
     open      = new PriorityQueue();
     cameFrom  = new Dictionary <node, node>();
     calculate = new hamming(dim);
     better    = new manhatten();
     way       = "";
 }
예제 #2
0
        public bool solve_Npuzzle()
        {
            solve solve_puzzle = new solve(width);

            Final_answer = new List <node>();
            answer       = new hamming(width);
            node puzzle_node = new node(puzzle, width);

            if (solve_puzzle.isSolvable(puzzle, width))
            {
                solve_puzzle.solve_prob(puzzle_node, answer.goal, width, method);
                Console.WriteLine();
                this.Final_answer = solve_puzzle.total_path;
            }
            else
            {
                return(false);
            }
            return(true);
        }