Sign in to follow this  
Followers 0
finanshow

The Algorithm Design of Candy Crush

11 posts in this topic

Hi guys,

 

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

 

com.supergames.candycrushsaga_94396700_0

0

Share this post


Link to post
Share on other sites

You need to be more specific. 

 

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

0

Share this post


Link to post
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.

0

Share this post


Link to post
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.

0

Share this post


Link to post
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,

0

Share this post


Link to post
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.

0

Share this post


Link to post
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

Share this post


Link to post
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.

Thanks CJ. laugh.png

0

Share this post


Link to post
Share on other sites

I believe I answered this kind of question before. You could search your space for 2 criteria: 2 of the same "candy" adjacent horizontally or vertically, and then see if at least a third is switchable from whichever direction the "candies" are in (horizontal or vertical). This covers the first portion. The second is looking for 2 "candies" that are in a line, horizontally or vertically, with only 1 piece that separates them. Then with that one piece, see if a piece in the opposite direction (if you are finding horizontal lines, look vertically, or vice versa) can be switched to make 3. If so, this is a match.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0