def runAstar(): initial_state = Problem.CREATE_INITIAL_STATE() print("Initial State:") print(Problem.DESCRIBE_STATE(initial_state)) global COUNT, BACKLINKS COUNT = 0 BACKLINKS = {} Astar(initial_state) print(str(COUNT) + " states examined.")
def backtrace(S): global BACKLINKS path = [] while not S == -1: path.append(S) S = BACKLINKS[Problem.HASHCODE(S)] path.reverse() print("Solution path: ") for s in path: print(Problem.DESCRIBE_STATE(s)) return path