Python3 Source Code

# Author: Hannes du Plooy 
# Date: 20 Sep 2016
# Objective: To solve the towers of hanoi with number of discs provided in the arguments to calling the program
import sys

def hanoi(source,dest,other,discs):
    if discs<=0:
        return
    hanoi(source,other,dest,discs-1)
    print("Move ",source," to ",dest)
    hanoi(other,dest,source,discs-1)

if len(sys.argv) < 2:
    print("Please provide number of discs!")
else:
    hanoi(0,2,1,int(sys.argv[1]))