I am creating an A Star search algorithm to solve a 8 puzzle board and I've got all the Board object classes listed within an ArrayList. My problem is I need to run methods within each of the Board objects to allow me to check if they have reached there goal, get board information and other functions similar to that.
Problem is I can't find a way after a few hours of internet searching that will solve this problem, I tried using an iterator to do the job which seems like the right direction but I couldn't get it to work but I don't have any experience with them.
Any help would be of great help.
public class Solve8Puzzle {
ArrayList startNode;
ArrayList nodes;
public Solve8Puzzle() {
startNode = new ArrayList();
nodes = new ArrayList();
}
public boolean checkGoalNodes() {
while( currently selected node has next ) {
run current node goal check
}
}
}
startNodeandnodes?Iterator? Did it fail to compile?