We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intm,n;charstr[202][202],str1[202][202],str2[202][202],str3[202][202];//Total 3 Patterns Repeatitve//str1 full of bombs//str2 detonate bombs in input//str3 detonate bombs in str2intmain(){intt;cin>>m>>n>>t;for(inti=0;i<m;i++)cin>>str[i];for(inti=0;i<m;i++)for(intj=0;j<n;j++){str1[i][j]='O';str2[i][j]='O';str3[i][j]='O';}//Processing for 1st Pattern using Inputfor(inti=0;i<m;i++){for(intj=0;j<n;j++){if(str[i][j]=='O'){str2[i][j]='.';if(i<m-1)str2[i+1][j]='.';if(i>0)str2[i-1][j]='.';if(j<n-1)str2[i][j+1]='.';if(j>0)str2[i][j-1]='.';}}}//Processing for 2nd Pattern using 1st Patternfor(inti=0;i<m;i++){for(intj=0;j<n;j++){if(str2[i][j]=='O'){str3[i][j]='.';if(i<m-1)str3[i+1][j]='.';if(i>0)str3[i-1][j]='.';if(j<n-1)str3[i][j+1]='.';if(j>0)str3[i][j-1]='.';}}}if(t==1||t==0){for(inti=0;i<m;i++)cout<<str[i]<<"\n";return0;}if((t-1)%4==0)for(inti=0;i<m;i++)cout<<str3[i]<<"\n";elseif((t-1)%2==0)for(inti=0;i<m;i++)cout<<str2[i]<<"\n";elsefor(inti=0;i<m;i++)cout<<str1[i]<<"\n";return0;}
The Bomberman Game
You are viewing a single comment's thread. Return to all comments →