2009-07-29から1日間の記事一覧

勝手に採点 (Re: 自分ならこう書く - pythonでA*)

自分ならこう書く - pythonでA* - ラシウラより def astar(init, goal, nexts, distance=lambda path: len(path), heuristic=lambda pos: 0): import heapq queue = [] checked = [init] heapq.heappush(queue, (distance([init]) + heuristic(init), [init]…

このブログに乗せているコードは引用を除き CC0 1.0 で提供します。