예제 #1
0
  private static int computeGScoreIncrease(Cell cell, Cell neighbour) {
    int diffX = Math.abs(cell.getXCoor() - neighbour.getXCoor());
    int diffY = Math.abs(cell.getYCoor() - neighbour.getYCoor());

    if (diffX > 0 && diffY > 0) {
      return 14; // diagonal
    } else {
      return 10; // orthogonal
    }
  }
예제 #2
0
 private static int computeEstimatedCost(Cell currentCell, Cell to) {
   return 10
       * (Math.abs(currentCell.getXCoor() - to.getXCoor())
           + Math.abs(currentCell.getYCoor() - to.getYCoor()));
 }