+ 4

Challenge: Tower of Hanoi

There are 3 rods and stock of 'd' discs smallest on top to biggest at bottom. Rules: Only one disk can be moved at a time. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack. No disk may be placed on top of a smaller disk. Task: - let's make d random - - show to user start-rod index - ask user, which rod is the end-rod. Input: (end-rod) 0<int<4 Output: boolean = user guess. Additional: !(rod indexes )&(rod quantity) can be fixed.

11th Aug 2017, 11:12 PM
Michał Bujakowski
Michał Bujakowski - avatar
17 Réponses
12th Aug 2017, 2:08 AM
Daniel
Daniel - avatar
+ 5
@$Vengat No, that's the entire problem! To get the entire stack to a diff rod! So if there is no, movement, the the challenge isn't completed! So there are 3 moves to move them to another stack.
13th Aug 2017, 12:19 PM
J.G.
J.G. - avatar
+ 3
@Baptiste I shared before because I think is better to ser graphically. Obviously first of all, the process is pure maths but maybe you can do a graphical version ;-)
12th Aug 2017, 10:38 PM
Daniel
Daniel - avatar
+ 3
Yeah of course, I just had this code (one of my first in sololearn) so I thought it might be good to show it here ^^ For the graphical version ... yes of course ! But not on Sololearn unfortunately ... I have nearly no knowledge of web development :/
12th Aug 2017, 10:39 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
Well, maybe you can research and see other codes to make your own, I know you can do it and share with us ;-)
12th Aug 2017, 10:41 PM
Daniel
Daniel - avatar
+ 3
You might be right but @TheOtherOne did it in a perfect teaching way already :)
12th Aug 2017, 10:45 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
But one problem. When number of discs is 2, there ahould be no movement but why are there 3 moves? Is it like they must be on specific rods or something
12th Aug 2017, 11:13 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Learn from him
12th Aug 2017, 10:46 PM
Daniel
Daniel - avatar
+ 1
You are quicker than my challenge! :P Really nice job
12th Aug 2017, 11:03 AM
Michał Bujakowski
Michał Bujakowski - avatar
+ 1
Thanks Michael but its not my code
12th Aug 2017, 3:01 PM
Daniel
Daniel - avatar
+ 1
@TheOtherOne but if you go to code you could see author too ;-)
12th Aug 2017, 4:35 PM
Daniel
Daniel - avatar
+ 1
Less fancy than a web code though ^^' https://code.sololearn.com/c8RY98giQvNu/?ref=app
12th Aug 2017, 10:35 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
Guys just make an interface tto existing web code. Together?
12th Aug 2017, 10:50 PM
Michał Bujakowski
Michał Bujakowski - avatar
0
Dis You refer to the author in comment? I can't see :)
12th Aug 2017, 3:51 PM
Michał Bujakowski
Michał Bujakowski - avatar
0
man, do you know a definition of work? No replacement - no work; Your question is like - why can;t we just draw a program as a movie ;D I think it's just an incoucious questipn ;)
13th Aug 2017, 12:21 AM
Michał Bujakowski
Michał Bujakowski - avatar
0
tower of Hanoi is for discs >=3 for 3disc minimum of 7moves are required for 4 disc 15 move's and for 5, 31moves and so
19th Aug 2017, 2:18 PM
pratheek shenoy k
0
https://code.sololearn.com/cx7nWow0Z82n/#py I've attempted my first solo-learn challenge. I've made a recursive python version that displays the towers using ASCII graphics. I've gone for maximum explanation as I really wanted to see the recursion. Disappointingly it times out and will not run on solo learn without removing the graphics and comments I spent so long adding; so I've not removed them. Please copy it to your desk top to see it running. p.s. Does anybody know how to extend the recursion depth on solo-learn?
14th Apr 2018, 7:26 PM
Brian Larkin
Brian Larkin - avatar