Computer Science Canada

Tower of hanoi

Author:  Viper [ Fri Oct 21, 2005 7:38 am ]
Post subject:  Tower of hanoi

http://www.cut-the-knot.org/recurrence/hanoi.shtml

i need help making this i know i have 2 use recursion but i could still use a few pointers plz n thx Razz

Author:  StarGateSG-1 [ Fri Oct 21, 2005 9:42 am ]
Post subject: 

All I can say is Good Luck, and post what you have and we can help you, you need to be very forward when asking for help.

Pointer #1:

Read that site, it tells you wnat you need, then look in the help file.

Author:  Viper [ Fri Oct 21, 2005 11:10 am ]
Post subject: 

this is what i have so far this version allows you to play the tower but i need the computer 2 b able to solve it im in the middle of changing it rite now so in order for you 2 play you might have 2 delete incomplete stuff

Author:  beard0 [ Fri Oct 21, 2005 11:35 am ]
Post subject: 

Here is a solving procedure I made that you can adapt:
code:
procedure move (nblocks : int, p1, p2, p3 : string (1)) % P1 is name of start pin, P2 is name of destination pin, P3 is the name of the other pin
    if nblocks = 1 then
        % Move top from P1 to P2
    else
        move (nblocks - 1, p1, p3, p2)
        move (1, p1, p2, p3)
        move (nblocks - 1, p3, p2, p1)
    end if
end move

Author:  Viper [ Mon Oct 31, 2005 9:22 am ]
Post subject: 

thx all (sry bout the spam:))


: