robbyRobot/robbyRobot4.js
// h = heuristic cost from cell to Target
h = heuristic cost from cell to Target
h = heuristic cost from cell to Target
function calcH(cell) {
      if (!cell.h) {
        const x = cells[targetCell].cellRow - cell.cellRow
        const y = cells[targetCell].cellCol - cell.cellCol
        cell.h = Math.abs(x) + Math.abs(y)
      }   
      return cell.h
    }
function calcH ( cell ) { if ( ! cell . h ) { const x = cells [ targetCell ] . cellRow - cell . cellRow const y = cells [ targetCell ] . cellCol - cell . cellCol cell . h = Math . abs ( x ) + Math . abs ( y ) } return cell . h }
h = heuristic cost from cell to Target
h = heuristic cost from cell to Target
// check if we have h saved or calc // h = sqrt(x^2 + y^2) // straight line to the Target // Manhattan distance heuristic