Removed class syntax

This commit is contained in:
Andriy Kashcha 2017-09-10 16:37:17 -07:00
parent 0ce6681436
commit 5601dee87e
2 changed files with 13 additions and 15 deletions

View File

@ -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

View File

@ -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;