code: def calc_cost(self, node_a, node_b):
          
          if node_b.x - node_a.x == 0 or node_b.y - node_a.y == 0:
              # direct neighbor - distance is 1
              ng = 1
          else:
              # not a direct neighbor - diagonal movement
              ng = SQRT2
  
          # weight for weighted algorithms
          if self.weighted:
              ng *= node_b.weight
  
          return node_a.g + ng
docs: get the distance between current node and the neighbor (cost)