%% Function to mess up the heart behavior


% TH = Heart Matrix
% The function checks all the rows of TH and randomly deletes some Agets
% (if there are any)

[rows columns]=size(TH);
i=1;
counter=0;
tot_counter=0;
while i<rows

    % Checks if there is an Aget at this step
    if(TH(i,3)==1)
        tot_counter=tot_counter+1;
        % Rand draws a number at random (uniformily distributed between 0 and 1) 
        % and compare it with 0.5. If it is greater, it deletes the Aget, 
        % it does nothing otherwise.
       if(rand > 0.7)
           TH(i,3)=0;
           %fprintf(1,'Aget deleted\n');
           counter=counter+1;
       end
    end
    
    i=i+1;
end
fprintf(1,'The total number of Aget is %d\n',tot_counter);
fprintf(1,'The number of deleted Aget is %d\n',counter);


% TH = Heart Matrix
% The function checks all the rows of TH and randomly deletes some Vgets
% (if there are any)

i=1;
counter=0;
tot_counter=0;
while i<rows

    % Checks if there is an Aget at this step
    if(TH(i,3)==2)
        tot_counter=tot_counter+1;
        % Rand draws a number at random (uniformily distributed between 0 and 1) 
        % and compare it with 0.5. If it is greater, it deletes the Aget, 
        % it does nothing otherwise.
       if(rand > 0.7)
           TH(i,3)=0;
           %fprintf(1,'Aget deleted\n');
           counter=counter+1;
       end
    end
    
    i=i+1;
end
fprintf(1,'The total number of Vget is %d\n',tot_counter);
fprintf(1,'The number of deleted Vget is %d\n',counter);