UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ Hanoi.java
public class Hanoi{
    public static void solve(int disks, int from,
                             int to){
        Trace.reverseIndent(disks, "solve(disks="+
            disks + ",from=" +from+ ",to=" +to+")");
        if (disks==1){
            printmove(1,from,to);
        } else {
            int using=6-from-to;
            solve(disks-1,from,using);
            printmove(disks,from,to);
            solve(disks-1,using,to);
        }
    }

  private static void printmove(int indent, int from, int to){
    Trace.reverseIndent(indent, "  *Move disk from " + from + " to " + to);
  }


  public static void main(String[] args){

    solve(10,1,3);
  }

}
//