1
\$\begingroup\$

I've been developing a game where a number of tiles can drag into a hexagonal grid background.

For some purpose I need to find the location of same tiles into an array and merge them.

Data Layer:

enter image description here

Presentation Layer:

enter image description here

I need to find the location of all the tiles those who have same value and connected with each other.

So I need a basic idea, how can I do that or if exists any algorithm.

Note: As3 related code will help.

\$\endgroup\$
  • \$\begingroup\$ I hope this link help you \$\endgroup\$ – Seyed Morteza Kamali Jul 31 '16 at 5:49
  • \$\begingroup\$ @smkplus thanks but i don't understand C#.algorithm or sudocode might help \$\endgroup\$ – moin khan Jul 31 '16 at 5:54
  • 1
    \$\begingroup\$ @moinkhan I'm not sure you tried very hard, just read the C# like it was pseudocode, it's defined with pretty clear variable names. \$\endgroup\$ – MichaelHouse Jul 31 '16 at 6:01
1
\$\begingroup\$

Amit's Game Programming Information extensively covers many different topics, including hexagonal grids. It is possibly the best free resource available, and I wholeheartedly recommend it.

For your particular problem, I imagine you would only need to traverse the data structure containing your hex tiles by probing the tiles around your starting tile. You could use a variation of the flood fill algorithm and perform the checks recursively.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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