This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: n=(m>0 & m<=7); %Creates another matrix around the cell. if((sum(sum(n))>=2) && (foodGrid(i-1,j-1)>75)) newAlgaeGrid(i,j)=1; end %Searches the surrounding cells for algae between the ages of 7 and 1. %If more than two of these cells are found, the main cell is reborn. elseif(newAlgaeGrid(i,j)>0) && (foodGrid(i-1,j-1)>50) newAlgaeGrid(i,j)=newAlgaeGrid(i,j)+1; elseif foodGrid(i-1,j-1)<=50 algaeGrid(i,j)=0; end end end outputGrid=newAlgaeGrid(2:end-1,2:end-1); end...
View Full Document
- Fall '07
- 0 m, 1 j, Laura Hyde, Chad Ohlandt, (i,j)==0