From 6e0571c565d521b1e1be6e92bff5a6ca31aa3269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Fri, 28 Jan 2022 22:16:22 +0100 Subject: [PATCH] Improve comment --- src/pathfinding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pathfinding.js b/src/pathfinding.js index 708cc49..0586187 100644 --- a/src/pathfinding.js +++ b/src/pathfinding.js @@ -61,7 +61,7 @@ function calculate_path(from, to) { if (previousNodes.has(neighborNode)) continue; // TODO We currently assume a cost of one for all transitions. Change this for 5/10/5 or difficult terrain support - // We charge an extra 0.0001 for diagonals + // We charge an extra 0.0001 for diagonals to unnecessary diagonal steps const isDiagonal = currentNode.node.x !== neighborNode.x && currentNode.node.y !== neighborNode.y; const edgeCost = isDiagonal ? 1.0001 : 1; const neighbor = {node: neighborNode, cost: currentNode.cost + edgeCost, estimated: currentNode.cost + edgeCost + estimate_cost(neighborNode, from), previous: currentNode};