#include <stdio.h>
typedef enum { first=1, second, third } Stack;
void hannoi (Stack from, Stack to, unsigned int n)
{
if (n == 1)
printf ("%d-->%d\n",from, to);
else
{
/* 6-from-to表示除了源柱子和目的柱子的另一根柱子 */
hannoi (from, 6-from-to, n-1);
hannoi (from, to, 1);
hannoi (6-from-to, to, n-1);
}
}
int main ()
{
hannoi (first, third, 3);
return 0;
}