/* 
 * Michael Gousie
 * COMP 318  Spring 2026
 * tower.cpp
 *
 * Description: recursive implementation of Tower of Hanoi
 * Input      : number of rings to move
 * Output     : a description of all the moves to make to
 *              move all of the rings from post A to post B
 */

#include<iostream>

using namespace std;

void towers (int n, char source, char dest, char spare) {
   if (n == 1)
      cout << "Move " << source << " to " << dest << endl;
   else {
      towers (n - 1, source, spare, dest);
      towers (1, source, dest, spare);
      towers (n - 1, spare, dest, source);
   }
}


int main () {
   int n;
   cout << "Enter number of disks: ";
   cin >> n;
   towers (n, 'A', 'B', 'C');
   cout << "Done!" << endl;
   return 0;
}

