# match-3, 4, 5, 6? Algorithm for a puzzle match game that will change the number of matches 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!

-
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

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.