# Junior Frogs

This challenge is based on the game Frogs which you may have seen before.

There are two blue frogs and two red frogs.

A frog can jump over one other frog onto an empty lilypad or it can slide onto an empty lilypad which is immediately next to it.

Only one frog, at a time, is allowed on each lilypad.

Now the idea is for the blue frogs and red frogs to change places. So, the red frogs will end up on the side where the blue frogs started and the blue frogs will end up where the red frogs began.

The challenge is to do this in as few slides and jumps as possible.

You could use the interactivity below to help you try out your ideas.

How do you know you have found the smallest possible number of slides and jumps?

Why not try three red frogs and three blue?

What is the smallest number of slides and jumps now?

How will you keep track of the moves you've made?

Where could you move that frog? What would happen next? So which move might be better/best?

Towards the end of August we had some last minute solutions sent in from different countries, namely - England, New Zealand, Australia, China and Denmark. We had a very precise, accurate and well-explained solution sent in earlier, by Hannah from Leicester High School for Girls in the UK. This represents the most exhaustive solution that I have come across for my particular activities. Well done Hannah! You have good reason to be proud of your work. I hope you will continue to work on some of the activities from this site.

*Two Red Frogs and Two Blue Frogs*

To keep this simple, let's assign a letter to each of our adventurous amphibians: from left to right, their names are A, B, C and D. At the start, you are able to move any of the $4$ amphibians. It doesn't matter whether you move a red frog or a blue frog first, because the layout is symmetrical. Let's say we move a red frog first. Imagine a situation where A jumps over B , we'd be in a right mess because no amphibian would be able to move anymore. So this means we have to slide B onto the lily pad directly beside it. Now, we can either move A, which would bring us back to the situation mentioned at the beginning, or we could, more sensibly, make C jump over B. Just to recap, our current position is A, C, B, (space), D.

At this point we can either move B or D. We'll have to think ahead. Say we move B onto the vacant lily pad. Now we could move either A or D. However, both these moves would bring us to a dead end and a serious congestion. This means we will have to slide D onto the lily pad beside it. From here, the only thing we can do is make B jump over D. Now we can move either A or D. Moving D would bring us to a congestion that just won't do, so we are obliged to jump A over C. There is only one move we can make at this point: sliding C onto the left-most lily pad. After this, there still is only one possible move: jumping D over A. From here on it's quite obvious: just slide A nicely in beside B, and we've exchanged the positions of the red frogs and blue frogs.

This is not the only solution: the exact reflection of what I've just explained, where the blue frog moves first, is the other answer. Altogether, this has taken $8$ moves in total, according to the NRICH interactivity. Each frog made exactly two slides and two jumps. I can be sure that this is the lowest possible number of moves because I have worked this out systematically. However, I have found that solving this puzzle in more than $8$ moves is impossible; from several trials I have discovered that doing it in $8$ moves is the only solution. This means that $8$ moves is also the highest as well as lowest possible number of moves for two red frogs and two blue frogs.

*Three Red Frogs and Three Blue Frogs*

Once again, let's give each frog a letter: from left to right, A, B, and C, which are the red frogs, and D, E, and F, which are blue frogs. To keep things consistent, I'll start with red frogs again, although, again, the puzzle layout is symmetrical. The first part of this puzzle is similar to the previous one, but I'll explain that bit again anyway; firstly, we want to move one of the red frogs, so that's either B or C. B will bring us into a mess, so we have to move C. Moving B at this point won't be a good idea, and neither will moving A, so we'll settle with jumping D over C. Sliding C onto the empty lily pad will bring a congestion later on so the best idea is to move E. If we slide F, it won't do any good, so let's make C hop over E. Moving E one lily pad along will lead to congestion so B should jump over D. If we move D over, it will lead to trouble, so we should move A onto the vacant lily pad. We now have an alternating pattern of red frogs and blue frogs, which is a good sign. From here it should be quite straightforward; the only thing we can do now is jump D over A. Moving A forward will lead to congestion (I apologise that I keep using that word, but it suits the situation best!) so I would jump E over B. In a similar pattern, let's jump F over C, and then move C onto the empty lily pad. After that we should jump B over F, and then jump A into the space that B just left. Now we should slide E in beside D, jump F over A and then move A into the spare slot.

This time the outcome is quite different: the interactivity states that red frogs made four slides and four jumps, and that blue frogs made two slides and five jumps. This means that blue frogs made fewer moves than frogs. The total number of moves is $15$. I tried this again starting with the bllue frogs, and this time the red frogs made two slides and five jumps, and the blue frogs made four of each. I can be assured that this is the shortest possible number of moves because I worked it out systematically and always chose the one move that would work. I think the key is to make an alternating pattern of red frogs and blue frogs, and from then on it's easy.

I worked out the smallest number of moves for one red frog and one blue frog, as well as four red frogs and four blue frogs, to see if there was a pattern and whether I could come up with a formula.

Here are my results:

$1$ of each type, $3$ moves

$2$ of each type, $8$ moves

$3$ of each type, $15$ moves

$4$ of each type, $24$ moves.

I noticed that the number of moves is the number of each type of frog multiplied by itself plus 2. Now, that's a bit of a mouthful, so here's the formula that I came up with: $n(n + 2)$ or $n ² + 2n$.

This might encourage others to write explanations in their own words, describing what they have done and where they got to.