Class Node

Class Documentation

class Node

Node class.

Parameters
  • x_: X value
  • y_: Y value
  • cost_: Cost to get to this node
  • h_cost_: Heuritic cost of this node
  • id_: Node’s id
  • pid_: Node’s parent’s id

Public Functions

Node(const int x = 0, const int y = 0, const double cost = 0, const double h_cost = 0, const int id = 0, const int pid = 0)

Constructor for Node class.

Parameters
  • x: X value
  • y: Y value
  • cost: Cost to get to this node
  • h_cost: Heuritic cost of this node
  • id: Node’s id
  • pid: Node’s parent’s id

void PrintStatus() const

Prints the values of the variables in the node.

Return
void

Node operator+(const Node &p) const

Overloading operator + for Node class.

Return
Node with current node’s and input node p’s values added
Parameters
  • p: node

Node operator-(const Node &p) const

Overloading operator - for Node class.

Return
Node with current node’s and input node p’s values subtracted
Parameters
  • p: node

bool operator==(const Node &p) const

Overloading operator == for Node class.

Return
bool whether current node equals input node
Parameters
  • p: node

Public Members

int x_

x coordinate

int y_

y coordinate

double cost_

cost to reach this node

double h_cost_

heuristic cost to reach the goal

int id_

Node id.

int pid_

Node’s parent’s id.