ハンノタ第i回移動問題
629 ワード
void hanoi_movei(int level, int i, int a, int b, int c)
{
int m;
int t;
int id=0;
m = 1<>=1) {
id--;
if ((i&m)==0) {
t = c;
c=b, b=t;
continue;
}
i ^= m;
if (i==0) {
printf("move %d from pole %c to %c
", id, a+'A', c+'A');
return;
}
t=a;
a=b, b=t;
}
}