diff --git a/a-star/heuristics.js b/a-star/heuristics.js index 749c097..83fee62 100644 --- a/a-star/heuristics.js +++ b/a-star/heuristics.js @@ -2,6 +2,17 @@ module.exports = { l2: l2, l1: l1 }; +/** + * Distance squared; + * + * @param {*} a + * @param {*} b + */ +function l3(a, b) { + var dx = Math.abs(a.x - b.x); + var dy = Math.abs(a.y - b.y); + return Math.pow((dx + dy), 2); +} /** * Euclid distance (l2 norm);