function [T1,N] = CA_A1(T1, white, black) 
%CA_A1 marks all white cells, which are surrounded by E,S, and SE black cells, with a unique color related to cells' location 

N=0;


%marks some white cells with unique colors
for lines=2:size(T1,1)-1
    for columns=2:size(T1,2)-1
        if (T1(lines, columns)== white) %if white
             postavljenaBoja = ((lines-2) * size(T1,2)-2) + (columns-1);
            if (lines ~= 2 && lines ~= size(T1,1)-1 && columns ~= 2 && columns ~= size(T1,2)-1 ) %not on boundaries
                if (T1(lines+1, columns)== black && T1(lines, columns+1)== black && T1(lines+1, columns+1)== black ) %S,E,ES
                        T1(lines, columns)= postavljenaBoja; end
            elseif (columns == 2 && lines == size(T1,1)-1 ) || (columns == size(T1,2)-1 && lines == size(T1,1)-1 ) %left or right corner of the lowest boundary line                
                        T1(lines, columns)= postavljenaBoja;
            end
        end
        N=N+1;
    end                
end