@@ -0,0 +1,783 @@
+%22%22%22%0Apynpuzzle - Solve n-puzzle with Python%0A%0ABest-first search algorithm%0A%0AVersion : 1.0.0%0AAuthor : Hamidreza Mahdavipanah%0ARepository: http://github.com/mahdavipanah/pynpuzzle%0ALicense : MIT License%0A%22%22%22%0Aimport heapq%0Afrom .tree_search import Node%0A%0Adef search(state, goal_state, fn):%0A    %22%22%22Best-first search%22%22%22%0A    queue = %5B%5D%0A    entrance = 0%0A    node = Node(state)%0A    while not node.is_goal(goal_state):%0A        node.expand()%0A        for child in node.children:%0A            queue_item = (fn(child), entrance, child)%0A            heapq.heappush(queue, queue_item)%0A            entrance += 1%0A        node = heapq.heappop(queue)%5B2%5D%0A%0A    output = %5B%5D%0A    output.append(node.state)%0A    for parent in node.parents():%0A        output.append(parent.state)%0A    output.reverse()%0A%0A    return output%0A%0A

Add best_first_search algorithm