Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Match-three puzzle games algorithm

I am trying to write a match-three puzzle game like 'call of Atlantis' myself. The most important algorithm is to find out all possible match-three possibilities. Is there any open source projects that can be referenced? Or any keywords to the algorithm? I am trying to look for a faster algorithm to calculate all possibilities. Thanks.

like image 521
Stan Avatar asked Feb 25 '26 22:02

Stan


1 Answers

To match 3 objects using one swap, you need already 2 objects lined up in the right way. Identify these pairs first. Then there are just a few possibilities from where a third object can be swapped in. Try to encode these patterns.

For smaller boards the easy brute force algorithm (try out all possible swaps and check if three objects line up in the neighborhood after a swap) may be sufficient.

Sorry, I can't say much more without a more precise description.

like image 177
Landei Avatar answered Feb 28 '26 00:02

Landei