'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
Dim imovs As Long
imovs += Hanoi(howmany - 1)
imovs += Hanoi(1)
imovs += Hanoi(howmany - 1)

Return imovs
End If

Recommended Answers

All 2 Replies

Hey , The question is not clear can u elaborate a little bit.
Thanks \

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.