I do not think you can randomly place the pieces of the puzzle anywhere and be able to solve it every time. You probably should create the puzzle in the solved position; then, make a bunch of random moves to mix it up. Then, it will always be solvable.
Now, for a bit of a challenge, try to make it so after it is solved, just clicking on the 'Run' button brings up the menu again (if not solved, it should let the user continue to solve the current puzzle). BTW, I know that just clicking on the 'Reset' button brings up the menu, but it could, instead, start with a title screen.
Evidently, Greenfoot does not like 'Greenfoot.start();' within a reset (at least in this case). I commented out the line and the freezing of the scenario went away. I added a header screen and did not have that statement in my version.
Greenfoot.start() in the start of the world code makes lines like "if (Greenfoot.isMouseClicked(this))" stop working the first time you reset the scencario, though if you click the reset button again the scenario will work fine. So clicking the reset button only makes the scenario stop working the first time afterwards you can reset as much as you like without any freezes. I don't know why it works like that, but I got the exact same issue with Wombat Puzzles, which uses Greenfoot.start() in the very start of a menu world as well. But in Wombat Puzzles I tried to add a wombat from the normal greenfoot scenario wombats, and when I clicked reset the first time I couldn't click on any button, but the wombat was running as it should.
I am not getting any of what I though was freezing now (I never checked to see if the clicking worked -- but the control buttons were not active). But what is happening now is after reseting and clicking on a size, it shows the completed puzzle for a few seconds, then goes back to the menu :? (clicking a size the second time does not revert back in like manner).
I don't get it. No matter how many times I reset I'm not experiencing "But what is happening now is after reseting and clicking on a size, it shows the completed puzzle for a few seconds, then goes back to the menu :?"
Looks like you got it! Good job. How about another challenge? If you are up to it, add a timer and a move counter and display the results after game completion. Maybe even devise a scoring system and display the score also (devising a decent scoring system that works fairly evenly for each level is the challenging part).
2012/8/20
2012/8/21
2012/8/21
2012/8/21
2012/8/22
2012/8/23
2012/8/24
2012/8/24
2012/8/24
2012/8/24
2012/8/25
2012/8/25
2012/8/25
2012/8/25
2012/8/25
2012/8/25
2012/8/26
2012/8/26
2012/8/27
2012/8/27
2012/8/27
2012/8/27
2012/8/27
2012/9/10
2012/9/11