コード例 #1
0
ファイル: BFSSearch2.java プロジェクト: Mel-BR/AI_HW1
 /**
  * create a new node and add queue if the new node cost is less than the current cost
  *
  * @param currNode
  * @param x
  * @param y
  */
 protected boolean checkAndAddNodeToList(Node currNode, int x, int y) {
   int cost = currNode.getCurrentPathCost() + 1;
   int h = 0; // heuristic(x,y);
   if (h + cost < this.maze[x][y]) {
     this.pq.add(new Node(currNode, x, y, cost, h));
     this.maze[x][y] = h + cost;
     this.expands++;
     return true;
   }
   return false;
 }