版本比较
C++之逃离后室游戏
正文
增加 17 行删除 5 行
8 行未改动91011121314151661 行未改动78798081828384858687888961 行未改动15115215315415515615715815914 行未改动17417517617717817918018110 行未改动8 行未改动#include <ctime>#include <conio.h>using namespace std;char mapa[11][11];bool canmove(int x,int y){if(x>0&&x<11&&y>0&&y<11&&mapa[x][y]!='#')return true;return false;}61 行未改动zy=y;}for(int i=1;i<=10;i++){for(int j=1;j<=10;j++){if(i==x&&j==y)cout<<'O';else if(i==zx&&j==zy)cout<<'*';else if((i==gx&&j==gy&&dead1!=5)||(i==gx2&&j==gy2&&dead2!=5))cout<<'G';else cout<<mapa[i][j];}cout<<endl;}if(_kbhit()){61 行未改动if(canmove(gx2+1,gy2)&&mapa[gx2+1][gy2]!='S')gx2++;}}Sleep(50);system("cls");gmove++;if(gmove%2==0&&usez){if(usez==1)zx--;if(usez==2)zx++;14 行未改动if(x==ex&&y==ey)cout<<"获胜"<<endl;else cout<<"失败"<<endl;return 0;}```违规紫衫如果你感兴趣的话也可以看看我的其他作品10 行未改动8 行未改动9101112131415161718192021222361 行未改动85868788899091929394959697989910061 行未改动16216316416516616716816917014 行未改动18518618718818919019119219310 行未改动8 行未改动#include <ctime>#include <conio.h>using namespace std;char mapa[11][11];// 设置控制台光标位置void gotoxy(int x, int y) {COORD coord;coord.X = x;coord.Y = y;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);}bool canmove(int x,int y){if(x>0&&x<11&&y>0&&y<11&&mapa[x][y]!='#')return true;return false;}61 行未改动zy=y;}for(int i=1;i<=10;i++){for(int j=1;j<=10;j++){if(i==x&&j==y)cout<<"○ ";else if(i==zx&&j==zy)cout<<"ヾ ";else if((i==gx&&j==gy&&dead1!=5)||(i==gx2&&j==gy2&&dead2!=5))cout<<"T_T";else if(mapa[i][j]=='#')cout<<"□ ";else if(mapa[i][j]=='D')cout<<"╔ ";else if(mapa[i][j]=='K')cout<<"▲ ";else if(mapa[i][j]=='S')cout<<"█ ";else cout<<"空 ";}cout<<endl;}if(_kbhit()){61 行未改动if(canmove(gx2+1,gy2)&&mapa[gx2+1][gy2]!='S')gx2++;}}Sleep(50);gotoxy(0,0);gmove++;if(gmove%2==0&&usez){if(usez==1)zx--;if(usez==2)zx++;14 行未改动if(x==ex&&y==ey)cout<<"获胜"<<endl;else cout<<"失败"<<endl;return 0;}```违规紫衫如果你感兴趣的话也可以看看我的其他作品10 行未改动