[Community Puzzle] Smooth!


Send your feedback or ask for help here!

Created by @JBM,validated by @bbb000bbbyyy,@Niako and @dbdr.
If you have any issues, feel free to ping them.

Does not untherstand the rules.
what is on the first line one of each fruit?

what is replaced by 3 bananas in the example?


@JBM do you think you could give an example of how this game would work with a higher starting number? im not sure if the game allows the same fruit to be used multiple times. Maybe i am overthinking this but im having a really hard time understanding the game and its stopping me from being able to solve the challenge. Can you only win at the end of a turn with 1 fruit remaining and otherwise if the number is not divisible by 5||3||2 your opponent wins? Appreciate you, thanks.

I have solved this puzzle and maybe I can help you.

Yes, it does. To example to win with f=9 you have to replace two times with oranges and then with one watermelon.

Yes, because as your last action to win, you have to replace one fruit with one watermelon.

I was also a little confused by the statement at the beginning too. To say it a bit more mathematical: In every game turn (with n fruits) you can replace the fruits by n/5 fruits (bananas), n/3 fruits (oranges), n/2 fruits (apples) or n fruits (watermelon). If n is not divisible by 5, 3 or 2 and n is not 1, you lost.
Except by the last action, it’s not important, which fruit is on the table, only how much.

I hope I could help you.


The english description should really be revised, preferably by someone who speaks the language and is up for the task. It’s close to impossible to comprehend as is.


Rules don’t explicitly forbid to replace any number of fruits with watermelons.
So if there are 7 fruits, Ham can replace them with 7 watermelons.
In turn, Ming can replace them with 7 watermelons again, and basically game never ends.

That’s true. But your task is to find out if they can win the game playing optimally. And replacing a number of a number of fruits > 1 by watermelons is never optimally.

1 Like

Replacing 7 fruits with 7 watermelons is optimal, because otherwise player loses.
Basically, that’s the only legit move in this case.

What I meant is that it doesn’t matter in this case: You can replace it and the game never ends (which is equal to losing the game). So if you have 7 fruits left, you will lose in either case.

So yes, the rules don’t forbid replacing any number of fruits with watermelons, but that doesn’t change the problem.

Just to say, for any new coder trying this exercice, and struggling with the statement: read the previous posts from @ItsAFeature, whose explanations greatly help me to understand the statement.

I’ll add to this.

The game isn’t about if player 1 wins. It is about if any player wins. Once you understand this, this puzzle becomes very easy.

For those who didn’t understand the problem .

Let’s takes the example of 15 Pieces :

  • 15 Pieces can be expressed as 3 bananas (since 1 banans = 5)
  • these 3 Pieces (of bananas) can be expressed by 1 Orange (since 1 Orange = 3)

We keep doing that until we reach 1 (Victory). if we can’t then it’s (Defeat)

15 = 5  *  3 
3  = 3  *  1

So if Number Of pieces is divided by any number rather than 2 ,3 or 5 then it’s defeat