Sometimes a player can't see the next move to do, so they need a hint. We must code a routine to give them such a hint.
The idea: We have plenty of space on the right of the game field, so the game will give a hint when you click on the right of the game field. How can we give the hint?
For each gem, starting from top-left to bottom-right, we'll see if swapping it with the gem at its right (if any) or with the gem below (if any) gives a streak. To make you see the code works, the script will show all possible hints.
The development: In
onClick function, when the player does not click in the game field, we will start the routine to give hints. We already said we can't foresee the game field with swapped gems, so we will physically ...