- /
-
Totem - Fish Harvesting
on 4 Oct 2022
- 7
- 18
- 0
- 0
- 267
%setup sand grid
B=219;
S=zeros(B);
%loading sand in the middle
S(110,110)=9e4;
while max(max(S))>1900
%identifiy sand pillars greater than 4
H=find(S>=4);
%take for sand grains from the tallest pillar
S(H)=S(H)-4;
%add sand to neighbours
S(H-1)=S(H-1)+1;
S(H+1)=S(H+1)+1;
S(H-B)=S(H-B)+1;
S(H+B)=S(H+B)+1;
end
%display the image
image(S)
colormap('prism');
axis equal
set(gca,"Position",[0 0 1 1])
set(gca,"YColor",'y')
set(gca,"XColor",'g')
set(gca,'TickDir','out')
Image
![](/responsive_image/300/300/0/0/0/cache/matlabcentral/communitycontests/uploaded_files/10555/image.png)