public override bool addToFrontier(PuzzleState aState) { //We only want to add the new state to the fringe if it doesn't exist // in the fringe or the searched list. if (Searched.Contains(aState) || Frontier.Contains(aState)) { return(false); } else { Frontier.AddLast(aState); return(true); } }
public override bool addToFrontier(PuzzleState aState) { //if this state has been found before, if (Searched.Contains(aState) || Frontier.Contains(aState)) { //discard it return(false); } else { //else put this item on the end of the queue; Frontier.AddLast(aState); return(true); } }