I am a beginner in Java, and I need some help.
I am trying to implement Breadth First Search algorithm to solve a puzzle game (Unblock Me a game on Android). I am done with the GUI, but I am stuck with the algorithm.
So far I can count the available moves of each block, which supposed to be the children nodes of the root node. Each node (linkedlist) has the position of each block, and all the nodes are being stored in a Set.
What I need now is to mark each node as visited, so I don't get into an infinite loop.
I would appreciate any kind of help, and please correct me if I am mistaken with anything.
Thanks in advance :)
Deque
interface on the linked list, you can easily modify that BFS to be also a DFS (if needed). docs.oracle.com/javase/7/docs/api/java/util/Deque.html – Sadonia