The Algorithm Design of Candy Crush

Started by
10 comments, last by Dragonsoulj 10 years, 10 months ago

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

Advertisement

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.

This topic is closed to new replies.

Advertisement