title: How to deal the close list when using A star algorithm
body: <p>Recently, I was working on A-star algorithm, and after lots of relevant research on the Internet， I am confused.</p>
  
  <p>Someone said when there is a successor which is already in the closelist, we just ignore it, but someone said we need to deal with the closelist</p>
  
  <p>There are two different pesuedocodes</p>
  
  <pre><code>Create a node containing the goal state node_goal.
  Create a node containing the start state node_start.
  Put node_start on the open list.
  while the OPEN list is not empty
  {
      Get the node off the open list with the lowest f and call it node_current
      if node_current is the same state as node_goal we have found the solution; break from the while loop
      Generate each state node_successor that can come after node_current
      for each node_successor of node_current
      {
          Set the cost of node_successor to be the cost of node_current plus the cost to get to node_successor from node_current
          find node_successor on the OPEN list
          if node_successor is on the OPEN list but the existing one is as good or better then discard this successor and continue
          if node_successor is on the CLOSED list but the existing one is as good or better then discard this successor and continue
          Remove occurences of node_successor from OPEN and CLOSED
          Set the parent of node_successor to node_current
          Set h to be the estimated distance to node_goal (Using the heuristic function)
           Add node_successor to the OPEN list
      }
      Add node_current to the CLOSED list
  }
  </code></pre>
  
  <hr>
  
  <pre><code>Get the square on the open list which has the lowest score. Let’s call this square S.
  Remove S from the open list and add S to the closed list.
  For each square T in S’s walkable adjacent tiles:
  If T is in the closed list: Ignore it.
  If T is not in the open list: Add it and compute its score.
  If T is already in the open list: Check if the F score is lower when we use the current generated path to get there. If it is, update its score and update its parent as well.
  </code></pre>
  
  <p>I don't know which one is right，hoping hear some advice from you.</p>
  
  <p>Thanks in advance</p>