from rcviz import callgraph, viz def move(fromPos,targetPos): print("Move disc from {} to {}".format(fromPos,targetPos)) global times times = 0 times += 1 def hanoi(numDisc,fromPos,helperPos,targetPos): if numDisc==0: pass else: hanoi(numDisc-1,fromPos,targetPos,helperPos) move(fromPos,targetPos) hanoi(numDisc-1,helperPos,fromPos,targetPos) hanoi(4,"A","B","C") callgraph.render("hanoi.png")