# Questions tagged [tower-of-hanoi]

A puzzle to build the Tower of Hanoi on an area of 3 rods with a number of disks of varying size.

22 questions
Filter by
Sorted by
Tagged with
145 views

### Solving the Towers of Hanoi problem in Python by using 3 stacks

I am attaching my code to solve the Hanoi problem. What do you think? Would you change something? I am attaching the instructions for solving the problem, does the code solve the question? In the ...
• 51
412 views

### Tower of Hanoi in Racket

I'm in the early stages of learning Racket, and decided to have a go at the tower of Hanoi. I did this without any reference whatsoever, so everything is up for review, including the algorithm as well ...
2k views

### Tower of Hanoi without recursion

Hi I am pretty new to programming and I would like you to give me some feedback about my code, how does it look, what could be better. Thank you. ...
• 61
654 views

### Script for Python Hanoi Tower OOP

Is my Python Script to play Hanoi Tower respectful of OOP spirit? I have difficulties to create meaningful classes so I started an easy project. Here is one class at the plateau level and then a ...
• 139
156 views

### Interactive Tower of Hanoi

I created this program some time ago. It shows you how to solve tower of hanoi for n disks, step by step. Here's the code: ...
• 2,740
2k views

### Tower of Hanoi Recursive Implementation using Python with OOP

I have just finished a small program for Tower of Hanoi using recursion. I did it to practice OOP which I recently learnt. It took me about 2 hours to research about the recursive algorithm and write ...
• 123
203 views

### Slow image generation

I build a Tower of Hanoi solver which print the solution as an image It works as expected but generating the image is relatively slow compared to the time to calculate the answer. Here is the code: ...
• 113
314 views

### Iterative version of Hanoi Tower exercise

I just finished a iterative version of Hanoi Tower. This is how the algorithm works: I'm trying to find a method to delete the goto instruction. Any tips? ...
• 161
1k views

### Iterative Implementation of Towers of Hanoi

Here is an implementation of Towers of Hanoi based on few observed patterns1 from the easier recursive solution: ...
• 1,174
788 views

### Python 2.7 Tower of Hanoi game with ASCII graphics

The game generates a fixed, "animated" game board via ASCII characters that is reprinted and cleared after each valid move. The format of the input for making moves is described in the script. You ...
580 views

### Tower of Hanoi solver in Ruby

Solved the classic Tower of Hanoi problem in Ruby, using recursion. Would love your feedback on this. ...
• 257
176 views

### Tower of Hanoi move method

So I have some code which solves the tower of hanoi problem. The code that I have written is pretty clunky and seems to repeat itself multiple times. Was just wondering if there was some way of ...
• 121
2k views

### Tower of Hanoi: graphical representation of optimal solution

I wrote a program to show graphically the solution of the problem of the Tower of Hanoi. Here is a video of an example run. The logic of the solving is taken from StackOverflow (see links in ...
• 27.5k
14k views

### Tower of Hanoi (without recursion)

I came across an interesting method of solution for the Tower of Hanoi puzzle and wrote a short version of it as a programming exercise. The program produces the correct results but I have two ...
• 351
285 views

### Towers of Hanoi redux

Inspired by Mayur Kulkarni's question this morning, I decided to post some code for the classic Towers of Hanoi problem, but this time in C++. Since this is fairly "textbook" kind of task, all ...
• 33.6k
1k views

### Tower of Hanoi simulation

I've just implemented a simulation of tower of hanoi in Java. Any suggestions are welcomed. Here's my code: ...
2k views

### Towers of Hanoi

I am just learning how to code in Ruby now with no prior experience. This is 3 towers of Hanoi where the user selects where to choose from and where to go with each disc, and not to have a bigger disc ...
• 171
3k views

### Implementation of Tower of Hanoi iterative procedure

I have been working last night on implementing Tower of Hanoi without using recursion. I have found an algorithm on Wikipedia about the same topic here. I have implemented it and it's working fine (...
• 63
5k views

### Solving the Reve's puzzle

I'm trying to solve the Reve's puzzle (a variant of the Tower of Hanoi puzzle with four pegs). This is what I've come up with so far: ...
• 173
3k views

### Tower of Hanoi solver

Requesting code review, best practices, optimizations for this solution to the Tower of Hanoi problem. ...
• 8,391