Created
December 4, 2025 07:22
-
-
Save lemanschik/79cd38230feacc156705711689acaf27 to your computer and use it in GitHub Desktop.
for cop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| awk -F"" '{for(i=1;i<=NF;i++)g[NR,i]=$i}END{do{c=0;for(y=1;y<=NR;y++)for(x=1;x<=NF;x++)if(g[y,x]=="@"){n=0;for(j=-1;j<2;j++)for(k=-1;k<2;k++)n+=(g[y+j,x+k]=="@");if(n<5){g[y,x]=".";c++}}t+=c}while(c);print t}' input_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment