Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I was wondering if someone had an idea or had some thoughts behind creating a match-3, match-4, match-5... all the way to match-10 just by changing a variable.

I think it is easy to do a match 3 or 4, but with higher matches, it becomes difficult and a new algorithm is needed. Does anyone have an idea on how this would be implemented?

I'm totally stuck. Thanks!

share|improve this question
3  
Ummm... Sorry but what? I don't even understand the question. –  Mike C May 7 '12 at 3:29
    
so, in many match 3 games you need to match 3 gems next to each other like bejeweled. In a match 4, you need to match 4 gems that are touching each other (any of tetris block formations). match5 is 5 gems, etc. –  Frank May 7 '12 at 3:33
    
Oh, that's what you meant by matching games. Sorry, to me a matching game could be anything from Bejeweled to Memory so I wasn't sure what you meant. –  Mike C May 7 '12 at 3:38

1 Answer 1

Just keep it as a variable, i.e. numToMatch = 3. In your algorithm, refer to this variable exclusively when you're trying to determine if there's a match or not.

If you want to vary this, say from level to level, I would suggest some algorithm like breadth-first or depth-first search, where you note the amount of touching, matched tiles. If it reaches the number you want, boom, victory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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