Exemplo n.º 1
0
 public void BFS() {
   boolean[] V = new boolean[1 << (N * M)];
   List<TOE> lst = new LinkedList<>();
   lst.add(this);
   V[this.toInt()] = true;
   TOE t = null;
   while (lst.size() > 0) {
     t = lst.remove(0);
     // System.out.println(t);
     if (t.solved()) break;
     for (TOE ti : t.next())
       if (!V[ti.toInt()]) {
         ti.parent = t;
         lst.add(ti);
         V[ti.toInt()] = true;
       }
   }
   t.print(0);
 }