This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game. but there is a question rising in my mind.

when i will set goal to complete the level, how will i know the goal is achievable ?

suppose in a level where i have to collect 5 Red, 12 blue, 9 green objects by matching the same(like farm heros). how would i decide how much moves i need to set to make this goal achievable. i mean it should be challenging but not be impossible.

since the objects spawn in a random whats the surety that there will be enough number of gem in the game to not make impossible.

is there some logical explanation for this, or i just have to test and look out how many moves it takes to achieve the goal.

Is there an algorithm which generates the gems according to target set, or they are generated in random manner?

To be more clear towards my question i am going to take an example of King.com's farm-heros-saga .

In level 9 the target is to collect number of four types of objects 26,26,14,5 respectively. and the maximum number of moves are 22.

now this goal may be achievable and challenging(i mean you can achieve it in two or three trials ) but not impossible.

Now my question is what made those guys so sure that it will not be impossible, how they decided that 22 move will be enough and challenging.

well.. they could have put the maximum number of moves to 5 or 6. but that would surely make it impossible to clear the level. so how they decided to keep move 22 or this.

Are they using static pattern to generate and spawn objects, or ratio of collectible gems is fixed(i.e in total gameplay there will be X%,Y%,Z%,M% of gems respectively ), or there is some other way. I just need some hint what should i look for..


Depending on which random number generator you are using, you should be able to specify a "salt" value. This enables you to generate the same series of gems every time (although they are still random). If you do it this way, you can then run the level lots of times and work out how many moves it should take.

  • 1
    \$\begingroup\$ I think you mean a "seed", not a "salt". \$\endgroup\$ – Philipp Jul 25 '14 at 14:46
  • \$\begingroup\$ isn't that gonna make all the moves predictable? i mean if player has played it 6-7 time. next time he will already know which move to make to clear the level. makes less challenging. \$\endgroup\$ – Pawan Joshi Jul 26 '14 at 5:50

A good algorithm to generate any kind of solvable puzzle is to first generate a solved configuration of the puzzle, and then backtrack a number of valid moves which would lead to this configuration. You can easily control the difficulty by how many moves you perform and you have a valid solution to it. However, keep in mind that there could always be a faster solution than what you generated.

  • \$\begingroup\$ so bottom line... we can't generate gems randomly. they has to be in certain pattern when game loads up first time ? \$\endgroup\$ – Pawan Joshi Jul 25 '14 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.