implementing the towers of hanoi puzzle