i = x-telg j = y-telg gam(x,y) = massiiv kus sees on pmst ruudud (10 x 10 näiteks) Private Sub CheckEdges(ByVal i As Long, ByVal j As Long) If gam(i, j).col <> 0 Then If j > 1 Then If gam(i, j - 1).sel <> gam(i, j).sel Then If pic(GetNR(i, j - 1)).Picture = pic(GetNR(i, j)).Picture Then 'If gam(i, j - 1).col = gam(i, j).col Then gam(i, j - 1).sel = gam(i, j).sel pic(GetNR(i, j - 1)).Visible = False Ch = Ch + 1 Call CheckEdges(i, j - 1) End If End If End If If j < 10 Then If gam(i, j + 1).sel <> gam(i, j).sel Then If pic(GetNR(i, j + 1)).Picture = pic(GetNR(i, j)).Picture Then 'If gam(i, j + 1).col = gam(i, j).col Then gam(i, j + 1).sel = gam(i, j).sel pic(GetNR(i, j + 1)).Visible = False Ch = Ch + 1 Call CheckEdges(i, j + 1) End If End If End If zips says: If i > 1 Then If gam(i - 1, j).sel <> gam(i, j).sel Then If pic(GetNR(i - 1, j)).Picture = pic(GetNR(i, j)).Picture Then 'If gam(i - 1, j).col = gam(i, j).col Then gam(i - 1, j).sel = gam(i, j).sel pic(GetNR(i - 1, j)).Visible = False Ch = Ch + 1 Call CheckEdges(i - 1, j) End If End If End If If i < 10 Then If gam(i + 1, j).sel <> gam(i, j).sel Then If pic(GetNR(i + 1, j)).Picture = pic(GetNR(i, j)).Picture Then 'If gam(i + 1, j).col = gam(i, j).col Then gam(i + 1, j).sel = gam(i, j).sel pic(GetNR(i + 1, j)).Visible = False Ch = Ch + 1 Call CheckEdges(i + 1, j) End If End If End If End If End Sub