-2

'Hello everyone i was wondering if you can help me with this program, the problem is that i have already calculated the amount of moves by using the recursion method but i need also to display were should the disks should be moved. Thank you' 'This is my code'

Function Hanoi(ByVal howmany As Long) As Long
If (howmany = 1) Then
Return 1
Else
Dim imovs As Long
imovs += Hanoi(howmany - 1)
imovs += Hanoi(1)
imovs += Hanoi(howmany - 1)

Return imovs
End If

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by nse2008
0

Hello, is that i am making a program related to a game call the towers of hanoi that you have a set ring that you have to past thru 3 towers but the problem is that you have only transfer one ring at a time and the ring should not be larger that one below it,they can only be relocated on the third tower bigger rings first to smaller rings in order, the code that i have made is to determine how many moves would be required to relocate all the rings to the third tower using the rules,The problem that i have is that the program can calcuate the number of moves needed to solve the game but i need also display instructions like move first tower to second towers for example,thank you for your attention, here is more information how the game is played http://en.wikipedia.org/wiki/Tower_of_hanoi

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.