From 5601dee87ef2f4319b2ecbc465bbd3758b308c4a Mon Sep 17 00:00:00 2001 From: Andriy Kashcha Date: Sun, 10 Sep 2017 16:37:17 -0700 Subject: [PATCH] Removed class syntax --- README.md | 2 +- a-star/NodeSearchState.js | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9aaa732..e66ffb8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ This code will correctly print a path: `d <- c <- a`. When pathfinder searches for a path between two nodes it considers all neighbors of a given node without any preference. In some cases we may want to -guide pathfinder and tell it our preferred exploration direction. +guide the pathfinder and tell it our preferred exploration direction. For example, when each node in a graph has coordinates, we can assume that nodes that are closer towards the path-finder's target should be explored diff --git a/a-star/NodeSearchState.js b/a-star/NodeSearchState.js index 0154ccb..32be751 100644 --- a/a-star/NodeSearchState.js +++ b/a-star/NodeSearchState.js @@ -1,20 +1,18 @@ -class NodeSearchState { - constructor(node) { - this.node = node; +var NodeSearchState = function NodeSearchState(node) { + this.node = node; - // How we came to this node? - this.parent = null; + // How we came to this node? + this.parent = null; - this.closed = false; - this.open = 0; + this.closed = false; + this.open = 0; - this.distanceToSource = Number.POSITIVE_INFINITY; - // the f(n) = g(n) + h(n) value - this.fScore = Number.POSITIVE_INFINITY; + this.distanceToSource = Number.POSITIVE_INFINITY; + // the f(n) = g(n) + h(n) value + this.fScore = Number.POSITIVE_INFINITY; - // used to reconstruct heap when fScore is updated. - this.heapIndex = -1; - } -} + // used to reconstruct heap when fScore is updated. + this.heapIndex = -1; +}; module.exports = NodeSearchState; \ No newline at end of file