Towers of Hanoi First Move
If you trace the recursion calls that your algorithm makes before it prints its first line, you will have if the first call is  hanoi(n, 'A', 'B', 'C') : 

hanoi(n, 'A', 'B', 'C')
hanoi(n-1, 'A', 'C', 'B')
hanoi(n-2, 'A', 'B', 'C')
...
hanoi(1, 'A', $ , €)
Moving disc from A to $


To see if $ is equal to B or C, you just have to remark that the value of to_peg and spare_peg alternate each time so the disk to move only depends on the parity of n. In our example :

If n is odd then \$ = B and otherwise, \$ = C