Hey guys,
Here is what I am working with right now:

It is an array which consists of block objects. What I am trying to do is to seperate this into color coded regions, where each region consists of 3 more more touching blocks (but not diagonally).
For example, the red regions will be split up as such:
region 1:
[0, 0] [0, 1] [1, 0] [1, 1] [1, 2] [2, 1] [2, 2]
region 2:
[3, 0] [4, 0] [4, 2] [5, 0] [5, 1] [5, 2] [6, 1]
region 3:
[5, 5] [6, 5] [6, 6]
region 4:
[8, 9] [8, 10], [9, 7] [9, 8] [9, 9] [10, 9] [10, 10] [11, 9]
region 5:
[2, 12] [3, 12] [3, 13] [4, 13] [5, 13]
etc... for all of the other colors.
Anyone have any idea on how to do this?
Here is what I am working with right now:

It is an array which consists of block objects. What I am trying to do is to seperate this into color coded regions, where each region consists of 3 more more touching blocks (but not diagonally).
For example, the red regions will be split up as such:
region 1:
[0, 0] [0, 1] [1, 0] [1, 1] [1, 2] [2, 1] [2, 2]
region 2:
[3, 0] [4, 0] [4, 2] [5, 0] [5, 1] [5, 2] [6, 1]
region 3:
[5, 5] [6, 5] [6, 6]
region 4:
[8, 9] [8, 10], [9, 7] [9, 8] [9, 9] [10, 9] [10, 10] [11, 9]
region 5:
[2, 12] [3, 12] [3, 13] [4, 13] [5, 13]
etc... for all of the other colors.
Anyone have any idea on how to do this?