N = 100;

dieAfter = 10;
initialInfection = 0.001;
infectionRate=0.9;
healRate=0.1;
immunityLoss=0.1;

%everyone on the boundary is immune
pop = zeros(N+2); 

%más határfeltétel:


%for starters, set everyone to healthy, and infect a few
pop(2:N+1,2:N+1) = ones(N) + (rand(N) < initialInfection); 
%pop(1:N+2,1:N+2) = ones(N+2) + (rand(N+2) < initialInfection); %periódikus határnál

%create a temporary array
newpop  = pop;

%create colourmap
%you can be immune, healty or at different stages of the disease (up to being dead)
map = zeros(dieAfter+2,3);
map(1,:) = [0 1 0]; % zero is immune, colour green
map(2,:) = [1 1 1]; % one is healthy, colour white
map(3:end, 1) = flipud(linspace(1,0,size(map(3:end, 1),1))); % shades of red (up to black)

for t= 1:150
    %show current state
    imagesc(pop,[0 dieAfter+2]);
    colormap(map);
   for i=2:N+1
       for j=2:N+1
   %for i=1:N+2 %periódikus határnál
   %    for j=1:N+2 %periódikus határnál
          guy=pop(i, j);
          newguy=newpop(i, j);
          
          %viselkedési szabályok:
          
          
          
          
          
          
          
          
          
          
          newpop(i,j)=newguy;
       end
   end
    
    %waitforbuttonpress;
    pause(0.2);
    %update population with the temporary array
    pop = newpop;
    
end

