版本比较
[游戏]0F Game
正文
增加 21 行删除 21 行
18 行未改动192021222323242526278 行未改动363738394040414243444546474847484950515253545556575758596061626363646566676868697070717273747 行未改动82838485868786878889909138 行未改动1301311321331341341351361371371381391401415 行未改动14714814915015115115215315415529 行未改动1851861871881891891901911921935 行未改动19920020120220320320420520620720820921021021121221321426 行未改动24124224324424524524624724824929 行未改动27928028128228328428328428528628728828929029129229329329429529629718 行未改动31631731831932032032132232332417 行未改动18 行未改动 if(i%100==0)srand((unsigned)time(0)); int x=rand()%(size)+1,y=rand()%(size)+1;// cout<<x<<" "<<y<<" "<<a[x][y]<<endl; if(a[x][y]==0){ as++; as++; a[x][y]=rand()%9;// cout<<x<<" "<<y<<" "<<a[x][y]<<endl; a[x-1][y]-=a[x][y]; if(a[x-1][y]<0)a[x-1][y]=10+a[x-1][y];8 行未改动// for(int j=1;j<=size;j++){// cout<<a[i][j];// }// cout<<endl;// } // }// cout<<endl; int f=1; for(int i=1;i<=size;i++){ for(int j=1;j<=size;j++){ if(a[i][j]==0)f=0; } } }
if(f){ cout<<"难度:"<<2*as<<endl; return ; } } }}void inf_game(){ cout<<"[无尽模式]"<<endl; cout<<"[无尽模式]"<<endl; cout<<endl; cout<<"[游戏规则]:"<<endl; cout<<"[1]. 选择一个位置并让这个位置上的数字归0"<<endl; cout<<"[2]. 相邻位子会加上这个数字并保留个位"<<endl; cout<<"[3]. 全部为0就胜利啦~"<<endl; cout<<"[Tips]: 此游戏带有自动存档功能,最好把游戏文件放进您的U盘里,\n且发现一个叫\"save.zf\"的文件不要删除哟~那是游戏存档!"<<endl; cout<<"[Tips]: 此游戏带有自动存档功能,最好把游戏文件放进您的U盘里,\n且发现一个叫\"save.zf\"的文件不要删除哟~那是游戏存档!"<<endl; cout<<"[Tips_2]: 此游戏全部为随机生成,可能无解哦"<<endl; cout<<"输入游戏大小(n*n,推荐3 ~ 6,max=10,min=3)[Input](输入格式n)<<"; int size; while(1){ cin>>size; cin>>size; if(size>10||size<=2){ cout<<"[Error] - Size is too large/small.Please input agian."<<endl<<"[Input]<<"; cout<<"[Error] - Size is too large/small.Please input agian."<<endl<<"[Input]<<"; } else break; } cout<<"Loading..."<<endl;7 行未改动 init(size);// bool f=1;// for(int i=1;i<=size;i++){// for(int j=1;j<=size;j++)// f=a[i][j]?0:1; // } // f=a[i][j]?0:1;// }// if(f){// cout<<"你赢了!"<<endl<<endl<<endl;// return ;// }38 行未改动 while(1){ cout<<"[Input](输入格式\"x y\",\"-1 -1\"来撤回)<<"; cin>>x>>y; if(((x<=0)||x>size||(y<=0)||y>size||a[x][y]==0)&&(x!=-1&&y!=-1))cout<<"数据不合法/超出或该位置已经为0,请重新输入"<<endl; else if(x==-1&&y==-1&&his.size()==1) cout<<"已经撤回到开始啦!"<<endl; else if(x==-1&&y==-1&&his.size()==1) cout<<"已经撤回到开始啦!"<<endl; else break; }
if(x==-1&&y==-1){ his.pop(); str strr=his.top(); his.pop();5 行未改动// cout<<endl; } } else{
a[x-1][y]=(a[x][y]+a[x-1][y])%10; a[x][y-1]=(a[x][y]+a[x][y-1])%10; a[x][y+1]=(a[x][y]+a[x][y+1])%10; a[x+1][y]=(a[x][y]+a[x+1][y])%10;29 行未改动 bool f=1; for(int i=1;i<=size;i++){ for(int j=1;j<=size;j++) if(a[i][j]!=0)f=0; } } if(f){ cout<<"你赢了!"<<endl<<endl<<endl; int t=time(0)-s_t; if(t/3600){5 行未改动 t%=60; } if(t){ cout<<t<<"sec"<<endl; t=0; t=0; } freopen("save.zf","w",stdout); cout<<0; freopen("CON","w",stdout); break; }
}}int main(){// ios::sync_with_stdio(false);26 行未改动// freopen("CON","r",stdin);// char s;// cin>>s;// if(s=='Y'){// //// while(1){// int x,y;// while(1){// cout<<"[Input](输入格式\"x y\")<<";29 行未改动// freopen("CON","w",stdout);// bool f=1;// for(int i=1;i<=size;i++){// for(int j=1;j<=size;j++)// f=a[i][j]?0:1; // } // f=a[i][j]?0:1;// }// if(f){// cout<<"你赢了!"<<endl<<endl<<endl;// freopen("save.zf","w",stdout);// cout<<0;// freopen("CON","w",stdout);// break;// }// }// } // }// else {// cout<<"存档已清除!"<<endl<<endl;// freopen("save.zf","w",stdout);// cout<<0;18 行未改动 while(1){ cout<<"[Input]<<"; cin>>option; if(option=="A"||option=="B"||option=="b"||option=="a")break; else cout<<"Error"<<endl; else cout<<"Error"<<endl; } if(option=="B"||option=="b")system("cls"),inf_game(); else if(option=="A"||option=="a")system("cls");//lev_game(); cout<<"0F Game"<<endl;17 行未改动