This site requires JavaScript, please enable it in your browser!
Greenfoot back

danpost's Comments

Back to danpost's profile

I posted my world class code at the following link: http://www.greenfoot.org/topics/5099
I did want to show the algorithm I used to effectively solve the puzzle; however, I did not want to upload the scenario and take anything (view/votes) from yours. I will supply a link to the new discussion thread with the code once it is started.
@askgriff, as it is right now, the levels (worlds) will reset everytime you enter or re-enter one. However, if you still want to do that, you can use a switch in the world constructor to add your objects into each world. swich (level*3+room) { case 0: // add objects for room 101 break; // etc. to case 8: // add objects for room 303 break; }
I tried my hand at this creating a scenario for this puzzle. I found I did not need recursion or iterating. I just used the current state along with the move count to determine the next move. And to determine when the puzzle was completed, the move count would be equal to '2^n-1', where 'n' is the number of disks.
@UNDEAD_DC, you should probably start a new discussion thread on this, providing what code you have so far. There are many aspects of how you started your project that would determine how to proceed. Mainly how the surface is created and how the movement of the car is coded.
@joeschmoe, adjust the speed slider.
@EmilyC26, thank you. Glad you like it.
@EmilyC26, try re-loading it (it works for me). If that does not help, I do not know what to suggest (I doubt it is a coding problem).
Just to let you know, it was not me 'danpost' who asked for the source.