function [T2,N] = CA_A6(T1,white, black) 
%CA_A6 - Color green ceells by \alpha

T2=T1;
N=0;
global cmap;
green = length(cmap);
alpha = length(cmap)-2;
beta = length(cmap)-3;

 for i=1:10000
    for lines=size(T1,1)-2:-1:3
        for columns=2:size(T1,2)-1
            if (T1(lines, columns) == green) % if green
                if (lines ==size(T1,1)-2) T2(lines, columns)= alpha; 
                elseif (lines > 3) % size(T1,1)-2 > lines > 3  
                     if(T1(lines,columns-1) == alpha || T1(lines+1,columns) == alpha || ...
                             T1(lines-1,columns) == alpha || T1(lines,columns+1) == alpha)
                         T2(lines, columns)= alpha; 
                     end
                elseif(T1(lines+1,columns) == alpha || T1(lines,columns-1) == beta || ...
                        T1(lines,columns+1) == beta)
                    T2(lines, columns)= beta; 
                end
            end
            N=N+1;
        end
    end
    if (norm(T1)==norm(T2)) 
        return; 
    else
%        figure; colormap(cmap); image(T2((2:size(T2,1)-1),(2:size(T2,2)-1))); title('CA\_A6x'); colorbar;  set(gcf,'renderer','OpenGL'); 
       T1=T2; 
    end
end
