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.

  • \$\begingroup\$ I hope this link help you \$\endgroup\$ Jul 31, 2016 at 5:49
  • \$\begingroup\$ @smkplus thanks but i don't understand C#.algorithm or sudocode might help \$\endgroup\$
    – moin khan
    Jul 31, 2016 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\$
    – House
    Jul 31, 2016 at 6:01

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .