Skip to content

Commit

Permalink
Update node.h
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Collamar authored Mar 23, 2018
1 parent e2e6e74 commit 1ce3bfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions node.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ NodeList* getChildren(Node *parent, State *goalState) {
* This simply evaluates the node's total cost, i.e. path cost + heuristic value.
* Created to abstract the proccess and reduce code cluttering. Note that
* a node's path cost in a tree depends purely on the node's depth, so the node's
* depth will be representing the path cost (to minimize memory space).
* depth will be representing the path cost (to save space).
* PARAMETER:
node - the node to get its total cost
* RETURN:
* Retuns the integer sum of the nodes path cost and heuristic value
* Retuns the integer sum of the node's path cost and heuristic value
**/
int totalCost(Node * const node) {
return node->depth + node->hCost;
}
}

0 comments on commit 1ce3bfe

Please sign in to comment.