//暴力递归 解决汉诺塔问题
public class TowerOfHanoi {
public void func(int N,String from, String to, String others){
if (N == 1){
System.out.println("move " + N + " from " + from + " to " + to);
return;
}{
func(N-1,from,others,to);
System.out.println("move " + N + " from " + from + " to " + to);
func(N-1,others,to,from);
}
}
public static void main(String[] args) {
TowerOfHanoi towerOfHanoi = new TowerOfHanoi();
towerOfHanoi.func(2,"left","right","mid");
}
}