資源描述:
《掃雷小游戲代碼c++版》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、#include#include#includeusingnamespacestd;intlei;intline,arrange,thunder1,thunder2,space;voidsaolei(char**&a,char**&c,int**&b,int**&d,int**&e,int**&g,int&line,int&arrange,int&thunder1,int&thunder2,int&space){intall=1;while(all){inti,j;a=newchar*[line],c=newch
2、ar*[line],b=newint*[line],d=newint*[line],e=newint*[line],g=newint*[line];for(i=0;i<=line-1;i++)a[i]=newchar[arrange],c[i]=newchar[arrange],b[i]=newint[arrange],d[i]=newint[arrange],e[i]=newint[arrange],g[i]=newint[arrange];for(i=0;i3、0,c[i][j]='.',e[i][j]=0,g[i][j]=0;intk;srand(int(time(0)));intz=1;while(z){k=rand()%(thunder2+1);if(k>=thunder1)z=0;}srand(int(time(0)));for(i=1;i<=k;i++){ints,t;L:{s=rand()%line;t=rand()%arrange;}if(!(s>=0&&s=0&&t4、;n=0&&a[i][j-1]=='#')b[i][j]++;if(j+1=0&&a[i-1][j]=='#')b[i][j]++;if(i+1=0&&j+15、]=='#')b[i][j]++;if(i-1>=0&&j-1>=0&&a[i-1][j-1]=='#')b[i][j]++;if(i+1=0&&i+1=0&&a[i][j-1]=='.')f++;if(j+16、ange&&a[i][j+1]=='.')f++;if(i-1>=0&&a[i-1][j]=='.')f++;if(i+1=0&&j+1=0&&j-1>=0&&a[i-1][j-1]=='.')f++;if(i+1=0&&i+1=0&&i+17、>=0&&j+18、
9、i==0&&j==arrange-1
10、
11、i==line-1&&j==0
12、
13、i==line-1&&j==arrange-1){if(f==3)d[i][j]=1;elsed[i][j]=0;}else{if(i==0&&j!=0&&j!=arrange-1
14、
15、i==line-1&&j!=arrange-1&&j!=0
16、
17、i!=line-1&&i!=0&&j==0
18、
19、i!=line-1&&i!=0&&j==arrange-1){i
20、f(f==