| InDustWeTrust (6) | |
|
Whenever I call that function again, b.is_clustered[coor_x][coor_y] always returns to 0 even though it is changed to 1 in the function. What is the problem and what should I do to keep b.is_clustered to 1? Thanks. void seek_for_cluster (board b, int color, int coor_x, int coor_y, int cluster_n) { if (b.is_clustered[coor_x][coor_y]==0) { if (b.color[coor_x][coor_y]==color) { b.is_clustered[coor_x][coor_y]=1; b.cluster_n[coor_x][coor_y]=cluster_n; if (coor_x>0) seek_for_cluster (b, color, coor_x-1, coor_y, cluster_n); if (coor_y>0) seek_for_cluster (b, color, coor_x, coor_y-1, cluster_n); if (coor_x<size_x-1) seek_for_cluster (b, color, coor_x+1, coor_y, cluster_n); if (coor_y<size_y-1) seek_for_cluster (b, color, coor_x, coor_y+1, cluster_n); } } } | |
|
Last edited on
|
|