I currently have a depth first search implemented as followed:
protected void algorithmLogic() {
currentNode = ((Stack<Node>) expanded).pop();
if(atGoal()) {
// Goal reached so stop
return;
}
else {
visited.add(currentNode);
if(currentNode.hasChild()) {
for(int i=currentNode.getChildren().size()-1;i>-1;i--) {
((Stack<Node>) expanded).push(currentNode.getChildren().get(i));
}
}
}
}
This is working on a tree on nodes.
Is it possible to edited this code in some way such that it performed iterative deepening search? Say with limit 2? I can't think of a way to track the level.