+ 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.
17 ответов
+ 9
https://code.sololearn.com/WfRRvrk8fwHd/?ref=app
Something like that?
+ 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.
+ 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 ;-)
+ 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 :/
+ 3
Well, maybe you can research and see other codes to make your own, I know you can do it and share with us ;-)
+ 3
You might be right but @TheOtherOne did it in a perfect teaching way already :)
+ 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
+ 2
Learn from him
+ 1
You are quicker than my challenge! :P
Really nice job
+ 1
Thanks Michael but its not my code
+ 1
@TheOtherOne
but if you go to code you could see author too ;-)
+ 1
Less fancy than a web code though ^^'
https://code.sololearn.com/c8RY98giQvNu/?ref=app
+ 1
Guys just make an interface tto existing web code.
Together?
0
Dis You refer to the author in comment? I can't see :)
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 ;)
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
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?