I think this solves the tower of hanoi problem