pathfinding-es
Version:
Comprehensive pathfinding library for grid based games
27 lines (22 loc) • 933 B
JavaScript
import BiAStarFinder from './BiAStarFinder';
/**
* Bi-direcitional Best-First-Search path-finder.
* @constructor
* @extends BiAStarFinder
* @param {Object} opt
* @param {boolean} opt.allowDiagonal Whether diagonal movement is allowed.
* Deprecated, use diagonalMovement instead.
* @param {boolean} opt.dontCrossCorners Disallow diagonal movement touching
* block corners. Deprecated, use diagonalMovement instead.
* @param {DiagonalMovement} opt.diagonalMovement Allowed diagonal movement.
* @param {function} opt.heuristic Heuristic function to estimate the distance
* (defaults to manhattan).
*/
function BiBestFirstFinder(opt) {
BiAStarFinder.call(this, opt);
const orig = this.heuristic;
this.heuristic = (dx, dy) => orig(dx, dy) * 1000000;
}
BiBestFirstFinder.prototype = new BiAStarFinder();
BiBestFirstFinder.prototype.constructor = BiBestFirstFinder;
export default BiBestFirstFinder;