Leaping Frogs Puzzle *** Mobile Friendly *** Instructions on Screen Click the [# frogs a side] on-screen arrows to change puzzle difficulty up/down between 2 and 9.. Click the Flag or [Restart] to restart current puzzle. **New** Click [Jump ...] to alter max jumpable frogs ** This new feature was inspired by @Palbot's query in the comments about how the puzzle might change if you could jump over a maximum of 2 frogs. This intrigued me because I wondered wondered how many less moves would be required to solve the puzzle at each level of difficulty, or more importantly what the minimum number of moves would be? One way to find out was to make it possible and count the # of moves. The Table below shows the #moves required to solve the puzzle in Normal mode (jump 1 frog), and the minimum #moves to solve it in Extended mode where you can (jump up to 2 frogs). (jump 1 frog) (jump up to 2 frogs) n #moves min #moves 2 8 5 3 15 10 4 24 16 5 35 24 6 48 33 7 63 44 8 80 55 9 99 68 The #moves required in Normal mode is fixed, and it will always take you that many moves if you solve it. However if you can jump up to 2 frogs at a time, you will obviously be able to solve it in less moves than that. I don't know for certain yet what the minimum #moves required to solve each level is. The values shown in the table above, are based solely on my testing and are the best results I was able to achieve. Please let me know in the comments if you can get a better result for any Level than the ones I got above. For Normal mode, I know the formula to calculate #moves from the #frogs per side (n), but I haven't been able to find a formula for the minimum #moves when you can jump up to 2 frogs at once. I thought I had one, but it broke down when I added the [5 frogs a side] level because I was able to solve that in 1 less move than my formula predicted? Have fun trying! When you have solved a puzzle, to help you remember how you solved it, it shows you a list of moves you made to achieve that result (each move being the Lilypad # the frog you clicked was sitting on). I also numbered the lilypads so it's easy to use those results to repeat your solve. Please do not post the details of those moves in the comments. It will be deleted if you do, because I don't want anyone to spoil the puzzle for others. And there's a new Bonus feature that pops up on a completed solve: a [Replay] button. Just click it to replay the solution you found! You can replay it as often as you wish. As an extra Bonus after a successful solve of a Level when jumping up to 2 frogs is allowed, if you solved it in more moves than the "assumed" minimum # moves (as per the Table above), then a [show min sol] button will also pop up, and if you click that it will play a solution that uses that "assumed" minimum # moves. Of course you may have found a better solution (less moves). However it won't pop up if you haven't made a reasonable attempt at solving it in less moves than you could using the same method used for solving it when you can only jump 1 frog at a time. PS: For those of you that have bothered to read this far, the formula (if n=#frogs per side) for the #moves to solve it in Normal mode is n(n+2). I am not sure if there is a formula for the min #moves in Extended mode (where you can jump up to 2 frogs at once). The formula I had that worked for n = 2, 3 & 4 was n^2+1, but it failed for n = 5 because it suggested a minimum of 26 moves, but I solved it in 25, and for n = 6 that formula would suggest it's 37 moves, but I managed to solve that in 34, so who knows? But then I found one that seemed to work for all of n = 2 - 7: n^2 + 1 (if n < 5) otherwise it's n^2 - 2(n-5) But it's no good either! I changed the project again to support up to 9 frogs per side, for which the above formula predicted the minimum #moves to solve it would be 58 (for n=8), but I was able to solve it in 56. It predicted 73 (for n=9), but I was able to solve that in 70, so it's back to the drawing board on that. Pity! Since then I actually did n=9 in 69 moves, n=7 in 44, n=6 in 33, n=5 in 24 & n=4 in 16, so that formula was based on false assumptions of what the minimums were for n = 4, 5, 6, 7, 8 & 9 anyway? Who knows what the minimums really are? Someone might be able to get even better results? I recently improved on the 56 for n=8, by solving it in 55! Now wondering if maybe n=9 can be done in 66? Well not sure about that, but the following day I did get it down to 68. Regards Greg
Created by @gregatku for use in Coding Classes for Kids Unlimited, for whom I work as a Coding teacher. A KU colleague created a version of this puzzle using Crabs instead of Frogs, but they had a Sprite for each Crab, thus making the code much more complex than it needed to be, and it also meant they needed 2 distinct projects for the Easy and Hard versions of the puzzle. I wanted to show them how to simplify the code significantly and implement both versions in the one project, by proper use of Clones, Local Variables (to distinguish clones and their properties from each other) and a single List (to record globally where each clone is), so I whipped-up this little project! However, with no changes to my code (except trivial ones to reduce the value of the Distance Apart variable, the size% of the Frog & Lilypad sprites, and a slight change to the x/y location of a Frog when it's on the central Lilypad), the project now supports 5 levels of difficulty Easy, Medium, Hard, Harder & Hardest. Thanks also to @Palbot for inspiring the new feature allowing you to jump as many as 2 frogs at once.