コード例 #1
0
 
    def __repr__(self): 
        return self.__str__() 
 
if __name__ == "__main__": 
    from Board import Board
    import Movement

    start = 11,12
    goal = 8,10
    PM = 5

    s = Pos(start, 3)
    g = Pos(goal, 1)
    tm = Board()
    tm.readBoard("../ficheros2/manglar.sbt")

    pf = PathFinder(tm.successors, tm.move_cost, tm.heuristic_to_goal)
    
    #import time 
    #t = time.clock() 
    path = list(pf.compute_path(s, g, 1,PM)) 
    #print "Elapsed: %s" % (time.clock() - t) 

    #path2, can, cost = pf.compute_path_until_PM(s, g, 1,PM)

    print path
   # print str(can) + "cost: " + str (cost)
   # print path2
    
    print Movement.calculate_steps(path)