A JS implementation of a standard cost-distance algorithm.