# The Algorithm Design of Candy Crush

This topic is 2019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys,

I would like to know how would you will design the core algorithm of CANDY CRUSH? Any one got idea?

##### Share on other sites

You need to be more specific.

In terms of representation, they can be stored in an array or a list.

##### Share on other sites

You need to be more specific.

In terms of representation, they can be stored in an array or a list.

Here what I mean is that algorithm to traverse the board to find out which candy need to be remove.

##### Share on other sites

Is this one of these "Match 3 in a row" games?

Just check if the two flipped objects are connected to 2 more equal objects, if yes remove all of them, if not flip back.

##### Share on other sites

You could use a flood fill to find and count the objects http://en.wikipedia.org/wiki/Flood_fill

##### Share on other sites

Is this one of these "Match 3 in a row" games?

Just check if the two flipped objects are connected to 2 more equal objects, if yes remove all of them, if not flip back.

Yes, It's kind of "Match 3 in a row" game.

How you got to implement this rule? Use recursion or backtracing? How to organized those objects, the board should be traverse each time.

Thanks,

##### Share on other sites

you can use a bit map to store the types of candy. the player can change only two of them each time. so you just scan and check the ranks of them.

##### Share on other sites

You could use a flood fill to find and count the objects http://en.wikipedia.org/wiki/Flood_fill

##### Share on other sites

You could use a flood fill to find and count the objects http://en.wikipedia.org/wiki/Flood_fill

learning...

##### Share on other sites

I am working on a match 3 game, but it also matches irregular pieces connected to the original match. For that I am using the flood fill already mentioned on the thread.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!