Knight Tour DFS
<p>Yesterday my program had errors, but the problem with the while loop is finished.
Now I'm encountering a new problem; the output is not as expected. There are still some output node 0 (zero).</p>

<pre><code>public void processKnightTour(int indexX, int indexY){
    int[] x={2,2,-2,-2,1,1,-1,-1};
    int[] y={1,-1,1,-1,2,-2,2,-2};
    int countPath=0;
    int indexList;
    workList = new ArrayList();
    node[indexX][indexY] = 1;
    workList.add(new Coordinate(indexX, indexY));
    current =(Coordinate) workList.get(workList.size()-1);
    boolean statusChild;
    while(node[current.getRow()][current.getColumn()] != 64 ){
        statusChild = false;
        for(int loop=0; loop&lt;8; loop++){
            if(current.getRow()+x[loop]&gt;=0 &amp;&amp; current.getRow()+x[loop]&lt;=7 &amp;&amp; current.getColumn()+y[loop]&gt;=0 &amp;&amp; current.getColumn()+y[loop]&lt;=7){
                if(node[(current.getRow()+x[loop])][(current.getColumn()+y[loop])]==0){
                    workList.add(new Coordinate(current.getRow()+x[loop], current.getColumn()+y[loop], current));
                    statusChild = true;
                }
            }    
        }

        if(statusChild == true){
            workList.remove(workList.indexOf(current));
        }else{
            after = (Coordinate) workList.get(workList.size()-2);
            if(!current.getParent().equals(after.getParent())){
                node[after.getParent().getRow()][after.getParent().getColumn()]=node[current.getParent().getRow()][current.getParent().getColumn()];
                node[current.getParent().getRow()][current.getParent().getColumn()] = 0;
            }
            node[current.getRow()][current.getColumn()] = 0;                
            workList.remove(workList.size()-1);                
        }
        current = (Coordinate) workList.get(workList.size()-1);
        node[current.getRow()][current.getColumn()] = (node[current.getParent().getRow()][current.getParent().getColumn()])+1;
        System.out.println(current.getRow()+", "+current.getColumn()+", "+node[current.getRow()][current.getColumn()]);
    }

}
</code></pre>

<p>and output like</p>

<blockquote>
  <p>1 8 15 22 3 10 19 0</p>
  
  <p>16 23 2 9 18 21 4 11 </p>
  
  <p>7 14 17 24 5 12 35 20 </p>
  
  <p>32 25 6 13 34 27 40 37 </p>
  
  <p>47 44 33 26 39 36 51 28 </p>
  
  <p>64 31 62 43 56 29 38 41 </p>
  
  <p>59 48 54 30 61 42 0 0 </p>
  
  <p>0 63 60 0 0 0 0 0</p>
</blockquote>
