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.

Filter by
Sorted by
Tagged with
6
votes
1answer
91 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. ...
3
votes
2answers
313 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 ...
2
votes
1answer
92 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: ...
12
votes
2answers
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 ...
11
votes
1answer
124 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: ...
2
votes
2answers
197 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? ...
4
votes
2answers
854 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: ...
7
votes
1answer
650 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 ...
4
votes
2answers
406 views

Tower of Hanoi solver in Ruby

Solved the classic Tower of Hanoi problem in Ruby, using recursion. Would love your feedback on this. ...
0
votes
1answer
116 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 ...
2
votes
1answer
1k 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 ...
7
votes
2answers
8k 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 ...
7
votes
1answer
264 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 ...
3
votes
1answer
858 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: ...
7
votes
4answers
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 ...
6
votes
1answer
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 (...
7
votes
1answer
4k 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: ...
7
votes
1answer
3k views

Tower of Hanoi solver

Requesting code review, best practices, optimizations for this solution to the Tower of Hanoi problem. ...
0
votes
1answer
2k views

Hanoi Towers solver [closed]

I've made an algorithm solving Hanoi Tower puzzles, for n disks and m pegs. It uses lists as pegs, each list's element contains disks array - {0, 0, 0} means the ...
8
votes
1answer
3k views

Towers of Hanoi in Haskell

Of course the recursive version is trivial: ...