Yonaba / Jumper

Fast, lightweight and easy-to-use pathfinding library for grid-based games
http://yonaba.github.io/Jumper
MIT License
607 stars 122 forks source link

Include weighting for A-star based search algorithms #19

Open Yonaba opened 10 years ago

Yonaba commented 10 years ago

I should consider including weighting for A-star based search algorithms when summing G-cost and H-cost to compose F-cost.

local function weightedF(G, H, alpha)
  alpha = alpha or 0.5
  return alpha * G + (1 - alpha) * H
end

The purpose of this is to give full control to balance between Dijkstra search (alpha = 1), Classical A-Star (alpha = 0,5) and Best-First-Search (alpha = 0).