I got this code from some website:

public void bfs(){ // BFS uses Queue data structure Queue queue = new LinkedList(); queue.add(this.rootNode); printNode(this.rootNode); rootNode.visited = true; while(!queue.isEmpty()) { Node node = (Node)queue.remove(); Node child=null; while((child=getUnvisitedChildNode(node))!=null) { child.visited=true; printNode(child); queue.add(child); } } // Clear visited property of nodes clearNodes();}I was asked to create a "solver" button for the Lights Out game if the user can't solve it anymore.
How can I adapt this code to be like:
Gets initial grid from a text file containing:

0111000000011100000001110Once "solver" button is pressed, a new frame would appear showing:

0010000000001000000000100Any answer is greatly appreciated. :)


Check Solution