/// <summary> /// A state node has not yet been evaluated, so test it using the "current" path and /// update its values if its a shorter path /// </summary> /// <param name="p_current">The node being evaluated</param> /// <param name="p_successor"> /// A successor to that node that needs to be checked for update /// </param> /// <param name="p_stateSpace">The state space governing the algorithm</param> protected virtual void UpdateCell(IStateNode p_current, IStateNode p_successor, IStateSpace p_stateSpace) { var deltaCost = p_stateSpace.FnCalculateActualCost(p_current, p_successor); // If its actually shorter to get to this node from the current node if (p_current.ActualCostFromStart + deltaCost < p_successor.ActualCostFromStart) { // Update the node's information to reflect its new position in the path p_successor.ActualCostFromStart = p_current.ActualCostFromStart + deltaCost; p_successor.Parent = p_current; m_openList.Update(p_successor); // Will "Add" or "Update" depending on whether or not its in the queue } }