private static int move(CI from, CI to, int num) { if (num == 1) { move1(from, to); return(1); } else { CI F, T; F.index = from.index; T.index = 3 - from.index - to.index; int c = move(F, T, num - 1); move1(from, to); F.index = 3 - from.index - to.index; T.index = to.index; return(c + 1 + move(F, T, num - 1)); } }
private static void move1(CI from, CI to) { s_cols[to.index][s_heights[to.index]++] = s_cols[from.index][--s_heights[from.index]]; }